@firecms/user_management 3.1.0 → 3.2.0-canary.44dc65b

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.
package/dist/index.umd.js CHANGED
@@ -501,19 +501,19 @@
501
501
  }
502
502
  return t1;
503
503
  }
504
- const RoleYupSchema = Yup__namespace.object().shape({
505
- id: Yup__namespace.string().required("Required"),
506
- name: Yup__namespace.string().required("Required")
504
+ const getRoleYupSchema = (t) => Yup__namespace.object().shape({
505
+ id: Yup__namespace.string().required(t("required")),
506
+ name: Yup__namespace.string().required(t("required"))
507
507
  });
508
- function canRoleBeEdited(loggedUser) {
508
+ function canRoleBeEdited(loggedUser, t) {
509
509
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
510
510
  if (!loggedUserIsAdmin) {
511
- throw new Error("Only admins can edit roles");
511
+ throw new Error(t("only_admins_edit_roles"));
512
512
  }
513
513
  return true;
514
514
  }
515
515
  function RolesDetailsForm(t0) {
516
- const $ = reactCompilerRuntime.c(164);
516
+ const $ = reactCompilerRuntime.c(311);
517
517
  const {
518
518
  open,
519
519
  role,
@@ -521,6 +521,9 @@
521
521
  handleClose,
522
522
  collections
523
523
  } = t0;
524
+ const {
525
+ t
526
+ } = core.useTranslation();
524
527
  const {
525
528
  saveRole
526
529
  } = useUserManagement();
@@ -530,34 +533,35 @@
530
533
  } = core.useAuthController();
531
534
  const [savingError, setSavingError] = React.useState();
532
535
  let t1;
533
- if ($[0] !== loggedInUser || $[1] !== saveRole) {
536
+ if ($[0] !== loggedInUser || $[1] !== saveRole || $[2] !== t) {
534
537
  t1 = (role_0) => {
535
538
  setSavingError(void 0);
536
539
  if (!loggedInUser) {
537
- throw new Error("User not found");
540
+ throw new Error(t("error_user_not_found"));
538
541
  }
539
- canRoleBeEdited(loggedInUser);
542
+ canRoleBeEdited(loggedInUser, t);
540
543
  return saveRole(role_0);
541
544
  };
542
545
  $[0] = loggedInUser;
543
546
  $[1] = saveRole;
544
- $[2] = t1;
547
+ $[2] = t;
548
+ $[3] = t1;
545
549
  } else {
546
- t1 = $[2];
550
+ t1 = $[3];
547
551
  }
548
552
  const onRoleUpdated = t1;
549
553
  let t2;
550
- if ($[3] !== role) {
554
+ if ($[4] !== role) {
551
555
  t2 = role ?? {
552
556
  name: ""
553
557
  };
554
- $[3] = role;
555
- $[4] = t2;
558
+ $[4] = role;
559
+ $[5] = t2;
556
560
  } else {
557
- t2 = $[4];
561
+ t2 = $[5];
558
562
  }
559
563
  let t3;
560
- if ($[5] !== handleClose || $[6] !== onRoleUpdated) {
564
+ if ($[6] !== handleClose || $[7] !== onRoleUpdated) {
561
565
  t3 = (role_1, formexController) => {
562
566
  try {
563
567
  return onRoleUpdated(role_1).then(() => {
@@ -574,26 +578,37 @@
574
578
  return Promise.resolve();
575
579
  }
576
580
  };
577
- $[5] = handleClose;
578
- $[6] = onRoleUpdated;
579
- $[7] = t3;
581
+ $[6] = handleClose;
582
+ $[7] = onRoleUpdated;
583
+ $[8] = t3;
580
584
  } else {
581
- t3 = $[7];
585
+ t3 = $[8];
582
586
  }
583
587
  let t4;
584
- if ($[8] !== t2 || $[9] !== t3) {
585
- t4 = {
588
+ if ($[9] !== t) {
589
+ t4 = (values) => getRoleYupSchema(t).validate(values, {
590
+ abortEarly: false
591
+ }).then(_temp$3).catch(_temp2$1);
592
+ $[9] = t;
593
+ $[10] = t4;
594
+ } else {
595
+ t4 = $[10];
596
+ }
597
+ let t5;
598
+ if ($[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
599
+ t5 = {
586
600
  initialValues: t2,
587
601
  onSubmit: t3,
588
- validation: _temp3$1
602
+ validation: t4
589
603
  };
590
- $[8] = t2;
591
- $[9] = t3;
592
- $[10] = t4;
604
+ $[11] = t2;
605
+ $[12] = t3;
606
+ $[13] = t4;
607
+ $[14] = t5;
593
608
  } else {
594
- t4 = $[10];
609
+ t5 = $[14];
595
610
  }
596
- const formex$1 = formex.useCreateFormex(t4);
611
+ const formex$1 = formex.useCreateFormex(t5);
597
612
  const {
598
613
  isSubmitting,
599
614
  touched,
@@ -609,606 +624,1058 @@
609
624
  const defaultRead = values_0.defaultPermissions?.read ?? false;
610
625
  const defaultEdit = values_0.defaultPermissions?.edit ?? false;
611
626
  const defaultDelete = values_0.defaultPermissions?.delete ?? false;
612
- let t5;
613
- if ($[11] !== setFieldValue || $[12] !== touched || $[13] !== values_0.name) {
614
- t5 = () => {
627
+ let t6;
628
+ if ($[15] !== setFieldValue || $[16] !== touched || $[17] !== values_0.name) {
629
+ t6 = () => {
615
630
  const idTouched = formex.getIn(touched, "id");
616
631
  if (!idTouched && values_0.name) {
617
632
  setFieldValue("id", core.toSnakeCase(values_0.name));
618
633
  }
619
634
  };
620
- $[11] = setFieldValue;
621
- $[12] = touched;
622
- $[13] = values_0.name;
623
- $[14] = t5;
635
+ $[15] = setFieldValue;
636
+ $[16] = touched;
637
+ $[17] = values_0.name;
638
+ $[18] = t6;
624
639
  } else {
625
- t5 = $[14];
640
+ t6 = $[18];
626
641
  }
627
- let t6;
628
- if ($[15] !== touched || $[16] !== values_0.name) {
629
- t6 = [touched, values_0.name];
630
- $[15] = touched;
631
- $[16] = values_0.name;
632
- $[17] = t6;
642
+ let t7;
643
+ if ($[19] !== touched || $[20] !== values_0.name) {
644
+ t7 = [touched, values_0.name];
645
+ $[19] = touched;
646
+ $[20] = values_0.name;
647
+ $[21] = t7;
633
648
  } else {
634
- t6 = $[17];
649
+ t7 = $[21];
635
650
  }
636
- React.useEffect(t5, t6);
637
- let t7;
638
- let t8;
639
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
640
- t7 = {
651
+ React.useEffect(t6, t7);
652
+ const t8 = formex$1.handleSubmit;
653
+ let t9;
654
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
655
+ t9 = {
641
656
  display: "flex",
642
657
  flexDirection: "column",
643
658
  position: "relative",
644
659
  height: "100%"
645
660
  };
646
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: "Role" });
647
- $[18] = t7;
648
- $[19] = t8;
649
- } else {
650
- t7 = $[18];
651
- t8 = $[19];
652
- }
653
- const t9 = touched.name && Boolean(errors_0.name);
654
- const t10 = isAdmin || !editable;
655
- let t11;
656
- if ($[20] !== handleChange || $[21] !== t10 || $[22] !== t9 || $[23] !== values_0.name) {
657
- t11 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "name", required: true, error: t9, value: values_0.name, disabled: t10, onChange: handleChange, "aria-describedby": "name-helper-text", label: "Name" });
658
- $[20] = handleChange;
659
- $[21] = t10;
660
661
  $[22] = t9;
661
- $[23] = values_0.name;
662
- $[24] = t11;
663
662
  } else {
664
- t11 = $[24];
663
+ t9 = $[22];
665
664
  }
666
- const t12 = touched.name && Boolean(errors_0.name) ? errors_0.name : "Name of this role";
667
- let t13;
668
- if ($[25] !== t12) {
669
- t13 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t12 });
670
- $[25] = t12;
671
- $[26] = t13;
665
+ let t10;
666
+ if ($[23] !== t) {
667
+ t10 = t("role");
668
+ $[23] = t;
669
+ $[24] = t10;
672
670
  } else {
673
- t13 = $[26];
671
+ t10 = $[24];
674
672
  }
675
- let t14;
676
- if ($[27] !== t11 || $[28] !== t13) {
677
- t14 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-8", children: [
678
- t11,
679
- t13
680
- ] });
681
- $[27] = t11;
682
- $[28] = t13;
683
- $[29] = t14;
673
+ let t11;
674
+ if ($[25] !== t10) {
675
+ t11 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: t10 });
676
+ $[25] = t10;
677
+ $[26] = t11;
684
678
  } else {
685
- t14 = $[29];
679
+ t11 = $[26];
686
680
  }
687
- const t15 = touched.id && Boolean(errors_0.id);
688
- const t16 = !isNewRole || !editable;
689
- let t17;
690
- if ($[30] !== handleChange || $[31] !== setFieldTouched) {
691
- t17 = (e_2) => {
692
- handleChange(e_2);
693
- setFieldTouched("id", true);
694
- };
695
- $[30] = handleChange;
696
- $[31] = setFieldTouched;
697
- $[32] = t17;
681
+ const t12 = touched.name && Boolean(errors_0.name);
682
+ const t13 = values_0.name;
683
+ const t14 = isAdmin || !editable;
684
+ let t15;
685
+ if ($[27] !== t) {
686
+ t15 = t("name");
687
+ $[27] = t;
688
+ $[28] = t15;
698
689
  } else {
699
- t17 = $[32];
690
+ t15 = $[28];
700
691
  }
701
- let t18;
702
- if ($[33] !== t15 || $[34] !== t16 || $[35] !== t17 || $[36] !== values_0.id) {
703
- t18 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "id", required: true, error: t15, value: values_0.id, disabled: t16, onChange: t17, "aria-describedby": "id-helper-text", label: "ID" });
704
- $[33] = t15;
692
+ let t16;
693
+ if ($[29] !== handleChange || $[30] !== t12 || $[31] !== t14 || $[32] !== t15 || $[33] !== values_0.name) {
694
+ t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "name", required: true, error: t12, value: t13, disabled: t14, onChange: handleChange, "aria-describedby": "name-helper-text", label: t15 });
695
+ $[29] = handleChange;
696
+ $[30] = t12;
697
+ $[31] = t14;
698
+ $[32] = t15;
699
+ $[33] = values_0.name;
705
700
  $[34] = t16;
706
- $[35] = t17;
707
- $[36] = values_0.id;
708
- $[37] = t18;
709
701
  } else {
710
- t18 = $[37];
702
+ t16 = $[34];
711
703
  }
712
- const t19 = touched.id && Boolean(errors_0.id) ? errors_0.id : "ID of this role";
713
- let t20;
714
- if ($[38] !== t19) {
715
- t20 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t19 });
716
- $[38] = t19;
717
- $[39] = t20;
704
+ let t17;
705
+ if ($[35] !== errors_0 || $[36] !== t || $[37] !== touched.name) {
706
+ t17 = touched.name && Boolean(errors_0.name) ? errors_0.name : t("name_of_this_role");
707
+ $[35] = errors_0;
708
+ $[36] = t;
709
+ $[37] = touched.name;
710
+ $[38] = t17;
718
711
  } else {
719
- t20 = $[39];
712
+ t17 = $[38];
720
713
  }
721
- let t21;
722
- if ($[40] !== t18 || $[41] !== t20) {
723
- t21 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
724
- t18,
725
- t20
726
- ] });
714
+ let t18;
715
+ if ($[39] !== t17) {
716
+ t18 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t17 });
717
+ $[39] = t17;
727
718
  $[40] = t18;
728
- $[41] = t20;
729
- $[42] = t21;
730
719
  } else {
731
- t21 = $[42];
720
+ t18 = $[40];
732
721
  }
733
- let t22;
734
- if ($[43] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
735
- t22 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { className: "rounded-md", children: [
736
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, {}),
737
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Create entities" }),
738
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Read entities" }),
739
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Update entities" }),
740
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Delete entities" }),
741
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" })
722
+ let t19;
723
+ if ($[41] !== t16 || $[42] !== t18) {
724
+ t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-8", children: [
725
+ t16,
726
+ t18
742
727
  ] });
743
- $[43] = t22;
728
+ $[41] = t16;
729
+ $[42] = t18;
730
+ $[43] = t19;
744
731
  } else {
745
- t22 = $[43];
732
+ t19 = $[43];
746
733
  }
734
+ const t20 = touched.id && Boolean(errors_0.id);
735
+ const t21 = values_0.id;
736
+ const t22 = !isNewRole || !editable;
747
737
  let t23;
748
- if ($[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
749
- t23 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "All collections" }) });
750
- $[44] = t23;
738
+ if ($[44] !== handleChange || $[45] !== setFieldTouched) {
739
+ t23 = (e_2) => {
740
+ handleChange(e_2);
741
+ setFieldTouched("id", true);
742
+ };
743
+ $[44] = handleChange;
744
+ $[45] = setFieldTouched;
745
+ $[46] = t23;
751
746
  } else {
752
- t23 = $[44];
747
+ t23 = $[46];
748
+ }
749
+ let t24;
750
+ if ($[47] !== t) {
751
+ t24 = t("id");
752
+ $[47] = t;
753
+ $[48] = t24;
754
+ } else {
755
+ t24 = $[48];
756
+ }
757
+ let t25;
758
+ if ($[49] !== t20 || $[50] !== t22 || $[51] !== t23 || $[52] !== t24 || $[53] !== values_0.id) {
759
+ t25 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "id", required: true, error: t20, value: t21, disabled: t22, onChange: t23, "aria-describedby": "id-helper-text", label: t24 });
760
+ $[49] = t20;
761
+ $[50] = t22;
762
+ $[51] = t23;
763
+ $[52] = t24;
764
+ $[53] = values_0.id;
765
+ $[54] = t25;
766
+ } else {
767
+ t25 = $[54];
753
768
  }
754
- const t24 = isAdmin || !editable;
755
- const t25 = (isAdmin || defaultCreate) ?? false;
756
769
  let t26;
757
- if ($[45] !== setFieldValue) {
758
- t26 = (checked) => setFieldValue("defaultPermissions.create", checked);
759
- $[45] = setFieldValue;
760
- $[46] = t26;
770
+ if ($[55] !== errors_0 || $[56] !== t || $[57] !== touched.id) {
771
+ t26 = touched.id && Boolean(errors_0.id) ? errors_0.id : t("id_of_this_role");
772
+ $[55] = errors_0;
773
+ $[56] = t;
774
+ $[57] = touched.id;
775
+ $[58] = t26;
761
776
  } else {
762
- t26 = $[46];
777
+ t26 = $[58];
763
778
  }
764
779
  let t27;
765
- if ($[47] !== t24 || $[48] !== t25 || $[49] !== t26) {
766
- t27 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Create entities in collections", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t24, checked: t25, onCheckedChange: t26 }) }) });
767
- $[47] = t24;
768
- $[48] = t25;
769
- $[49] = t26;
770
- $[50] = t27;
780
+ if ($[59] !== t26) {
781
+ t27 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t26 });
782
+ $[59] = t26;
783
+ $[60] = t27;
771
784
  } else {
772
- t27 = $[50];
785
+ t27 = $[60];
786
+ }
787
+ let t28;
788
+ if ($[61] !== t25 || $[62] !== t27) {
789
+ t28 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
790
+ t25,
791
+ t27
792
+ ] });
793
+ $[61] = t25;
794
+ $[62] = t27;
795
+ $[63] = t28;
796
+ } else {
797
+ t28 = $[63];
798
+ }
799
+ let t29;
800
+ if ($[64] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
801
+ t29 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, {});
802
+ $[64] = t29;
803
+ } else {
804
+ t29 = $[64];
773
805
  }
774
- const t28 = isAdmin || !editable;
775
- const t29 = (isAdmin || defaultRead) ?? false;
776
806
  let t30;
777
- if ($[51] !== setFieldValue) {
778
- t30 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
779
- $[51] = setFieldValue;
780
- $[52] = t30;
807
+ if ($[65] !== t) {
808
+ t30 = t("create_entities");
809
+ $[65] = t;
810
+ $[66] = t30;
781
811
  } else {
782
- t30 = $[52];
812
+ t30 = $[66];
783
813
  }
784
814
  let t31;
785
- if ($[53] !== t28 || $[54] !== t29 || $[55] !== t30) {
786
- t31 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Access all data in every collection", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t28, checked: t29, onCheckedChange: t30 }) }) });
787
- $[53] = t28;
788
- $[54] = t29;
789
- $[55] = t30;
790
- $[56] = t31;
815
+ if ($[67] !== t30) {
816
+ t31 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t30 });
817
+ $[67] = t30;
818
+ $[68] = t31;
819
+ } else {
820
+ t31 = $[68];
821
+ }
822
+ let t32;
823
+ if ($[69] !== t) {
824
+ t32 = t("read_entities");
825
+ $[69] = t;
826
+ $[70] = t32;
791
827
  } else {
792
- t31 = $[56];
828
+ t32 = $[70];
829
+ }
830
+ let t33;
831
+ if ($[71] !== t32) {
832
+ t33 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t32 });
833
+ $[71] = t32;
834
+ $[72] = t33;
835
+ } else {
836
+ t33 = $[72];
793
837
  }
794
- const t32 = isAdmin || !editable;
795
- const t33 = (isAdmin || defaultEdit) ?? false;
796
838
  let t34;
797
- if ($[57] !== setFieldValue) {
798
- t34 = (checked_1) => setFieldValue("defaultPermissions.edit", checked_1);
799
- $[57] = setFieldValue;
800
- $[58] = t34;
839
+ if ($[73] !== t) {
840
+ t34 = t("update_entities");
841
+ $[73] = t;
842
+ $[74] = t34;
801
843
  } else {
802
- t34 = $[58];
844
+ t34 = $[74];
803
845
  }
804
846
  let t35;
805
- if ($[59] !== t32 || $[60] !== t33 || $[61] !== t34) {
806
- t35 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Update data in any collection", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t32, checked: t33, onCheckedChange: t34 }) }) });
807
- $[59] = t32;
808
- $[60] = t33;
809
- $[61] = t34;
810
- $[62] = t35;
847
+ if ($[75] !== t34) {
848
+ t35 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t34 });
849
+ $[75] = t34;
850
+ $[76] = t35;
851
+ } else {
852
+ t35 = $[76];
853
+ }
854
+ let t36;
855
+ if ($[77] !== t) {
856
+ t36 = t("delete_entities");
857
+ $[77] = t;
858
+ $[78] = t36;
859
+ } else {
860
+ t36 = $[78];
861
+ }
862
+ let t37;
863
+ if ($[79] !== t36) {
864
+ t37 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t36 });
865
+ $[79] = t36;
866
+ $[80] = t37;
811
867
  } else {
812
- t35 = $[62];
868
+ t37 = $[80];
813
869
  }
814
- const t36 = isAdmin || !editable;
815
- const t37 = (isAdmin || defaultDelete) ?? false;
816
870
  let t38;
817
- if ($[63] !== setFieldValue) {
818
- t38 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
819
- $[63] = setFieldValue;
820
- $[64] = t38;
871
+ if ($[81] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
872
+ t38 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" });
873
+ $[81] = t38;
821
874
  } else {
822
- t38 = $[64];
875
+ t38 = $[81];
823
876
  }
824
877
  let t39;
825
- if ($[65] !== t36 || $[66] !== t37 || $[67] !== t38) {
826
- t39 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Delete data in any collection", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t36, checked: t37, onCheckedChange: t38 }) }) });
827
- $[65] = t36;
828
- $[66] = t37;
829
- $[67] = t38;
830
- $[68] = t39;
878
+ if ($[82] !== t31 || $[83] !== t33 || $[84] !== t35 || $[85] !== t37) {
879
+ t39 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { className: "rounded-md", children: [
880
+ t29,
881
+ t31,
882
+ t33,
883
+ t35,
884
+ t37,
885
+ t38
886
+ ] });
887
+ $[82] = t31;
888
+ $[83] = t33;
889
+ $[84] = t35;
890
+ $[85] = t37;
891
+ $[86] = t39;
831
892
  } else {
832
- t39 = $[68];
893
+ t39 = $[86];
833
894
  }
834
895
  let t40;
835
- if ($[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
836
- t40 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" });
837
- $[69] = t40;
896
+ if ($[87] !== t) {
897
+ t40 = t("all_collections");
898
+ $[87] = t;
899
+ $[88] = t40;
838
900
  } else {
839
- t40 = $[69];
901
+ t40 = $[88];
840
902
  }
841
903
  let t41;
842
- if ($[70] !== t27 || $[71] !== t31 || $[72] !== t35 || $[73] !== t39) {
843
- t41 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
844
- t23,
845
- t27,
846
- t31,
847
- t35,
848
- t39,
849
- t40
850
- ] });
851
- $[70] = t27;
852
- $[71] = t31;
853
- $[72] = t35;
854
- $[73] = t39;
855
- $[74] = t41;
904
+ if ($[89] !== t40) {
905
+ t41 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: t40 }) });
906
+ $[89] = t40;
907
+ $[90] = t41;
856
908
  } else {
857
- t41 = $[74];
909
+ t41 = $[90];
858
910
  }
859
911
  let t42;
860
- if ($[75] !== collections || $[76] !== defaultCreate || $[77] !== defaultDelete || $[78] !== defaultEdit || $[79] !== defaultRead || $[80] !== editable || $[81] !== isAdmin || $[82] !== setFieldValue || $[83] !== values_0) {
861
- t42 = collections && collections.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
862
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: col.name }),
863
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultCreate || !editable, checked: (isAdmin || defaultCreate || formex.getIn(values_0, `collectionPermissions.${col.id}.create`)) ?? false, onCheckedChange: (checked_3) => setFieldValue(`collectionPermissions.${col.id}.create`, checked_3) }) }),
864
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultRead || !editable, checked: (isAdmin || defaultRead || formex.getIn(values_0, `collectionPermissions.${col.id}.read`)) ?? false, onCheckedChange: (checked_4) => setFieldValue(`collectionPermissions.${col.id}.read`, checked_4) }) }),
865
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultEdit || !editable, checked: (isAdmin || defaultEdit || formex.getIn(values_0, `collectionPermissions.${col.id}.edit`)) ?? false, onCheckedChange: (checked_5) => setFieldValue(`collectionPermissions.${col.id}.edit`, checked_5) }) }),
866
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultDelete || !editable, checked: (isAdmin || defaultDelete || formex.getIn(values_0, `collectionPermissions.${col.id}.delete`)) ?? false, onCheckedChange: (checked_6) => setFieldValue(`collectionPermissions.${col.id}.delete`, checked_6) }) }),
867
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Allow all permissions in this collections", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "color-inherit", onClick: () => {
868
- setFieldValue(`collectionPermissions.${col.id}.create`, true);
869
- setFieldValue(`collectionPermissions.${col.id}.read`, true);
870
- setFieldValue(`collectionPermissions.${col.id}.edit`, true);
871
- setFieldValue(`collectionPermissions.${col.id}.delete`, true);
872
- }, disabled: isAdmin || !editable, variant: "text", children: "All" }) }) })
873
- ] }, col.name));
874
- $[75] = collections;
875
- $[76] = defaultCreate;
876
- $[77] = defaultDelete;
877
- $[78] = defaultEdit;
878
- $[79] = defaultRead;
879
- $[80] = editable;
880
- $[81] = isAdmin;
881
- $[82] = setFieldValue;
882
- $[83] = values_0;
883
- $[84] = t42;
884
- } else {
885
- t42 = $[84];
886
- }
887
- let t43;
888
- if ($[85] !== t41 || $[86] !== t42) {
889
- t43 = /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { className: "bg-inherit overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full rounded-md", children: [
890
- t22,
891
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
892
- t41,
893
- t42
894
- ] })
895
- ] }) });
896
- $[85] = t41;
897
- $[86] = t42;
898
- $[87] = t43;
912
+ if ($[91] !== t) {
913
+ t42 = t("create_entities_in_collections");
914
+ $[91] = t;
915
+ $[92] = t42;
916
+ } else {
917
+ t42 = $[92];
918
+ }
919
+ const t43 = isAdmin || !editable;
920
+ const t44 = (isAdmin || defaultCreate) ?? false;
921
+ let t45;
922
+ if ($[93] !== setFieldValue) {
923
+ t45 = (checked) => setFieldValue("defaultPermissions.create", checked);
924
+ $[93] = setFieldValue;
925
+ $[94] = t45;
899
926
  } else {
900
- t43 = $[87];
927
+ t45 = $[94];
901
928
  }
902
- let t44;
903
- if ($[88] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
904
- t44 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: "You can customise the permissions that the users related to this role can perform in the entities of each collection" });
905
- $[88] = t44;
929
+ let t46;
930
+ if ($[95] !== t43 || $[96] !== t44 || $[97] !== t45) {
931
+ t46 = /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t43, checked: t44, onCheckedChange: t45 });
932
+ $[95] = t43;
933
+ $[96] = t44;
934
+ $[97] = t45;
935
+ $[98] = t46;
906
936
  } else {
907
- t44 = $[88];
937
+ t46 = $[98];
908
938
  }
909
- let t45;
910
- if ($[89] !== t43) {
911
- t45 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
912
- t43,
913
- t44
914
- ] });
915
- $[89] = t43;
916
- $[90] = t45;
939
+ let t47;
940
+ if ($[99] !== t42 || $[100] !== t46) {
941
+ t47 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t42, children: t46 }) });
942
+ $[99] = t42;
943
+ $[100] = t46;
944
+ $[101] = t47;
917
945
  } else {
918
- t45 = $[90];
946
+ t47 = $[101];
919
947
  }
920
- const t46 = touched.config && Boolean(errors_0.config);
921
- const t47 = isAdmin || !editable;
922
948
  let t48;
923
- if ($[91] !== setFieldValue) {
924
- t48 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
925
- $[91] = setFieldValue;
926
- $[92] = t48;
949
+ if ($[102] !== t) {
950
+ t48 = t("access_all_data_in_every_collection");
951
+ $[102] = t;
952
+ $[103] = t48;
927
953
  } else {
928
- t48 = $[92];
954
+ t48 = $[103];
929
955
  }
930
- const t49 = isAdmin || values_0.config?.createCollections ? "true" : "false";
931
- let t50;
956
+ const t49 = isAdmin || !editable;
957
+ const t50 = (isAdmin || defaultRead) ?? false;
932
958
  let t51;
933
- if ($[93] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
934
- t50 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
935
- t51 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
936
- $[93] = t50;
937
- $[94] = t51;
959
+ if ($[104] !== setFieldValue) {
960
+ t51 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
961
+ $[104] = setFieldValue;
962
+ $[105] = t51;
938
963
  } else {
939
- t50 = $[93];
940
- t51 = $[94];
964
+ t51 = $[105];
941
965
  }
942
966
  let t52;
943
- if ($[95] !== t46 || $[96] !== t47 || $[97] !== t48 || $[98] !== t49) {
944
- t52 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { error: t46, size: "large", fullWidth: true, id: "createCollections", name: "createCollections", label: "Create collections", position: "item-aligned", disabled: t47, onChange: t48, value: t49, renderValue: _temp4$1, children: [
945
- t50,
946
- t51
947
- ] });
948
- $[95] = t46;
949
- $[96] = t47;
950
- $[97] = t48;
951
- $[98] = t49;
952
- $[99] = t52;
967
+ if ($[106] !== t49 || $[107] !== t50 || $[108] !== t51) {
968
+ t52 = /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t49, checked: t50, onCheckedChange: t51 });
969
+ $[106] = t49;
970
+ $[107] = t50;
971
+ $[108] = t51;
972
+ $[109] = t52;
953
973
  } else {
954
- t52 = $[99];
974
+ t52 = $[109];
975
+ }
976
+ let t53;
977
+ if ($[110] !== t48 || $[111] !== t52) {
978
+ t53 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t48, children: t52 }) });
979
+ $[110] = t48;
980
+ $[111] = t52;
981
+ $[112] = t53;
982
+ } else {
983
+ t53 = $[112];
955
984
  }
956
- const t53 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user create collections";
957
985
  let t54;
958
- if ($[100] !== t53) {
959
- t54 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t53 });
960
- $[100] = t53;
961
- $[101] = t54;
962
- } else {
963
- t54 = $[101];
964
- }
965
- let t55;
966
- if ($[102] !== t52 || $[103] !== t54) {
967
- t55 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
968
- t52,
969
- t54
970
- ] });
971
- $[102] = t52;
972
- $[103] = t54;
973
- $[104] = t55;
986
+ if ($[113] !== t) {
987
+ t54 = t("update_data_in_any_collection");
988
+ $[113] = t;
989
+ $[114] = t54;
974
990
  } else {
975
- t55 = $[104];
991
+ t54 = $[114];
992
+ }
993
+ const t55 = isAdmin || !editable;
994
+ const t56 = (isAdmin || defaultEdit) ?? false;
995
+ let t57;
996
+ if ($[115] !== setFieldValue) {
997
+ t57 = (checked_1) => setFieldValue("defaultPermissions.edit", checked_1);
998
+ $[115] = setFieldValue;
999
+ $[116] = t57;
1000
+ } else {
1001
+ t57 = $[116];
976
1002
  }
977
- const t56 = touched.config && Boolean(errors_0.config);
978
- const t57 = isAdmin || !editable;
979
1003
  let t58;
980
- if ($[105] !== setFieldValue) {
981
- t58 = (event_0) => setFieldValue("config.editCollections", event_0.target.value === "own" ? "own" : event_0.target.value === "true");
982
- $[105] = setFieldValue;
983
- $[106] = t58;
1004
+ if ($[117] !== t55 || $[118] !== t56 || $[119] !== t57) {
1005
+ t58 = /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t55, checked: t56, onCheckedChange: t57 });
1006
+ $[117] = t55;
1007
+ $[118] = t56;
1008
+ $[119] = t57;
1009
+ $[120] = t58;
984
1010
  } else {
985
- t58 = $[106];
1011
+ t58 = $[120];
1012
+ }
1013
+ let t59;
1014
+ if ($[121] !== t54 || $[122] !== t58) {
1015
+ t59 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t54, children: t58 }) });
1016
+ $[121] = t54;
1017
+ $[122] = t58;
1018
+ $[123] = t59;
1019
+ } else {
1020
+ t59 = $[123];
986
1021
  }
987
- const t59 = isAdmin ? "true" : values_0.config?.editCollections === "own" ? "own" : values_0.config?.editCollections ? "true" : "false";
988
1022
  let t60;
989
- let t61;
990
- let t62;
991
- if ($[107] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
992
- t60 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
993
- t61 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
994
- t62 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "own", children: " Only his/her own " });
995
- $[107] = t60;
996
- $[108] = t61;
997
- $[109] = t62;
998
- } else {
999
- t60 = $[107];
1000
- t61 = $[108];
1001
- t62 = $[109];
1023
+ if ($[124] !== t) {
1024
+ t60 = t("delete_data_in_any_collection");
1025
+ $[124] = t;
1026
+ $[125] = t60;
1027
+ } else {
1028
+ t60 = $[125];
1002
1029
  }
1030
+ const t61 = isAdmin || !editable;
1031
+ const t62 = (isAdmin || defaultDelete) ?? false;
1003
1032
  let t63;
1004
- if ($[110] !== t56 || $[111] !== t57 || $[112] !== t58 || $[113] !== t59) {
1005
- t63 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { size: "large", fullWidth: true, error: t56, id: "editCollections", name: "editCollections", label: "Edit collections", disabled: t57, position: "item-aligned", onChange: t58, value: t59, renderValue: _temp5$1, children: [
1006
- t60,
1007
- t61,
1008
- t62
1009
- ] });
1010
- $[110] = t56;
1011
- $[111] = t57;
1012
- $[112] = t58;
1013
- $[113] = t59;
1014
- $[114] = t63;
1033
+ if ($[126] !== setFieldValue) {
1034
+ t63 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
1035
+ $[126] = setFieldValue;
1036
+ $[127] = t63;
1037
+ } else {
1038
+ t63 = $[127];
1039
+ }
1040
+ let t64;
1041
+ if ($[128] !== t61 || $[129] !== t62 || $[130] !== t63) {
1042
+ t64 = /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t61, checked: t62, onCheckedChange: t63 });
1043
+ $[128] = t61;
1044
+ $[129] = t62;
1045
+ $[130] = t63;
1046
+ $[131] = t64;
1015
1047
  } else {
1016
- t63 = $[114];
1048
+ t64 = $[131];
1017
1049
  }
1018
- const t64 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user edit collections";
1019
1050
  let t65;
1020
- if ($[115] !== t64) {
1021
- t65 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t64 });
1022
- $[115] = t64;
1023
- $[116] = t65;
1051
+ if ($[132] !== t60 || $[133] !== t64) {
1052
+ t65 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t60, children: t64 }) });
1053
+ $[132] = t60;
1054
+ $[133] = t64;
1055
+ $[134] = t65;
1024
1056
  } else {
1025
- t65 = $[116];
1057
+ t65 = $[134];
1026
1058
  }
1027
1059
  let t66;
1028
- if ($[117] !== t63 || $[118] !== t65) {
1029
- t66 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1030
- t63,
1031
- t65
1060
+ if ($[135] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1061
+ t66 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" });
1062
+ $[135] = t66;
1063
+ } else {
1064
+ t66 = $[135];
1065
+ }
1066
+ let t67;
1067
+ if ($[136] !== t41 || $[137] !== t47 || $[138] !== t53 || $[139] !== t59 || $[140] !== t65) {
1068
+ t67 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
1069
+ t41,
1070
+ t47,
1071
+ t53,
1072
+ t59,
1073
+ t65,
1074
+ t66
1032
1075
  ] });
1033
- $[117] = t63;
1034
- $[118] = t65;
1035
- $[119] = t66;
1036
- } else {
1037
- t66 = $[119];
1076
+ $[136] = t41;
1077
+ $[137] = t47;
1078
+ $[138] = t53;
1079
+ $[139] = t59;
1080
+ $[140] = t65;
1081
+ $[141] = t67;
1082
+ } else {
1083
+ t67 = $[141];
1084
+ }
1085
+ let t68;
1086
+ if ($[142] !== collections || $[143] !== defaultCreate || $[144] !== defaultDelete || $[145] !== defaultEdit || $[146] !== defaultRead || $[147] !== editable || $[148] !== isAdmin || $[149] !== setFieldValue || $[150] !== t || $[151] !== values_0) {
1087
+ t68 = collections && collections.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
1088
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: col.name }),
1089
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultCreate || !editable, checked: (isAdmin || defaultCreate || formex.getIn(values_0, `collectionPermissions.${col.id}.create`)) ?? false, onCheckedChange: (checked_3) => setFieldValue(`collectionPermissions.${col.id}.create`, checked_3) }) }),
1090
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultRead || !editable, checked: (isAdmin || defaultRead || formex.getIn(values_0, `collectionPermissions.${col.id}.read`)) ?? false, onCheckedChange: (checked_4) => setFieldValue(`collectionPermissions.${col.id}.read`, checked_4) }) }),
1091
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultEdit || !editable, checked: (isAdmin || defaultEdit || formex.getIn(values_0, `collectionPermissions.${col.id}.edit`)) ?? false, onCheckedChange: (checked_5) => setFieldValue(`collectionPermissions.${col.id}.edit`, checked_5) }) }),
1092
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: isAdmin || defaultDelete || !editable, checked: (isAdmin || defaultDelete || formex.getIn(values_0, `collectionPermissions.${col.id}.delete`)) ?? false, onCheckedChange: (checked_6) => setFieldValue(`collectionPermissions.${col.id}.delete`, checked_6) }) }),
1093
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("allow_all_permissions_in_this_collections"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "color-inherit", onClick: () => {
1094
+ setFieldValue(`collectionPermissions.${col.id}.create`, true);
1095
+ setFieldValue(`collectionPermissions.${col.id}.read`, true);
1096
+ setFieldValue(`collectionPermissions.${col.id}.edit`, true);
1097
+ setFieldValue(`collectionPermissions.${col.id}.delete`, true);
1098
+ }, disabled: isAdmin || !editable, variant: "text", children: t("all") }) }) })
1099
+ ] }, col.name));
1100
+ $[142] = collections;
1101
+ $[143] = defaultCreate;
1102
+ $[144] = defaultDelete;
1103
+ $[145] = defaultEdit;
1104
+ $[146] = defaultRead;
1105
+ $[147] = editable;
1106
+ $[148] = isAdmin;
1107
+ $[149] = setFieldValue;
1108
+ $[150] = t;
1109
+ $[151] = values_0;
1110
+ $[152] = t68;
1111
+ } else {
1112
+ t68 = $[152];
1038
1113
  }
1039
- const t67 = touched.config && Boolean(errors_0.config);
1040
- const t68 = isAdmin || !editable;
1041
1114
  let t69;
1042
- if ($[120] !== setFieldValue) {
1043
- t69 = (event_1) => setFieldValue("config.deleteCollections", event_1.target.value === "own" ? "own" : event_1.target.value === "true");
1044
- $[120] = setFieldValue;
1045
- $[121] = t69;
1115
+ if ($[153] !== t67 || $[154] !== t68) {
1116
+ t69 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1117
+ t67,
1118
+ t68
1119
+ ] });
1120
+ $[153] = t67;
1121
+ $[154] = t68;
1122
+ $[155] = t69;
1123
+ } else {
1124
+ t69 = $[155];
1125
+ }
1126
+ let t70;
1127
+ if ($[156] !== t39 || $[157] !== t69) {
1128
+ t70 = /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { className: "bg-inherit overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full rounded-md", children: [
1129
+ t39,
1130
+ t69
1131
+ ] }) });
1132
+ $[156] = t39;
1133
+ $[157] = t69;
1134
+ $[158] = t70;
1046
1135
  } else {
1047
- t69 = $[121];
1136
+ t70 = $[158];
1048
1137
  }
1049
- const t70 = isAdmin ? "true" : values_0.config?.deleteCollections === "own" ? "own" : values_0.config?.deleteCollections ? "true" : "false";
1050
1138
  let t71;
1139
+ if ($[159] !== t) {
1140
+ t71 = t("customise_permissions_description");
1141
+ $[159] = t;
1142
+ $[160] = t71;
1143
+ } else {
1144
+ t71 = $[160];
1145
+ }
1051
1146
  let t72;
1147
+ if ($[161] !== t71) {
1148
+ t72 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t71 });
1149
+ $[161] = t71;
1150
+ $[162] = t72;
1151
+ } else {
1152
+ t72 = $[162];
1153
+ }
1052
1154
  let t73;
1053
- if ($[122] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1054
- t71 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
1055
- t72 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
1056
- t73 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "own", children: " Only his/her own " });
1057
- $[122] = t71;
1058
- $[123] = t72;
1059
- $[124] = t73;
1060
- } else {
1061
- t71 = $[122];
1062
- t72 = $[123];
1063
- t73 = $[124];
1064
- }
1065
- let t74;
1066
- if ($[125] !== t67 || $[126] !== t68 || $[127] !== t69 || $[128] !== t70) {
1067
- t74 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { size: "large", fullWidth: true, error: t67, id: "deleteCollections", name: "deleteCollections", label: "Delete collections", disabled: t68, position: "item-aligned", onChange: t69, value: t70, renderValue: _temp6$1, children: [
1068
- t71,
1069
- t72,
1070
- t73
1155
+ if ($[163] !== t70 || $[164] !== t72) {
1156
+ t73 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1157
+ t70,
1158
+ t72
1071
1159
  ] });
1072
- $[125] = t67;
1073
- $[126] = t68;
1074
- $[127] = t69;
1075
- $[128] = t70;
1076
- $[129] = t74;
1160
+ $[163] = t70;
1161
+ $[164] = t72;
1162
+ $[165] = t73;
1077
1163
  } else {
1078
- t74 = $[129];
1164
+ t73 = $[165];
1079
1165
  }
1080
- const t75 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user delete collections";
1081
- let t76;
1082
- if ($[130] !== t75) {
1083
- t76 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t75 });
1084
- $[130] = t75;
1085
- $[131] = t76;
1166
+ const t74 = touched.config && Boolean(errors_0.config);
1167
+ let t75;
1168
+ if ($[166] !== t) {
1169
+ t75 = t("create_collections");
1170
+ $[166] = t;
1171
+ $[167] = t75;
1086
1172
  } else {
1087
- t76 = $[131];
1173
+ t75 = $[167];
1088
1174
  }
1175
+ const t76 = isAdmin || !editable;
1089
1176
  let t77;
1090
- if ($[132] !== t74 || $[133] !== t76) {
1091
- t77 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1092
- t74,
1093
- t76
1094
- ] });
1095
- $[132] = t74;
1096
- $[133] = t76;
1097
- $[134] = t77;
1098
- } else {
1099
- t77 = $[134];
1100
- }
1101
- let t78;
1102
- if ($[135] !== t14 || $[136] !== t21 || $[137] !== t45 || $[138] !== t55 || $[139] !== t66 || $[140] !== t77) {
1103
- t78 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1104
- t14,
1105
- t21,
1106
- t45,
1107
- t55,
1108
- t66,
1109
- t77
1110
- ] }) });
1111
- $[135] = t14;
1112
- $[136] = t21;
1113
- $[137] = t45;
1114
- $[138] = t55;
1115
- $[139] = t66;
1116
- $[140] = t77;
1117
- $[141] = t78;
1177
+ if ($[168] !== setFieldValue) {
1178
+ t77 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
1179
+ $[168] = setFieldValue;
1180
+ $[169] = t77;
1118
1181
  } else {
1119
- t78 = $[141];
1182
+ t77 = $[169];
1120
1183
  }
1184
+ const t78 = isAdmin || values_0.config?.createCollections ? "true" : "false";
1121
1185
  let t79;
1122
- if ($[142] !== savingError) {
1123
- t79 = savingError && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "text-red-500 dark:text-red-500", children: savingError.message ?? "There was an error saving this role" });
1124
- $[142] = savingError;
1125
- $[143] = t79;
1186
+ if ($[170] !== t) {
1187
+ t79 = (value) => value === "true" ? t("yes") : t("no");
1188
+ $[170] = t;
1189
+ $[171] = t79;
1126
1190
  } else {
1127
- t79 = $[143];
1191
+ t79 = $[171];
1128
1192
  }
1129
1193
  let t80;
1130
- if ($[144] !== handleClose) {
1131
- t80 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: () => {
1132
- handleClose();
1133
- }, children: "Cancel" });
1134
- $[144] = handleClose;
1135
- $[145] = t80;
1194
+ if ($[172] !== t) {
1195
+ t80 = t("yes");
1196
+ $[172] = t;
1197
+ $[173] = t80;
1136
1198
  } else {
1137
- t80 = $[145];
1199
+ t80 = $[173];
1200
+ }
1201
+ let t81;
1202
+ if ($[174] !== t80) {
1203
+ t81 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "true", children: [
1204
+ " ",
1205
+ t80,
1206
+ " "
1207
+ ] });
1208
+ $[174] = t80;
1209
+ $[175] = t81;
1210
+ } else {
1211
+ t81 = $[175];
1212
+ }
1213
+ let t82;
1214
+ if ($[176] !== t) {
1215
+ t82 = t("no");
1216
+ $[176] = t;
1217
+ $[177] = t82;
1218
+ } else {
1219
+ t82 = $[177];
1138
1220
  }
1139
- const t81 = !dirty;
1140
- const t82 = isNewRole ? "Create role" : "Update";
1141
1221
  let t83;
1142
- if ($[146] !== isSubmitting || $[147] !== t81 || $[148] !== t82) {
1143
- t83 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t81, loading: isSubmitting, children: t82 });
1144
- $[146] = isSubmitting;
1145
- $[147] = t81;
1146
- $[148] = t82;
1147
- $[149] = t83;
1222
+ if ($[178] !== t82) {
1223
+ t83 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "false", children: [
1224
+ " ",
1225
+ t82,
1226
+ " "
1227
+ ] });
1228
+ $[178] = t82;
1229
+ $[179] = t83;
1148
1230
  } else {
1149
- t83 = $[149];
1231
+ t83 = $[179];
1150
1232
  }
1151
1233
  let t84;
1152
- if ($[150] !== t79 || $[151] !== t80 || $[152] !== t83) {
1153
- t84 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { position: "sticky", children: [
1154
- t79,
1155
- t80,
1234
+ if ($[180] !== t74 || $[181] !== t75 || $[182] !== t76 || $[183] !== t77 || $[184] !== t78 || $[185] !== t79 || $[186] !== t81 || $[187] !== t83) {
1235
+ t84 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { error: t74, size: "large", fullWidth: true, id: "createCollections", name: "createCollections", label: t75, position: "item-aligned", disabled: t76, onChange: t77, value: t78, renderValue: t79, children: [
1236
+ t81,
1156
1237
  t83
1157
1238
  ] });
1158
- $[150] = t79;
1159
- $[151] = t80;
1160
- $[152] = t83;
1161
- $[153] = t84;
1162
- } else {
1163
- t84 = $[153];
1239
+ $[180] = t74;
1240
+ $[181] = t75;
1241
+ $[182] = t76;
1242
+ $[183] = t77;
1243
+ $[184] = t78;
1244
+ $[185] = t79;
1245
+ $[186] = t81;
1246
+ $[187] = t83;
1247
+ $[188] = t84;
1248
+ } else {
1249
+ t84 = $[188];
1164
1250
  }
1165
1251
  let t85;
1166
- if ($[154] !== formex$1.handleSubmit || $[155] !== t78 || $[156] !== t84) {
1167
- t85 = /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, autoComplete: "off", onSubmit: formex$1.handleSubmit, style: t7, children: [
1168
- t8,
1169
- t78,
1170
- t84
1171
- ] });
1172
- $[154] = formex$1.handleSubmit;
1173
- $[155] = t78;
1174
- $[156] = t84;
1175
- $[157] = t85;
1252
+ if ($[189] !== errors_0 || $[190] !== t || $[191] !== touched.config) {
1253
+ t85 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_create_collections");
1254
+ $[189] = errors_0;
1255
+ $[190] = t;
1256
+ $[191] = touched.config;
1257
+ $[192] = t85;
1176
1258
  } else {
1177
- t85 = $[157];
1259
+ t85 = $[192];
1178
1260
  }
1179
1261
  let t86;
1180
- if ($[158] !== formex$1 || $[159] !== t85) {
1181
- t86 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t85 });
1182
- $[158] = formex$1;
1183
- $[159] = t85;
1184
- $[160] = t86;
1262
+ if ($[193] !== t85) {
1263
+ t86 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t85 });
1264
+ $[193] = t85;
1265
+ $[194] = t86;
1185
1266
  } else {
1186
- t86 = $[160];
1267
+ t86 = $[194];
1187
1268
  }
1188
1269
  let t87;
1189
- if ($[161] !== open || $[162] !== t86) {
1190
- t87 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, maxWidth: "4xl", children: t86 });
1191
- $[161] = open;
1192
- $[162] = t86;
1193
- $[163] = t87;
1270
+ if ($[195] !== t84 || $[196] !== t86) {
1271
+ t87 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1272
+ t84,
1273
+ t86
1274
+ ] });
1275
+ $[195] = t84;
1276
+ $[196] = t86;
1277
+ $[197] = t87;
1278
+ } else {
1279
+ t87 = $[197];
1280
+ }
1281
+ const t88 = touched.config && Boolean(errors_0.config);
1282
+ let t89;
1283
+ if ($[198] !== t) {
1284
+ t89 = t("edit_collections");
1285
+ $[198] = t;
1286
+ $[199] = t89;
1287
+ } else {
1288
+ t89 = $[199];
1289
+ }
1290
+ const t90 = isAdmin || !editable;
1291
+ let t91;
1292
+ if ($[200] !== setFieldValue) {
1293
+ t91 = (event_0) => setFieldValue("config.editCollections", event_0.target.value === "own" ? "own" : event_0.target.value === "true");
1294
+ $[200] = setFieldValue;
1295
+ $[201] = t91;
1296
+ } else {
1297
+ t91 = $[201];
1298
+ }
1299
+ const t92 = isAdmin ? "true" : values_0.config?.editCollections === "own" ? "own" : values_0.config?.editCollections ? "true" : "false";
1300
+ let t93;
1301
+ if ($[202] !== t) {
1302
+ t93 = (value_0) => value_0 === "own" ? t("own") : value_0 === "true" ? t("yes") : t("no");
1303
+ $[202] = t;
1304
+ $[203] = t93;
1305
+ } else {
1306
+ t93 = $[203];
1307
+ }
1308
+ let t94;
1309
+ if ($[204] !== t) {
1310
+ t94 = t("yes");
1311
+ $[204] = t;
1312
+ $[205] = t94;
1313
+ } else {
1314
+ t94 = $[205];
1315
+ }
1316
+ let t95;
1317
+ if ($[206] !== t94) {
1318
+ t95 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "true", children: [
1319
+ " ",
1320
+ t94,
1321
+ " "
1322
+ ] });
1323
+ $[206] = t94;
1324
+ $[207] = t95;
1194
1325
  } else {
1195
- t87 = $[163];
1326
+ t95 = $[207];
1196
1327
  }
1197
- return t87;
1198
- }
1199
- function _temp6$1(value_1) {
1200
- return value_1 === "own" ? "Own" : value_1 === "true" ? "Yes" : "No";
1201
- }
1202
- function _temp5$1(value_0) {
1203
- return value_0 === "own" ? "Own" : value_0 === "true" ? "Yes" : "No";
1204
- }
1205
- function _temp4$1(value) {
1206
- return value === "true" ? "Yes" : "No";
1207
- }
1208
- function _temp3$1(values) {
1209
- return RoleYupSchema.validate(values, {
1210
- abortEarly: false
1211
- }).then(_temp$3).catch(_temp2$1);
1328
+ let t96;
1329
+ if ($[208] !== t) {
1330
+ t96 = t("no");
1331
+ $[208] = t;
1332
+ $[209] = t96;
1333
+ } else {
1334
+ t96 = $[209];
1335
+ }
1336
+ let t97;
1337
+ if ($[210] !== t96) {
1338
+ t97 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "false", children: [
1339
+ " ",
1340
+ t96,
1341
+ " "
1342
+ ] });
1343
+ $[210] = t96;
1344
+ $[211] = t97;
1345
+ } else {
1346
+ t97 = $[211];
1347
+ }
1348
+ let t98;
1349
+ if ($[212] !== t) {
1350
+ t98 = t("only_own_collections");
1351
+ $[212] = t;
1352
+ $[213] = t98;
1353
+ } else {
1354
+ t98 = $[213];
1355
+ }
1356
+ let t99;
1357
+ if ($[214] !== t98) {
1358
+ t99 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "own", children: [
1359
+ " ",
1360
+ t98,
1361
+ " "
1362
+ ] });
1363
+ $[214] = t98;
1364
+ $[215] = t99;
1365
+ } else {
1366
+ t99 = $[215];
1367
+ }
1368
+ let t100;
1369
+ if ($[216] !== t88 || $[217] !== t89 || $[218] !== t90 || $[219] !== t91 || $[220] !== t92 || $[221] !== t93 || $[222] !== t95 || $[223] !== t97 || $[224] !== t99) {
1370
+ t100 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { size: "large", fullWidth: true, error: t88, id: "editCollections", name: "editCollections", label: t89, disabled: t90, position: "item-aligned", onChange: t91, value: t92, renderValue: t93, children: [
1371
+ t95,
1372
+ t97,
1373
+ t99
1374
+ ] });
1375
+ $[216] = t88;
1376
+ $[217] = t89;
1377
+ $[218] = t90;
1378
+ $[219] = t91;
1379
+ $[220] = t92;
1380
+ $[221] = t93;
1381
+ $[222] = t95;
1382
+ $[223] = t97;
1383
+ $[224] = t99;
1384
+ $[225] = t100;
1385
+ } else {
1386
+ t100 = $[225];
1387
+ }
1388
+ let t101;
1389
+ if ($[226] !== errors_0 || $[227] !== t || $[228] !== touched.config) {
1390
+ t101 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_edit_collections");
1391
+ $[226] = errors_0;
1392
+ $[227] = t;
1393
+ $[228] = touched.config;
1394
+ $[229] = t101;
1395
+ } else {
1396
+ t101 = $[229];
1397
+ }
1398
+ let t102;
1399
+ if ($[230] !== t101) {
1400
+ t102 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t101 });
1401
+ $[230] = t101;
1402
+ $[231] = t102;
1403
+ } else {
1404
+ t102 = $[231];
1405
+ }
1406
+ let t103;
1407
+ if ($[232] !== t100 || $[233] !== t102) {
1408
+ t103 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1409
+ t100,
1410
+ t102
1411
+ ] });
1412
+ $[232] = t100;
1413
+ $[233] = t102;
1414
+ $[234] = t103;
1415
+ } else {
1416
+ t103 = $[234];
1417
+ }
1418
+ const t104 = touched.config && Boolean(errors_0.config);
1419
+ let t105;
1420
+ if ($[235] !== t) {
1421
+ t105 = t("delete_collections");
1422
+ $[235] = t;
1423
+ $[236] = t105;
1424
+ } else {
1425
+ t105 = $[236];
1426
+ }
1427
+ const t106 = isAdmin || !editable;
1428
+ let t107;
1429
+ if ($[237] !== setFieldValue) {
1430
+ t107 = (event_1) => setFieldValue("config.deleteCollections", event_1.target.value === "own" ? "own" : event_1.target.value === "true");
1431
+ $[237] = setFieldValue;
1432
+ $[238] = t107;
1433
+ } else {
1434
+ t107 = $[238];
1435
+ }
1436
+ const t108 = isAdmin ? "true" : values_0.config?.deleteCollections === "own" ? "own" : values_0.config?.deleteCollections ? "true" : "false";
1437
+ let t109;
1438
+ if ($[239] !== t) {
1439
+ t109 = (value_1) => value_1 === "own" ? t("own") : value_1 === "true" ? t("yes") : t("no");
1440
+ $[239] = t;
1441
+ $[240] = t109;
1442
+ } else {
1443
+ t109 = $[240];
1444
+ }
1445
+ let t110;
1446
+ if ($[241] !== t) {
1447
+ t110 = t("yes");
1448
+ $[241] = t;
1449
+ $[242] = t110;
1450
+ } else {
1451
+ t110 = $[242];
1452
+ }
1453
+ let t111;
1454
+ if ($[243] !== t110) {
1455
+ t111 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "true", children: [
1456
+ " ",
1457
+ t110,
1458
+ " "
1459
+ ] });
1460
+ $[243] = t110;
1461
+ $[244] = t111;
1462
+ } else {
1463
+ t111 = $[244];
1464
+ }
1465
+ let t112;
1466
+ if ($[245] !== t) {
1467
+ t112 = t("no");
1468
+ $[245] = t;
1469
+ $[246] = t112;
1470
+ } else {
1471
+ t112 = $[246];
1472
+ }
1473
+ let t113;
1474
+ if ($[247] !== t112) {
1475
+ t113 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "false", children: [
1476
+ " ",
1477
+ t112,
1478
+ " "
1479
+ ] });
1480
+ $[247] = t112;
1481
+ $[248] = t113;
1482
+ } else {
1483
+ t113 = $[248];
1484
+ }
1485
+ let t114;
1486
+ if ($[249] !== t) {
1487
+ t114 = t("only_own_collections");
1488
+ $[249] = t;
1489
+ $[250] = t114;
1490
+ } else {
1491
+ t114 = $[250];
1492
+ }
1493
+ let t115;
1494
+ if ($[251] !== t114) {
1495
+ t115 = /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectItem, { value: "own", children: [
1496
+ " ",
1497
+ t114,
1498
+ " "
1499
+ ] });
1500
+ $[251] = t114;
1501
+ $[252] = t115;
1502
+ } else {
1503
+ t115 = $[252];
1504
+ }
1505
+ let t116;
1506
+ if ($[253] !== t104 || $[254] !== t105 || $[255] !== t106 || $[256] !== t107 || $[257] !== t108 || $[258] !== t109 || $[259] !== t111 || $[260] !== t113 || $[261] !== t115) {
1507
+ t116 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { size: "large", fullWidth: true, error: t104, id: "deleteCollections", name: "deleteCollections", label: t105, disabled: t106, position: "item-aligned", onChange: t107, value: t108, renderValue: t109, children: [
1508
+ t111,
1509
+ t113,
1510
+ t115
1511
+ ] });
1512
+ $[253] = t104;
1513
+ $[254] = t105;
1514
+ $[255] = t106;
1515
+ $[256] = t107;
1516
+ $[257] = t108;
1517
+ $[258] = t109;
1518
+ $[259] = t111;
1519
+ $[260] = t113;
1520
+ $[261] = t115;
1521
+ $[262] = t116;
1522
+ } else {
1523
+ t116 = $[262];
1524
+ }
1525
+ let t117;
1526
+ if ($[263] !== errors_0 || $[264] !== t || $[265] !== touched.config) {
1527
+ t117 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_delete_collections");
1528
+ $[263] = errors_0;
1529
+ $[264] = t;
1530
+ $[265] = touched.config;
1531
+ $[266] = t117;
1532
+ } else {
1533
+ t117 = $[266];
1534
+ }
1535
+ let t118;
1536
+ if ($[267] !== t117) {
1537
+ t118 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t117 });
1538
+ $[267] = t117;
1539
+ $[268] = t118;
1540
+ } else {
1541
+ t118 = $[268];
1542
+ }
1543
+ let t119;
1544
+ if ($[269] !== t116 || $[270] !== t118) {
1545
+ t119 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1546
+ t116,
1547
+ t118
1548
+ ] });
1549
+ $[269] = t116;
1550
+ $[270] = t118;
1551
+ $[271] = t119;
1552
+ } else {
1553
+ t119 = $[271];
1554
+ }
1555
+ let t120;
1556
+ if ($[272] !== t103 || $[273] !== t119 || $[274] !== t19 || $[275] !== t28 || $[276] !== t73 || $[277] !== t87) {
1557
+ t120 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1558
+ t19,
1559
+ t28,
1560
+ t73,
1561
+ t87,
1562
+ t103,
1563
+ t119
1564
+ ] }) });
1565
+ $[272] = t103;
1566
+ $[273] = t119;
1567
+ $[274] = t19;
1568
+ $[275] = t28;
1569
+ $[276] = t73;
1570
+ $[277] = t87;
1571
+ $[278] = t120;
1572
+ } else {
1573
+ t120 = $[278];
1574
+ }
1575
+ let t121;
1576
+ if ($[279] !== savingError || $[280] !== t) {
1577
+ t121 = savingError && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "text-red-500 dark:text-red-500", children: savingError.message ?? t("error_saving_role") });
1578
+ $[279] = savingError;
1579
+ $[280] = t;
1580
+ $[281] = t121;
1581
+ } else {
1582
+ t121 = $[281];
1583
+ }
1584
+ let t122;
1585
+ if ($[282] !== handleClose) {
1586
+ t122 = () => {
1587
+ handleClose();
1588
+ };
1589
+ $[282] = handleClose;
1590
+ $[283] = t122;
1591
+ } else {
1592
+ t122 = $[283];
1593
+ }
1594
+ let t123;
1595
+ if ($[284] !== t) {
1596
+ t123 = t("cancel");
1597
+ $[284] = t;
1598
+ $[285] = t123;
1599
+ } else {
1600
+ t123 = $[285];
1601
+ }
1602
+ let t124;
1603
+ if ($[286] !== t122 || $[287] !== t123) {
1604
+ t124 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: t122, children: t123 });
1605
+ $[286] = t122;
1606
+ $[287] = t123;
1607
+ $[288] = t124;
1608
+ } else {
1609
+ t124 = $[288];
1610
+ }
1611
+ const t125 = !dirty;
1612
+ let t126;
1613
+ if ($[289] !== isNewRole || $[290] !== t) {
1614
+ t126 = isNewRole ? t("create_role") : t("update");
1615
+ $[289] = isNewRole;
1616
+ $[290] = t;
1617
+ $[291] = t126;
1618
+ } else {
1619
+ t126 = $[291];
1620
+ }
1621
+ let t127;
1622
+ if ($[292] !== isSubmitting || $[293] !== t125 || $[294] !== t126) {
1623
+ t127 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t125, loading: isSubmitting, children: t126 });
1624
+ $[292] = isSubmitting;
1625
+ $[293] = t125;
1626
+ $[294] = t126;
1627
+ $[295] = t127;
1628
+ } else {
1629
+ t127 = $[295];
1630
+ }
1631
+ let t128;
1632
+ if ($[296] !== t121 || $[297] !== t124 || $[298] !== t127) {
1633
+ t128 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { position: "sticky", children: [
1634
+ t121,
1635
+ t124,
1636
+ t127
1637
+ ] });
1638
+ $[296] = t121;
1639
+ $[297] = t124;
1640
+ $[298] = t127;
1641
+ $[299] = t128;
1642
+ } else {
1643
+ t128 = $[299];
1644
+ }
1645
+ let t129;
1646
+ if ($[300] !== formex$1.handleSubmit || $[301] !== t11 || $[302] !== t120 || $[303] !== t128) {
1647
+ t129 = /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, autoComplete: "off", onSubmit: t8, style: t9, children: [
1648
+ t11,
1649
+ t120,
1650
+ t128
1651
+ ] });
1652
+ $[300] = formex$1.handleSubmit;
1653
+ $[301] = t11;
1654
+ $[302] = t120;
1655
+ $[303] = t128;
1656
+ $[304] = t129;
1657
+ } else {
1658
+ t129 = $[304];
1659
+ }
1660
+ let t130;
1661
+ if ($[305] !== formex$1 || $[306] !== t129) {
1662
+ t130 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t129 });
1663
+ $[305] = formex$1;
1664
+ $[306] = t129;
1665
+ $[307] = t130;
1666
+ } else {
1667
+ t130 = $[307];
1668
+ }
1669
+ let t131;
1670
+ if ($[308] !== open || $[309] !== t130) {
1671
+ t131 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, maxWidth: "4xl", children: t130 });
1672
+ $[308] = open;
1673
+ $[309] = t130;
1674
+ $[310] = t131;
1675
+ } else {
1676
+ t131 = $[310];
1677
+ }
1678
+ return t131;
1212
1679
  }
1213
1680
  function _temp2$1(e_1) {
1214
1681
  const errors = {};
@@ -1251,11 +1718,14 @@
1251
1718
  }
1252
1719
  }];
1253
1720
  function RolesTable(t0) {
1254
- const $ = reactCompilerRuntime.c(25);
1721
+ const $ = reactCompilerRuntime.c(54);
1255
1722
  const {
1256
1723
  onRoleClicked,
1257
1724
  editable
1258
1725
  } = t0;
1726
+ const {
1727
+ t
1728
+ } = core.useTranslation();
1259
1729
  const {
1260
1730
  roles,
1261
1731
  saveRole,
@@ -1266,19 +1736,77 @@
1266
1736
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
1267
1737
  let t1;
1268
1738
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1269
- t1 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
1270
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "w-16" }),
1271
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: "Role" }),
1272
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "items-center", children: "Is Admin" }),
1273
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: "Default permissions" })
1274
- ] });
1739
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "w-16" });
1275
1740
  $[0] = t1;
1276
1741
  } else {
1277
1742
  t1 = $[0];
1278
1743
  }
1279
1744
  let t2;
1280
- if ($[1] !== editable || $[2] !== onRoleClicked || $[3] !== roles) {
1281
- t2 = roles && roles.map((role) => {
1745
+ if ($[1] !== t) {
1746
+ t2 = t("role");
1747
+ $[1] = t;
1748
+ $[2] = t2;
1749
+ } else {
1750
+ t2 = $[2];
1751
+ }
1752
+ let t3;
1753
+ if ($[3] !== t2) {
1754
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: t2 });
1755
+ $[3] = t2;
1756
+ $[4] = t3;
1757
+ } else {
1758
+ t3 = $[4];
1759
+ }
1760
+ let t4;
1761
+ if ($[5] !== t) {
1762
+ t4 = t("is_admin");
1763
+ $[5] = t;
1764
+ $[6] = t4;
1765
+ } else {
1766
+ t4 = $[6];
1767
+ }
1768
+ let t5;
1769
+ if ($[7] !== t4) {
1770
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "items-center", children: t4 });
1771
+ $[7] = t4;
1772
+ $[8] = t5;
1773
+ } else {
1774
+ t5 = $[8];
1775
+ }
1776
+ let t6;
1777
+ if ($[9] !== t) {
1778
+ t6 = t("default_permissions");
1779
+ $[9] = t;
1780
+ $[10] = t6;
1781
+ } else {
1782
+ t6 = $[10];
1783
+ }
1784
+ let t7;
1785
+ if ($[11] !== t6) {
1786
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: t6 });
1787
+ $[11] = t6;
1788
+ $[12] = t7;
1789
+ } else {
1790
+ t7 = $[12];
1791
+ }
1792
+ let t8;
1793
+ if ($[13] !== t3 || $[14] !== t5 || $[15] !== t7) {
1794
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
1795
+ t1,
1796
+ t3,
1797
+ t5,
1798
+ t7
1799
+ ] });
1800
+ $[13] = t3;
1801
+ $[14] = t5;
1802
+ $[15] = t7;
1803
+ $[16] = t8;
1804
+ } else {
1805
+ t8 = $[16];
1806
+ }
1807
+ let t9;
1808
+ if ($[17] !== editable || $[18] !== onRoleClicked || $[19] !== roles || $[20] !== t) {
1809
+ t9 = roles && roles.map((role) => {
1282
1810
  const canCreateAll = role.isAdmin || role.defaultPermissions?.create;
1283
1811
  const canReadAll = role.isAdmin || role.defaultPermissions?.read;
1284
1812
  const canUpdateAll = role.isAdmin || role.defaultPermissions?.edit;
@@ -1288,63 +1816,74 @@
1288
1816
  }, children: [
1289
1817
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { style: {
1290
1818
  width: "64px"
1291
- }, children: !role.isAdmin && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Delete this role", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", disabled: !editable, onClick: (event) => {
1819
+ }, children: !role.isAdmin && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: t("delete_this_role"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", disabled: !editable, onClick: (event) => {
1292
1820
  event.stopPropagation();
1293
1821
  return setRoleToBeDeleted(role);
1294
1822
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}) }) }) }),
1295
1823
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role }) }),
1296
1824
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "items-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { checked: role.isAdmin ?? false }) }),
1297
1825
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { children: [
1298
- canCreateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Create" }),
1299
- canReadAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Read" }),
1300
- canUpdateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Update" }),
1301
- canDeleteAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Delete" })
1826
+ canCreateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: t("create") }),
1827
+ canReadAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: t("read") }),
1828
+ canUpdateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: t("update") }),
1829
+ canDeleteAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: t("delete") })
1302
1830
  ] }) })
1303
1831
  ] }, role.name);
1304
1832
  });
1305
- $[1] = editable;
1306
- $[2] = onRoleClicked;
1307
- $[3] = roles;
1308
- $[4] = t2;
1833
+ $[17] = editable;
1834
+ $[18] = onRoleClicked;
1835
+ $[19] = roles;
1836
+ $[20] = t;
1837
+ $[21] = t9;
1309
1838
  } else {
1310
- t2 = $[4];
1839
+ t9 = $[21];
1311
1840
  }
1312
- let t3;
1313
- if ($[5] !== allowDefaultRolesCreation || $[6] !== roles || $[7] !== saveRole) {
1314
- t3 = (!roles || roles.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1315
- /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You don't have any roles yet." }),
1841
+ let t10;
1842
+ if ($[22] !== allowDefaultRolesCreation || $[23] !== roles || $[24] !== saveRole || $[25] !== t) {
1843
+ t10 = (!roles || roles.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1844
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_roles_yet") }),
1316
1845
  allowDefaultRolesCreation && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
1317
1846
  DEFAULT_ROLES.forEach((role_0) => {
1318
1847
  saveRole(role_0);
1319
1848
  });
1320
- }, children: "Create default roles" })
1849
+ }, children: t("create_default_roles") })
1321
1850
  ] }) }) });
1322
- $[5] = allowDefaultRolesCreation;
1323
- $[6] = roles;
1324
- $[7] = saveRole;
1325
- $[8] = t3;
1851
+ $[22] = allowDefaultRolesCreation;
1852
+ $[23] = roles;
1853
+ $[24] = saveRole;
1854
+ $[25] = t;
1855
+ $[26] = t10;
1326
1856
  } else {
1327
- t3 = $[8];
1857
+ t10 = $[26];
1328
1858
  }
1329
- let t4;
1330
- if ($[9] !== t2 || $[10] !== t3) {
1331
- t4 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
1332
- t1,
1333
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1334
- t2,
1335
- t3
1336
- ] })
1859
+ let t11;
1860
+ if ($[27] !== t10 || $[28] !== t9) {
1861
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1862
+ t9,
1863
+ t10
1337
1864
  ] });
1338
- $[9] = t2;
1339
- $[10] = t3;
1340
- $[11] = t4;
1865
+ $[27] = t10;
1866
+ $[28] = t9;
1867
+ $[29] = t11;
1341
1868
  } else {
1342
- t4 = $[11];
1869
+ t11 = $[29];
1343
1870
  }
1344
- const t5 = Boolean(roleToBeDeleted);
1345
- let t6;
1346
- if ($[12] !== deleteRole || $[13] !== roleToBeDeleted) {
1347
- t6 = () => {
1871
+ let t12;
1872
+ if ($[30] !== t11 || $[31] !== t8) {
1873
+ t12 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
1874
+ t8,
1875
+ t11
1876
+ ] });
1877
+ $[30] = t11;
1878
+ $[31] = t8;
1879
+ $[32] = t12;
1880
+ } else {
1881
+ t12 = $[32];
1882
+ }
1883
+ const t13 = Boolean(roleToBeDeleted);
1884
+ let t14;
1885
+ if ($[33] !== deleteRole || $[34] !== roleToBeDeleted) {
1886
+ t14 = () => {
1348
1887
  if (roleToBeDeleted) {
1349
1888
  setDeleteInProgress(true);
1350
1889
  deleteRole(roleToBeDeleted).then(() => {
@@ -1354,58 +1893,87 @@
1354
1893
  });
1355
1894
  }
1356
1895
  };
1357
- $[12] = deleteRole;
1358
- $[13] = roleToBeDeleted;
1359
- $[14] = t6;
1896
+ $[33] = deleteRole;
1897
+ $[34] = roleToBeDeleted;
1898
+ $[35] = t14;
1360
1899
  } else {
1361
- t6 = $[14];
1900
+ t14 = $[35];
1362
1901
  }
1363
- let t7;
1364
- let t8;
1365
- let t9;
1366
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1367
- t7 = () => {
1902
+ let t15;
1903
+ if ($[36] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1904
+ t15 = () => {
1368
1905
  setRoleToBeDeleted(void 0);
1369
1906
  };
1370
- t8 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Delete?" });
1371
- t9 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Are you sure you want to delete this role?" });
1372
- $[15] = t7;
1373
- $[16] = t8;
1374
- $[17] = t9;
1907
+ $[36] = t15;
1375
1908
  } else {
1376
- t7 = $[15];
1377
- t8 = $[16];
1378
- t9 = $[17];
1909
+ t15 = $[36];
1379
1910
  }
1380
- let t10;
1381
- if ($[18] !== deleteInProgress || $[19] !== t5 || $[20] !== t6) {
1382
- t10 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1383
- $[18] = deleteInProgress;
1384
- $[19] = t5;
1385
- $[20] = t6;
1386
- $[21] = t10;
1911
+ let t16;
1912
+ if ($[37] !== t) {
1913
+ t16 = t("delete_confirmation_title");
1914
+ $[37] = t;
1915
+ $[38] = t16;
1387
1916
  } else {
1388
- t10 = $[21];
1917
+ t16 = $[38];
1389
1918
  }
1390
- let t11;
1391
- if ($[22] !== t10 || $[23] !== t4) {
1392
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full overflow-auto", children: [
1393
- t4,
1394
- t10
1919
+ let t17;
1920
+ if ($[39] !== t16) {
1921
+ t17 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t16 });
1922
+ $[39] = t16;
1923
+ $[40] = t17;
1924
+ } else {
1925
+ t17 = $[40];
1926
+ }
1927
+ let t18;
1928
+ if ($[41] !== t) {
1929
+ t18 = t("delete_role_confirmation");
1930
+ $[41] = t;
1931
+ $[42] = t18;
1932
+ } else {
1933
+ t18 = $[42];
1934
+ }
1935
+ let t19;
1936
+ if ($[43] !== t18) {
1937
+ t19 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t18 });
1938
+ $[43] = t18;
1939
+ $[44] = t19;
1940
+ } else {
1941
+ t19 = $[44];
1942
+ }
1943
+ let t20;
1944
+ if ($[45] !== deleteInProgress || $[46] !== t13 || $[47] !== t14 || $[48] !== t17 || $[49] !== t19) {
1945
+ t20 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t13, loading: deleteInProgress, onAccept: t14, onCancel: t15, title: t17, body: t19 });
1946
+ $[45] = deleteInProgress;
1947
+ $[46] = t13;
1948
+ $[47] = t14;
1949
+ $[48] = t17;
1950
+ $[49] = t19;
1951
+ $[50] = t20;
1952
+ } else {
1953
+ t20 = $[50];
1954
+ }
1955
+ let t21;
1956
+ if ($[51] !== t12 || $[52] !== t20) {
1957
+ t21 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full overflow-auto", children: [
1958
+ t12,
1959
+ t20
1395
1960
  ] });
1396
- $[22] = t10;
1397
- $[23] = t4;
1398
- $[24] = t11;
1961
+ $[51] = t12;
1962
+ $[52] = t20;
1963
+ $[53] = t21;
1399
1964
  } else {
1400
- t11 = $[24];
1965
+ t21 = $[53];
1401
1966
  }
1402
- return t11;
1967
+ return t21;
1403
1968
  }
1404
1969
  const RolesView = React.memo(function RolesView2(t0) {
1405
- const $ = reactCompilerRuntime.c(13);
1970
+ const $ = reactCompilerRuntime.c(25);
1406
1971
  const {
1407
1972
  children
1408
1973
  } = t0;
1974
+ const {
1975
+ t
1976
+ } = core.useTranslation();
1409
1977
  const {
1410
1978
  collections
1411
1979
  } = core.useNavigationController();
@@ -1434,79 +2002,124 @@
1434
2002
  }
1435
2003
  const handleClose = t2;
1436
2004
  let t3;
1437
- if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1438
- t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Roles" });
1439
- $[2] = t3;
2005
+ if ($[2] !== t) {
2006
+ t3 = t("roles");
2007
+ $[2] = t;
2008
+ $[3] = t3;
1440
2009
  } else {
1441
- t3 = $[2];
2010
+ t3 = $[3];
1442
2011
  }
1443
2012
  let t4;
2013
+ if ($[4] !== t3) {
2014
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t3 });
2015
+ $[4] = t3;
2016
+ $[5] = t4;
2017
+ } else {
2018
+ t4 = $[5];
2019
+ }
1444
2020
  let t5;
1445
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1446
- t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1447
- t3,
1448
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
1449
- ] });
1450
- t5 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
1451
- $[3] = t4;
1452
- $[4] = t5;
2021
+ let t6;
2022
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2023
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2024
+ t6 = () => setDialogOpen(true);
2025
+ $[6] = t5;
2026
+ $[7] = t6;
1453
2027
  } else {
1454
- t4 = $[3];
1455
- t5 = $[4];
2028
+ t5 = $[6];
2029
+ t6 = $[7];
1456
2030
  }
1457
- const t6 = selectedRole?.id ?? "new";
1458
2031
  let t7;
1459
- if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
1460
- t7 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
1461
- $[5] = collections;
1462
- $[6] = dialogOpen;
1463
- $[7] = selectedRole;
1464
- $[8] = t6;
2032
+ if ($[8] !== t) {
2033
+ t7 = t("add_role");
2034
+ $[8] = t;
1465
2035
  $[9] = t7;
1466
2036
  } else {
1467
2037
  t7 = $[9];
1468
2038
  }
1469
2039
  let t8;
1470
- if ($[10] !== children || $[11] !== t7) {
1471
- t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1472
- children,
2040
+ if ($[10] !== t7) {
2041
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: t5, onClick: t6, children: t7 });
2042
+ $[10] = t7;
2043
+ $[11] = t8;
2044
+ } else {
2045
+ t8 = $[11];
2046
+ }
2047
+ let t9;
2048
+ if ($[12] !== t4 || $[13] !== t8) {
2049
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1473
2050
  t4,
1474
- t5,
1475
- t7
2051
+ t8
2052
+ ] });
2053
+ $[12] = t4;
2054
+ $[13] = t8;
2055
+ $[14] = t9;
2056
+ } else {
2057
+ t9 = $[14];
2058
+ }
2059
+ let t10;
2060
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2061
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
2062
+ $[15] = t10;
2063
+ } else {
2064
+ t10 = $[15];
2065
+ }
2066
+ const t11 = selectedRole?.id ?? "new";
2067
+ let t12;
2068
+ if ($[16] !== collections || $[17] !== dialogOpen || $[18] !== selectedRole || $[19] !== t11) {
2069
+ t12 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t11);
2070
+ $[16] = collections;
2071
+ $[17] = dialogOpen;
2072
+ $[18] = selectedRole;
2073
+ $[19] = t11;
2074
+ $[20] = t12;
2075
+ } else {
2076
+ t12 = $[20];
2077
+ }
2078
+ let t13;
2079
+ if ($[21] !== children || $[22] !== t12 || $[23] !== t9) {
2080
+ t13 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2081
+ children,
2082
+ t9,
2083
+ t10,
2084
+ t12
1476
2085
  ] });
1477
- $[10] = children;
1478
- $[11] = t7;
1479
- $[12] = t8;
2086
+ $[21] = children;
2087
+ $[22] = t12;
2088
+ $[23] = t9;
2089
+ $[24] = t13;
1480
2090
  } else {
1481
- t8 = $[12];
2091
+ t13 = $[24];
1482
2092
  }
1483
- return t8;
2093
+ return t13;
1484
2094
  });
1485
- const UserYupSchema = Yup__namespace.object().shape({
1486
- displayName: Yup__namespace.string().required("Required"),
1487
- email: Yup__namespace.string().email().required("Required"),
2095
+ const getUserYupSchema = (t) => Yup__namespace.object().shape({
2096
+ displayName: Yup__namespace.string().required(t("required")),
2097
+ email: Yup__namespace.string().email().required(t("required")),
1488
2098
  roles: Yup__namespace.array().min(1)
1489
2099
  });
1490
- function canUserBeEdited(loggedUser, user, users, roles, prevUser) {
2100
+ function canUserBeEdited(loggedUser, user, users, roles, t, prevUser) {
1491
2101
  const admins = users.filter((u) => u.roles?.map((r) => r.id).includes("admin"));
1492
2102
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
1493
2103
  const didRolesChange = !prevUser || !areRolesEqual(prevUser.roles ?? [], user.roles ?? []);
1494
2104
  if (didRolesChange && !loggedUserIsAdmin) {
1495
- throw new Error("Only admins can change roles");
2105
+ throw new Error(t("only_admins_change_roles"));
1496
2106
  }
1497
2107
  const adminRoleRemoved = prevUser && prevUser.roles?.map((r) => r.id).includes("admin") && !user.roles?.map((r) => r.id).includes("admin");
1498
2108
  if (adminRoleRemoved && admins.length === 1) {
1499
- throw new Error("There must be at least one admin");
2109
+ throw new Error(t("must_be_at_least_one_admin"));
1500
2110
  }
1501
2111
  return true;
1502
2112
  }
1503
2113
  function UserDetailsForm(t0) {
1504
- const $ = reactCompilerRuntime.c(73);
2114
+ const $ = reactCompilerRuntime.c(112);
1505
2115
  const {
1506
2116
  open,
1507
2117
  user: userProp,
1508
2118
  handleClose
1509
2119
  } = t0;
2120
+ const {
2121
+ t
2122
+ } = core.useTranslation();
1510
2123
  const snackbarController = core.useSnackbarController();
1511
2124
  const {
1512
2125
  user: loggedInUser
@@ -1518,13 +2131,13 @@
1518
2131
  } = useUserManagement();
1519
2132
  const isNewUser = !userProp;
1520
2133
  let t1;
1521
- if ($[0] !== loggedInUser || $[1] !== roles || $[2] !== saveUser || $[3] !== userProp || $[4] !== users) {
2134
+ if ($[0] !== loggedInUser || $[1] !== roles || $[2] !== saveUser || $[3] !== t || $[4] !== userProp || $[5] !== users) {
1522
2135
  t1 = (savedUser) => {
1523
2136
  if (!loggedInUser) {
1524
- throw new Error("Logged user not found");
2137
+ throw new Error(t("logged_user_not_found"));
1525
2138
  }
1526
2139
  try {
1527
- canUserBeEdited(loggedInUser, savedUser, users, roles, userProp);
2140
+ canUserBeEdited(loggedInUser, savedUser, users, roles, t, userProp);
1528
2141
  return saveUser(savedUser);
1529
2142
  } catch (t210) {
1530
2143
  const e = t210;
@@ -1534,29 +2147,40 @@
1534
2147
  $[0] = loggedInUser;
1535
2148
  $[1] = roles;
1536
2149
  $[2] = saveUser;
1537
- $[3] = userProp;
1538
- $[4] = users;
1539
- $[5] = t1;
2150
+ $[3] = t;
2151
+ $[4] = userProp;
2152
+ $[5] = users;
2153
+ $[6] = t1;
1540
2154
  } else {
1541
- t1 = $[5];
2155
+ t1 = $[6];
1542
2156
  }
1543
2157
  const onUserUpdated = t1;
1544
2158
  let t2;
1545
- if ($[6] !== roles || $[7] !== userProp) {
2159
+ if ($[7] !== roles || $[8] !== userProp) {
1546
2160
  t2 = userProp ?? {
1547
2161
  displayName: "",
1548
2162
  email: "",
1549
2163
  roles: roles.filter(_temp$2)
1550
2164
  };
1551
- $[6] = roles;
1552
- $[7] = userProp;
1553
- $[8] = t2;
2165
+ $[7] = roles;
2166
+ $[8] = userProp;
2167
+ $[9] = t2;
1554
2168
  } else {
1555
- t2 = $[8];
2169
+ t2 = $[9];
1556
2170
  }
1557
2171
  let t3;
1558
- if ($[9] !== handleClose || $[10] !== onUserUpdated || $[11] !== snackbarController) {
1559
- t3 = (user, formexController) => onUserUpdated(user).then(() => {
2172
+ if ($[10] !== t) {
2173
+ t3 = (values) => getUserYupSchema(t).validate(values, {
2174
+ abortEarly: false
2175
+ }).then(_temp2).catch(_temp4);
2176
+ $[10] = t;
2177
+ $[11] = t3;
2178
+ } else {
2179
+ t3 = $[11];
2180
+ }
2181
+ let t4;
2182
+ if ($[12] !== handleClose || $[13] !== onUserUpdated || $[14] !== snackbarController) {
2183
+ t4 = (user, formexController) => onUserUpdated(user).then(() => {
1560
2184
  handleClose();
1561
2185
  formexController.resetForm({
1562
2186
  values: user
@@ -1567,27 +2191,28 @@
1567
2191
  message: e_1.message
1568
2192
  });
1569
2193
  });
1570
- $[9] = handleClose;
1571
- $[10] = onUserUpdated;
1572
- $[11] = snackbarController;
1573
- $[12] = t3;
2194
+ $[12] = handleClose;
2195
+ $[13] = onUserUpdated;
2196
+ $[14] = snackbarController;
2197
+ $[15] = t4;
1574
2198
  } else {
1575
- t3 = $[12];
2199
+ t4 = $[15];
1576
2200
  }
1577
- let t4;
1578
- if ($[13] !== t2 || $[14] !== t3) {
1579
- t4 = {
2201
+ let t5;
2202
+ if ($[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
2203
+ t5 = {
1580
2204
  initialValues: t2,
1581
- validation: _temp5,
1582
- onSubmit: t3
2205
+ validation: t3,
2206
+ onSubmit: t4
1583
2207
  };
1584
- $[13] = t2;
1585
- $[14] = t3;
1586
- $[15] = t4;
2208
+ $[16] = t2;
2209
+ $[17] = t3;
2210
+ $[18] = t4;
2211
+ $[19] = t5;
1587
2212
  } else {
1588
- t4 = $[15];
2213
+ t5 = $[19];
1589
2214
  }
1590
- const formex$1 = formex.useCreateFormex(t4);
2215
+ const formex$1 = formex.useCreateFormex(t5);
1591
2216
  const {
1592
2217
  isSubmitting,
1593
2218
  handleChange,
@@ -1598,225 +2223,326 @@
1598
2223
  handleSubmit,
1599
2224
  submitCount
1600
2225
  } = formex$1;
1601
- let t5;
1602
- if ($[16] !== handleClose) {
1603
- t5 = (open_0) => !open_0 ? handleClose() : void 0;
1604
- $[16] = handleClose;
1605
- $[17] = t5;
2226
+ let t6;
2227
+ if ($[20] !== handleClose) {
2228
+ t6 = (open_0) => !open_0 ? handleClose() : void 0;
2229
+ $[20] = handleClose;
2230
+ $[21] = t6;
1606
2231
  } else {
1607
- t5 = $[17];
2232
+ t6 = $[21];
1608
2233
  }
1609
- let t6;
1610
2234
  let t7;
1611
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1612
- t6 = {
2235
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2236
+ t7 = {
1613
2237
  display: "flex",
1614
2238
  flexDirection: "column",
1615
2239
  position: "relative",
1616
2240
  height: "100%"
1617
2241
  };
1618
- t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: "User" });
1619
- $[18] = t6;
1620
- $[19] = t7;
2242
+ $[22] = t7;
1621
2243
  } else {
1622
- t6 = $[18];
1623
- t7 = $[19];
2244
+ t7 = $[22];
1624
2245
  }
1625
- const t8 = submitCount > 0 && Boolean(errors.displayName);
1626
- const t9 = values_0.displayName ?? "";
1627
- let t10;
1628
- if ($[20] !== handleChange || $[21] !== t8 || $[22] !== t9) {
1629
- t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "displayName", required: true, error: t8, value: t9, onChange: handleChange, "aria-describedby": "name-helper-text", label: "Name" });
1630
- $[20] = handleChange;
1631
- $[21] = t8;
1632
- $[22] = t9;
1633
- $[23] = t10;
2246
+ let t8;
2247
+ if ($[23] !== t) {
2248
+ t8 = t("user");
2249
+ $[23] = t;
2250
+ $[24] = t8;
1634
2251
  } else {
1635
- t10 = $[23];
2252
+ t8 = $[24];
1636
2253
  }
1637
- const t11 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : "Name of this user";
1638
- let t12;
1639
- if ($[24] !== t11) {
1640
- t12 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t11 });
1641
- $[24] = t11;
1642
- $[25] = t12;
2254
+ let t9;
2255
+ if ($[25] !== t8) {
2256
+ t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: t8 });
2257
+ $[25] = t8;
2258
+ $[26] = t9;
1643
2259
  } else {
1644
- t12 = $[25];
2260
+ t9 = $[26];
1645
2261
  }
1646
- let t13;
1647
- if ($[26] !== t10 || $[27] !== t12) {
1648
- t13 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1649
- t10,
1650
- t12
1651
- ] });
1652
- $[26] = t10;
1653
- $[27] = t12;
1654
- $[28] = t13;
2262
+ let t10;
2263
+ if ($[27] !== isNewUser || $[28] !== snackbarController || $[29] !== t || $[30] !== userProp) {
2264
+ t10 = !isNewUser && userProp?.uid && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2265
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-surface-accent-600 dark:text-surface-accent-400", children: t("user_id") }),
2266
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", children: userProp.uid }),
2267
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("copy"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: () => {
2268
+ navigator.clipboard.writeText(userProp.uid);
2269
+ snackbarController.open({
2270
+ type: "success",
2271
+ message: t("copied")
2272
+ });
2273
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CopyIcon, { size: "small" }) }) })
2274
+ ] }) });
2275
+ $[27] = isNewUser;
2276
+ $[28] = snackbarController;
2277
+ $[29] = t;
2278
+ $[30] = userProp;
2279
+ $[31] = t10;
1655
2280
  } else {
1656
- t13 = $[28];
2281
+ t10 = $[31];
1657
2282
  }
1658
- const t14 = submitCount > 0 && Boolean(errors.email);
1659
- const t15 = values_0.email ?? "";
1660
- let t16;
1661
- if ($[29] !== handleChange || $[30] !== t14 || $[31] !== t15) {
1662
- t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { required: true, error: t14, name: "email", value: t15, onChange: handleChange, "aria-describedby": "email-helper-text", label: "Email" });
1663
- $[29] = handleChange;
1664
- $[30] = t14;
1665
- $[31] = t15;
1666
- $[32] = t16;
2283
+ const t11 = submitCount > 0 && Boolean(errors.displayName);
2284
+ const t12 = values_0.displayName ?? "";
2285
+ let t13;
2286
+ if ($[32] !== t) {
2287
+ t13 = t("name");
2288
+ $[32] = t;
2289
+ $[33] = t13;
1667
2290
  } else {
1668
- t16 = $[32];
2291
+ t13 = $[33];
1669
2292
  }
1670
- const t17 = submitCount > 0 && Boolean(errors.email) ? errors.email : "Email of this user";
1671
- let t18;
1672
- if ($[33] !== t17) {
1673
- t18 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t17 });
1674
- $[33] = t17;
1675
- $[34] = t18;
2293
+ let t14;
2294
+ if ($[34] !== handleChange || $[35] !== t11 || $[36] !== t12 || $[37] !== t13) {
2295
+ t14 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "displayName", required: true, error: t11, value: t12, onChange: handleChange, "aria-describedby": "name-helper-text", label: t13 });
2296
+ $[34] = handleChange;
2297
+ $[35] = t11;
2298
+ $[36] = t12;
2299
+ $[37] = t13;
2300
+ $[38] = t14;
2301
+ } else {
2302
+ t14 = $[38];
2303
+ }
2304
+ let t15;
2305
+ if ($[39] !== errors || $[40] !== submitCount || $[41] !== t) {
2306
+ t15 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : t("name_of_this_user");
2307
+ $[39] = errors;
2308
+ $[40] = submitCount;
2309
+ $[41] = t;
2310
+ $[42] = t15;
2311
+ } else {
2312
+ t15 = $[42];
2313
+ }
2314
+ let t16;
2315
+ if ($[43] !== t15) {
2316
+ t16 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t15 });
2317
+ $[43] = t15;
2318
+ $[44] = t16;
1676
2319
  } else {
1677
- t18 = $[34];
2320
+ t16 = $[44];
1678
2321
  }
1679
- let t19;
1680
- if ($[35] !== t16 || $[36] !== t18) {
1681
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1682
- t16,
1683
- t18
2322
+ let t17;
2323
+ if ($[45] !== t14 || $[46] !== t16) {
2324
+ t17 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
2325
+ t14,
2326
+ t16
1684
2327
  ] });
1685
- $[35] = t16;
1686
- $[36] = t18;
1687
- $[37] = t19;
2328
+ $[45] = t14;
2329
+ $[46] = t16;
2330
+ $[47] = t17;
1688
2331
  } else {
1689
- t19 = $[37];
2332
+ t17 = $[47];
1690
2333
  }
2334
+ const t18 = submitCount > 0 && Boolean(errors.email);
2335
+ const t19 = values_0.email ?? "";
1691
2336
  let t20;
1692
- if ($[38] !== values_0.roles) {
1693
- t20 = values_0.roles?.map(_temp6) ?? [];
1694
- $[38] = values_0.roles;
1695
- $[39] = t20;
2337
+ if ($[48] !== t) {
2338
+ t20 = t("email");
2339
+ $[48] = t;
2340
+ $[49] = t20;
1696
2341
  } else {
1697
- t20 = $[39];
2342
+ t20 = $[49];
1698
2343
  }
1699
2344
  let t21;
1700
- if ($[40] !== roles || $[41] !== setFieldValue) {
1701
- t21 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
1702
- $[40] = roles;
1703
- $[41] = setFieldValue;
1704
- $[42] = t21;
2345
+ if ($[50] !== handleChange || $[51] !== t18 || $[52] !== t19 || $[53] !== t20) {
2346
+ t21 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { required: true, error: t18, name: "email", value: t19, onChange: handleChange, "aria-describedby": "email-helper-text", label: t20 });
2347
+ $[50] = handleChange;
2348
+ $[51] = t18;
2349
+ $[52] = t19;
2350
+ $[53] = t20;
2351
+ $[54] = t21;
1705
2352
  } else {
1706
- t21 = $[42];
2353
+ t21 = $[54];
1707
2354
  }
1708
2355
  let t22;
1709
- if ($[43] !== roles) {
1710
- t22 = roles.map(_temp7);
1711
- $[43] = roles;
1712
- $[44] = t22;
2356
+ if ($[55] !== errors || $[56] !== submitCount || $[57] !== t) {
2357
+ t22 = submitCount > 0 && Boolean(errors.email) ? errors.email : t("email_of_this_user");
2358
+ $[55] = errors;
2359
+ $[56] = submitCount;
2360
+ $[57] = t;
2361
+ $[58] = t22;
1713
2362
  } else {
1714
- t22 = $[44];
2363
+ t22 = $[58];
1715
2364
  }
1716
2365
  let t23;
1717
- if ($[45] !== t20 || $[46] !== t21 || $[47] !== t22) {
1718
- t23 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { className: "w-full", label: "Roles", value: t20, onValueChange: t21, children: t22 }) });
1719
- $[45] = t20;
1720
- $[46] = t21;
1721
- $[47] = t22;
1722
- $[48] = t23;
2366
+ if ($[59] !== t22) {
2367
+ t23 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t22 });
2368
+ $[59] = t22;
2369
+ $[60] = t23;
1723
2370
  } else {
1724
- t23 = $[48];
2371
+ t23 = $[60];
1725
2372
  }
1726
2373
  let t24;
1727
- if ($[49] !== t13 || $[50] !== t19 || $[51] !== t23) {
1728
- t24 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1729
- t13,
1730
- t19,
2374
+ if ($[61] !== t21 || $[62] !== t23) {
2375
+ t24 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
2376
+ t21,
1731
2377
  t23
1732
- ] }) });
1733
- $[49] = t13;
1734
- $[50] = t19;
1735
- $[51] = t23;
1736
- $[52] = t24;
2378
+ ] });
2379
+ $[61] = t21;
2380
+ $[62] = t23;
2381
+ $[63] = t24;
1737
2382
  } else {
1738
- t24 = $[52];
2383
+ t24 = $[63];
1739
2384
  }
1740
2385
  let t25;
1741
- if ($[53] !== handleClose) {
1742
- t25 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: () => {
1743
- handleClose();
1744
- }, children: "Cancel" });
1745
- $[53] = handleClose;
1746
- $[54] = t25;
2386
+ if ($[64] !== t) {
2387
+ t25 = t("roles");
2388
+ $[64] = t;
2389
+ $[65] = t25;
1747
2390
  } else {
1748
- t25 = $[54];
2391
+ t25 = $[65];
2392
+ }
2393
+ let t26;
2394
+ if ($[66] !== values_0.roles) {
2395
+ t26 = values_0.roles?.map(_temp5) ?? [];
2396
+ $[66] = values_0.roles;
2397
+ $[67] = t26;
2398
+ } else {
2399
+ t26 = $[67];
2400
+ }
2401
+ let t27;
2402
+ if ($[68] !== roles || $[69] !== setFieldValue) {
2403
+ t27 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
2404
+ $[68] = roles;
2405
+ $[69] = setFieldValue;
2406
+ $[70] = t27;
2407
+ } else {
2408
+ t27 = $[70];
1749
2409
  }
1750
- const t26 = !dirty;
1751
- const t27 = isNewUser ? "Create user" : "Update";
1752
2410
  let t28;
1753
- if ($[55] !== isSubmitting || $[56] !== t26 || $[57] !== t27) {
1754
- t28 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t26, loading: isSubmitting, children: t27 });
1755
- $[55] = isSubmitting;
1756
- $[56] = t26;
1757
- $[57] = t27;
1758
- $[58] = t28;
2411
+ if ($[71] !== roles) {
2412
+ t28 = roles.map(_temp6);
2413
+ $[71] = roles;
2414
+ $[72] = t28;
1759
2415
  } else {
1760
- t28 = $[58];
2416
+ t28 = $[72];
1761
2417
  }
1762
2418
  let t29;
1763
- if ($[59] !== t25 || $[60] !== t28) {
1764
- t29 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { children: [
1765
- t25,
1766
- t28
1767
- ] });
1768
- $[59] = t25;
1769
- $[60] = t28;
1770
- $[61] = t29;
2419
+ if ($[73] !== t25 || $[74] !== t26 || $[75] !== t27 || $[76] !== t28) {
2420
+ t29 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { className: "w-full", label: t25, value: t26, onValueChange: t27, children: t28 }) });
2421
+ $[73] = t25;
2422
+ $[74] = t26;
2423
+ $[75] = t27;
2424
+ $[76] = t28;
2425
+ $[77] = t29;
1771
2426
  } else {
1772
- t29 = $[61];
2427
+ t29 = $[77];
1773
2428
  }
1774
2429
  let t30;
1775
- if ($[62] !== handleSubmit || $[63] !== t24 || $[64] !== t29) {
1776
- t30 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t6, children: [
1777
- t7,
2430
+ if ($[78] !== t10 || $[79] !== t17 || $[80] !== t24 || $[81] !== t29) {
2431
+ t30 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
2432
+ t10,
2433
+ t17,
1778
2434
  t24,
1779
2435
  t29
1780
- ] });
1781
- $[62] = handleSubmit;
1782
- $[63] = t24;
1783
- $[64] = t29;
1784
- $[65] = t30;
2436
+ ] }) });
2437
+ $[78] = t10;
2438
+ $[79] = t17;
2439
+ $[80] = t24;
2440
+ $[81] = t29;
2441
+ $[82] = t30;
1785
2442
  } else {
1786
- t30 = $[65];
2443
+ t30 = $[82];
1787
2444
  }
1788
2445
  let t31;
1789
- if ($[66] !== formex$1 || $[67] !== t30) {
1790
- t31 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t30 });
1791
- $[66] = formex$1;
1792
- $[67] = t30;
1793
- $[68] = t31;
2446
+ if ($[83] !== handleClose) {
2447
+ t31 = () => {
2448
+ handleClose();
2449
+ };
2450
+ $[83] = handleClose;
2451
+ $[84] = t31;
1794
2452
  } else {
1795
- t31 = $[68];
2453
+ t31 = $[84];
1796
2454
  }
1797
2455
  let t32;
1798
- if ($[69] !== open || $[70] !== t31 || $[71] !== t5) {
1799
- t32 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: t5, maxWidth: "4xl", children: t31 });
1800
- $[69] = open;
1801
- $[70] = t31;
1802
- $[71] = t5;
1803
- $[72] = t32;
2456
+ if ($[85] !== t) {
2457
+ t32 = t("cancel");
2458
+ $[85] = t;
2459
+ $[86] = t32;
2460
+ } else {
2461
+ t32 = $[86];
2462
+ }
2463
+ let t33;
2464
+ if ($[87] !== t31 || $[88] !== t32) {
2465
+ t33 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: t31, children: t32 });
2466
+ $[87] = t31;
2467
+ $[88] = t32;
2468
+ $[89] = t33;
2469
+ } else {
2470
+ t33 = $[89];
2471
+ }
2472
+ const t34 = !dirty;
2473
+ let t35;
2474
+ if ($[90] !== isNewUser || $[91] !== t) {
2475
+ t35 = isNewUser ? t("create_user") : t("update");
2476
+ $[90] = isNewUser;
2477
+ $[91] = t;
2478
+ $[92] = t35;
2479
+ } else {
2480
+ t35 = $[92];
2481
+ }
2482
+ let t36;
2483
+ if ($[93] !== isSubmitting || $[94] !== t34 || $[95] !== t35) {
2484
+ t36 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t34, loading: isSubmitting, children: t35 });
2485
+ $[93] = isSubmitting;
2486
+ $[94] = t34;
2487
+ $[95] = t35;
2488
+ $[96] = t36;
2489
+ } else {
2490
+ t36 = $[96];
2491
+ }
2492
+ let t37;
2493
+ if ($[97] !== t33 || $[98] !== t36) {
2494
+ t37 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { children: [
2495
+ t33,
2496
+ t36
2497
+ ] });
2498
+ $[97] = t33;
2499
+ $[98] = t36;
2500
+ $[99] = t37;
2501
+ } else {
2502
+ t37 = $[99];
2503
+ }
2504
+ let t38;
2505
+ if ($[100] !== handleSubmit || $[101] !== t30 || $[102] !== t37 || $[103] !== t9) {
2506
+ t38 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t7, children: [
2507
+ t9,
2508
+ t30,
2509
+ t37
2510
+ ] });
2511
+ $[100] = handleSubmit;
2512
+ $[101] = t30;
2513
+ $[102] = t37;
2514
+ $[103] = t9;
2515
+ $[104] = t38;
2516
+ } else {
2517
+ t38 = $[104];
2518
+ }
2519
+ let t39;
2520
+ if ($[105] !== formex$1 || $[106] !== t38) {
2521
+ t39 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t38 });
2522
+ $[105] = formex$1;
2523
+ $[106] = t38;
2524
+ $[107] = t39;
1804
2525
  } else {
1805
- t32 = $[72];
2526
+ t39 = $[107];
1806
2527
  }
1807
- return t32;
2528
+ let t40;
2529
+ if ($[108] !== open || $[109] !== t39 || $[110] !== t6) {
2530
+ t40 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: t6, maxWidth: "4xl", children: t39 });
2531
+ $[108] = open;
2532
+ $[109] = t39;
2533
+ $[110] = t6;
2534
+ $[111] = t40;
2535
+ } else {
2536
+ t40 = $[111];
2537
+ }
2538
+ return t40;
1808
2539
  }
1809
- function _temp7(userRole) {
2540
+ function _temp6(userRole) {
1810
2541
  return /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelectItem, { value: userRole.id, children: /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id) }, userRole.id);
1811
2542
  }
1812
- function _temp6(r_0) {
2543
+ function _temp5(r_0) {
1813
2544
  return r_0.id;
1814
2545
  }
1815
- function _temp5(values) {
1816
- return UserYupSchema.validate(values, {
1817
- abortEarly: false
1818
- }).then(_temp2).catch(_temp4);
1819
- }
1820
2546
  function _temp4(e_0) {
1821
2547
  return e_0.inner.reduce(_temp3, {});
1822
2548
  }
@@ -1831,10 +2557,13 @@
1831
2557
  return r.id === "editor";
1832
2558
  }
1833
2559
  function UsersTable(t0) {
1834
- const $ = reactCompilerRuntime.c(28);
2560
+ const $ = reactCompilerRuntime.c(63);
1835
2561
  const {
1836
2562
  onUserClicked
1837
2563
  } = t0;
2564
+ const {
2565
+ t
2566
+ } = core.useTranslation();
1838
2567
  const {
1839
2568
  users,
1840
2569
  saveUser,
@@ -1849,21 +2578,103 @@
1849
2578
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
1850
2579
  let t1;
1851
2580
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1852
- t1 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
1853
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" }),
1854
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Email" }),
1855
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Name" }),
1856
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Roles" }),
1857
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Created on" }),
1858
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" })
1859
- ] });
2581
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" });
1860
2582
  $[0] = t1;
1861
2583
  } else {
1862
2584
  t1 = $[0];
1863
2585
  }
1864
2586
  let t2;
1865
- if ($[1] !== dateFormat || $[2] !== dateUtilsLocale || $[3] !== onUserClicked || $[4] !== users) {
1866
- t2 = users && users.map((user) => {
2587
+ if ($[1] !== t) {
2588
+ t2 = t("email");
2589
+ $[1] = t;
2590
+ $[2] = t2;
2591
+ } else {
2592
+ t2 = $[2];
2593
+ }
2594
+ let t3;
2595
+ if ($[3] !== t2) {
2596
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t2 });
2597
+ $[3] = t2;
2598
+ $[4] = t3;
2599
+ } else {
2600
+ t3 = $[4];
2601
+ }
2602
+ let t4;
2603
+ if ($[5] !== t) {
2604
+ t4 = t("name");
2605
+ $[5] = t;
2606
+ $[6] = t4;
2607
+ } else {
2608
+ t4 = $[6];
2609
+ }
2610
+ let t5;
2611
+ if ($[7] !== t4) {
2612
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t4 });
2613
+ $[7] = t4;
2614
+ $[8] = t5;
2615
+ } else {
2616
+ t5 = $[8];
2617
+ }
2618
+ let t6;
2619
+ if ($[9] !== t) {
2620
+ t6 = t("roles");
2621
+ $[9] = t;
2622
+ $[10] = t6;
2623
+ } else {
2624
+ t6 = $[10];
2625
+ }
2626
+ let t7;
2627
+ if ($[11] !== t6) {
2628
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t6 });
2629
+ $[11] = t6;
2630
+ $[12] = t7;
2631
+ } else {
2632
+ t7 = $[12];
2633
+ }
2634
+ let t8;
2635
+ if ($[13] !== t) {
2636
+ t8 = t("created_on");
2637
+ $[13] = t;
2638
+ $[14] = t8;
2639
+ } else {
2640
+ t8 = $[14];
2641
+ }
2642
+ let t9;
2643
+ if ($[15] !== t8) {
2644
+ t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t8 });
2645
+ $[15] = t8;
2646
+ $[16] = t9;
2647
+ } else {
2648
+ t9 = $[16];
2649
+ }
2650
+ let t10;
2651
+ if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2652
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" });
2653
+ $[17] = t10;
2654
+ } else {
2655
+ t10 = $[17];
2656
+ }
2657
+ let t11;
2658
+ if ($[18] !== t3 || $[19] !== t5 || $[20] !== t7 || $[21] !== t9) {
2659
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
2660
+ t1,
2661
+ t3,
2662
+ t5,
2663
+ t7,
2664
+ t9,
2665
+ t10
2666
+ ] });
2667
+ $[18] = t3;
2668
+ $[19] = t5;
2669
+ $[20] = t7;
2670
+ $[21] = t9;
2671
+ $[22] = t11;
2672
+ } else {
2673
+ t11 = $[22];
2674
+ }
2675
+ let t12;
2676
+ if ($[23] !== dateFormat || $[24] !== dateUtilsLocale || $[25] !== onUserClicked || $[26] !== t || $[27] !== users) {
2677
+ t12 = users && users.map((user) => {
1867
2678
  const userRoles = user.roles;
1868
2679
  const formattedDate = user.created_on ? dateFns.format(user.created_on, dateFormat, {
1869
2680
  locale: dateUtilsLocale
@@ -1876,24 +2687,25 @@
1876
2687
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "font-medium align-left", children: user.displayName }),
1877
2688
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
1878
2689
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate }),
1879
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "smallest", onClick: (event) => {
2690
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: t("delete_this_user"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "smallest", onClick: (event) => {
1880
2691
  event.stopPropagation();
1881
2692
  return setUserToBeDeleted(user);
1882
2693
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) }) }) })
1883
2694
  ] }, "row_" + user.uid);
1884
2695
  });
1885
- $[1] = dateFormat;
1886
- $[2] = dateUtilsLocale;
1887
- $[3] = onUserClicked;
1888
- $[4] = users;
1889
- $[5] = t2;
2696
+ $[23] = dateFormat;
2697
+ $[24] = dateUtilsLocale;
2698
+ $[25] = onUserClicked;
2699
+ $[26] = t;
2700
+ $[27] = users;
2701
+ $[28] = t12;
1890
2702
  } else {
1891
- t2 = $[5];
2703
+ t12 = $[28];
1892
2704
  }
1893
- let t3;
1894
- if ($[6] !== authController || $[7] !== saveUser || $[8] !== snackbarController || $[9] !== users) {
1895
- t3 = (!users || users.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1896
- /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "There are no users yet" }),
2705
+ let t13;
2706
+ if ($[29] !== authController || $[30] !== saveUser || $[31] !== snackbarController || $[32] !== t || $[33] !== users) {
2707
+ t13 = (!users || users.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
2708
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_users_yet") }),
1897
2709
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
1898
2710
  if (!authController.user?.uid) {
1899
2711
  throw Error("UsersTable, authController misconfiguration");
@@ -1921,35 +2733,45 @@
1921
2733
  message: "Error adding user: " + error.message
1922
2734
  });
1923
2735
  });
1924
- }, children: "Add the logged user as an admin" })
2736
+ }, children: t("add_logged_user_as_admin") })
1925
2737
  ] }) }) });
1926
- $[6] = authController;
1927
- $[7] = saveUser;
1928
- $[8] = snackbarController;
1929
- $[9] = users;
1930
- $[10] = t3;
2738
+ $[29] = authController;
2739
+ $[30] = saveUser;
2740
+ $[31] = snackbarController;
2741
+ $[32] = t;
2742
+ $[33] = users;
2743
+ $[34] = t13;
1931
2744
  } else {
1932
- t3 = $[10];
2745
+ t13 = $[34];
1933
2746
  }
1934
- let t4;
1935
- if ($[11] !== t2 || $[12] !== t3) {
1936
- t4 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
1937
- t1,
1938
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1939
- t2,
1940
- t3
1941
- ] })
2747
+ let t14;
2748
+ if ($[35] !== t12 || $[36] !== t13) {
2749
+ t14 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
2750
+ t12,
2751
+ t13
1942
2752
  ] });
1943
- $[11] = t2;
1944
- $[12] = t3;
1945
- $[13] = t4;
2753
+ $[35] = t12;
2754
+ $[36] = t13;
2755
+ $[37] = t14;
1946
2756
  } else {
1947
- t4 = $[13];
2757
+ t14 = $[37];
1948
2758
  }
1949
- const t5 = Boolean(userToBeDeleted);
1950
- let t6;
1951
- if ($[14] !== deleteUser || $[15] !== snackbarController || $[16] !== userToBeDeleted) {
1952
- t6 = () => {
2759
+ let t15;
2760
+ if ($[38] !== t11 || $[39] !== t14) {
2761
+ t15 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
2762
+ t11,
2763
+ t14
2764
+ ] });
2765
+ $[38] = t11;
2766
+ $[39] = t14;
2767
+ $[40] = t15;
2768
+ } else {
2769
+ t15 = $[40];
2770
+ }
2771
+ const t16 = Boolean(userToBeDeleted);
2772
+ let t17;
2773
+ if ($[41] !== deleteUser || $[42] !== snackbarController || $[43] !== userToBeDeleted) {
2774
+ t17 = () => {
1953
2775
  if (userToBeDeleted) {
1954
2776
  setDeleteInProgress(true);
1955
2777
  deleteUser(userToBeDeleted).then(() => {
@@ -1964,62 +2786,91 @@
1964
2786
  });
1965
2787
  }
1966
2788
  };
1967
- $[14] = deleteUser;
1968
- $[15] = snackbarController;
1969
- $[16] = userToBeDeleted;
1970
- $[17] = t6;
2789
+ $[41] = deleteUser;
2790
+ $[42] = snackbarController;
2791
+ $[43] = userToBeDeleted;
2792
+ $[44] = t17;
1971
2793
  } else {
1972
- t6 = $[17];
2794
+ t17 = $[44];
1973
2795
  }
1974
- let t7;
1975
- let t8;
1976
- let t9;
1977
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1978
- t7 = () => {
2796
+ let t18;
2797
+ if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2798
+ t18 = () => {
1979
2799
  setUserToBeDeleted(void 0);
1980
2800
  };
1981
- t8 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Delete?" });
1982
- t9 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Are you sure you want to delete this user?" });
1983
- $[18] = t7;
1984
- $[19] = t8;
1985
- $[20] = t9;
2801
+ $[45] = t18;
1986
2802
  } else {
1987
- t7 = $[18];
1988
- t8 = $[19];
1989
- t9 = $[20];
2803
+ t18 = $[45];
1990
2804
  }
1991
- let t10;
1992
- if ($[21] !== deleteInProgress || $[22] !== t5 || $[23] !== t6) {
1993
- t10 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1994
- $[21] = deleteInProgress;
1995
- $[22] = t5;
1996
- $[23] = t6;
1997
- $[24] = t10;
2805
+ let t19;
2806
+ if ($[46] !== t) {
2807
+ t19 = t("delete_confirmation_title");
2808
+ $[46] = t;
2809
+ $[47] = t19;
1998
2810
  } else {
1999
- t10 = $[24];
2811
+ t19 = $[47];
2000
2812
  }
2001
- let t11;
2002
- if ($[25] !== t10 || $[26] !== t4) {
2003
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto", children: [
2004
- t4,
2005
- t10
2813
+ let t20;
2814
+ if ($[48] !== t19) {
2815
+ t20 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t19 });
2816
+ $[48] = t19;
2817
+ $[49] = t20;
2818
+ } else {
2819
+ t20 = $[49];
2820
+ }
2821
+ let t21;
2822
+ if ($[50] !== t) {
2823
+ t21 = t("delete_user_confirmation");
2824
+ $[50] = t;
2825
+ $[51] = t21;
2826
+ } else {
2827
+ t21 = $[51];
2828
+ }
2829
+ let t22;
2830
+ if ($[52] !== t21) {
2831
+ t22 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t21 });
2832
+ $[52] = t21;
2833
+ $[53] = t22;
2834
+ } else {
2835
+ t22 = $[53];
2836
+ }
2837
+ let t23;
2838
+ if ($[54] !== deleteInProgress || $[55] !== t16 || $[56] !== t17 || $[57] !== t20 || $[58] !== t22) {
2839
+ t23 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t16, loading: deleteInProgress, onAccept: t17, onCancel: t18, title: t20, body: t22 });
2840
+ $[54] = deleteInProgress;
2841
+ $[55] = t16;
2842
+ $[56] = t17;
2843
+ $[57] = t20;
2844
+ $[58] = t22;
2845
+ $[59] = t23;
2846
+ } else {
2847
+ t23 = $[59];
2848
+ }
2849
+ let t24;
2850
+ if ($[60] !== t15 || $[61] !== t23) {
2851
+ t24 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto", children: [
2852
+ t15,
2853
+ t23
2006
2854
  ] });
2007
- $[25] = t10;
2008
- $[26] = t4;
2009
- $[27] = t11;
2855
+ $[60] = t15;
2856
+ $[61] = t23;
2857
+ $[62] = t24;
2010
2858
  } else {
2011
- t11 = $[27];
2859
+ t24 = $[62];
2012
2860
  }
2013
- return t11;
2861
+ return t24;
2014
2862
  }
2015
2863
  function _temp$1(userRole) {
2016
2864
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2017
2865
  }
2018
2866
  const UsersView = function UsersView2(t0) {
2019
- const $ = reactCompilerRuntime.c(13);
2867
+ const $ = reactCompilerRuntime.c(24);
2020
2868
  const {
2021
2869
  children
2022
2870
  } = t0;
2871
+ const {
2872
+ t
2873
+ } = core.useTranslation();
2023
2874
  const [dialogOpen, setDialogOpen] = React.useState(false);
2024
2875
  const [selectedUser, setSelectedUser] = React.useState();
2025
2876
  const [newFormKey, setNewFormKey] = React.useState(0);
@@ -2059,52 +2910,90 @@
2059
2910
  }
2060
2911
  const handleAddUser = t3;
2061
2912
  let t4;
2062
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2063
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2064
- $[3] = t4;
2913
+ if ($[3] !== t) {
2914
+ t4 = t("users");
2915
+ $[3] = t;
2916
+ $[4] = t4;
2065
2917
  } else {
2066
- t4 = $[3];
2918
+ t4 = $[4];
2067
2919
  }
2068
2920
  let t5;
2921
+ if ($[5] !== t4) {
2922
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t4 });
2923
+ $[5] = t4;
2924
+ $[6] = t5;
2925
+ } else {
2926
+ t5 = $[6];
2927
+ }
2069
2928
  let t6;
2070
- if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2071
- t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2072
- t4,
2073
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: handleAddUser, children: "Add user" })
2074
- ] });
2075
- t6 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2076
- $[4] = t5;
2077
- $[5] = t6;
2929
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2930
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2931
+ $[7] = t6;
2932
+ } else {
2933
+ t6 = $[7];
2934
+ }
2935
+ let t7;
2936
+ if ($[8] !== t) {
2937
+ t7 = t("add_user");
2938
+ $[8] = t;
2939
+ $[9] = t7;
2078
2940
  } else {
2079
- t5 = $[4];
2080
- t6 = $[5];
2941
+ t7 = $[9];
2081
2942
  }
2082
- const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2083
2943
  let t8;
2084
- if ($[6] !== dialogOpen || $[7] !== selectedUser || $[8] !== t7) {
2085
- t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t7);
2086
- $[6] = dialogOpen;
2087
- $[7] = selectedUser;
2088
- $[8] = t7;
2089
- $[9] = t8;
2944
+ if ($[10] !== t7) {
2945
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: t6, onClick: handleAddUser, children: t7 });
2946
+ $[10] = t7;
2947
+ $[11] = t8;
2090
2948
  } else {
2091
- t8 = $[9];
2949
+ t8 = $[11];
2092
2950
  }
2093
2951
  let t9;
2094
- if ($[10] !== children || $[11] !== t8) {
2095
- t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2096
- children,
2952
+ if ($[12] !== t5 || $[13] !== t8) {
2953
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2097
2954
  t5,
2098
- t6,
2099
2955
  t8
2100
2956
  ] });
2101
- $[10] = children;
2102
- $[11] = t8;
2103
- $[12] = t9;
2957
+ $[12] = t5;
2958
+ $[13] = t8;
2959
+ $[14] = t9;
2104
2960
  } else {
2105
- t9 = $[12];
2961
+ t9 = $[14];
2106
2962
  }
2107
- return t9;
2963
+ let t10;
2964
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2965
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2966
+ $[15] = t10;
2967
+ } else {
2968
+ t10 = $[15];
2969
+ }
2970
+ const t11 = selectedUser?.uid ?? `new-${newFormKey}`;
2971
+ let t12;
2972
+ if ($[16] !== dialogOpen || $[17] !== selectedUser || $[18] !== t11) {
2973
+ t12 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t11);
2974
+ $[16] = dialogOpen;
2975
+ $[17] = selectedUser;
2976
+ $[18] = t11;
2977
+ $[19] = t12;
2978
+ } else {
2979
+ t12 = $[19];
2980
+ }
2981
+ let t13;
2982
+ if ($[20] !== children || $[21] !== t12 || $[22] !== t9) {
2983
+ t13 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2984
+ children,
2985
+ t9,
2986
+ t10,
2987
+ t12
2988
+ ] });
2989
+ $[20] = children;
2990
+ $[21] = t12;
2991
+ $[22] = t9;
2992
+ $[23] = t13;
2993
+ } else {
2994
+ t13 = $[23];
2995
+ }
2996
+ return t13;
2108
2997
  };
2109
2998
  function _temp(k) {
2110
2999
  return k + 1;
@@ -2179,7 +3068,7 @@
2179
3068
  return t5;
2180
3069
  }
2181
3070
  function IntroWidget(t0) {
2182
- const $ = reactCompilerRuntime.c(17);
3071
+ const $ = reactCompilerRuntime.c(31);
2183
3072
  const {
2184
3073
  noUsers,
2185
3074
  noRoles,
@@ -2187,21 +3076,55 @@
2187
3076
  } = t0;
2188
3077
  const authController = core.useAuthController();
2189
3078
  const snackbarController = core.useSnackbarController();
2190
- const buttonLabel = noUsers && noRoles ? "Create default roles and add current user as admin" : noUsers ? "Add current user as admin" : noRoles ? "Create default roles" : void 0;
3079
+ const {
3080
+ t
3081
+ } = core.useTranslation();
2191
3082
  let t1;
3083
+ if ($[0] !== noRoles || $[1] !== noUsers || $[2] !== t) {
3084
+ t1 = noUsers && noRoles ? t("create_default_roles_and_add_admin") : noUsers ? t("add_current_user_as_admin") : noRoles ? t("create_default_roles") : void 0;
3085
+ $[0] = noRoles;
3086
+ $[1] = noUsers;
3087
+ $[2] = t;
3088
+ $[3] = t1;
3089
+ } else {
3090
+ t1 = $[3];
3091
+ }
3092
+ const buttonLabel = t1;
2192
3093
  let t2;
2193
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2194
- t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: "Create your users and roles" });
2195
- t2 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: "You have no users or roles defined. You can create default roles and add the current user as admin." });
2196
- $[0] = t1;
2197
- $[1] = t2;
3094
+ if ($[4] !== t) {
3095
+ t2 = t("create_your_users_and_roles");
3096
+ $[4] = t;
3097
+ $[5] = t2;
2198
3098
  } else {
2199
- t1 = $[0];
2200
- t2 = $[1];
3099
+ t2 = $[5];
2201
3100
  }
2202
3101
  let t3;
2203
- if ($[2] !== authController.user?.displayName || $[3] !== authController.user?.email || $[4] !== authController.user?.isAnonymous || $[5] !== authController.user?.photoURL || $[6] !== authController.user?.providerId || $[7] !== authController.user?.uid || $[8] !== noRoles || $[9] !== noUsers || $[10] !== snackbarController || $[11] !== userManagement) {
2204
- t3 = () => {
3102
+ if ($[6] !== t2) {
3103
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: t2 });
3104
+ $[6] = t2;
3105
+ $[7] = t3;
3106
+ } else {
3107
+ t3 = $[7];
3108
+ }
3109
+ let t4;
3110
+ if ($[8] !== t) {
3111
+ t4 = t("no_users_or_roles_defined");
3112
+ $[8] = t;
3113
+ $[9] = t4;
3114
+ } else {
3115
+ t4 = $[9];
3116
+ }
3117
+ let t5;
3118
+ if ($[10] !== t4) {
3119
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: t4 });
3120
+ $[10] = t4;
3121
+ $[11] = t5;
3122
+ } else {
3123
+ t5 = $[11];
3124
+ }
3125
+ let t6;
3126
+ if ($[12] !== authController.user?.displayName || $[13] !== authController.user?.email || $[14] !== authController.user?.isAnonymous || $[15] !== authController.user?.photoURL || $[16] !== authController.user?.providerId || $[17] !== authController.user?.uid || $[18] !== noRoles || $[19] !== noUsers || $[20] !== snackbarController || $[21] !== userManagement) {
3127
+ t6 = () => {
2205
3128
  if (!authController.user?.uid) {
2206
3129
  throw Error("UsersTable, authController misconfiguration");
2207
3130
  }
@@ -2236,54 +3159,64 @@
2236
3159
  });
2237
3160
  }
2238
3161
  };
2239
- $[2] = authController.user?.displayName;
2240
- $[3] = authController.user?.email;
2241
- $[4] = authController.user?.isAnonymous;
2242
- $[5] = authController.user?.photoURL;
2243
- $[6] = authController.user?.providerId;
2244
- $[7] = authController.user?.uid;
2245
- $[8] = noRoles;
2246
- $[9] = noUsers;
2247
- $[10] = snackbarController;
2248
- $[11] = userManagement;
2249
- $[12] = t3;
3162
+ $[12] = authController.user?.displayName;
3163
+ $[13] = authController.user?.email;
3164
+ $[14] = authController.user?.isAnonymous;
3165
+ $[15] = authController.user?.photoURL;
3166
+ $[16] = authController.user?.providerId;
3167
+ $[17] = authController.user?.uid;
3168
+ $[18] = noRoles;
3169
+ $[19] = noUsers;
3170
+ $[20] = snackbarController;
3171
+ $[21] = userManagement;
3172
+ $[22] = t6;
3173
+ } else {
3174
+ t6 = $[22];
3175
+ }
3176
+ let t7;
3177
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3178
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
3179
+ $[23] = t7;
2250
3180
  } else {
2251
- t3 = $[12];
3181
+ t7 = $[23];
2252
3182
  }
2253
- let t4;
2254
- if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2255
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2256
- $[13] = t4;
3183
+ let t8;
3184
+ if ($[24] !== buttonLabel || $[25] !== t6) {
3185
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: t6, children: [
3186
+ t7,
3187
+ buttonLabel
3188
+ ] });
3189
+ $[24] = buttonLabel;
3190
+ $[25] = t6;
3191
+ $[26] = t8;
2257
3192
  } else {
2258
- t4 = $[13];
3193
+ t8 = $[26];
2259
3194
  }
2260
- let t5;
2261
- if ($[14] !== buttonLabel || $[15] !== t3) {
2262
- t5 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
2263
- t1,
2264
- t2,
2265
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: t3, children: [
2266
- t4,
2267
- buttonLabel
2268
- ] })
3195
+ let t9;
3196
+ if ($[27] !== t3 || $[28] !== t5 || $[29] !== t8) {
3197
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
3198
+ t3,
3199
+ t5,
3200
+ t8
2269
3201
  ] });
2270
- $[14] = buttonLabel;
2271
- $[15] = t3;
2272
- $[16] = t5;
3202
+ $[27] = t3;
3203
+ $[28] = t5;
3204
+ $[29] = t8;
3205
+ $[30] = t9;
2273
3206
  } else {
2274
- t5 = $[16];
3207
+ t9 = $[30];
2275
3208
  }
2276
- return t5;
3209
+ return t9;
2277
3210
  }
2278
3211
  const userManagementAdminViews = [{
2279
3212
  path: "users",
2280
- name: "CMS Users",
3213
+ name: "cms_users",
2281
3214
  group: "Admin",
2282
3215
  icon: "face",
2283
3216
  view: /* @__PURE__ */ jsxRuntime.jsx(UsersView, {})
2284
3217
  }, {
2285
3218
  path: "roles",
2286
- name: "Roles",
3219
+ name: "roles_menu",
2287
3220
  group: "Admin",
2288
3221
  icon: "gpp_good",
2289
3222
  view: /* @__PURE__ */ jsxRuntime.jsx(RolesView, {})
@@ -2292,14 +3225,12 @@
2292
3225
  exports2.IntroWidget = IntroWidget;
2293
3226
  exports2.RESERVED_GROUPS = RESERVED_GROUPS;
2294
3227
  exports2.RoleChip = RoleChip;
2295
- exports2.RoleYupSchema = RoleYupSchema;
2296
3228
  exports2.RolesDetailsForm = RolesDetailsForm;
2297
3229
  exports2.RolesTable = RolesTable;
2298
3230
  exports2.RolesView = RolesView;
2299
3231
  exports2.UserDetailsForm = UserDetailsForm;
2300
3232
  exports2.UserManagementContext = UserManagementContext;
2301
3233
  exports2.UserManagementProvider = UserManagementProvider;
2302
- exports2.UserYupSchema = UserYupSchema;
2303
3234
  exports2.UsersTable = UsersTable;
2304
3235
  exports2.UsersView = UsersView;
2305
3236
  exports2.areRolesEqual = areRolesEqual;
@@ -2307,7 +3238,9 @@
2307
3238
  exports2.clearDelegatedLoginTokensCache = clearDelegatedLoginTokensCache;
2308
3239
  exports2.darkenColor = darkenColor;
2309
3240
  exports2.getDelegatedLoginTokenFromCache = getDelegatedLoginTokenFromCache;
3241
+ exports2.getRoleYupSchema = getRoleYupSchema;
2310
3242
  exports2.getUserRoles = getUserRoles;
3243
+ exports2.getUserYupSchema = getUserYupSchema;
2311
3244
  exports2.hexToRgbaWithOpacity = hexToRgbaWithOpacity;
2312
3245
  exports2.resolveUserRolePermissions = resolveUserRolePermissions;
2313
3246
  exports2.useBuildUserManagement = useBuildUserManagement;