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