use of org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor in project openmrs-module-pihcore by PIH.
the class SectionsDefault method getContactPhoneNumber.
public Question getContactPhoneNumber() {
Question q = new Question();
q.setId("contactPhoneNumberQuestionLabel");
q.setHeader("zl.registration.patient.contactPerson.phonenumber.question");
q.setLegend("zl.registration.patient.contactPerson.phonenumber.label");
{
Field f = new Field();
f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:TELEPHONE NUMBER OF CONTACT");
f.setLabel("registrationapp.patient.phone.label");
f.setType("obsgroup");
ContactPersonConfigDescriptor contactPersonConfig = config.getRegistrationConfig().getContactPerson();
if (contactPersonConfig != null && contactPersonConfig.getRequired() == true) {
f.setCssClasses(Arrays.asList("required"));
}
if (contactPersonConfig != null && contactPersonConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactPersonConfig.getPhoneNumber().getRegex())) {
f.setCssClasses(Arrays.asList("regex"));
f.setWidget(getTextFieldWidget(30, contactPersonConfig.getPhoneNumber().getRegex()));
} else {
f.setWidget(getTextFieldWidget(30));
}
q.addField(f);
}
return q;
}
Aggregations