Search in sources :

Example 1 with ContactPersonConfigDescriptor

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;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) ContactPersonConfigDescriptor(org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor) Question(org.openmrs.module.registrationapp.model.Question)

Aggregations

ContactPersonConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor)1 Field (org.openmrs.module.registrationapp.model.Field)1 Question (org.openmrs.module.registrationapp.model.Question)1