@firecms/user_management 3.1.0-canary.1df3b2c → 3.1.0-canary.501d471

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;
784
+ } else {
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;
771
796
  } else {
772
- t27 = $[50];
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;
827
+ } else {
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;
791
835
  } else {
792
- t31 = $[56];
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;
811
859
  } else {
812
- t35 = $[62];
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;
867
+ } else {
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;
899
916
  } else {
900
- t43 = $[87];
917
+ t42 = $[92];
901
918
  }
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;
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;
906
926
  } else {
907
- t44 = $[88];
927
+ t45 = $[94];
908
928
  }
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;
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;
936
+ } else {
937
+ t46 = $[98];
938
+ }
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;
973
+ } else {
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;
953
982
  } else {
954
- t52 = $[99];
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;
990
+ } else {
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;
974
1000
  } else {
975
- t55 = $[104];
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;
1010
+ } else {
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;
984
1019
  } else {
985
- t58 = $[106];
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;
1015
1037
  } else {
1016
- t63 = $[114];
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;
1047
+ } else {
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;
1046
1123
  } else {
1047
- t69 = $[121];
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;
1135
+ } else {
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(114);
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,335 @@
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("div", { 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
2262
+ let t10;
2263
+ if ($[27] !== isNewUser || $[28] !== snackbarController || $[29] !== t || $[30] !== userProp) {
2264
+ t10 = !isNewUser && userProp?.uid && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2265
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-mono text-surface-accent-500 dark:text-surface-accent-400 font-normal", children: userProp.uid }),
2266
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("copy"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "smallest", onClick: () => {
2267
+ navigator.clipboard.writeText(userProp.uid);
2268
+ snackbarController.open({
2269
+ type: "success",
2270
+ message: t("copied")
2271
+ });
2272
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CopyIcon, { size: "smallest" }) }) })
1651
2273
  ] });
1652
- $[26] = t10;
1653
- $[27] = t12;
1654
- $[28] = t13;
2274
+ $[27] = isNewUser;
2275
+ $[28] = snackbarController;
2276
+ $[29] = t;
2277
+ $[30] = userProp;
2278
+ $[31] = t10;
1655
2279
  } else {
1656
- t13 = $[28];
2280
+ t10 = $[31];
1657
2281
  }
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;
2282
+ let t11;
2283
+ if ($[32] !== t10 || $[33] !== t9) {
2284
+ t11 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
2285
+ t9,
2286
+ t10
2287
+ ] }) });
2288
+ $[32] = t10;
2289
+ $[33] = t9;
2290
+ $[34] = t11;
1667
2291
  } else {
1668
- t16 = $[32];
2292
+ t11 = $[34];
1669
2293
  }
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;
2294
+ const t12 = submitCount > 0 && Boolean(errors.displayName);
2295
+ const t13 = values_0.displayName ?? "";
2296
+ let t14;
2297
+ if ($[35] !== t) {
2298
+ t14 = t("name");
2299
+ $[35] = t;
2300
+ $[36] = t14;
1676
2301
  } else {
1677
- t18 = $[34];
2302
+ t14 = $[36];
1678
2303
  }
1679
- let t19;
1680
- if ($[35] !== t16 || $[36] !== t18) {
1681
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1682
- t16,
1683
- t18
1684
- ] });
1685
- $[35] = t16;
1686
- $[36] = t18;
1687
- $[37] = t19;
2304
+ let t15;
2305
+ if ($[37] !== handleChange || $[38] !== t12 || $[39] !== t13 || $[40] !== t14) {
2306
+ t15 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "displayName", required: true, error: t12, value: t13, onChange: handleChange, "aria-describedby": "name-helper-text", label: t14 });
2307
+ $[37] = handleChange;
2308
+ $[38] = t12;
2309
+ $[39] = t13;
2310
+ $[40] = t14;
2311
+ $[41] = t15;
1688
2312
  } else {
1689
- t19 = $[37];
2313
+ t15 = $[41];
1690
2314
  }
1691
- let t20;
1692
- if ($[38] !== values_0.roles) {
1693
- t20 = values_0.roles?.map(_temp6) ?? [];
1694
- $[38] = values_0.roles;
1695
- $[39] = t20;
2315
+ let t16;
2316
+ if ($[42] !== errors || $[43] !== submitCount || $[44] !== t) {
2317
+ t16 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : t("name_of_this_user");
2318
+ $[42] = errors;
2319
+ $[43] = submitCount;
2320
+ $[44] = t;
2321
+ $[45] = t16;
1696
2322
  } else {
1697
- t20 = $[39];
2323
+ t16 = $[45];
1698
2324
  }
2325
+ let t17;
2326
+ if ($[46] !== t16) {
2327
+ t17 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t16 });
2328
+ $[46] = t16;
2329
+ $[47] = t17;
2330
+ } else {
2331
+ t17 = $[47];
2332
+ }
2333
+ let t18;
2334
+ if ($[48] !== t15 || $[49] !== t17) {
2335
+ t18 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
2336
+ t15,
2337
+ t17
2338
+ ] });
2339
+ $[48] = t15;
2340
+ $[49] = t17;
2341
+ $[50] = t18;
2342
+ } else {
2343
+ t18 = $[50];
2344
+ }
2345
+ const t19 = submitCount > 0 && Boolean(errors.email);
2346
+ const t20 = values_0.email ?? "";
1699
2347
  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;
2348
+ if ($[51] !== t) {
2349
+ t21 = t("email");
2350
+ $[51] = t;
2351
+ $[52] = t21;
1705
2352
  } else {
1706
- t21 = $[42];
2353
+ t21 = $[52];
1707
2354
  }
1708
2355
  let t22;
1709
- if ($[43] !== roles) {
1710
- t22 = roles.map(_temp7);
1711
- $[43] = roles;
1712
- $[44] = t22;
2356
+ if ($[53] !== handleChange || $[54] !== t19 || $[55] !== t20 || $[56] !== t21) {
2357
+ t22 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { required: true, error: t19, name: "email", value: t20, onChange: handleChange, "aria-describedby": "email-helper-text", label: t21 });
2358
+ $[53] = handleChange;
2359
+ $[54] = t19;
2360
+ $[55] = t20;
2361
+ $[56] = t21;
2362
+ $[57] = t22;
1713
2363
  } else {
1714
- t22 = $[44];
2364
+ t22 = $[57];
1715
2365
  }
1716
2366
  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;
2367
+ if ($[58] !== errors || $[59] !== submitCount || $[60] !== t) {
2368
+ t23 = submitCount > 0 && Boolean(errors.email) ? errors.email : t("email_of_this_user");
2369
+ $[58] = errors;
2370
+ $[59] = submitCount;
2371
+ $[60] = t;
2372
+ $[61] = t23;
1723
2373
  } else {
1724
- t23 = $[48];
2374
+ t23 = $[61];
1725
2375
  }
1726
2376
  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,
1731
- t23
1732
- ] }) });
1733
- $[49] = t13;
1734
- $[50] = t19;
1735
- $[51] = t23;
1736
- $[52] = t24;
2377
+ if ($[62] !== t23) {
2378
+ t24 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t23 });
2379
+ $[62] = t23;
2380
+ $[63] = t24;
1737
2381
  } else {
1738
- t24 = $[52];
2382
+ t24 = $[63];
1739
2383
  }
1740
2384
  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;
2385
+ if ($[64] !== t22 || $[65] !== t24) {
2386
+ t25 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
2387
+ t22,
2388
+ t24
2389
+ ] });
2390
+ $[64] = t22;
2391
+ $[65] = t24;
2392
+ $[66] = t25;
1747
2393
  } else {
1748
- t25 = $[54];
2394
+ t25 = $[66];
2395
+ }
2396
+ let t26;
2397
+ if ($[67] !== t) {
2398
+ t26 = t("roles");
2399
+ $[67] = t;
2400
+ $[68] = t26;
2401
+ } else {
2402
+ t26 = $[68];
2403
+ }
2404
+ let t27;
2405
+ if ($[69] !== values_0.roles) {
2406
+ t27 = values_0.roles?.map(_temp5) ?? [];
2407
+ $[69] = values_0.roles;
2408
+ $[70] = t27;
2409
+ } else {
2410
+ t27 = $[70];
1749
2411
  }
1750
- const t26 = !dirty;
1751
- const t27 = isNewUser ? "Create user" : "Update";
1752
2412
  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;
2413
+ if ($[71] !== roles || $[72] !== setFieldValue) {
2414
+ t28 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
2415
+ $[71] = roles;
2416
+ $[72] = setFieldValue;
2417
+ $[73] = t28;
1759
2418
  } else {
1760
- t28 = $[58];
2419
+ t28 = $[73];
1761
2420
  }
1762
2421
  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;
2422
+ if ($[74] !== roles) {
2423
+ t29 = roles.map(_temp6);
2424
+ $[74] = roles;
2425
+ $[75] = t29;
1771
2426
  } else {
1772
- t29 = $[61];
2427
+ t29 = $[75];
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,
1778
- t24,
1779
- t29
1780
- ] });
1781
- $[62] = handleSubmit;
1782
- $[63] = t24;
1783
- $[64] = t29;
1784
- $[65] = t30;
2430
+ if ($[76] !== t26 || $[77] !== t27 || $[78] !== t28 || $[79] !== t29) {
2431
+ t30 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { className: "w-full", label: t26, value: t27, onValueChange: t28, children: t29 }) });
2432
+ $[76] = t26;
2433
+ $[77] = t27;
2434
+ $[78] = t28;
2435
+ $[79] = t29;
2436
+ $[80] = t30;
1785
2437
  } else {
1786
- t30 = $[65];
2438
+ t30 = $[80];
1787
2439
  }
1788
2440
  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;
2441
+ if ($[81] !== t18 || $[82] !== t25 || $[83] !== t30) {
2442
+ t31 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
2443
+ t18,
2444
+ t25,
2445
+ t30
2446
+ ] }) });
2447
+ $[81] = t18;
2448
+ $[82] = t25;
2449
+ $[83] = t30;
2450
+ $[84] = t31;
1794
2451
  } else {
1795
- t31 = $[68];
2452
+ t31 = $[84];
1796
2453
  }
1797
2454
  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;
2455
+ if ($[85] !== handleClose) {
2456
+ t32 = () => {
2457
+ handleClose();
2458
+ };
2459
+ $[85] = handleClose;
2460
+ $[86] = t32;
2461
+ } else {
2462
+ t32 = $[86];
2463
+ }
2464
+ let t33;
2465
+ if ($[87] !== t) {
2466
+ t33 = t("cancel");
2467
+ $[87] = t;
2468
+ $[88] = t33;
2469
+ } else {
2470
+ t33 = $[88];
2471
+ }
2472
+ let t34;
2473
+ if ($[89] !== t32 || $[90] !== t33) {
2474
+ t34 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: t32, children: t33 });
2475
+ $[89] = t32;
2476
+ $[90] = t33;
2477
+ $[91] = t34;
2478
+ } else {
2479
+ t34 = $[91];
2480
+ }
2481
+ const t35 = !dirty;
2482
+ let t36;
2483
+ if ($[92] !== isNewUser || $[93] !== t) {
2484
+ t36 = isNewUser ? t("create_user") : t("update");
2485
+ $[92] = isNewUser;
2486
+ $[93] = t;
2487
+ $[94] = t36;
2488
+ } else {
2489
+ t36 = $[94];
2490
+ }
2491
+ let t37;
2492
+ if ($[95] !== isSubmitting || $[96] !== t35 || $[97] !== t36) {
2493
+ t37 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t35, loading: isSubmitting, children: t36 });
2494
+ $[95] = isSubmitting;
2495
+ $[96] = t35;
2496
+ $[97] = t36;
2497
+ $[98] = t37;
2498
+ } else {
2499
+ t37 = $[98];
2500
+ }
2501
+ let t38;
2502
+ if ($[99] !== t34 || $[100] !== t37) {
2503
+ t38 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { children: [
2504
+ t34,
2505
+ t37
2506
+ ] });
2507
+ $[99] = t34;
2508
+ $[100] = t37;
2509
+ $[101] = t38;
2510
+ } else {
2511
+ t38 = $[101];
2512
+ }
2513
+ let t39;
2514
+ if ($[102] !== handleSubmit || $[103] !== t11 || $[104] !== t31 || $[105] !== t38) {
2515
+ t39 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t7, children: [
2516
+ t11,
2517
+ t31,
2518
+ t38
2519
+ ] });
2520
+ $[102] = handleSubmit;
2521
+ $[103] = t11;
2522
+ $[104] = t31;
2523
+ $[105] = t38;
2524
+ $[106] = t39;
2525
+ } else {
2526
+ t39 = $[106];
2527
+ }
2528
+ let t40;
2529
+ if ($[107] !== formex$1 || $[108] !== t39) {
2530
+ t40 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t39 });
2531
+ $[107] = formex$1;
2532
+ $[108] = t39;
2533
+ $[109] = t40;
1804
2534
  } else {
1805
- t32 = $[72];
2535
+ t40 = $[109];
1806
2536
  }
1807
- return t32;
2537
+ let t41;
2538
+ if ($[110] !== open || $[111] !== t40 || $[112] !== t6) {
2539
+ t41 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: t6, maxWidth: "4xl", children: t40 });
2540
+ $[110] = open;
2541
+ $[111] = t40;
2542
+ $[112] = t6;
2543
+ $[113] = t41;
2544
+ } else {
2545
+ t41 = $[113];
2546
+ }
2547
+ return t41;
1808
2548
  }
1809
- function _temp7(userRole) {
2549
+ function _temp6(userRole) {
1810
2550
  return /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelectItem, { value: userRole.id, children: /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id) }, userRole.id);
1811
2551
  }
1812
- function _temp6(r_0) {
2552
+ function _temp5(r_0) {
1813
2553
  return r_0.id;
1814
2554
  }
1815
- function _temp5(values) {
1816
- return UserYupSchema.validate(values, {
1817
- abortEarly: false
1818
- }).then(_temp2).catch(_temp4);
1819
- }
1820
2555
  function _temp4(e_0) {
1821
2556
  return e_0.inner.reduce(_temp3, {});
1822
2557
  }
@@ -1831,10 +2566,13 @@
1831
2566
  return r.id === "editor";
1832
2567
  }
1833
2568
  function UsersTable(t0) {
1834
- const $ = reactCompilerRuntime.c(28);
2569
+ const $ = reactCompilerRuntime.c(63);
1835
2570
  const {
1836
2571
  onUserClicked
1837
2572
  } = t0;
2573
+ const {
2574
+ t
2575
+ } = core.useTranslation();
1838
2576
  const {
1839
2577
  users,
1840
2578
  saveUser,
@@ -1849,21 +2587,103 @@
1849
2587
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
1850
2588
  let t1;
1851
2589
  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
- ] });
2590
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" });
1860
2591
  $[0] = t1;
1861
2592
  } else {
1862
2593
  t1 = $[0];
1863
2594
  }
1864
2595
  let t2;
1865
- if ($[1] !== dateFormat || $[2] !== dateUtilsLocale || $[3] !== onUserClicked || $[4] !== users) {
1866
- t2 = users && users.map((user) => {
2596
+ if ($[1] !== t) {
2597
+ t2 = t("email");
2598
+ $[1] = t;
2599
+ $[2] = t2;
2600
+ } else {
2601
+ t2 = $[2];
2602
+ }
2603
+ let t3;
2604
+ if ($[3] !== t2) {
2605
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t2 });
2606
+ $[3] = t2;
2607
+ $[4] = t3;
2608
+ } else {
2609
+ t3 = $[4];
2610
+ }
2611
+ let t4;
2612
+ if ($[5] !== t) {
2613
+ t4 = t("name");
2614
+ $[5] = t;
2615
+ $[6] = t4;
2616
+ } else {
2617
+ t4 = $[6];
2618
+ }
2619
+ let t5;
2620
+ if ($[7] !== t4) {
2621
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t4 });
2622
+ $[7] = t4;
2623
+ $[8] = t5;
2624
+ } else {
2625
+ t5 = $[8];
2626
+ }
2627
+ let t6;
2628
+ if ($[9] !== t) {
2629
+ t6 = t("roles");
2630
+ $[9] = t;
2631
+ $[10] = t6;
2632
+ } else {
2633
+ t6 = $[10];
2634
+ }
2635
+ let t7;
2636
+ if ($[11] !== t6) {
2637
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t6 });
2638
+ $[11] = t6;
2639
+ $[12] = t7;
2640
+ } else {
2641
+ t7 = $[12];
2642
+ }
2643
+ let t8;
2644
+ if ($[13] !== t) {
2645
+ t8 = t("created_on");
2646
+ $[13] = t;
2647
+ $[14] = t8;
2648
+ } else {
2649
+ t8 = $[14];
2650
+ }
2651
+ let t9;
2652
+ if ($[15] !== t8) {
2653
+ t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: t8 });
2654
+ $[15] = t8;
2655
+ $[16] = t9;
2656
+ } else {
2657
+ t9 = $[16];
2658
+ }
2659
+ let t10;
2660
+ if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2661
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" });
2662
+ $[17] = t10;
2663
+ } else {
2664
+ t10 = $[17];
2665
+ }
2666
+ let t11;
2667
+ if ($[18] !== t3 || $[19] !== t5 || $[20] !== t7 || $[21] !== t9) {
2668
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
2669
+ t1,
2670
+ t3,
2671
+ t5,
2672
+ t7,
2673
+ t9,
2674
+ t10
2675
+ ] });
2676
+ $[18] = t3;
2677
+ $[19] = t5;
2678
+ $[20] = t7;
2679
+ $[21] = t9;
2680
+ $[22] = t11;
2681
+ } else {
2682
+ t11 = $[22];
2683
+ }
2684
+ let t12;
2685
+ if ($[23] !== dateFormat || $[24] !== dateUtilsLocale || $[25] !== onUserClicked || $[26] !== t || $[27] !== users) {
2686
+ t12 = users && users.map((user) => {
1867
2687
  const userRoles = user.roles;
1868
2688
  const formattedDate = user.created_on ? dateFns.format(user.created_on, dateFormat, {
1869
2689
  locale: dateUtilsLocale
@@ -1872,28 +2692,32 @@
1872
2692
  onUserClicked(user);
1873
2693
  }, children: [
1874
2694
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Avatar, { src: user.photoURL ?? void 0, outerClassName: "w-8 h-8 min-w-8 min-h-8 p-0", className: "text-sm", hover: false, children: user.displayName ? user.displayName[0].toUpperCase() : user.email ? user.email[0].toUpperCase() : "U" }) }),
1875
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: user.email }),
2695
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
2696
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: user.email }),
2697
+ user.uid && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-surface-accent-500 dark:text-surface-accent-400 font-mono mt-1", children: user.uid })
2698
+ ] }) }),
1876
2699
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "font-medium align-left", children: user.displayName }),
1877
2700
  /* @__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
2701
  /* @__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) => {
2702
+ /* @__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
2703
  event.stopPropagation();
1881
2704
  return setUserToBeDeleted(user);
1882
2705
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) }) }) })
1883
2706
  ] }, "row_" + user.uid);
1884
2707
  });
1885
- $[1] = dateFormat;
1886
- $[2] = dateUtilsLocale;
1887
- $[3] = onUserClicked;
1888
- $[4] = users;
1889
- $[5] = t2;
2708
+ $[23] = dateFormat;
2709
+ $[24] = dateUtilsLocale;
2710
+ $[25] = onUserClicked;
2711
+ $[26] = t;
2712
+ $[27] = users;
2713
+ $[28] = t12;
1890
2714
  } else {
1891
- t2 = $[5];
2715
+ t12 = $[28];
1892
2716
  }
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" }),
2717
+ let t13;
2718
+ if ($[29] !== authController || $[30] !== saveUser || $[31] !== snackbarController || $[32] !== t || $[33] !== users) {
2719
+ 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: [
2720
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_users_yet") }),
1897
2721
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
1898
2722
  if (!authController.user?.uid) {
1899
2723
  throw Error("UsersTable, authController misconfiguration");
@@ -1921,35 +2745,45 @@
1921
2745
  message: "Error adding user: " + error.message
1922
2746
  });
1923
2747
  });
1924
- }, children: "Add the logged user as an admin" })
2748
+ }, children: t("add_logged_user_as_admin") })
1925
2749
  ] }) }) });
1926
- $[6] = authController;
1927
- $[7] = saveUser;
1928
- $[8] = snackbarController;
1929
- $[9] = users;
1930
- $[10] = t3;
2750
+ $[29] = authController;
2751
+ $[30] = saveUser;
2752
+ $[31] = snackbarController;
2753
+ $[32] = t;
2754
+ $[33] = users;
2755
+ $[34] = t13;
1931
2756
  } else {
1932
- t3 = $[10];
2757
+ t13 = $[34];
1933
2758
  }
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
- ] })
2759
+ let t14;
2760
+ if ($[35] !== t12 || $[36] !== t13) {
2761
+ t14 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
2762
+ t12,
2763
+ t13
1942
2764
  ] });
1943
- $[11] = t2;
1944
- $[12] = t3;
1945
- $[13] = t4;
2765
+ $[35] = t12;
2766
+ $[36] = t13;
2767
+ $[37] = t14;
1946
2768
  } else {
1947
- t4 = $[13];
2769
+ t14 = $[37];
1948
2770
  }
1949
- const t5 = Boolean(userToBeDeleted);
1950
- let t6;
1951
- if ($[14] !== deleteUser || $[15] !== snackbarController || $[16] !== userToBeDeleted) {
1952
- t6 = () => {
2771
+ let t15;
2772
+ if ($[38] !== t11 || $[39] !== t14) {
2773
+ t15 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
2774
+ t11,
2775
+ t14
2776
+ ] });
2777
+ $[38] = t11;
2778
+ $[39] = t14;
2779
+ $[40] = t15;
2780
+ } else {
2781
+ t15 = $[40];
2782
+ }
2783
+ const t16 = Boolean(userToBeDeleted);
2784
+ let t17;
2785
+ if ($[41] !== deleteUser || $[42] !== snackbarController || $[43] !== userToBeDeleted) {
2786
+ t17 = () => {
1953
2787
  if (userToBeDeleted) {
1954
2788
  setDeleteInProgress(true);
1955
2789
  deleteUser(userToBeDeleted).then(() => {
@@ -1964,62 +2798,91 @@
1964
2798
  });
1965
2799
  }
1966
2800
  };
1967
- $[14] = deleteUser;
1968
- $[15] = snackbarController;
1969
- $[16] = userToBeDeleted;
1970
- $[17] = t6;
2801
+ $[41] = deleteUser;
2802
+ $[42] = snackbarController;
2803
+ $[43] = userToBeDeleted;
2804
+ $[44] = t17;
1971
2805
  } else {
1972
- t6 = $[17];
2806
+ t17 = $[44];
1973
2807
  }
1974
- let t7;
1975
- let t8;
1976
- let t9;
1977
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1978
- t7 = () => {
2808
+ let t18;
2809
+ if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2810
+ t18 = () => {
1979
2811
  setUserToBeDeleted(void 0);
1980
2812
  };
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;
2813
+ $[45] = t18;
1986
2814
  } else {
1987
- t7 = $[18];
1988
- t8 = $[19];
1989
- t9 = $[20];
2815
+ t18 = $[45];
1990
2816
  }
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;
2817
+ let t19;
2818
+ if ($[46] !== t) {
2819
+ t19 = t("delete_confirmation_title");
2820
+ $[46] = t;
2821
+ $[47] = t19;
1998
2822
  } else {
1999
- t10 = $[24];
2823
+ t19 = $[47];
2000
2824
  }
2001
- let t11;
2002
- if ($[25] !== t10 || $[26] !== t4) {
2003
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto", children: [
2004
- t4,
2005
- t10
2825
+ let t20;
2826
+ if ($[48] !== t19) {
2827
+ t20 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t19 });
2828
+ $[48] = t19;
2829
+ $[49] = t20;
2830
+ } else {
2831
+ t20 = $[49];
2832
+ }
2833
+ let t21;
2834
+ if ($[50] !== t) {
2835
+ t21 = t("delete_user_confirmation");
2836
+ $[50] = t;
2837
+ $[51] = t21;
2838
+ } else {
2839
+ t21 = $[51];
2840
+ }
2841
+ let t22;
2842
+ if ($[52] !== t21) {
2843
+ t22 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t21 });
2844
+ $[52] = t21;
2845
+ $[53] = t22;
2846
+ } else {
2847
+ t22 = $[53];
2848
+ }
2849
+ let t23;
2850
+ if ($[54] !== deleteInProgress || $[55] !== t16 || $[56] !== t17 || $[57] !== t20 || $[58] !== t22) {
2851
+ t23 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t16, loading: deleteInProgress, onAccept: t17, onCancel: t18, title: t20, body: t22 });
2852
+ $[54] = deleteInProgress;
2853
+ $[55] = t16;
2854
+ $[56] = t17;
2855
+ $[57] = t20;
2856
+ $[58] = t22;
2857
+ $[59] = t23;
2858
+ } else {
2859
+ t23 = $[59];
2860
+ }
2861
+ let t24;
2862
+ if ($[60] !== t15 || $[61] !== t23) {
2863
+ t24 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto", children: [
2864
+ t15,
2865
+ t23
2006
2866
  ] });
2007
- $[25] = t10;
2008
- $[26] = t4;
2009
- $[27] = t11;
2867
+ $[60] = t15;
2868
+ $[61] = t23;
2869
+ $[62] = t24;
2010
2870
  } else {
2011
- t11 = $[27];
2871
+ t24 = $[62];
2012
2872
  }
2013
- return t11;
2873
+ return t24;
2014
2874
  }
2015
2875
  function _temp$1(userRole) {
2016
2876
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2017
2877
  }
2018
2878
  const UsersView = function UsersView2(t0) {
2019
- const $ = reactCompilerRuntime.c(13);
2879
+ const $ = reactCompilerRuntime.c(24);
2020
2880
  const {
2021
2881
  children
2022
2882
  } = t0;
2883
+ const {
2884
+ t
2885
+ } = core.useTranslation();
2023
2886
  const [dialogOpen, setDialogOpen] = React.useState(false);
2024
2887
  const [selectedUser, setSelectedUser] = React.useState();
2025
2888
  const [newFormKey, setNewFormKey] = React.useState(0);
@@ -2059,52 +2922,90 @@
2059
2922
  }
2060
2923
  const handleAddUser = t3;
2061
2924
  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;
2925
+ if ($[3] !== t) {
2926
+ t4 = t("users");
2927
+ $[3] = t;
2928
+ $[4] = t4;
2065
2929
  } else {
2066
- t4 = $[3];
2930
+ t4 = $[4];
2067
2931
  }
2068
2932
  let t5;
2933
+ if ($[5] !== t4) {
2934
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t4 });
2935
+ $[5] = t4;
2936
+ $[6] = t5;
2937
+ } else {
2938
+ t5 = $[6];
2939
+ }
2069
2940
  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;
2941
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2942
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2943
+ $[7] = t6;
2944
+ } else {
2945
+ t6 = $[7];
2946
+ }
2947
+ let t7;
2948
+ if ($[8] !== t) {
2949
+ t7 = t("add_user");
2950
+ $[8] = t;
2951
+ $[9] = t7;
2078
2952
  } else {
2079
- t5 = $[4];
2080
- t6 = $[5];
2953
+ t7 = $[9];
2081
2954
  }
2082
- const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2083
2955
  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;
2956
+ if ($[10] !== t7) {
2957
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: t6, onClick: handleAddUser, children: t7 });
2958
+ $[10] = t7;
2959
+ $[11] = t8;
2090
2960
  } else {
2091
- t8 = $[9];
2961
+ t8 = $[11];
2092
2962
  }
2093
2963
  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,
2964
+ if ($[12] !== t5 || $[13] !== t8) {
2965
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2097
2966
  t5,
2098
- t6,
2099
2967
  t8
2100
2968
  ] });
2101
- $[10] = children;
2102
- $[11] = t8;
2103
- $[12] = t9;
2969
+ $[12] = t5;
2970
+ $[13] = t8;
2971
+ $[14] = t9;
2104
2972
  } else {
2105
- t9 = $[12];
2973
+ t9 = $[14];
2106
2974
  }
2107
- return t9;
2975
+ let t10;
2976
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2977
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2978
+ $[15] = t10;
2979
+ } else {
2980
+ t10 = $[15];
2981
+ }
2982
+ const t11 = selectedUser?.uid ?? `new-${newFormKey}`;
2983
+ let t12;
2984
+ if ($[16] !== dialogOpen || $[17] !== selectedUser || $[18] !== t11) {
2985
+ t12 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t11);
2986
+ $[16] = dialogOpen;
2987
+ $[17] = selectedUser;
2988
+ $[18] = t11;
2989
+ $[19] = t12;
2990
+ } else {
2991
+ t12 = $[19];
2992
+ }
2993
+ let t13;
2994
+ if ($[20] !== children || $[21] !== t12 || $[22] !== t9) {
2995
+ t13 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2996
+ children,
2997
+ t9,
2998
+ t10,
2999
+ t12
3000
+ ] });
3001
+ $[20] = children;
3002
+ $[21] = t12;
3003
+ $[22] = t9;
3004
+ $[23] = t13;
3005
+ } else {
3006
+ t13 = $[23];
3007
+ }
3008
+ return t13;
2108
3009
  };
2109
3010
  function _temp(k) {
2110
3011
  return k + 1;
@@ -2179,7 +3080,7 @@
2179
3080
  return t5;
2180
3081
  }
2181
3082
  function IntroWidget(t0) {
2182
- const $ = reactCompilerRuntime.c(17);
3083
+ const $ = reactCompilerRuntime.c(31);
2183
3084
  const {
2184
3085
  noUsers,
2185
3086
  noRoles,
@@ -2187,21 +3088,55 @@
2187
3088
  } = t0;
2188
3089
  const authController = core.useAuthController();
2189
3090
  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;
3091
+ const {
3092
+ t
3093
+ } = core.useTranslation();
2191
3094
  let t1;
3095
+ if ($[0] !== noRoles || $[1] !== noUsers || $[2] !== t) {
3096
+ t1 = noUsers && noRoles ? t("create_default_roles_and_add_admin") : noUsers ? t("add_current_user_as_admin") : noRoles ? t("create_default_roles") : void 0;
3097
+ $[0] = noRoles;
3098
+ $[1] = noUsers;
3099
+ $[2] = t;
3100
+ $[3] = t1;
3101
+ } else {
3102
+ t1 = $[3];
3103
+ }
3104
+ const buttonLabel = t1;
2192
3105
  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;
3106
+ if ($[4] !== t) {
3107
+ t2 = t("create_your_users_and_roles");
3108
+ $[4] = t;
3109
+ $[5] = t2;
2198
3110
  } else {
2199
- t1 = $[0];
2200
- t2 = $[1];
3111
+ t2 = $[5];
2201
3112
  }
2202
3113
  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 = () => {
3114
+ if ($[6] !== t2) {
3115
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: t2 });
3116
+ $[6] = t2;
3117
+ $[7] = t3;
3118
+ } else {
3119
+ t3 = $[7];
3120
+ }
3121
+ let t4;
3122
+ if ($[8] !== t) {
3123
+ t4 = t("no_users_or_roles_defined");
3124
+ $[8] = t;
3125
+ $[9] = t4;
3126
+ } else {
3127
+ t4 = $[9];
3128
+ }
3129
+ let t5;
3130
+ if ($[10] !== t4) {
3131
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: t4 });
3132
+ $[10] = t4;
3133
+ $[11] = t5;
3134
+ } else {
3135
+ t5 = $[11];
3136
+ }
3137
+ let t6;
3138
+ 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) {
3139
+ t6 = () => {
2205
3140
  if (!authController.user?.uid) {
2206
3141
  throw Error("UsersTable, authController misconfiguration");
2207
3142
  }
@@ -2236,54 +3171,64 @@
2236
3171
  });
2237
3172
  }
2238
3173
  };
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;
3174
+ $[12] = authController.user?.displayName;
3175
+ $[13] = authController.user?.email;
3176
+ $[14] = authController.user?.isAnonymous;
3177
+ $[15] = authController.user?.photoURL;
3178
+ $[16] = authController.user?.providerId;
3179
+ $[17] = authController.user?.uid;
3180
+ $[18] = noRoles;
3181
+ $[19] = noUsers;
3182
+ $[20] = snackbarController;
3183
+ $[21] = userManagement;
3184
+ $[22] = t6;
3185
+ } else {
3186
+ t6 = $[22];
3187
+ }
3188
+ let t7;
3189
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3190
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
3191
+ $[23] = t7;
2250
3192
  } else {
2251
- t3 = $[12];
3193
+ t7 = $[23];
2252
3194
  }
2253
- let t4;
2254
- if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2255
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2256
- $[13] = t4;
3195
+ let t8;
3196
+ if ($[24] !== buttonLabel || $[25] !== t6) {
3197
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: t6, children: [
3198
+ t7,
3199
+ buttonLabel
3200
+ ] });
3201
+ $[24] = buttonLabel;
3202
+ $[25] = t6;
3203
+ $[26] = t8;
2257
3204
  } else {
2258
- t4 = $[13];
3205
+ t8 = $[26];
2259
3206
  }
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
- ] })
3207
+ let t9;
3208
+ if ($[27] !== t3 || $[28] !== t5 || $[29] !== t8) {
3209
+ 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: [
3210
+ t3,
3211
+ t5,
3212
+ t8
2269
3213
  ] });
2270
- $[14] = buttonLabel;
2271
- $[15] = t3;
2272
- $[16] = t5;
3214
+ $[27] = t3;
3215
+ $[28] = t5;
3216
+ $[29] = t8;
3217
+ $[30] = t9;
2273
3218
  } else {
2274
- t5 = $[16];
3219
+ t9 = $[30];
2275
3220
  }
2276
- return t5;
3221
+ return t9;
2277
3222
  }
2278
3223
  const userManagementAdminViews = [{
2279
3224
  path: "users",
2280
- name: "CMS Users",
3225
+ name: "cms_users",
2281
3226
  group: "Admin",
2282
3227
  icon: "face",
2283
3228
  view: /* @__PURE__ */ jsxRuntime.jsx(UsersView, {})
2284
3229
  }, {
2285
3230
  path: "roles",
2286
- name: "Roles",
3231
+ name: "roles_menu",
2287
3232
  group: "Admin",
2288
3233
  icon: "gpp_good",
2289
3234
  view: /* @__PURE__ */ jsxRuntime.jsx(RolesView, {})
@@ -2292,14 +3237,12 @@
2292
3237
  exports2.IntroWidget = IntroWidget;
2293
3238
  exports2.RESERVED_GROUPS = RESERVED_GROUPS;
2294
3239
  exports2.RoleChip = RoleChip;
2295
- exports2.RoleYupSchema = RoleYupSchema;
2296
3240
  exports2.RolesDetailsForm = RolesDetailsForm;
2297
3241
  exports2.RolesTable = RolesTable;
2298
3242
  exports2.RolesView = RolesView;
2299
3243
  exports2.UserDetailsForm = UserDetailsForm;
2300
3244
  exports2.UserManagementContext = UserManagementContext;
2301
3245
  exports2.UserManagementProvider = UserManagementProvider;
2302
- exports2.UserYupSchema = UserYupSchema;
2303
3246
  exports2.UsersTable = UsersTable;
2304
3247
  exports2.UsersView = UsersView;
2305
3248
  exports2.areRolesEqual = areRolesEqual;
@@ -2307,7 +3250,9 @@
2307
3250
  exports2.clearDelegatedLoginTokensCache = clearDelegatedLoginTokensCache;
2308
3251
  exports2.darkenColor = darkenColor;
2309
3252
  exports2.getDelegatedLoginTokenFromCache = getDelegatedLoginTokenFromCache;
3253
+ exports2.getRoleYupSchema = getRoleYupSchema;
2310
3254
  exports2.getUserRoles = getUserRoles;
3255
+ exports2.getUserYupSchema = getUserYupSchema;
2311
3256
  exports2.hexToRgbaWithOpacity = hexToRgbaWithOpacity;
2312
3257
  exports2.resolveUserRolePermissions = resolveUserRolePermissions;
2313
3258
  exports2.useBuildUserManagement = useBuildUserManagement;