Search in sources :

Example 1 with ContactInfoConfigDescriptor

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

Example 2 with ContactInfoConfigDescriptor

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;
}
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

ContactInfoConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor)2 Field (org.openmrs.module.registrationapp.model.Field)2 Question (org.openmrs.module.registrationapp.model.Question)2