use of org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor in project openmrs-module-pihcore by PIH.
the class SectionsDefault method getTelephoneNumberQuestion.
public Question getTelephoneNumberQuestion() {
Question q = new Question();
q.setId("phoneNumberLabel");
q.setLegend("registrationapp.patient.phone.label");
q.setHeader("registrationapp.patient.phone.question");
Field f = new Field();
f.setFormFieldName("phoneNumber");
f.setType("personAttribute");
f.setUuid(Metadata.getPhoneNumberAttributeType().getUuid());
ContactInfoConfigDescriptor contactInfoConfig = config.getRegistrationConfig().getContactInfo();
if (contactInfoConfig != null && contactInfoConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactInfoConfig.getPhoneNumber().getRegex())) {
f.setCssClasses(Arrays.asList("regex"));
f.setWidget(getTextFieldWidget(null, contactInfoConfig.getPhoneNumber().getRegex()));
} else {
f.setWidget(getTextFieldWidget());
}
q.addField(f);
return q;
}
use of org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor in project openmrs-module-pihcore by PIH.
the class SectionsPeru method getTelephoneNumberQuestion.
public Question getTelephoneNumberQuestion() {
Question q = new Question();
q.setId("phoneNumberLabel");
q.setLegend("registrationapp.patient.phone.label");
q.setHeader("registrationapp.patient.phone.question");
Field f = new Field();
f.setFormFieldName("phoneNumber");
f.setType("personAttribute");
f.setUuid(Metadata.getPhoneNumberAttributeType().getUuid());
ContactInfoConfigDescriptor contactInfoConfig = config.getRegistrationConfig().getContactInfo();
if (contactInfoConfig != null && contactInfoConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactInfoConfig.getPhoneNumber().getRegex())) {
f.setCssClasses(Arrays.asList("regex"));
f.setWidget(getTextFieldWidget(null, contactInfoConfig.getPhoneNumber().getRegex()));
} else {
f.setWidget(getTextFieldWidget());
}
q.addField(f);
return q;
}
Aggregations