@erpsquad/common 1.10.17 → 1.10.19
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/chunks/{android-12-switch-Nw977vtV.esm.js → android-12-switch-BJGIDwYR.esm.js} +131 -80
- package/dist/chunks/android-12-switch-BJGIDwYR.esm.js.map +1 -0
- package/dist/chunks/{android-12-switch-DQG8As1Y.js → android-12-switch-PEYCUiaq.js} +131 -80
- package/dist/chunks/android-12-switch-PEYCUiaq.js.map +1 -0
- package/dist/chunks/{appbar-CGe_OPDv.js → appbar-rUKxg-G7.js} +3 -2
- package/dist/chunks/{appbar-CGe_OPDv.js.map → appbar-rUKxg-G7.js.map} +1 -1
- package/dist/chunks/{appbar-KrkQiVAV.esm.js → appbar-zELMJiqH.esm.js} +3 -2
- package/dist/chunks/{appbar-KrkQiVAV.esm.js.map → appbar-zELMJiqH.esm.js.map} +1 -1
- package/dist/chunks/{default-data-pmy2guR7.js → default-data-COIp_txP.js} +4 -4
- package/dist/chunks/{default-data-pmy2guR7.js.map → default-data-COIp_txP.js.map} +1 -1
- package/dist/chunks/{default-data-Dt8HLhhG.esm.js → default-data-Ceg98EuN.esm.js} +4 -4
- package/dist/chunks/{default-data-Dt8HLhhG.esm.js.map → default-data-Ceg98EuN.esm.js.map} +1 -1
- package/dist/chunks/{form-builder-deconversion-DLGJdpXM.esm.js → form-builder-deconversion-B4OuGvBB.esm.js} +6 -2
- package/dist/chunks/form-builder-deconversion-B4OuGvBB.esm.js.map +1 -0
- package/dist/chunks/{form-builder-deconversion-D5-FPTEJ.js → form-builder-deconversion-BcmOEnG9.js} +6 -2
- package/dist/chunks/form-builder-deconversion-BcmOEnG9.js.map +1 -0
- package/dist/chunks/{fullScreen-8kPj1_fu.esm.js → fullScreen-BZgvFEKI.esm.js} +2 -2
- package/dist/chunks/{fullScreen-8kPj1_fu.esm.js.map → fullScreen-BZgvFEKI.esm.js.map} +1 -1
- package/dist/chunks/{fullScreen-DZWgEHUi.js → fullScreen-CSJaBvxv.js} +2 -2
- package/dist/chunks/{fullScreen-DZWgEHUi.js.map → fullScreen-CSJaBvxv.js.map} +1 -1
- package/dist/chunks/{sidebar-BeSjxulx.esm.js → sidebar-BXrUlb1O.esm.js} +2 -2
- package/dist/chunks/{sidebar-BeSjxulx.esm.js.map → sidebar-BXrUlb1O.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-DKHIqaS0.js → sidebar-BbJUAEIV.js} +2 -2
- package/dist/chunks/{sidebar-DKHIqaS0.js.map → sidebar-BbJUAEIV.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-Ca2YjEI4.js → sidebarScreen-DnI42_mr.js} +3 -3
- package/dist/chunks/{sidebarScreen-Ca2YjEI4.js.map → sidebarScreen-DnI42_mr.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-DQWQqmvK.esm.js → sidebarScreen-NlMW1w_l.esm.js} +3 -3
- package/dist/chunks/{sidebarScreen-DQWQqmvK.esm.js.map → sidebarScreen-NlMW1w_l.esm.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-DjrmGUaV.js → uom-field-wrapper-BsTblyVT.js} +91 -15
- package/dist/chunks/uom-field-wrapper-BsTblyVT.js.map +1 -0
- package/dist/chunks/{uom-field-wrapper-Db0m4mhG.esm.js → uom-field-wrapper-D0YgJsP5.esm.js} +91 -15
- package/dist/chunks/uom-field-wrapper-D0YgJsP5.esm.js.map +1 -0
- package/dist/components/department-add-modal.d.ts +8 -1
- package/dist/components/designation-add-modal.d.ts +9 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
- package/dist/components/index.esm.js +5 -5
- package/dist/components/index.js +5 -5
- package/dist/components/team-add-modal.d.ts +7 -1
- package/dist/hooks/useSetDefaultConfig.d.ts +2 -1
- package/dist/index.esm.js +8 -8
- package/dist/index.js +8 -8
- package/dist/layout/index.esm.js +2 -2
- package/dist/layout/index.js +2 -2
- package/dist/src/components/department-add-modal.d.ts +8 -1
- package/dist/src/components/designation-add-modal.d.ts +9 -1
- package/dist/src/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
- package/dist/src/components/team-add-modal.d.ts +7 -1
- package/dist/src/hooks/useSetDefaultConfig.d.ts +2 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/index.esm.js +5 -5
- package/dist/views/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/android-12-switch-DQG8As1Y.js.map +0 -1
- package/dist/chunks/android-12-switch-Nw977vtV.esm.js.map +0 -1
- package/dist/chunks/form-builder-deconversion-D5-FPTEJ.js.map +0 -1
- package/dist/chunks/form-builder-deconversion-DLGJdpXM.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-Db0m4mhG.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-DjrmGUaV.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
|
|
3
3
|
const identifier = require("./identifier-B8P9ZGxG.js");
|
|
4
|
-
const appbar = require("./appbar-
|
|
4
|
+
const appbar = require("./appbar-rUKxg-G7.js");
|
|
5
5
|
const useAuth = require("./useAuth-C0YAAvbk.js");
|
|
6
6
|
const material = require("@mui/material");
|
|
7
7
|
const reactDnd = require("react-dnd");
|
|
@@ -12,7 +12,7 @@ const reactHookForm = require("react-hook-form");
|
|
|
12
12
|
;/* empty css */
|
|
13
13
|
const reactI18next = require("react-i18next");
|
|
14
14
|
const notification = require("./notification-lAbbtOBF.js");
|
|
15
|
-
const formBuilderDeconversion = require("./form-builder-deconversion-
|
|
15
|
+
const formBuilderDeconversion = require("./form-builder-deconversion-BcmOEnG9.js");
|
|
16
16
|
const Yup = require("yup");
|
|
17
17
|
const dayjs = require("dayjs");
|
|
18
18
|
const common = require("./common-BFmedrzX.js");
|
|
@@ -19263,14 +19263,7 @@ const addressColumns = [
|
|
|
19263
19263
|
editProperties: {
|
|
19264
19264
|
placeholder: "Enter City",
|
|
19265
19265
|
field_name: "city",
|
|
19266
|
-
validations: [
|
|
19267
|
-
{
|
|
19268
|
-
type: "required",
|
|
19269
|
-
value: true,
|
|
19270
|
-
msg_en: "City is required",
|
|
19271
|
-
msg_ar: "City is required"
|
|
19272
|
-
}
|
|
19273
|
-
]
|
|
19266
|
+
validations: []
|
|
19274
19267
|
}
|
|
19275
19268
|
},
|
|
19276
19269
|
{
|
|
@@ -19389,8 +19382,8 @@ const generateValidationSchema1 = () => {
|
|
|
19389
19382
|
then: () => Yup__namespace.string().required("Company is required"),
|
|
19390
19383
|
otherwise: () => Yup__namespace.string().optional().nullable()
|
|
19391
19384
|
}),
|
|
19392
|
-
[PARTIES_FIELDS.VAT_NUMBER]: Yup__namespace.string().optional().nullable(),
|
|
19393
|
-
[PARTIES_FIELDS.CRN]: Yup__namespace.string().optional().nullable(),
|
|
19385
|
+
[PARTIES_FIELDS.VAT_NUMBER]: Yup__namespace.string().optional().nullable().max(15, "VAT number should not exceed 15 digits").matches(/^\d{15}$/, { excludeEmptyString: true, message: "VAT number should have exactly 15 digits" }),
|
|
19386
|
+
[PARTIES_FIELDS.CRN]: Yup__namespace.string().optional().nullable().max(10, "CRN should not exceed 10 digits").matches(/^\d{10}$/, { excludeEmptyString: true, message: "CRN should have exactly 10 digits" }),
|
|
19394
19387
|
[PARTIES_FIELDS.COMPANY]: Yup__namespace.mixed().required("Company is required"),
|
|
19395
19388
|
[PARTIES_FIELDS.CURRENCY]: Yup__namespace.array().required("Currency is required"),
|
|
19396
19389
|
[PARTIES_FIELDS.RESPONSIBLE_PERSON]: Yup__namespace.string().required("Responsible Person is required"),
|
|
@@ -19445,7 +19438,8 @@ const getDefaultConfig = (props, user) => {
|
|
|
19445
19438
|
const useDefaultConfig = ({
|
|
19446
19439
|
props,
|
|
19447
19440
|
setValue,
|
|
19448
|
-
isInternalOptions
|
|
19441
|
+
isInternalOptions,
|
|
19442
|
+
watchedValue
|
|
19449
19443
|
}) => {
|
|
19450
19444
|
const { user: authUser } = useAuth.useAuth();
|
|
19451
19445
|
const contextUser = getEffectiveUser(authUser);
|
|
@@ -19453,15 +19447,19 @@ const useDefaultConfig = ({
|
|
|
19453
19447
|
React$1.useEffect(() => {
|
|
19454
19448
|
const user = getEffectiveUser(contextUser);
|
|
19455
19449
|
const { value, options } = getDefaultConfig(props, user);
|
|
19450
|
+
if (!isInternalOptions) {
|
|
19451
|
+
setDefaultOptions(options);
|
|
19452
|
+
}
|
|
19453
|
+
const hasValue2 = watchedValue !== null && watchedValue !== void 0 && watchedValue !== "" && (!Array.isArray(watchedValue) || watchedValue.length > 0);
|
|
19454
|
+
if (hasValue2) {
|
|
19455
|
+
return;
|
|
19456
|
+
}
|
|
19456
19457
|
if (value === null || value === void 0) {
|
|
19457
19458
|
return;
|
|
19458
19459
|
}
|
|
19459
19460
|
if (typeof setValue === "function") {
|
|
19460
19461
|
setValue(`${props.fieldArrayName}.${props.name}`, (props == null ? void 0 : props.is_multiselect) ? [value] : value);
|
|
19461
19462
|
}
|
|
19462
|
-
if (!isInternalOptions) {
|
|
19463
|
-
setDefaultOptions(options);
|
|
19464
|
-
}
|
|
19465
19463
|
}, [props == null ? void 0 : props.name, props == null ? void 0 : props.apiType, contextUser, setValue, isInternalOptions]);
|
|
19466
19464
|
return {
|
|
19467
19465
|
defaultOptions
|
|
@@ -19686,7 +19684,8 @@ const DynamicSearchSelect = React$1.memo((props) => {
|
|
|
19686
19684
|
const { defaultOptions = [] } = useDefaultConfig({
|
|
19687
19685
|
props,
|
|
19688
19686
|
setValue,
|
|
19689
|
-
isInternalOptions
|
|
19687
|
+
isInternalOptions,
|
|
19688
|
+
watchedValue
|
|
19690
19689
|
});
|
|
19691
19690
|
const searchOptionsLocally = React$1.useCallback((searchTerm, value) => {
|
|
19692
19691
|
const currentOptions = props.options && props.options.length > 0 ? props.options : defaultOptions || [];
|
|
@@ -27247,7 +27246,8 @@ const InlineEditFields = ({
|
|
|
27247
27246
|
isInternal: (fieldProperties == null ? void 0 : fieldProperties.isInternal) || !(fieldProperties == null ? void 0 : fieldProperties.apiType),
|
|
27248
27247
|
multiple: fieldProperties == null ? void 0 : fieldProperties.is_multiple,
|
|
27249
27248
|
value: (fieldProperties == null ? void 0 : fieldProperties.is_multiple) ? Array.isArray(inputValue == null ? void 0 : inputValue[column.id]) ? inputValue == null ? void 0 : inputValue[column.id] : [] : inputValue == null ? void 0 : inputValue[column.id],
|
|
27250
|
-
getSelectedData: (row2) => getSelectedData(fieldProperties == null ? void 0 : fieldProperties.field_name, row2)
|
|
27249
|
+
getSelectedData: (row2) => getSelectedData(fieldProperties == null ? void 0 : fieldProperties.field_name, row2),
|
|
27250
|
+
disabled: fieldDisbled
|
|
27251
27251
|
}
|
|
27252
27252
|
),
|
|
27253
27253
|
(errors == null ? void 0 : errors[column.id]) && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(useAuth.Typography, { color: "theme.error.600", type: "s5", children: errors == null ? void 0 : errors[column.id] })
|
|
@@ -27515,6 +27515,18 @@ const MaterialTable = React$1.memo(({
|
|
|
27515
27515
|
/^(https?:\/\/)?((([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,})|localhost)(:\d{2,5})?(\/[a-zA-Z0-9#_-]+\/?)*(\?[a-zA-Z0-9&=_-]+)?(#\S+)?$/,
|
|
27516
27516
|
{ excludeEmptyString: true, message: "Please enter valid URL." }
|
|
27517
27517
|
);
|
|
27518
|
+
case "date":
|
|
27519
|
+
case "date_time":
|
|
27520
|
+
case "time":
|
|
27521
|
+
return Yup__namespace.date().transform((value, originalValue) => {
|
|
27522
|
+
if (originalValue && typeof originalValue === "object" && "toDate" in originalValue) {
|
|
27523
|
+
return originalValue.toDate();
|
|
27524
|
+
}
|
|
27525
|
+
return value;
|
|
27526
|
+
}).typeError("Valid date is required");
|
|
27527
|
+
case "file":
|
|
27528
|
+
case "image":
|
|
27529
|
+
return Yup__namespace.mixed().nullable();
|
|
27518
27530
|
default:
|
|
27519
27531
|
return Yup__namespace.string();
|
|
27520
27532
|
}
|
|
@@ -27556,6 +27568,17 @@ const MaterialTable = React$1.memo(({
|
|
|
27556
27568
|
)) || validations;
|
|
27557
27569
|
}
|
|
27558
27570
|
});
|
|
27571
|
+
case "validate":
|
|
27572
|
+
if (typeof validation.callback === "function") {
|
|
27573
|
+
vld = vld.test(
|
|
27574
|
+
validation.name || "custom-validate",
|
|
27575
|
+
validation.msg_en || "Validation failed",
|
|
27576
|
+
function(value) {
|
|
27577
|
+
return validation.callback(value, this.parent);
|
|
27578
|
+
}
|
|
27579
|
+
);
|
|
27580
|
+
}
|
|
27581
|
+
break;
|
|
27559
27582
|
default:
|
|
27560
27583
|
vld = validations;
|
|
27561
27584
|
break;
|
|
@@ -28875,7 +28898,8 @@ ${val}`;
|
|
|
28875
28898
|
name: PARTIES_FIELDS.VAT_NUMBER,
|
|
28876
28899
|
placeholder: t("common.party.fields.vat_number_placeholder"),
|
|
28877
28900
|
fieldArrayName: PARTIES_FORM_ARRAY_NAME,
|
|
28878
|
-
formControl: control
|
|
28901
|
+
formControl: control,
|
|
28902
|
+
max: 15
|
|
28879
28903
|
}
|
|
28880
28904
|
) }),
|
|
28881
28905
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, xs: 12, sm: 6, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
@@ -28885,7 +28909,8 @@ ${val}`;
|
|
|
28885
28909
|
name: PARTIES_FIELDS.CRN,
|
|
28886
28910
|
placeholder: t("common.party.fields.crn_placeholder"),
|
|
28887
28911
|
fieldArrayName: PARTIES_FORM_ARRAY_NAME,
|
|
28888
|
-
formControl: control
|
|
28912
|
+
formControl: control,
|
|
28913
|
+
max: 10
|
|
28889
28914
|
}
|
|
28890
28915
|
) })
|
|
28891
28916
|
] }),
|
|
@@ -34586,32 +34611,38 @@ const teamValidationSchema = Yup__namespace.object().shape({
|
|
|
34586
34611
|
description: Yup__namespace.string()
|
|
34587
34612
|
})
|
|
34588
34613
|
});
|
|
34589
|
-
const
|
|
34614
|
+
const getDefaultValues$2 = (initialValues) => ({
|
|
34590
34615
|
team: {
|
|
34591
34616
|
name: "",
|
|
34592
|
-
department_id: null,
|
|
34617
|
+
department_id: (initialValues == null ? void 0 : initialValues.department_id) ?? null,
|
|
34593
34618
|
team_lead_id: null,
|
|
34594
34619
|
member_ids: null,
|
|
34595
34620
|
description: ""
|
|
34596
34621
|
}
|
|
34597
|
-
};
|
|
34622
|
+
});
|
|
34598
34623
|
const TeamAddModal = ({
|
|
34599
34624
|
isOpen,
|
|
34600
34625
|
setIsOpen,
|
|
34601
34626
|
onSave,
|
|
34602
34627
|
isLoading,
|
|
34603
|
-
modalProps
|
|
34628
|
+
modalProps,
|
|
34629
|
+
initialValues
|
|
34604
34630
|
}) => {
|
|
34605
34631
|
const { t } = reactI18next.useTranslation();
|
|
34606
34632
|
const { control, handleSubmit, reset, watch } = reactHookForm.useForm({
|
|
34607
34633
|
mode: "all",
|
|
34608
34634
|
resolver: appbar.o(teamValidationSchema),
|
|
34609
|
-
defaultValues:
|
|
34635
|
+
defaultValues: getDefaultValues$2(initialValues)
|
|
34610
34636
|
});
|
|
34611
34637
|
const selectedDepartmentId = watch("team.department_id");
|
|
34612
34638
|
const selectedTeamLeadId = watch("team.team_lead_id");
|
|
34639
|
+
React$1.useEffect(() => {
|
|
34640
|
+
if (isOpen) {
|
|
34641
|
+
reset(getDefaultValues$2(initialValues));
|
|
34642
|
+
}
|
|
34643
|
+
}, [isOpen]);
|
|
34613
34644
|
const handleModalClose = () => {
|
|
34614
|
-
reset(
|
|
34645
|
+
reset(getDefaultValues$2(initialValues));
|
|
34615
34646
|
setIsOpen();
|
|
34616
34647
|
};
|
|
34617
34648
|
const onSubmit = async (values) => {
|
|
@@ -34738,44 +34769,40 @@ const departmentValidationSchema = Yup__namespace.object().shape({
|
|
|
34738
34769
|
description: Yup__namespace.string()
|
|
34739
34770
|
})
|
|
34740
34771
|
});
|
|
34772
|
+
const getDefaultValues$1 = (initialValues) => ({
|
|
34773
|
+
department: {
|
|
34774
|
+
company_id: (initialValues == null ? void 0 : initialValues.company_id) ?? null,
|
|
34775
|
+
department_code: "",
|
|
34776
|
+
name: "",
|
|
34777
|
+
parent_department_id: (initialValues == null ? void 0 : initialValues.parent_department_id) ?? null,
|
|
34778
|
+
department_head_id: null,
|
|
34779
|
+
cost_code: "",
|
|
34780
|
+
status: true,
|
|
34781
|
+
description: ""
|
|
34782
|
+
}
|
|
34783
|
+
});
|
|
34741
34784
|
const DepartmentAddModal = ({
|
|
34742
34785
|
isOpen,
|
|
34743
34786
|
setIsOpen,
|
|
34744
34787
|
onSave,
|
|
34745
34788
|
isLoading,
|
|
34746
|
-
modalProps
|
|
34789
|
+
modalProps,
|
|
34790
|
+
initialValues
|
|
34747
34791
|
}) => {
|
|
34748
34792
|
const { t } = reactI18next.useTranslation();
|
|
34749
34793
|
const { control, handleSubmit, reset, trigger, watch } = reactHookForm.useForm({
|
|
34750
34794
|
mode: "all",
|
|
34751
34795
|
resolver: appbar.o(departmentValidationSchema),
|
|
34752
|
-
defaultValues:
|
|
34753
|
-
department: {
|
|
34754
|
-
company_id: null,
|
|
34755
|
-
department_code: "",
|
|
34756
|
-
name: "",
|
|
34757
|
-
parent_department_id: null,
|
|
34758
|
-
department_head_id: null,
|
|
34759
|
-
cost_code: "",
|
|
34760
|
-
status: true,
|
|
34761
|
-
description: ""
|
|
34762
|
-
}
|
|
34763
|
-
}
|
|
34796
|
+
defaultValues: getDefaultValues$1(initialValues)
|
|
34764
34797
|
});
|
|
34765
34798
|
const rootCompanyId = watch("department.company_id");
|
|
34799
|
+
React$1.useEffect(() => {
|
|
34800
|
+
if (isOpen) {
|
|
34801
|
+
reset(getDefaultValues$1(initialValues));
|
|
34802
|
+
}
|
|
34803
|
+
}, [isOpen]);
|
|
34766
34804
|
const handleModalClose = () => {
|
|
34767
|
-
reset(
|
|
34768
|
-
department: {
|
|
34769
|
-
company_id: null,
|
|
34770
|
-
department_code: "",
|
|
34771
|
-
name: "",
|
|
34772
|
-
parent_department_id: null,
|
|
34773
|
-
department_head_id: null,
|
|
34774
|
-
cost_code: "",
|
|
34775
|
-
status: true,
|
|
34776
|
-
description: ""
|
|
34777
|
-
}
|
|
34778
|
-
});
|
|
34805
|
+
reset(getDefaultValues$1(initialValues));
|
|
34779
34806
|
setIsOpen();
|
|
34780
34807
|
};
|
|
34781
34808
|
const onSubmit = async (values) => {
|
|
@@ -34865,7 +34892,8 @@ const DepartmentAddModal = ({
|
|
|
34865
34892
|
required: false,
|
|
34866
34893
|
options: [],
|
|
34867
34894
|
customeFilter: {
|
|
34868
|
-
"&company_id.eq": rootCompanyId || 0
|
|
34895
|
+
"&company_id.eq": rootCompanyId || 0,
|
|
34896
|
+
"&is_active.eq": 1
|
|
34869
34897
|
}
|
|
34870
34898
|
}
|
|
34871
34899
|
) }),
|
|
@@ -35043,51 +35071,51 @@ const LocationAddModal = ({
|
|
|
35043
35071
|
};
|
|
35044
35072
|
const designationValidationSchema = Yup__namespace.object().shape({
|
|
35045
35073
|
designation: Yup__namespace.object().shape({
|
|
35046
|
-
company_id: Yup__namespace.
|
|
35074
|
+
company_id: Yup__namespace.number().nullable().required("Company is required"),
|
|
35047
35075
|
designation_code: Yup__namespace.string(),
|
|
35048
35076
|
name: Yup__namespace.string().required("Designation Name is required"),
|
|
35077
|
+
department_id: Yup__namespace.number().nullable().required("Department is required"),
|
|
35049
35078
|
reports_to: Yup__namespace.string().nullable(),
|
|
35050
35079
|
level: Yup__namespace.number().nullable().typeError("Level must be a number"),
|
|
35051
35080
|
status: Yup__namespace.boolean(),
|
|
35052
35081
|
description: Yup__namespace.string()
|
|
35053
35082
|
})
|
|
35054
35083
|
});
|
|
35084
|
+
const getDefaultValues = (initialValues) => ({
|
|
35085
|
+
designation: {
|
|
35086
|
+
company_id: (initialValues == null ? void 0 : initialValues.company_id) ?? null,
|
|
35087
|
+
designation_code: "",
|
|
35088
|
+
name: "",
|
|
35089
|
+
department_id: (initialValues == null ? void 0 : initialValues.department_id) ?? null,
|
|
35090
|
+
reports_to: (initialValues == null ? void 0 : initialValues.parent_designation_id) ?? null,
|
|
35091
|
+
level: null,
|
|
35092
|
+
status: true,
|
|
35093
|
+
description: ""
|
|
35094
|
+
}
|
|
35095
|
+
});
|
|
35055
35096
|
const DesignationAddModal = ({
|
|
35056
35097
|
isOpen,
|
|
35057
35098
|
setIsOpen,
|
|
35058
35099
|
onSave,
|
|
35059
35100
|
isLoading,
|
|
35060
|
-
modalProps
|
|
35101
|
+
modalProps,
|
|
35102
|
+
initialValues
|
|
35061
35103
|
}) => {
|
|
35062
35104
|
const { t } = reactI18next.useTranslation();
|
|
35063
35105
|
const { control, handleSubmit, reset, trigger, watch } = reactHookForm.useForm({
|
|
35064
35106
|
mode: "all",
|
|
35065
35107
|
resolver: appbar.o(designationValidationSchema),
|
|
35066
|
-
defaultValues:
|
|
35067
|
-
designation: {
|
|
35068
|
-
company_id: null,
|
|
35069
|
-
designation_code: "",
|
|
35070
|
-
name: "",
|
|
35071
|
-
reports_to: null,
|
|
35072
|
-
level: null,
|
|
35073
|
-
status: true,
|
|
35074
|
-
description: ""
|
|
35075
|
-
}
|
|
35076
|
-
}
|
|
35108
|
+
defaultValues: getDefaultValues(initialValues)
|
|
35077
35109
|
});
|
|
35078
|
-
watch("designation.company_id");
|
|
35110
|
+
const rootCompanyId = watch("designation.company_id");
|
|
35111
|
+
const rootDepartmentId = watch("designation.department_id");
|
|
35112
|
+
React$1.useEffect(() => {
|
|
35113
|
+
if (isOpen) {
|
|
35114
|
+
reset(getDefaultValues(initialValues));
|
|
35115
|
+
}
|
|
35116
|
+
}, [isOpen]);
|
|
35079
35117
|
const handleModalClose = () => {
|
|
35080
|
-
reset(
|
|
35081
|
-
designation: {
|
|
35082
|
-
company_id: null,
|
|
35083
|
-
designation_code: "",
|
|
35084
|
-
name: "",
|
|
35085
|
-
reports_to: null,
|
|
35086
|
-
level: null,
|
|
35087
|
-
status: true,
|
|
35088
|
-
description: ""
|
|
35089
|
-
}
|
|
35090
|
-
});
|
|
35118
|
+
reset(getDefaultValues(initialValues));
|
|
35091
35119
|
setIsOpen();
|
|
35092
35120
|
};
|
|
35093
35121
|
const onSubmit = async (values) => {
|
|
@@ -35124,6 +35152,23 @@ const DesignationAddModal = ({
|
|
|
35124
35152
|
options: []
|
|
35125
35153
|
}
|
|
35126
35154
|
) }),
|
|
35155
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, sm: 12, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
35156
|
+
DynamicSearchSelect,
|
|
35157
|
+
{
|
|
35158
|
+
label: t("hrms.organization_structure.designationModal.department_label", "Department"),
|
|
35159
|
+
name: "department_id",
|
|
35160
|
+
placeholder: t("hrms.organization_structure.designationModal.department_placeholder", "Select Department"),
|
|
35161
|
+
fieldArrayName: "designation",
|
|
35162
|
+
formControl: control,
|
|
35163
|
+
apiType: "department",
|
|
35164
|
+
required: true,
|
|
35165
|
+
options: [],
|
|
35166
|
+
customeFilter: {
|
|
35167
|
+
"&company_id.eq": rootCompanyId || 0
|
|
35168
|
+
// '&is_active.eq': 1
|
|
35169
|
+
}
|
|
35170
|
+
}
|
|
35171
|
+
) }),
|
|
35127
35172
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, sm: 6, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
35128
35173
|
appbar.DynamicInput,
|
|
35129
35174
|
{
|
|
@@ -35155,8 +35200,13 @@ const DesignationAddModal = ({
|
|
|
35155
35200
|
placeholder: t("hrms.organization_structure.designationModal.reports_to_placeholder", "Select Reports To"),
|
|
35156
35201
|
fieldArrayName: "designation",
|
|
35157
35202
|
formControl: control,
|
|
35158
|
-
apiType: "
|
|
35159
|
-
required: false
|
|
35203
|
+
apiType: "designation",
|
|
35204
|
+
required: false,
|
|
35205
|
+
options: [],
|
|
35206
|
+
customeFilter: {
|
|
35207
|
+
"&company_id.eq": rootCompanyId || 0,
|
|
35208
|
+
"&department_id.eq": rootDepartmentId || 0
|
|
35209
|
+
}
|
|
35160
35210
|
}
|
|
35161
35211
|
) }),
|
|
35162
35212
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, sm: 6, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
@@ -35167,6 +35217,7 @@ const DesignationAddModal = ({
|
|
|
35167
35217
|
label: t("hrms.organization_structure.designationModal.level_label", "Level"),
|
|
35168
35218
|
name: "level",
|
|
35169
35219
|
fieldArrayName: "designation",
|
|
35220
|
+
disabled: true,
|
|
35170
35221
|
placeholder: t("hrms.organization_structure.designationModal.level_placeholder", "Enter Level")
|
|
35171
35222
|
}
|
|
35172
35223
|
) }),
|
|
@@ -40745,4 +40796,4 @@ exports.createApiThunk = createApiThunk;
|
|
|
40745
40796
|
exports.dynamicSelectAdd = dynamicSelectAdd;
|
|
40746
40797
|
exports.useThemeProps = useThemeProps;
|
|
40747
40798
|
exports.userRoles = userRoles;
|
|
40748
|
-
//# sourceMappingURL=android-12-switch-
|
|
40799
|
+
//# sourceMappingURL=android-12-switch-PEYCUiaq.js.map
|