ichec-angular-core 0.3.13 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -647,6 +647,19 @@ class FormService {
647
647
  }
648
648
  return files;
649
649
  }
650
+ hasRequiredFiles(form, input) {
651
+ for (const key of Object.keys(form.controls)) {
652
+ if (this.getType(key, input) == "FILE") {
653
+ if (this.isRequired(key, input)) {
654
+ const record = form.get(key)?.value;
655
+ if (!record.file) {
656
+ return false;
657
+ }
658
+ }
659
+ }
660
+ }
661
+ return true;
662
+ }
650
663
  updateFieldValue(control, item) {
651
664
  return { value: control.value.value,
652
665
  field: item.field.id,
@@ -665,6 +678,17 @@ class FormService {
665
678
  }
666
679
  return "";
667
680
  }
681
+ isRequired(key, input) {
682
+ const field_id = parseInt(key);
683
+ for (const group of input.groups) {
684
+ for (const field of group.fields) {
685
+ if (field.id == field_id) {
686
+ return field.required;
687
+ }
688
+ }
689
+ }
690
+ return false;
691
+ }
668
692
  getValue(key, item) {
669
693
  const field = parseInt(key);
670
694
  for (const value of item.values) {