@firecms/user_management 3.0.0 → 3.1.0-canary.02232f4

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
@@ -360,11 +360,17 @@
360
360
  }
361
361
  const mgmtUser_0 = users.find((u_3) => u_3.email?.toLowerCase() === user_3?.email?.toLowerCase());
362
362
  if (mgmtUser_0) {
363
- if (mgmtUser_0.uid !== user_3.uid) {
364
- console.warn("User uid has changed, updating user in user management system");
363
+ const needsUidUpdate = mgmtUser_0.uid !== user_3.uid;
364
+ const needsPhotoUpdate = user_3.photoURL && mgmtUser_0.photoURL !== user_3.photoURL;
365
+ if (needsUidUpdate || needsPhotoUpdate) {
366
+ const updateReason = needsUidUpdate ? "uid" : "photoURL";
367
+ console.debug(`User ${updateReason} has changed, updating user in user management system`);
365
368
  saveUser({
366
369
  ...mgmtUser_0,
367
- uid: user_3.uid
370
+ uid: user_3.uid,
371
+ ...needsPhotoUpdate ? {
372
+ photoURL: user_3.photoURL
373
+ } : {}
368
374
  }).then(() => {
369
375
  console.debug("User updated in user management system", mgmtUser_0);
370
376
  }).catch((e_4) => {
@@ -495,19 +501,19 @@
495
501
  }
496
502
  return t1;
497
503
  }
498
- const RoleYupSchema = Yup__namespace.object().shape({
499
- id: Yup__namespace.string().required("Required"),
500
- 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"))
501
507
  });
502
- function canRoleBeEdited(loggedUser) {
508
+ function canRoleBeEdited(loggedUser, t) {
503
509
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
504
510
  if (!loggedUserIsAdmin) {
505
- throw new Error("Only admins can edit roles");
511
+ throw new Error(t("only_admins_edit_roles"));
506
512
  }
507
513
  return true;
508
514
  }
509
515
  function RolesDetailsForm(t0) {
510
- const $ = reactCompilerRuntime.c(164);
516
+ const $ = reactCompilerRuntime.c(311);
511
517
  const {
512
518
  open,
513
519
  role,
@@ -515,6 +521,9 @@
515
521
  handleClose,
516
522
  collections
517
523
  } = t0;
524
+ const {
525
+ t
526
+ } = core.useTranslation();
518
527
  const {
519
528
  saveRole
520
529
  } = useUserManagement();
@@ -524,34 +533,35 @@
524
533
  } = core.useAuthController();
525
534
  const [savingError, setSavingError] = React.useState();
526
535
  let t1;
527
- if ($[0] !== loggedInUser || $[1] !== saveRole) {
536
+ if ($[0] !== loggedInUser || $[1] !== saveRole || $[2] !== t) {
528
537
  t1 = (role_0) => {
529
538
  setSavingError(void 0);
530
539
  if (!loggedInUser) {
531
- throw new Error("User not found");
540
+ throw new Error(t("error_user_not_found"));
532
541
  }
533
- canRoleBeEdited(loggedInUser);
542
+ canRoleBeEdited(loggedInUser, t);
534
543
  return saveRole(role_0);
535
544
  };
536
545
  $[0] = loggedInUser;
537
546
  $[1] = saveRole;
538
- $[2] = t1;
547
+ $[2] = t;
548
+ $[3] = t1;
539
549
  } else {
540
- t1 = $[2];
550
+ t1 = $[3];
541
551
  }
542
552
  const onRoleUpdated = t1;
543
553
  let t2;
544
- if ($[3] !== role) {
554
+ if ($[4] !== role) {
545
555
  t2 = role ?? {
546
556
  name: ""
547
557
  };
548
- $[3] = role;
549
- $[4] = t2;
558
+ $[4] = role;
559
+ $[5] = t2;
550
560
  } else {
551
- t2 = $[4];
561
+ t2 = $[5];
552
562
  }
553
563
  let t3;
554
- if ($[5] !== handleClose || $[6] !== onRoleUpdated) {
564
+ if ($[6] !== handleClose || $[7] !== onRoleUpdated) {
555
565
  t3 = (role_1, formexController) => {
556
566
  try {
557
567
  return onRoleUpdated(role_1).then(() => {
@@ -568,26 +578,37 @@
568
578
  return Promise.resolve();
569
579
  }
570
580
  };
571
- $[5] = handleClose;
572
- $[6] = onRoleUpdated;
573
- $[7] = t3;
581
+ $[6] = handleClose;
582
+ $[7] = onRoleUpdated;
583
+ $[8] = t3;
574
584
  } else {
575
- t3 = $[7];
585
+ t3 = $[8];
576
586
  }
577
587
  let t4;
578
- if ($[8] !== t2 || $[9] !== t3) {
579
- 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 = {
580
600
  initialValues: t2,
581
601
  onSubmit: t3,
582
- validation: _temp3$1
602
+ validation: t4
583
603
  };
584
- $[8] = t2;
585
- $[9] = t3;
586
- $[10] = t4;
604
+ $[11] = t2;
605
+ $[12] = t3;
606
+ $[13] = t4;
607
+ $[14] = t5;
587
608
  } else {
588
- t4 = $[10];
609
+ t5 = $[14];
589
610
  }
590
- const formex$1 = formex.useCreateFormex(t4);
611
+ const formex$1 = formex.useCreateFormex(t5);
591
612
  const {
592
613
  isSubmitting,
593
614
  touched,
@@ -603,606 +624,1058 @@
603
624
  const defaultRead = values_0.defaultPermissions?.read ?? false;
604
625
  const defaultEdit = values_0.defaultPermissions?.edit ?? false;
605
626
  const defaultDelete = values_0.defaultPermissions?.delete ?? false;
606
- let t5;
607
- if ($[11] !== setFieldValue || $[12] !== touched || $[13] !== values_0.name) {
608
- t5 = () => {
627
+ let t6;
628
+ if ($[15] !== setFieldValue || $[16] !== touched || $[17] !== values_0.name) {
629
+ t6 = () => {
609
630
  const idTouched = formex.getIn(touched, "id");
610
631
  if (!idTouched && values_0.name) {
611
632
  setFieldValue("id", core.toSnakeCase(values_0.name));
612
633
  }
613
634
  };
614
- $[11] = setFieldValue;
615
- $[12] = touched;
616
- $[13] = values_0.name;
617
- $[14] = t5;
635
+ $[15] = setFieldValue;
636
+ $[16] = touched;
637
+ $[17] = values_0.name;
638
+ $[18] = t6;
618
639
  } else {
619
- t5 = $[14];
640
+ t6 = $[18];
620
641
  }
621
- let t6;
622
- if ($[15] !== touched || $[16] !== values_0.name) {
623
- t6 = [touched, values_0.name];
624
- $[15] = touched;
625
- $[16] = values_0.name;
626
- $[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;
627
648
  } else {
628
- t6 = $[17];
649
+ t7 = $[21];
629
650
  }
630
- React.useEffect(t5, t6);
631
- let t7;
632
- let t8;
633
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
634
- 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 = {
635
656
  display: "flex",
636
657
  flexDirection: "column",
637
658
  position: "relative",
638
659
  height: "100%"
639
660
  };
640
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: "Role" });
641
- $[18] = t7;
642
- $[19] = t8;
643
- } else {
644
- t7 = $[18];
645
- t8 = $[19];
646
- }
647
- const t9 = touched.name && Boolean(errors_0.name);
648
- const t10 = isAdmin || !editable;
649
- let t11;
650
- if ($[20] !== handleChange || $[21] !== t10 || $[22] !== t9 || $[23] !== values_0.name) {
651
- 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" });
652
- $[20] = handleChange;
653
- $[21] = t10;
654
661
  $[22] = t9;
655
- $[23] = values_0.name;
656
- $[24] = t11;
657
662
  } else {
658
- t11 = $[24];
663
+ t9 = $[22];
659
664
  }
660
- const t12 = touched.name && Boolean(errors_0.name) ? errors_0.name : "Name of this role";
661
- let t13;
662
- if ($[25] !== t12) {
663
- t13 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t12 });
664
- $[25] = t12;
665
- $[26] = t13;
665
+ let t10;
666
+ if ($[23] !== t) {
667
+ t10 = t("role");
668
+ $[23] = t;
669
+ $[24] = t10;
666
670
  } else {
667
- t13 = $[26];
671
+ t10 = $[24];
668
672
  }
669
- let t14;
670
- if ($[27] !== t11 || $[28] !== t13) {
671
- t14 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-8", children: [
672
- t11,
673
- t13
674
- ] });
675
- $[27] = t11;
676
- $[28] = t13;
677
- $[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;
678
678
  } else {
679
- t14 = $[29];
679
+ t11 = $[26];
680
680
  }
681
- const t15 = touched.id && Boolean(errors_0.id);
682
- const t16 = !isNewRole || !editable;
683
- let t17;
684
- if ($[30] !== handleChange || $[31] !== setFieldTouched) {
685
- t17 = (e_2) => {
686
- handleChange(e_2);
687
- setFieldTouched("id", true);
688
- };
689
- $[30] = handleChange;
690
- $[31] = setFieldTouched;
691
- $[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;
692
689
  } else {
693
- t17 = $[32];
690
+ t15 = $[28];
694
691
  }
695
- let t18;
696
- if ($[33] !== t15 || $[34] !== t16 || $[35] !== t17 || $[36] !== values_0.id) {
697
- 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" });
698
- $[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;
699
700
  $[34] = t16;
700
- $[35] = t17;
701
- $[36] = values_0.id;
702
- $[37] = t18;
703
701
  } else {
704
- t18 = $[37];
702
+ t16 = $[34];
705
703
  }
706
- const t19 = touched.id && Boolean(errors_0.id) ? errors_0.id : "ID of this role";
707
- let t20;
708
- if ($[38] !== t19) {
709
- t20 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t19 });
710
- $[38] = t19;
711
- $[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;
712
711
  } else {
713
- t20 = $[39];
712
+ t17 = $[38];
714
713
  }
715
- let t21;
716
- if ($[40] !== t18 || $[41] !== t20) {
717
- t21 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
718
- t18,
719
- t20
720
- ] });
714
+ let t18;
715
+ if ($[39] !== t17) {
716
+ t18 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t17 });
717
+ $[39] = t17;
721
718
  $[40] = t18;
722
- $[41] = t20;
723
- $[42] = t21;
724
719
  } else {
725
- t21 = $[42];
720
+ t18 = $[40];
726
721
  }
727
- let t22;
728
- if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
729
- t22 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { className: "rounded-md", children: [
730
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, {}),
731
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Create entities" }),
732
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Read entities" }),
733
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Update entities" }),
734
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: "Delete entities" }),
735
- /* @__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
736
727
  ] });
737
- $[43] = t22;
728
+ $[41] = t16;
729
+ $[42] = t18;
730
+ $[43] = t19;
738
731
  } else {
739
- t22 = $[43];
732
+ t19 = $[43];
740
733
  }
734
+ const t20 = touched.id && Boolean(errors_0.id);
735
+ const t21 = values_0.id;
736
+ const t22 = !isNewRole || !editable;
741
737
  let t23;
742
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
743
- t23 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "All collections" }) });
744
- $[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;
745
746
  } else {
746
- 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];
747
768
  }
748
- const t24 = isAdmin || !editable;
749
- const t25 = (isAdmin || defaultCreate) ?? false;
750
769
  let t26;
751
- if ($[45] !== setFieldValue) {
752
- t26 = (checked) => setFieldValue("defaultPermissions.create", checked);
753
- $[45] = setFieldValue;
754
- $[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;
755
776
  } else {
756
- t26 = $[46];
777
+ t26 = $[58];
757
778
  }
758
779
  let t27;
759
- if ($[47] !== t24 || $[48] !== t25 || $[49] !== t26) {
760
- 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 }) }) });
761
- $[47] = t24;
762
- $[48] = t25;
763
- $[49] = t26;
764
- $[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;
765
796
  } else {
766
- 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];
767
805
  }
768
- const t28 = isAdmin || !editable;
769
- const t29 = (isAdmin || defaultRead) ?? false;
770
806
  let t30;
771
- if ($[51] !== setFieldValue) {
772
- t30 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
773
- $[51] = setFieldValue;
774
- $[52] = t30;
807
+ if ($[65] !== t) {
808
+ t30 = t("create_entities");
809
+ $[65] = t;
810
+ $[66] = t30;
775
811
  } else {
776
- t30 = $[52];
812
+ t30 = $[66];
777
813
  }
778
814
  let t31;
779
- if ($[53] !== t28 || $[54] !== t29 || $[55] !== t30) {
780
- 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 }) }) });
781
- $[53] = t28;
782
- $[54] = t29;
783
- $[55] = t30;
784
- $[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;
785
835
  } else {
786
- t31 = $[56];
836
+ t33 = $[72];
787
837
  }
788
- const t32 = isAdmin || !editable;
789
- const t33 = (isAdmin || defaultEdit) ?? false;
790
838
  let t34;
791
- if ($[57] !== setFieldValue) {
792
- t34 = (checked_1) => setFieldValue("defaultPermissions.edit", checked_1);
793
- $[57] = setFieldValue;
794
- $[58] = t34;
839
+ if ($[73] !== t) {
840
+ t34 = t("update_entities");
841
+ $[73] = t;
842
+ $[74] = t34;
795
843
  } else {
796
- t34 = $[58];
844
+ t34 = $[74];
797
845
  }
798
846
  let t35;
799
- if ($[59] !== t32 || $[60] !== t33 || $[61] !== t34) {
800
- 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 }) }) });
801
- $[59] = t32;
802
- $[60] = t33;
803
- $[61] = t34;
804
- $[62] = t35;
847
+ if ($[75] !== t34) {
848
+ t35 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t34 });
849
+ $[75] = t34;
850
+ $[76] = t35;
805
851
  } else {
806
- t35 = $[62];
852
+ t35 = $[76];
853
+ }
854
+ let t36;
855
+ if ($[77] !== t) {
856
+ t36 = t("delete_entities");
857
+ $[77] = t;
858
+ $[78] = t36;
859
+ } else {
860
+ t36 = $[78];
861
+ }
862
+ let t37;
863
+ if ($[79] !== t36) {
864
+ t37 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: t36 });
865
+ $[79] = t36;
866
+ $[80] = t37;
867
+ } else {
868
+ t37 = $[80];
807
869
  }
808
- const t36 = isAdmin || !editable;
809
- const t37 = (isAdmin || defaultDelete) ?? false;
810
870
  let t38;
811
- if ($[63] !== setFieldValue) {
812
- t38 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
813
- $[63] = setFieldValue;
814
- $[64] = t38;
871
+ if ($[81] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
872
+ t38 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" });
873
+ $[81] = t38;
815
874
  } else {
816
- t38 = $[64];
875
+ t38 = $[81];
817
876
  }
818
877
  let t39;
819
- if ($[65] !== t36 || $[66] !== t37 || $[67] !== t38) {
820
- 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 }) }) });
821
- $[65] = t36;
822
- $[66] = t37;
823
- $[67] = t38;
824
- $[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;
825
892
  } else {
826
- t39 = $[68];
893
+ t39 = $[86];
827
894
  }
828
895
  let t40;
829
- if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
830
- t40 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center" });
831
- $[69] = t40;
896
+ if ($[87] !== t) {
897
+ t40 = t("all_collections");
898
+ $[87] = t;
899
+ $[88] = t40;
832
900
  } else {
833
- t40 = $[69];
901
+ t40 = $[88];
834
902
  }
835
903
  let t41;
836
- if ($[70] !== t27 || $[71] !== t31 || $[72] !== t35 || $[73] !== t39) {
837
- t41 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
838
- t23,
839
- t27,
840
- t31,
841
- t35,
842
- t39,
843
- t40
844
- ] });
845
- $[70] = t27;
846
- $[71] = t31;
847
- $[72] = t35;
848
- $[73] = t39;
849
- $[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;
850
908
  } else {
851
- t41 = $[74];
909
+ t41 = $[90];
852
910
  }
853
911
  let t42;
854
- if ($[75] !== collections || $[76] !== defaultCreate || $[77] !== defaultDelete || $[78] !== defaultEdit || $[79] !== defaultRead || $[80] !== editable || $[81] !== isAdmin || $[82] !== setFieldValue || $[83] !== values_0) {
855
- t42 = collections && collections.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { children: [
856
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { scope: "row", children: col.name }),
857
- /* @__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) }) }),
858
- /* @__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) }) }),
859
- /* @__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) }) }),
860
- /* @__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) }) }),
861
- /* @__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: () => {
862
- setFieldValue(`collectionPermissions.${col.id}.create`, true);
863
- setFieldValue(`collectionPermissions.${col.id}.read`, true);
864
- setFieldValue(`collectionPermissions.${col.id}.edit`, true);
865
- setFieldValue(`collectionPermissions.${col.id}.delete`, true);
866
- }, disabled: isAdmin || !editable, variant: "text", children: "All" }) }) })
867
- ] }, col.name));
868
- $[75] = collections;
869
- $[76] = defaultCreate;
870
- $[77] = defaultDelete;
871
- $[78] = defaultEdit;
872
- $[79] = defaultRead;
873
- $[80] = editable;
874
- $[81] = isAdmin;
875
- $[82] = setFieldValue;
876
- $[83] = values_0;
877
- $[84] = t42;
878
- } else {
879
- t42 = $[84];
880
- }
881
- let t43;
882
- if ($[85] !== t41 || $[86] !== t42) {
883
- t43 = /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { className: "bg-inherit overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full rounded-md", children: [
884
- t22,
885
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
886
- t41,
887
- t42
888
- ] })
889
- ] }) });
890
- $[85] = t41;
891
- $[86] = t42;
892
- $[87] = t43;
912
+ if ($[91] !== t) {
913
+ t42 = t("create_entities_in_collections");
914
+ $[91] = t;
915
+ $[92] = t42;
893
916
  } else {
894
- t43 = $[87];
917
+ t42 = $[92];
895
918
  }
896
- let t44;
897
- if ($[88] === Symbol.for("react.memo_cache_sentinel")) {
898
- 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" });
899
- $[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;
900
926
  } else {
901
- t44 = $[88];
927
+ t45 = $[94];
902
928
  }
903
- let t45;
904
- if ($[89] !== t43) {
905
- t45 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
906
- t43,
907
- t44
908
- ] });
909
- $[89] = t43;
910
- $[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;
911
936
  } else {
912
- t45 = $[90];
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;
945
+ } else {
946
+ t47 = $[101];
913
947
  }
914
- const t46 = touched.config && Boolean(errors_0.config);
915
- const t47 = isAdmin || !editable;
916
948
  let t48;
917
- if ($[91] !== setFieldValue) {
918
- t48 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
919
- $[91] = setFieldValue;
920
- $[92] = t48;
949
+ if ($[102] !== t) {
950
+ t48 = t("access_all_data_in_every_collection");
951
+ $[102] = t;
952
+ $[103] = t48;
921
953
  } else {
922
- t48 = $[92];
954
+ t48 = $[103];
923
955
  }
924
- const t49 = isAdmin || values_0.config?.createCollections ? "true" : "false";
925
- let t50;
956
+ const t49 = isAdmin || !editable;
957
+ const t50 = (isAdmin || defaultRead) ?? false;
926
958
  let t51;
927
- if ($[93] === Symbol.for("react.memo_cache_sentinel")) {
928
- t50 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
929
- t51 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
930
- $[93] = t50;
931
- $[94] = t51;
959
+ if ($[104] !== setFieldValue) {
960
+ t51 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
961
+ $[104] = setFieldValue;
962
+ $[105] = t51;
932
963
  } else {
933
- t50 = $[93];
934
- t51 = $[94];
964
+ t51 = $[105];
935
965
  }
936
966
  let t52;
937
- if ($[95] !== t46 || $[96] !== t47 || $[97] !== t48 || $[98] !== t49) {
938
- 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: [
939
- t50,
940
- t51
941
- ] });
942
- $[95] = t46;
943
- $[96] = t47;
944
- $[97] = t48;
945
- $[98] = t49;
946
- $[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;
947
982
  } else {
948
- t52 = $[99];
983
+ t53 = $[112];
949
984
  }
950
- const t53 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user create collections";
951
985
  let t54;
952
- if ($[100] !== t53) {
953
- t54 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t53 });
954
- $[100] = t53;
955
- $[101] = t54;
956
- } else {
957
- t54 = $[101];
958
- }
959
- let t55;
960
- if ($[102] !== t52 || $[103] !== t54) {
961
- t55 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
962
- t52,
963
- t54
964
- ] });
965
- $[102] = t52;
966
- $[103] = t54;
967
- $[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;
968
1000
  } else {
969
- t55 = $[104];
1001
+ t57 = $[116];
970
1002
  }
971
- const t56 = touched.config && Boolean(errors_0.config);
972
- const t57 = isAdmin || !editable;
973
1003
  let t58;
974
- if ($[105] !== setFieldValue) {
975
- t58 = (event_0) => setFieldValue("config.editCollections", event_0.target.value === "own" ? "own" : event_0.target.value === "true");
976
- $[105] = setFieldValue;
977
- $[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;
978
1010
  } else {
979
- t58 = $[106];
1011
+ t58 = $[120];
1012
+ }
1013
+ let t59;
1014
+ if ($[121] !== t54 || $[122] !== t58) {
1015
+ t59 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t54, children: t58 }) });
1016
+ $[121] = t54;
1017
+ $[122] = t58;
1018
+ $[123] = t59;
1019
+ } else {
1020
+ t59 = $[123];
980
1021
  }
981
- const t59 = isAdmin ? "true" : values_0.config?.editCollections === "own" ? "own" : values_0.config?.editCollections ? "true" : "false";
982
1022
  let t60;
983
- let t61;
984
- let t62;
985
- if ($[107] === Symbol.for("react.memo_cache_sentinel")) {
986
- t60 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
987
- t61 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
988
- t62 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "own", children: " Only his/her own " });
989
- $[107] = t60;
990
- $[108] = t61;
991
- $[109] = t62;
992
- } else {
993
- t60 = $[107];
994
- t61 = $[108];
995
- 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];
996
1029
  }
1030
+ const t61 = isAdmin || !editable;
1031
+ const t62 = (isAdmin || defaultDelete) ?? false;
997
1032
  let t63;
998
- if ($[110] !== t56 || $[111] !== t57 || $[112] !== t58 || $[113] !== t59) {
999
- 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: [
1000
- t60,
1001
- t61,
1002
- t62
1003
- ] });
1004
- $[110] = t56;
1005
- $[111] = t57;
1006
- $[112] = t58;
1007
- $[113] = t59;
1008
- $[114] = t63;
1033
+ if ($[126] !== setFieldValue) {
1034
+ t63 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
1035
+ $[126] = setFieldValue;
1036
+ $[127] = t63;
1037
+ } else {
1038
+ t63 = $[127];
1039
+ }
1040
+ let t64;
1041
+ if ($[128] !== t61 || $[129] !== t62 || $[130] !== t63) {
1042
+ t64 = /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { disabled: t61, checked: t62, onCheckedChange: t63 });
1043
+ $[128] = t61;
1044
+ $[129] = t62;
1045
+ $[130] = t63;
1046
+ $[131] = t64;
1009
1047
  } else {
1010
- t63 = $[114];
1048
+ t64 = $[131];
1011
1049
  }
1012
- const t64 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user edit collections";
1013
1050
  let t65;
1014
- if ($[115] !== t64) {
1015
- t65 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t64 });
1016
- $[115] = t64;
1017
- $[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;
1018
1056
  } else {
1019
- t65 = $[116];
1057
+ t65 = $[134];
1020
1058
  }
1021
1059
  let t66;
1022
- if ($[117] !== t63 || $[118] !== t65) {
1023
- t66 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1024
- t63,
1025
- 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
1026
1075
  ] });
1027
- $[117] = t63;
1028
- $[118] = t65;
1029
- $[119] = t66;
1030
- } else {
1031
- 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];
1032
1113
  }
1033
- const t67 = touched.config && Boolean(errors_0.config);
1034
- const t68 = isAdmin || !editable;
1035
1114
  let t69;
1036
- if ($[120] !== setFieldValue) {
1037
- t69 = (event_1) => setFieldValue("config.deleteCollections", event_1.target.value === "own" ? "own" : event_1.target.value === "true");
1038
- $[120] = setFieldValue;
1039
- $[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;
1040
1123
  } else {
1041
- 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];
1042
1137
  }
1043
- const t70 = isAdmin ? "true" : values_0.config?.deleteCollections === "own" ? "own" : values_0.config?.deleteCollections ? "true" : "false";
1044
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
+ }
1045
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
+ }
1046
1154
  let t73;
1047
- if ($[122] === Symbol.for("react.memo_cache_sentinel")) {
1048
- t71 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "true", children: " Yes " });
1049
- t72 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "false", children: " No " });
1050
- t73 = /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: "own", children: " Only his/her own " });
1051
- $[122] = t71;
1052
- $[123] = t72;
1053
- $[124] = t73;
1054
- } else {
1055
- t71 = $[122];
1056
- t72 = $[123];
1057
- t73 = $[124];
1058
- }
1059
- let t74;
1060
- if ($[125] !== t67 || $[126] !== t68 || $[127] !== t69 || $[128] !== t70) {
1061
- 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: [
1062
- t71,
1063
- t72,
1064
- t73
1155
+ if ($[163] !== t70 || $[164] !== t72) {
1156
+ t73 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1157
+ t70,
1158
+ t72
1065
1159
  ] });
1066
- $[125] = t67;
1067
- $[126] = t68;
1068
- $[127] = t69;
1069
- $[128] = t70;
1070
- $[129] = t74;
1160
+ $[163] = t70;
1161
+ $[164] = t72;
1162
+ $[165] = t73;
1071
1163
  } else {
1072
- t74 = $[129];
1164
+ t73 = $[165];
1073
1165
  }
1074
- const t75 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user delete collections";
1075
- let t76;
1076
- if ($[130] !== t75) {
1077
- t76 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t75 });
1078
- $[130] = t75;
1079
- $[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;
1080
1172
  } else {
1081
- t76 = $[131];
1173
+ t75 = $[167];
1082
1174
  }
1175
+ const t76 = isAdmin || !editable;
1083
1176
  let t77;
1084
- if ($[132] !== t74 || $[133] !== t76) {
1085
- t77 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1086
- t74,
1087
- t76
1088
- ] });
1089
- $[132] = t74;
1090
- $[133] = t76;
1091
- $[134] = t77;
1092
- } else {
1093
- t77 = $[134];
1094
- }
1095
- let t78;
1096
- if ($[135] !== t14 || $[136] !== t21 || $[137] !== t45 || $[138] !== t55 || $[139] !== t66 || $[140] !== t77) {
1097
- t78 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1098
- t14,
1099
- t21,
1100
- t45,
1101
- t55,
1102
- t66,
1103
- t77
1104
- ] }) });
1105
- $[135] = t14;
1106
- $[136] = t21;
1107
- $[137] = t45;
1108
- $[138] = t55;
1109
- $[139] = t66;
1110
- $[140] = t77;
1111
- $[141] = t78;
1177
+ if ($[168] !== setFieldValue) {
1178
+ t77 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
1179
+ $[168] = setFieldValue;
1180
+ $[169] = t77;
1112
1181
  } else {
1113
- t78 = $[141];
1182
+ t77 = $[169];
1114
1183
  }
1184
+ const t78 = isAdmin || values_0.config?.createCollections ? "true" : "false";
1115
1185
  let t79;
1116
- if ($[142] !== savingError) {
1117
- 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" });
1118
- $[142] = savingError;
1119
- $[143] = t79;
1186
+ if ($[170] !== t) {
1187
+ t79 = (value) => value === "true" ? t("yes") : t("no");
1188
+ $[170] = t;
1189
+ $[171] = t79;
1120
1190
  } else {
1121
- t79 = $[143];
1191
+ t79 = $[171];
1122
1192
  }
1123
1193
  let t80;
1124
- if ($[144] !== handleClose) {
1125
- t80 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", color: "primary", onClick: () => {
1126
- handleClose();
1127
- }, children: "Cancel" });
1128
- $[144] = handleClose;
1129
- $[145] = t80;
1194
+ if ($[172] !== t) {
1195
+ t80 = t("yes");
1196
+ $[172] = t;
1197
+ $[173] = t80;
1130
1198
  } else {
1131
- 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];
1132
1220
  }
1133
- const t81 = !dirty;
1134
- const t82 = isNewRole ? "Create role" : "Update";
1135
1221
  let t83;
1136
- if ($[146] !== isSubmitting || $[147] !== t81 || $[148] !== t82) {
1137
- t83 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", color: "primary", type: "submit", disabled: t81, loading: isSubmitting, children: t82 });
1138
- $[146] = isSubmitting;
1139
- $[147] = t81;
1140
- $[148] = t82;
1141
- $[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;
1142
1230
  } else {
1143
- t83 = $[149];
1231
+ t83 = $[179];
1144
1232
  }
1145
1233
  let t84;
1146
- if ($[150] !== t79 || $[151] !== t80 || $[152] !== t83) {
1147
- t84 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { position: "sticky", children: [
1148
- t79,
1149
- 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,
1150
1237
  t83
1151
1238
  ] });
1152
- $[150] = t79;
1153
- $[151] = t80;
1154
- $[152] = t83;
1155
- $[153] = t84;
1156
- } else {
1157
- 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];
1158
1250
  }
1159
1251
  let t85;
1160
- if ($[154] !== formex$1.handleSubmit || $[155] !== t78 || $[156] !== t84) {
1161
- t85 = /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, autoComplete: "off", onSubmit: formex$1.handleSubmit, style: t7, children: [
1162
- t8,
1163
- t78,
1164
- t84
1165
- ] });
1166
- $[154] = formex$1.handleSubmit;
1167
- $[155] = t78;
1168
- $[156] = t84;
1169
- $[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;
1170
1258
  } else {
1171
- t85 = $[157];
1259
+ t85 = $[192];
1172
1260
  }
1173
1261
  let t86;
1174
- if ($[158] !== formex$1 || $[159] !== t85) {
1175
- t86 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t85 });
1176
- $[158] = formex$1;
1177
- $[159] = t85;
1178
- $[160] = t86;
1262
+ if ($[193] !== t85) {
1263
+ t86 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t85 });
1264
+ $[193] = t85;
1265
+ $[194] = t86;
1179
1266
  } else {
1180
- t86 = $[160];
1267
+ t86 = $[194];
1181
1268
  }
1182
1269
  let t87;
1183
- if ($[161] !== open || $[162] !== t86) {
1184
- t87 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, maxWidth: "4xl", children: t86 });
1185
- $[161] = open;
1186
- $[162] = t86;
1187
- $[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;
1188
1325
  } else {
1189
- t87 = $[163];
1326
+ t95 = $[207];
1190
1327
  }
1191
- return t87;
1192
- }
1193
- function _temp6$1(value_1) {
1194
- return value_1 === "own" ? "Own" : value_1 === "true" ? "Yes" : "No";
1195
- }
1196
- function _temp5$1(value_0) {
1197
- return value_0 === "own" ? "Own" : value_0 === "true" ? "Yes" : "No";
1198
- }
1199
- function _temp4$1(value) {
1200
- return value === "true" ? "Yes" : "No";
1201
- }
1202
- function _temp3$1(values) {
1203
- return RoleYupSchema.validate(values, {
1204
- abortEarly: false
1205
- }).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;
1206
1679
  }
1207
1680
  function _temp2$1(e_1) {
1208
1681
  const errors = {};
@@ -1245,11 +1718,14 @@
1245
1718
  }
1246
1719
  }];
1247
1720
  function RolesTable(t0) {
1248
- const $ = reactCompilerRuntime.c(25);
1721
+ const $ = reactCompilerRuntime.c(54);
1249
1722
  const {
1250
1723
  onRoleClicked,
1251
1724
  editable
1252
1725
  } = t0;
1726
+ const {
1727
+ t
1728
+ } = core.useTranslation();
1253
1729
  const {
1254
1730
  roles,
1255
1731
  saveRole,
@@ -1259,20 +1735,78 @@
1259
1735
  const [roleToBeDeleted, setRoleToBeDeleted] = React.useState(void 0);
1260
1736
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
1261
1737
  let t1;
1262
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1263
- t1 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
1264
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "w-16" }),
1265
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: "Role" }),
1266
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "items-center", children: "Is Admin" }),
1267
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, children: "Default permissions" })
1268
- ] });
1738
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1739
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { header: true, className: "w-16" });
1269
1740
  $[0] = t1;
1270
1741
  } else {
1271
1742
  t1 = $[0];
1272
1743
  }
1273
1744
  let t2;
1274
- if ($[1] !== editable || $[2] !== onRoleClicked || $[3] !== roles) {
1275
- 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) => {
1276
1810
  const canCreateAll = role.isAdmin || role.defaultPermissions?.create;
1277
1811
  const canReadAll = role.isAdmin || role.defaultPermissions?.read;
1278
1812
  const canUpdateAll = role.isAdmin || role.defaultPermissions?.edit;
@@ -1282,63 +1816,74 @@
1282
1816
  }, children: [
1283
1817
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { style: {
1284
1818
  width: "64px"
1285
- }, 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) => {
1286
1820
  event.stopPropagation();
1287
1821
  return setRoleToBeDeleted(role);
1288
1822
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}) }) }) }),
1289
1823
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role }) }),
1290
1824
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "items-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { checked: role.isAdmin ?? false }) }),
1291
1825
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { children: [
1292
- canCreateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Create" }),
1293
- canReadAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Read" }),
1294
- canUpdateAll && /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Update" }),
1295
- 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") })
1296
1830
  ] }) })
1297
1831
  ] }, role.name);
1298
1832
  });
1299
- $[1] = editable;
1300
- $[2] = onRoleClicked;
1301
- $[3] = roles;
1302
- $[4] = t2;
1833
+ $[17] = editable;
1834
+ $[18] = onRoleClicked;
1835
+ $[19] = roles;
1836
+ $[20] = t;
1837
+ $[21] = t9;
1303
1838
  } else {
1304
- t2 = $[4];
1839
+ t9 = $[21];
1305
1840
  }
1306
- let t3;
1307
- if ($[5] !== allowDefaultRolesCreation || $[6] !== roles || $[7] !== saveRole) {
1308
- 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: [
1309
- /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You don't have any roles yet." }),
1310
- allowDefaultRolesCreation && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outlined", onClick: () => {
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") }),
1845
+ allowDefaultRolesCreation && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
1311
1846
  DEFAULT_ROLES.forEach((role_0) => {
1312
1847
  saveRole(role_0);
1313
1848
  });
1314
- }, children: "Create default roles" })
1849
+ }, children: t("create_default_roles") })
1315
1850
  ] }) }) });
1316
- $[5] = allowDefaultRolesCreation;
1317
- $[6] = roles;
1318
- $[7] = saveRole;
1319
- $[8] = t3;
1851
+ $[22] = allowDefaultRolesCreation;
1852
+ $[23] = roles;
1853
+ $[24] = saveRole;
1854
+ $[25] = t;
1855
+ $[26] = t10;
1320
1856
  } else {
1321
- t3 = $[8];
1857
+ t10 = $[26];
1322
1858
  }
1323
- let t4;
1324
- if ($[9] !== t2 || $[10] !== t3) {
1325
- t4 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
1326
- t1,
1327
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1328
- t2,
1329
- t3
1330
- ] })
1859
+ let t11;
1860
+ if ($[27] !== t10 || $[28] !== t9) {
1861
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1862
+ t9,
1863
+ t10
1331
1864
  ] });
1332
- $[9] = t2;
1333
- $[10] = t3;
1334
- $[11] = t4;
1865
+ $[27] = t10;
1866
+ $[28] = t9;
1867
+ $[29] = t11;
1335
1868
  } else {
1336
- t4 = $[11];
1869
+ t11 = $[29];
1337
1870
  }
1338
- const t5 = Boolean(roleToBeDeleted);
1339
- let t6;
1340
- if ($[12] !== deleteRole || $[13] !== roleToBeDeleted) {
1341
- 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 = () => {
1342
1887
  if (roleToBeDeleted) {
1343
1888
  setDeleteInProgress(true);
1344
1889
  deleteRole(roleToBeDeleted).then(() => {
@@ -1348,65 +1893,94 @@
1348
1893
  });
1349
1894
  }
1350
1895
  };
1351
- $[12] = deleteRole;
1352
- $[13] = roleToBeDeleted;
1353
- $[14] = t6;
1896
+ $[33] = deleteRole;
1897
+ $[34] = roleToBeDeleted;
1898
+ $[35] = t14;
1354
1899
  } else {
1355
- t6 = $[14];
1900
+ t14 = $[35];
1356
1901
  }
1357
- let t7;
1358
- let t8;
1359
- let t9;
1360
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1361
- t7 = () => {
1902
+ let t15;
1903
+ if ($[36] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1904
+ t15 = () => {
1362
1905
  setRoleToBeDeleted(void 0);
1363
1906
  };
1364
- t8 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Delete?" });
1365
- t9 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Are you sure you want to delete this role?" });
1366
- $[15] = t7;
1367
- $[16] = t8;
1368
- $[17] = t9;
1907
+ $[36] = t15;
1369
1908
  } else {
1370
- t7 = $[15];
1371
- t8 = $[16];
1372
- t9 = $[17];
1909
+ t15 = $[36];
1373
1910
  }
1374
- let t10;
1375
- if ($[18] !== deleteInProgress || $[19] !== t5 || $[20] !== t6) {
1376
- t10 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1377
- $[18] = deleteInProgress;
1378
- $[19] = t5;
1379
- $[20] = t6;
1380
- $[21] = t10;
1911
+ let t16;
1912
+ if ($[37] !== t) {
1913
+ t16 = t("delete_confirmation_title");
1914
+ $[37] = t;
1915
+ $[38] = t16;
1381
1916
  } else {
1382
- t10 = $[21];
1917
+ t16 = $[38];
1383
1918
  }
1384
- let t11;
1385
- if ($[22] !== t10 || $[23] !== t4) {
1386
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full overflow-auto", children: [
1387
- t4,
1388
- 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
1389
1960
  ] });
1390
- $[22] = t10;
1391
- $[23] = t4;
1392
- $[24] = t11;
1961
+ $[51] = t12;
1962
+ $[52] = t20;
1963
+ $[53] = t21;
1393
1964
  } else {
1394
- t11 = $[24];
1965
+ t21 = $[53];
1395
1966
  }
1396
- return t11;
1967
+ return t21;
1397
1968
  }
1398
1969
  const RolesView = React.memo(function RolesView2(t0) {
1399
- const $ = reactCompilerRuntime.c(13);
1970
+ const $ = reactCompilerRuntime.c(25);
1400
1971
  const {
1401
1972
  children
1402
1973
  } = t0;
1974
+ const {
1975
+ t
1976
+ } = core.useTranslation();
1403
1977
  const {
1404
1978
  collections
1405
1979
  } = core.useNavigationController();
1406
1980
  const [dialogOpen, setDialogOpen] = React.useState(false);
1407
1981
  const [selectedRole, setSelectedRole] = React.useState();
1408
1982
  let t1;
1409
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1983
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1410
1984
  t1 = (user) => {
1411
1985
  setDialogOpen(true);
1412
1986
  setSelectedRole(user);
@@ -1417,7 +1991,7 @@
1417
1991
  }
1418
1992
  const onRoleClicked = t1;
1419
1993
  let t2;
1420
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1994
+ if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1421
1995
  t2 = () => {
1422
1996
  setSelectedRole(void 0);
1423
1997
  setDialogOpen(false);
@@ -1428,79 +2002,124 @@
1428
2002
  }
1429
2003
  const handleClose = t2;
1430
2004
  let t3;
1431
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1432
- t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Roles" });
1433
- $[2] = t3;
2005
+ if ($[2] !== t) {
2006
+ t3 = t("roles");
2007
+ $[2] = t;
2008
+ $[3] = t3;
1434
2009
  } else {
1435
- t3 = $[2];
2010
+ t3 = $[3];
1436
2011
  }
1437
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
+ }
1438
2020
  let t5;
1439
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1440
- t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1441
- t3,
1442
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
1443
- ] });
1444
- t5 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
1445
- $[3] = t4;
1446
- $[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;
1447
2027
  } else {
1448
- t4 = $[3];
1449
- t5 = $[4];
2028
+ t5 = $[6];
2029
+ t6 = $[7];
1450
2030
  }
1451
- const t6 = selectedRole?.id ?? "new";
1452
2031
  let t7;
1453
- if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
1454
- t7 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
1455
- $[5] = collections;
1456
- $[6] = dialogOpen;
1457
- $[7] = selectedRole;
1458
- $[8] = t6;
2032
+ if ($[8] !== t) {
2033
+ t7 = t("add_role");
2034
+ $[8] = t;
1459
2035
  $[9] = t7;
1460
2036
  } else {
1461
2037
  t7 = $[9];
1462
2038
  }
1463
2039
  let t8;
1464
- if ($[10] !== children || $[11] !== t7) {
1465
- t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1466
- 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: [
1467
2050
  t4,
1468
- t5,
1469
- t7
2051
+ t8
1470
2052
  ] });
1471
- $[10] = children;
1472
- $[11] = t7;
1473
- $[12] = t8;
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;
1474
2075
  } else {
1475
- t8 = $[12];
2076
+ t12 = $[20];
1476
2077
  }
1477
- return t8;
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
2085
+ ] });
2086
+ $[21] = children;
2087
+ $[22] = t12;
2088
+ $[23] = t9;
2089
+ $[24] = t13;
2090
+ } else {
2091
+ t13 = $[24];
2092
+ }
2093
+ return t13;
1478
2094
  });
1479
- const UserYupSchema = Yup__namespace.object().shape({
1480
- displayName: Yup__namespace.string().required("Required"),
1481
- 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")),
1482
2098
  roles: Yup__namespace.array().min(1)
1483
2099
  });
1484
- function canUserBeEdited(loggedUser, user, users, roles, prevUser) {
2100
+ function canUserBeEdited(loggedUser, user, users, roles, t, prevUser) {
1485
2101
  const admins = users.filter((u) => u.roles?.map((r) => r.id).includes("admin"));
1486
2102
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
1487
2103
  const didRolesChange = !prevUser || !areRolesEqual(prevUser.roles ?? [], user.roles ?? []);
1488
2104
  if (didRolesChange && !loggedUserIsAdmin) {
1489
- throw new Error("Only admins can change roles");
2105
+ throw new Error(t("only_admins_change_roles"));
1490
2106
  }
1491
2107
  const adminRoleRemoved = prevUser && prevUser.roles?.map((r) => r.id).includes("admin") && !user.roles?.map((r) => r.id).includes("admin");
1492
2108
  if (adminRoleRemoved && admins.length === 1) {
1493
- throw new Error("There must be at least one admin");
2109
+ throw new Error(t("must_be_at_least_one_admin"));
1494
2110
  }
1495
2111
  return true;
1496
2112
  }
1497
2113
  function UserDetailsForm(t0) {
1498
- const $ = reactCompilerRuntime.c(73);
2114
+ const $ = reactCompilerRuntime.c(114);
1499
2115
  const {
1500
2116
  open,
1501
2117
  user: userProp,
1502
2118
  handleClose
1503
2119
  } = t0;
2120
+ const {
2121
+ t
2122
+ } = core.useTranslation();
1504
2123
  const snackbarController = core.useSnackbarController();
1505
2124
  const {
1506
2125
  user: loggedInUser
@@ -1512,13 +2131,13 @@
1512
2131
  } = useUserManagement();
1513
2132
  const isNewUser = !userProp;
1514
2133
  let t1;
1515
- 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) {
1516
2135
  t1 = (savedUser) => {
1517
2136
  if (!loggedInUser) {
1518
- throw new Error("Logged user not found");
2137
+ throw new Error(t("logged_user_not_found"));
1519
2138
  }
1520
2139
  try {
1521
- canUserBeEdited(loggedInUser, savedUser, users, roles, userProp);
2140
+ canUserBeEdited(loggedInUser, savedUser, users, roles, t, userProp);
1522
2141
  return saveUser(savedUser);
1523
2142
  } catch (t210) {
1524
2143
  const e = t210;
@@ -1528,29 +2147,40 @@
1528
2147
  $[0] = loggedInUser;
1529
2148
  $[1] = roles;
1530
2149
  $[2] = saveUser;
1531
- $[3] = userProp;
1532
- $[4] = users;
1533
- $[5] = t1;
2150
+ $[3] = t;
2151
+ $[4] = userProp;
2152
+ $[5] = users;
2153
+ $[6] = t1;
1534
2154
  } else {
1535
- t1 = $[5];
2155
+ t1 = $[6];
1536
2156
  }
1537
2157
  const onUserUpdated = t1;
1538
2158
  let t2;
1539
- if ($[6] !== roles || $[7] !== userProp) {
2159
+ if ($[7] !== roles || $[8] !== userProp) {
1540
2160
  t2 = userProp ?? {
1541
2161
  displayName: "",
1542
2162
  email: "",
1543
2163
  roles: roles.filter(_temp$2)
1544
2164
  };
1545
- $[6] = roles;
1546
- $[7] = userProp;
1547
- $[8] = t2;
2165
+ $[7] = roles;
2166
+ $[8] = userProp;
2167
+ $[9] = t2;
1548
2168
  } else {
1549
- t2 = $[8];
2169
+ t2 = $[9];
1550
2170
  }
1551
2171
  let t3;
1552
- if ($[9] !== handleClose || $[10] !== onUserUpdated || $[11] !== snackbarController) {
1553
- 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(() => {
1554
2184
  handleClose();
1555
2185
  formexController.resetForm({
1556
2186
  values: user
@@ -1561,27 +2191,28 @@
1561
2191
  message: e_1.message
1562
2192
  });
1563
2193
  });
1564
- $[9] = handleClose;
1565
- $[10] = onUserUpdated;
1566
- $[11] = snackbarController;
1567
- $[12] = t3;
2194
+ $[12] = handleClose;
2195
+ $[13] = onUserUpdated;
2196
+ $[14] = snackbarController;
2197
+ $[15] = t4;
1568
2198
  } else {
1569
- t3 = $[12];
1570
- }
1571
- let t4;
1572
- if ($[13] !== t2 || $[14] !== t3) {
1573
- t4 = {
2199
+ t4 = $[15];
2200
+ }
2201
+ let t5;
2202
+ if ($[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
2203
+ t5 = {
1574
2204
  initialValues: t2,
1575
- validation: _temp5,
1576
- onSubmit: t3
2205
+ validation: t3,
2206
+ onSubmit: t4
1577
2207
  };
1578
- $[13] = t2;
1579
- $[14] = t3;
1580
- $[15] = t4;
2208
+ $[16] = t2;
2209
+ $[17] = t3;
2210
+ $[18] = t4;
2211
+ $[19] = t5;
1581
2212
  } else {
1582
- t4 = $[15];
2213
+ t5 = $[19];
1583
2214
  }
1584
- const formex$1 = formex.useCreateFormex(t4);
2215
+ const formex$1 = formex.useCreateFormex(t5);
1585
2216
  const {
1586
2217
  isSubmitting,
1587
2218
  handleChange,
@@ -1592,225 +2223,335 @@
1592
2223
  handleSubmit,
1593
2224
  submitCount
1594
2225
  } = formex$1;
1595
- let t5;
1596
- if ($[16] !== handleClose) {
1597
- t5 = (open_0) => !open_0 ? handleClose() : void 0;
1598
- $[16] = handleClose;
1599
- $[17] = t5;
2226
+ let t6;
2227
+ if ($[20] !== handleClose) {
2228
+ t6 = (open_0) => !open_0 ? handleClose() : void 0;
2229
+ $[20] = handleClose;
2230
+ $[21] = t6;
1600
2231
  } else {
1601
- t5 = $[17];
2232
+ t6 = $[21];
1602
2233
  }
1603
- let t6;
1604
2234
  let t7;
1605
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1606
- t6 = {
2235
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2236
+ t7 = {
1607
2237
  display: "flex",
1608
2238
  flexDirection: "column",
1609
2239
  position: "relative",
1610
2240
  height: "100%"
1611
2241
  };
1612
- t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { variant: "h4", gutterBottom: false, children: "User" });
1613
- $[18] = t6;
1614
- $[19] = t7;
2242
+ $[22] = t7;
1615
2243
  } else {
1616
- t6 = $[18];
1617
- t7 = $[19];
2244
+ t7 = $[22];
1618
2245
  }
1619
- const t8 = submitCount > 0 && Boolean(errors.displayName);
1620
- const t9 = values_0.displayName ?? "";
1621
- let t10;
1622
- if ($[20] !== handleChange || $[21] !== t8 || $[22] !== t9) {
1623
- t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "displayName", required: true, error: t8, value: t9, onChange: handleChange, "aria-describedby": "name-helper-text", label: "Name" });
1624
- $[20] = handleChange;
1625
- $[21] = t8;
1626
- $[22] = t9;
1627
- $[23] = t10;
2246
+ let t8;
2247
+ if ($[23] !== t) {
2248
+ t8 = t("user");
2249
+ $[23] = t;
2250
+ $[24] = t8;
1628
2251
  } else {
1629
- t10 = $[23];
2252
+ t8 = $[24];
1630
2253
  }
1631
- const t11 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : "Name of this user";
1632
- let t12;
1633
- if ($[24] !== t11) {
1634
- t12 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t11 });
1635
- $[24] = t11;
1636
- $[25] = t12;
2254
+ let t9;
2255
+ if ($[25] !== t8) {
2256
+ t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { children: t8 });
2257
+ $[25] = t8;
2258
+ $[26] = t9;
1637
2259
  } else {
1638
- t12 = $[25];
2260
+ t9 = $[26];
1639
2261
  }
1640
- let t13;
1641
- if ($[26] !== t10 || $[27] !== t12) {
1642
- t13 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1643
- t10,
1644
- 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" }) }) })
1645
2273
  ] });
1646
- $[26] = t10;
1647
- $[27] = t12;
1648
- $[28] = t13;
2274
+ $[27] = isNewUser;
2275
+ $[28] = snackbarController;
2276
+ $[29] = t;
2277
+ $[30] = userProp;
2278
+ $[31] = t10;
1649
2279
  } else {
1650
- t13 = $[28];
2280
+ t10 = $[31];
1651
2281
  }
1652
- const t14 = submitCount > 0 && Boolean(errors.email);
1653
- const t15 = values_0.email ?? "";
1654
- let t16;
1655
- if ($[29] !== handleChange || $[30] !== t14 || $[31] !== t15) {
1656
- t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { required: true, error: t14, name: "email", value: t15, onChange: handleChange, "aria-describedby": "email-helper-text", label: "Email" });
1657
- $[29] = handleChange;
1658
- $[30] = t14;
1659
- $[31] = t15;
1660
- $[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;
1661
2291
  } else {
1662
- t16 = $[32];
2292
+ t11 = $[34];
1663
2293
  }
1664
- const t17 = submitCount > 0 && Boolean(errors.email) ? errors.email : "Email of this user";
1665
- let t18;
1666
- if ($[33] !== t17) {
1667
- t18 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t17 });
1668
- $[33] = t17;
1669
- $[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;
1670
2301
  } else {
1671
- t18 = $[34];
2302
+ t14 = $[36];
1672
2303
  }
1673
- let t19;
1674
- if ($[35] !== t16 || $[36] !== t18) {
1675
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
1676
- t16,
1677
- t18
1678
- ] });
1679
- $[35] = t16;
1680
- $[36] = t18;
1681
- $[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;
1682
2312
  } else {
1683
- t19 = $[37];
2313
+ t15 = $[41];
1684
2314
  }
1685
- let t20;
1686
- if ($[38] !== values_0.roles) {
1687
- t20 = values_0.roles?.map(_temp6) ?? [];
1688
- $[38] = values_0.roles;
1689
- $[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;
2322
+ } else {
2323
+ t16 = $[45];
2324
+ }
2325
+ let t17;
2326
+ if ($[46] !== t16) {
2327
+ t17 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t16 });
2328
+ $[46] = t16;
2329
+ $[47] = t17;
1690
2330
  } else {
1691
- t20 = $[39];
2331
+ t17 = $[47];
1692
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 ?? "";
1693
2347
  let t21;
1694
- if ($[40] !== roles || $[41] !== setFieldValue) {
1695
- t21 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
1696
- $[40] = roles;
1697
- $[41] = setFieldValue;
1698
- $[42] = t21;
2348
+ if ($[51] !== t) {
2349
+ t21 = t("email");
2350
+ $[51] = t;
2351
+ $[52] = t21;
1699
2352
  } else {
1700
- t21 = $[42];
2353
+ t21 = $[52];
1701
2354
  }
1702
2355
  let t22;
1703
- if ($[43] !== roles) {
1704
- t22 = roles.map(_temp7);
1705
- $[43] = roles;
1706
- $[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;
1707
2363
  } else {
1708
- t22 = $[44];
2364
+ t22 = $[57];
1709
2365
  }
1710
2366
  let t23;
1711
- if ($[45] !== t20 || $[46] !== t21 || $[47] !== t22) {
1712
- 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 }) });
1713
- $[45] = t20;
1714
- $[46] = t21;
1715
- $[47] = t22;
1716
- $[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;
1717
2373
  } else {
1718
- t23 = $[48];
2374
+ t23 = $[61];
1719
2375
  }
1720
2376
  let t24;
1721
- if ($[49] !== t13 || $[50] !== t19 || $[51] !== t23) {
1722
- t24 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1723
- t13,
1724
- t19,
1725
- t23
1726
- ] }) });
1727
- $[49] = t13;
1728
- $[50] = t19;
1729
- $[51] = t23;
1730
- $[52] = t24;
2377
+ if ($[62] !== t23) {
2378
+ t24 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t23 });
2379
+ $[62] = t23;
2380
+ $[63] = t24;
1731
2381
  } else {
1732
- t24 = $[52];
2382
+ t24 = $[63];
1733
2383
  }
1734
2384
  let t25;
1735
- if ($[53] !== handleClose) {
1736
- t25 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", color: "primary", onClick: () => {
1737
- handleClose();
1738
- }, children: "Cancel" });
1739
- $[53] = handleClose;
1740
- $[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;
1741
2393
  } else {
1742
- 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];
1743
2411
  }
1744
- const t26 = !dirty;
1745
- const t27 = isNewUser ? "Create user" : "Update";
1746
2412
  let t28;
1747
- if ($[55] !== isSubmitting || $[56] !== t26 || $[57] !== t27) {
1748
- t28 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", color: "primary", type: "submit", disabled: t26, loading: isSubmitting, children: t27 });
1749
- $[55] = isSubmitting;
1750
- $[56] = t26;
1751
- $[57] = t27;
1752
- $[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;
1753
2418
  } else {
1754
- t28 = $[58];
2419
+ t28 = $[73];
1755
2420
  }
1756
2421
  let t29;
1757
- if ($[59] !== t25 || $[60] !== t28) {
1758
- t29 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { children: [
1759
- t25,
1760
- t28
1761
- ] });
1762
- $[59] = t25;
1763
- $[60] = t28;
1764
- $[61] = t29;
2422
+ if ($[74] !== roles) {
2423
+ t29 = roles.map(_temp6);
2424
+ $[74] = roles;
2425
+ $[75] = t29;
1765
2426
  } else {
1766
- t29 = $[61];
2427
+ t29 = $[75];
1767
2428
  }
1768
2429
  let t30;
1769
- if ($[62] !== handleSubmit || $[63] !== t24 || $[64] !== t29) {
1770
- t30 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t6, children: [
1771
- t7,
1772
- t24,
1773
- t29
1774
- ] });
1775
- $[62] = handleSubmit;
1776
- $[63] = t24;
1777
- $[64] = t29;
1778
- $[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;
1779
2437
  } else {
1780
- t30 = $[65];
2438
+ t30 = $[80];
1781
2439
  }
1782
2440
  let t31;
1783
- if ($[66] !== formex$1 || $[67] !== t30) {
1784
- t31 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: t30 });
1785
- $[66] = formex$1;
1786
- $[67] = t30;
1787
- $[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;
1788
2451
  } else {
1789
- t31 = $[68];
2452
+ t31 = $[84];
1790
2453
  }
1791
2454
  let t32;
1792
- if ($[69] !== open || $[70] !== t31 || $[71] !== t5) {
1793
- t32 = /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: t5, maxWidth: "4xl", children: t31 });
1794
- $[69] = open;
1795
- $[70] = t31;
1796
- $[71] = t5;
1797
- $[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;
2534
+ } else {
2535
+ t40 = $[109];
2536
+ }
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;
1798
2544
  } else {
1799
- t32 = $[72];
2545
+ t41 = $[113];
1800
2546
  }
1801
- return t32;
2547
+ return t41;
1802
2548
  }
1803
- function _temp7(userRole) {
2549
+ function _temp6(userRole) {
1804
2550
  return /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelectItem, { value: userRole.id, children: /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id) }, userRole.id);
1805
2551
  }
1806
- function _temp6(r_0) {
2552
+ function _temp5(r_0) {
1807
2553
  return r_0.id;
1808
2554
  }
1809
- function _temp5(values) {
1810
- return UserYupSchema.validate(values, {
1811
- abortEarly: false
1812
- }).then(_temp2).catch(_temp4);
1813
- }
1814
2555
  function _temp4(e_0) {
1815
2556
  return e_0.inner.reduce(_temp3, {});
1816
2557
  }
@@ -1825,10 +2566,13 @@
1825
2566
  return r.id === "editor";
1826
2567
  }
1827
2568
  function UsersTable(t0) {
1828
- const $ = reactCompilerRuntime.c(28);
2569
+ const $ = reactCompilerRuntime.c(63);
1829
2570
  const {
1830
2571
  onUserClicked
1831
2572
  } = t0;
2573
+ const {
2574
+ t
2575
+ } = core.useTranslation();
1832
2576
  const {
1833
2577
  users,
1834
2578
  saveUser,
@@ -1842,21 +2586,104 @@
1842
2586
  const [userToBeDeleted, setUserToBeDeleted] = React.useState(void 0);
1843
2587
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
1844
2588
  let t1;
1845
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1846
- t1 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
1847
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "truncate w-16" }),
1848
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Email" }),
1849
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Name" }),
1850
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Roles" }),
1851
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Created on" })
1852
- ] });
2589
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2590
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" });
1853
2591
  $[0] = t1;
1854
2592
  } else {
1855
2593
  t1 = $[0];
1856
2594
  }
1857
2595
  let t2;
1858
- if ($[1] !== dateFormat || $[2] !== dateUtilsLocale || $[3] !== onUserClicked || $[4] !== users) {
1859
- 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) => {
1860
2687
  const userRoles = user.roles;
1861
2688
  const formattedDate = user.created_on ? dateFns.format(user.created_on, dateFormat, {
1862
2689
  locale: dateUtilsLocale
@@ -1864,29 +2691,34 @@
1864
2691
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { onClick: () => {
1865
2692
  onUserClicked(user);
1866
2693
  }, children: [
1867
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-10", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (event) => {
1868
- event.stopPropagation();
1869
- return setUserToBeDeleted(user);
1870
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}) }) }) }),
1871
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: user.email }),
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" }) }),
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
+ ] }) }),
1872
2699
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "font-medium align-left", children: user.displayName }),
1873
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 }),
1874
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate })
2701
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate }),
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) => {
2703
+ event.stopPropagation();
2704
+ return setUserToBeDeleted(user);
2705
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) }) }) })
1875
2706
  ] }, "row_" + user.uid);
1876
2707
  });
1877
- $[1] = dateFormat;
1878
- $[2] = dateUtilsLocale;
1879
- $[3] = onUserClicked;
1880
- $[4] = users;
1881
- $[5] = t2;
2708
+ $[23] = dateFormat;
2709
+ $[24] = dateUtilsLocale;
2710
+ $[25] = onUserClicked;
2711
+ $[26] = t;
2712
+ $[27] = users;
2713
+ $[28] = t12;
1882
2714
  } else {
1883
- t2 = $[5];
2715
+ t12 = $[28];
1884
2716
  }
1885
- let t3;
1886
- if ($[6] !== authController || $[7] !== saveUser || $[8] !== snackbarController || $[9] !== users) {
1887
- 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: [
1888
- /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "There are no users yet" }),
1889
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outlined", onClick: () => {
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") }),
2721
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
1890
2722
  if (!authController.user?.uid) {
1891
2723
  throw Error("UsersTable, authController misconfiguration");
1892
2724
  }
@@ -1913,35 +2745,45 @@
1913
2745
  message: "Error adding user: " + error.message
1914
2746
  });
1915
2747
  });
1916
- }, children: "Add the logged user as an admin" })
2748
+ }, children: t("add_logged_user_as_admin") })
1917
2749
  ] }) }) });
1918
- $[6] = authController;
1919
- $[7] = saveUser;
1920
- $[8] = snackbarController;
1921
- $[9] = users;
1922
- $[10] = t3;
2750
+ $[29] = authController;
2751
+ $[30] = saveUser;
2752
+ $[31] = snackbarController;
2753
+ $[32] = t;
2754
+ $[33] = users;
2755
+ $[34] = t13;
1923
2756
  } else {
1924
- t3 = $[10];
2757
+ t13 = $[34];
1925
2758
  }
1926
- let t4;
1927
- if ($[11] !== t2 || $[12] !== t3) {
1928
- t4 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "w-full", children: [
1929
- t1,
1930
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
1931
- t2,
1932
- t3
1933
- ] })
2759
+ let t14;
2760
+ if ($[35] !== t12 || $[36] !== t13) {
2761
+ t14 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableBody, { children: [
2762
+ t12,
2763
+ t13
1934
2764
  ] });
1935
- $[11] = t2;
1936
- $[12] = t3;
1937
- $[13] = t4;
2765
+ $[35] = t12;
2766
+ $[36] = t13;
2767
+ $[37] = t14;
1938
2768
  } else {
1939
- t4 = $[13];
2769
+ t14 = $[37];
1940
2770
  }
1941
- const t5 = Boolean(userToBeDeleted);
1942
- let t6;
1943
- if ($[14] !== deleteUser || $[15] !== snackbarController || $[16] !== userToBeDeleted) {
1944
- 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 = () => {
1945
2787
  if (userToBeDeleted) {
1946
2788
  setDeleteInProgress(true);
1947
2789
  deleteUser(userToBeDeleted).then(() => {
@@ -1956,68 +2798,97 @@
1956
2798
  });
1957
2799
  }
1958
2800
  };
1959
- $[14] = deleteUser;
1960
- $[15] = snackbarController;
1961
- $[16] = userToBeDeleted;
1962
- $[17] = t6;
2801
+ $[41] = deleteUser;
2802
+ $[42] = snackbarController;
2803
+ $[43] = userToBeDeleted;
2804
+ $[44] = t17;
1963
2805
  } else {
1964
- t6 = $[17];
2806
+ t17 = $[44];
1965
2807
  }
1966
- let t7;
1967
- let t8;
1968
- let t9;
1969
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1970
- t7 = () => {
2808
+ let t18;
2809
+ if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2810
+ t18 = () => {
1971
2811
  setUserToBeDeleted(void 0);
1972
2812
  };
1973
- t8 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Delete?" });
1974
- t9 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Are you sure you want to delete this user?" });
1975
- $[18] = t7;
1976
- $[19] = t8;
1977
- $[20] = t9;
2813
+ $[45] = t18;
1978
2814
  } else {
1979
- t7 = $[18];
1980
- t8 = $[19];
1981
- t9 = $[20];
2815
+ t18 = $[45];
1982
2816
  }
1983
- let t10;
1984
- if ($[21] !== deleteInProgress || $[22] !== t5 || $[23] !== t6) {
1985
- t10 = /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1986
- $[21] = deleteInProgress;
1987
- $[22] = t5;
1988
- $[23] = t6;
1989
- $[24] = t10;
2817
+ let t19;
2818
+ if ($[46] !== t) {
2819
+ t19 = t("delete_confirmation_title");
2820
+ $[46] = t;
2821
+ $[47] = t19;
1990
2822
  } else {
1991
- t10 = $[24];
2823
+ t19 = $[47];
1992
2824
  }
1993
- let t11;
1994
- if ($[25] !== t10 || $[26] !== t4) {
1995
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto", children: [
1996
- t4,
1997
- 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
1998
2866
  ] });
1999
- $[25] = t10;
2000
- $[26] = t4;
2001
- $[27] = t11;
2867
+ $[60] = t15;
2868
+ $[61] = t23;
2869
+ $[62] = t24;
2002
2870
  } else {
2003
- t11 = $[27];
2871
+ t24 = $[62];
2004
2872
  }
2005
- return t11;
2873
+ return t24;
2006
2874
  }
2007
2875
  function _temp$1(userRole) {
2008
2876
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2009
2877
  }
2010
2878
  const UsersView = function UsersView2(t0) {
2011
- const $ = reactCompilerRuntime.c(13);
2879
+ const $ = reactCompilerRuntime.c(24);
2012
2880
  const {
2013
2881
  children
2014
2882
  } = t0;
2883
+ const {
2884
+ t
2885
+ } = core.useTranslation();
2015
2886
  const [dialogOpen, setDialogOpen] = React.useState(false);
2016
2887
  const [selectedUser, setSelectedUser] = React.useState();
2017
2888
  const [newFormKey, setNewFormKey] = React.useState(0);
2018
2889
  useUserManagement();
2019
2890
  let t1;
2020
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2891
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2021
2892
  t1 = (user) => {
2022
2893
  setSelectedUser(user);
2023
2894
  setDialogOpen(true);
@@ -2028,7 +2899,7 @@
2028
2899
  }
2029
2900
  const onUserClicked = t1;
2030
2901
  let t2;
2031
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2902
+ if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2032
2903
  t2 = () => {
2033
2904
  setDialogOpen(false);
2034
2905
  setSelectedUser(void 0);
@@ -2039,7 +2910,7 @@
2039
2910
  }
2040
2911
  const handleClose = t2;
2041
2912
  let t3;
2042
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2913
+ if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2043
2914
  t3 = () => {
2044
2915
  setSelectedUser(void 0);
2045
2916
  setNewFormKey(_temp);
@@ -2051,52 +2922,90 @@
2051
2922
  }
2052
2923
  const handleAddUser = t3;
2053
2924
  let t4;
2054
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2055
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2056
- $[3] = t4;
2925
+ if ($[3] !== t) {
2926
+ t4 = t("users");
2927
+ $[3] = t;
2928
+ $[4] = t4;
2057
2929
  } else {
2058
- t4 = $[3];
2930
+ t4 = $[4];
2059
2931
  }
2060
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
+ }
2061
2940
  let t6;
2062
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2063
- t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2064
- t4,
2065
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: handleAddUser, children: "Add user" })
2066
- ] });
2067
- t6 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2068
- $[4] = t5;
2069
- $[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;
2070
2952
  } else {
2071
- t5 = $[4];
2072
- t6 = $[5];
2953
+ t7 = $[9];
2073
2954
  }
2074
- const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2075
2955
  let t8;
2076
- if ($[6] !== dialogOpen || $[7] !== selectedUser || $[8] !== t7) {
2077
- t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t7);
2078
- $[6] = dialogOpen;
2079
- $[7] = selectedUser;
2080
- $[8] = t7;
2081
- $[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;
2082
2960
  } else {
2083
- t8 = $[9];
2961
+ t8 = $[11];
2084
2962
  }
2085
2963
  let t9;
2086
- if ($[10] !== children || $[11] !== t8) {
2087
- t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2088
- children,
2964
+ if ($[12] !== t5 || $[13] !== t8) {
2965
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2089
2966
  t5,
2090
- t6,
2091
2967
  t8
2092
2968
  ] });
2093
- $[10] = children;
2094
- $[11] = t8;
2095
- $[12] = t9;
2969
+ $[12] = t5;
2970
+ $[13] = t8;
2971
+ $[14] = t9;
2096
2972
  } else {
2097
- t9 = $[12];
2973
+ t9 = $[14];
2098
2974
  }
2099
- 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;
2100
3009
  };
2101
3010
  function _temp(k) {
2102
3011
  return k + 1;
@@ -2171,7 +3080,7 @@
2171
3080
  return t5;
2172
3081
  }
2173
3082
  function IntroWidget(t0) {
2174
- const $ = reactCompilerRuntime.c(17);
3083
+ const $ = reactCompilerRuntime.c(31);
2175
3084
  const {
2176
3085
  noUsers,
2177
3086
  noRoles,
@@ -2179,21 +3088,55 @@
2179
3088
  } = t0;
2180
3089
  const authController = core.useAuthController();
2181
3090
  const snackbarController = core.useSnackbarController();
2182
- 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();
2183
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;
2184
3105
  let t2;
2185
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2186
- t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: "Create your users and roles" });
2187
- 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." });
2188
- $[0] = t1;
2189
- $[1] = t2;
3106
+ if ($[4] !== t) {
3107
+ t2 = t("create_your_users_and_roles");
3108
+ $[4] = t;
3109
+ $[5] = t2;
2190
3110
  } else {
2191
- t1 = $[0];
2192
- t2 = $[1];
3111
+ t2 = $[5];
2193
3112
  }
2194
3113
  let t3;
2195
- 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) {
2196
- 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 = () => {
2197
3140
  if (!authController.user?.uid) {
2198
3141
  throw Error("UsersTable, authController misconfiguration");
2199
3142
  }
@@ -2228,69 +3171,78 @@
2228
3171
  });
2229
3172
  }
2230
3173
  };
2231
- $[2] = authController.user?.displayName;
2232
- $[3] = authController.user?.email;
2233
- $[4] = authController.user?.isAnonymous;
2234
- $[5] = authController.user?.photoURL;
2235
- $[6] = authController.user?.providerId;
2236
- $[7] = authController.user?.uid;
2237
- $[8] = noRoles;
2238
- $[9] = noUsers;
2239
- $[10] = snackbarController;
2240
- $[11] = userManagement;
2241
- $[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;
2242
3192
  } else {
2243
- t3 = $[12];
3193
+ t7 = $[23];
2244
3194
  }
2245
- let t4;
2246
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
2247
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2248
- $[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;
2249
3204
  } else {
2250
- t4 = $[13];
3205
+ t8 = $[26];
2251
3206
  }
2252
- let t5;
2253
- if ($[14] !== buttonLabel || $[15] !== t3) {
2254
- 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: [
2255
- t1,
2256
- t2,
2257
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "outlined", onClick: t3, children: [
2258
- t4,
2259
- buttonLabel
2260
- ] })
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
2261
3213
  ] });
2262
- $[14] = buttonLabel;
2263
- $[15] = t3;
2264
- $[16] = t5;
3214
+ $[27] = t3;
3215
+ $[28] = t5;
3216
+ $[29] = t8;
3217
+ $[30] = t9;
2265
3218
  } else {
2266
- t5 = $[16];
3219
+ t9 = $[30];
2267
3220
  }
2268
- return t5;
3221
+ return t9;
2269
3222
  }
2270
3223
  const userManagementAdminViews = [{
2271
3224
  path: "users",
2272
- name: "CMS Users",
3225
+ name: "cms_users",
2273
3226
  group: "Admin",
2274
3227
  icon: "face",
2275
3228
  view: /* @__PURE__ */ jsxRuntime.jsx(UsersView, {})
2276
3229
  }, {
2277
3230
  path: "roles",
2278
- name: "Roles",
3231
+ name: "roles_menu",
2279
3232
  group: "Admin",
2280
3233
  icon: "gpp_good",
2281
3234
  view: /* @__PURE__ */ jsxRuntime.jsx(RolesView, {})
2282
3235
  }];
3236
+ exports2.DEFAULT_ROLES = DEFAULT_ROLES;
2283
3237
  exports2.IntroWidget = IntroWidget;
2284
3238
  exports2.RESERVED_GROUPS = RESERVED_GROUPS;
2285
3239
  exports2.RoleChip = RoleChip;
2286
- exports2.RoleYupSchema = RoleYupSchema;
2287
3240
  exports2.RolesDetailsForm = RolesDetailsForm;
2288
3241
  exports2.RolesTable = RolesTable;
2289
3242
  exports2.RolesView = RolesView;
2290
3243
  exports2.UserDetailsForm = UserDetailsForm;
2291
3244
  exports2.UserManagementContext = UserManagementContext;
2292
3245
  exports2.UserManagementProvider = UserManagementProvider;
2293
- exports2.UserYupSchema = UserYupSchema;
2294
3246
  exports2.UsersTable = UsersTable;
2295
3247
  exports2.UsersView = UsersView;
2296
3248
  exports2.areRolesEqual = areRolesEqual;
@@ -2298,7 +3250,9 @@
2298
3250
  exports2.clearDelegatedLoginTokensCache = clearDelegatedLoginTokensCache;
2299
3251
  exports2.darkenColor = darkenColor;
2300
3252
  exports2.getDelegatedLoginTokenFromCache = getDelegatedLoginTokenFromCache;
3253
+ exports2.getRoleYupSchema = getRoleYupSchema;
2301
3254
  exports2.getUserRoles = getUserRoles;
3255
+ exports2.getUserYupSchema = getUserYupSchema;
2302
3256
  exports2.hexToRgbaWithOpacity = hexToRgbaWithOpacity;
2303
3257
  exports2.resolveUserRolePermissions = resolveUserRolePermissions;
2304
3258
  exports2.useBuildUserManagement = useBuildUserManagement;