|
@@ -153,15 +153,27 @@ parentSegment.find('#frm-add-{{$label}}')
|
|
|
|
|
|
let form = $(this);
|
|
|
|
|
|
+ // require additionReasonCategory if active
|
|
|
+ form.find('[name="additionReasonCategory"]').removeAttr('required');
|
|
|
+ if(!form.find('[name="additionReasonCategory"]:checked').length) {
|
|
|
+ if(form.find('[name="isRemoved"][value="0"]').is(':checked')) {
|
|
|
+ form.find('[name="additionReasonCategory"]').attr('required', 'required');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // require removalReasonCategory if not active
|
|
|
+ form.find('[name="removalReasonCategory"]').removeAttr('required');
|
|
|
+ if(!form.find('[name="removalReasonCategory"]:checked').length) {
|
|
|
+ if(form.find('[name="isRemoved"][value="1"]').is(':checked')) {
|
|
|
+ form.find('[name="removalReasonCategory"]').attr('required', 'required');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!form[0].checkValidity()) {
|
|
|
form[0].reportValidity();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(!form.find('[name="additionReasonCategory"]:checked').length) {
|
|
|
- form.find('[name="additionReasonCategory"][value="ON_INTAKE"]').prop('checked', true);
|
|
|
- }
|
|
|
-
|
|
|
// add [data-name] values to payload
|
|
|
let dataField = form.find('[name="data"]').first();
|
|
|
let parsed = null;
|