Search in sources :

Example 61 with Question

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

Aggregations

Question (org.openmrs.module.registrationapp.model.Question)61 Field (org.openmrs.module.registrationapp.model.Field)60 AddressField (org.openmrs.module.addresshierarchy.AddressField)27 DropdownWidget (org.openmrs.module.registrationapp.model.DropdownWidget)16 HashMap (java.util.HashMap)9 AddressHierarchyLevel (org.openmrs.module.addresshierarchy.AddressHierarchyLevel)7 AddressHierarchyService (org.openmrs.module.addresshierarchy.service.AddressHierarchyService)7 ContactInfoConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor)2 Section (org.openmrs.module.registrationapp.model.Section)2 ContactPersonConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor)1