@atomsolution/sdk-merchant 1.1.1 → 1.2.0
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/components/role/PermissionCheckboxGroup.d.ts +2 -1
- package/dist/index.cjs +106 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +106 -135
- package/dist/index.esm.js.map +1 -1
- package/dist/services/roleService.d.ts +1 -5
- package/dist/style.css +3 -0
- package/dist/types/role.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -73919,15 +73919,16 @@ const PermissionCheckboxGroup = ({
|
|
|
73919
73919
|
subGroups = [],
|
|
73920
73920
|
isNested = false,
|
|
73921
73921
|
collapsible = true,
|
|
73922
|
+
disabled = false,
|
|
73922
73923
|
value = [],
|
|
73923
73924
|
onChange
|
|
73924
73925
|
}) => {
|
|
73925
73926
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
73926
73927
|
const getAllPermissionIds = () => {
|
|
73927
|
-
let ids = permissions.map((p) => p.
|
|
73928
|
+
let ids = permissions.map((p) => p.code);
|
|
73928
73929
|
if (isNested && subGroups.length > 0) {
|
|
73929
73930
|
subGroups.forEach((subGroup) => {
|
|
73930
|
-
ids = [...ids, ...subGroup.permissions.map((p) => p.
|
|
73931
|
+
ids = [...ids, ...subGroup.permissions.map((p) => p.code)];
|
|
73931
73932
|
});
|
|
73932
73933
|
}
|
|
73933
73934
|
return ids;
|
|
@@ -73943,42 +73944,30 @@ const PermissionCheckboxGroup = ({
|
|
|
73943
73944
|
onChange(newValue);
|
|
73944
73945
|
};
|
|
73945
73946
|
const handlePermissionChange = (permissionId, checked, permissionsList) => {
|
|
73946
|
-
const clickedPermission = permissionsList.find((p) => p.
|
|
73947
|
-
const primaryPermissions = permissionsList.filter(
|
|
73948
|
-
|
|
73949
|
-
);
|
|
73950
|
-
const
|
|
73951
|
-
(p) => p.is_primary !== true
|
|
73952
|
-
);
|
|
73953
|
-
const primaryIds = primaryPermissions.map((p) => p.id);
|
|
73954
|
-
const nonPrimaryIds = nonPrimaryPermissions.map((p) => p.id);
|
|
73947
|
+
const clickedPermission = permissionsList.find((p) => p.code === permissionId);
|
|
73948
|
+
const primaryPermissions = permissionsList.filter((p) => p.is_primary === true);
|
|
73949
|
+
const nonPrimaryPermissions = permissionsList.filter((p) => p.is_primary !== true);
|
|
73950
|
+
const primaryIds = primaryPermissions.map((p) => p.code);
|
|
73951
|
+
const nonPrimaryIds = nonPrimaryPermissions.map((p) => p.code);
|
|
73955
73952
|
let newValue = [...value];
|
|
73956
73953
|
if (checked) {
|
|
73957
73954
|
if (!(clickedPermission == null ? void 0 : clickedPermission.is_primary)) {
|
|
73958
|
-
const missingPrimaryIds = primaryIds.filter(
|
|
73959
|
-
|
|
73960
|
-
);
|
|
73961
|
-
newValue = [
|
|
73962
|
-
.../* @__PURE__ */ new Set([...newValue, ...missingPrimaryIds, permissionId])
|
|
73963
|
-
];
|
|
73955
|
+
const missingPrimaryIds = primaryIds.filter((code2) => !newValue.includes(code2));
|
|
73956
|
+
newValue = [.../* @__PURE__ */ new Set([...newValue, ...missingPrimaryIds, permissionId])];
|
|
73964
73957
|
} else {
|
|
73965
|
-
if (!newValue.includes(permissionId))
|
|
73966
|
-
newValue.push(permissionId);
|
|
73967
|
-
}
|
|
73958
|
+
if (!newValue.includes(permissionId)) newValue.push(permissionId);
|
|
73968
73959
|
}
|
|
73969
73960
|
} else {
|
|
73970
73961
|
if (clickedPermission == null ? void 0 : clickedPermission.is_primary) {
|
|
73971
|
-
newValue = newValue.filter(
|
|
73972
|
-
(id) => id !== permissionId && !nonPrimaryIds.includes(id)
|
|
73973
|
-
);
|
|
73962
|
+
newValue = newValue.filter((code2) => code2 !== permissionId && !nonPrimaryIds.includes(code2));
|
|
73974
73963
|
} else {
|
|
73975
|
-
newValue = newValue.filter((
|
|
73964
|
+
newValue = newValue.filter((code2) => code2 !== permissionId);
|
|
73976
73965
|
}
|
|
73977
73966
|
}
|
|
73978
73967
|
onChange(newValue);
|
|
73979
73968
|
};
|
|
73980
73969
|
const handleSubGroupChange = (subGroup, checked) => {
|
|
73981
|
-
const subGroupPermissionIds = subGroup.permissions.map((p) => p.
|
|
73970
|
+
const subGroupPermissionIds = subGroup.permissions.map((p) => p.code);
|
|
73982
73971
|
let newValue;
|
|
73983
73972
|
if (checked) {
|
|
73984
73973
|
newValue = [.../* @__PURE__ */ new Set([...value, ...subGroupPermissionIds])];
|
|
@@ -73989,41 +73978,42 @@ const PermissionCheckboxGroup = ({
|
|
|
73989
73978
|
};
|
|
73990
73979
|
const isSubGroupChecked = (subGroup) => {
|
|
73991
73980
|
if (subGroup.permissions.length === 0) return false;
|
|
73992
|
-
return subGroup.permissions.every((p) => value.includes(p.
|
|
73981
|
+
return subGroup.permissions.every((p) => value.includes(p.code));
|
|
73993
73982
|
};
|
|
73994
73983
|
const isSubGroupIndeterminate = (subGroup) => {
|
|
73995
73984
|
const checked = isSubGroupChecked(subGroup);
|
|
73996
|
-
return !checked && subGroup.permissions.some((p) => value.includes(p.
|
|
73985
|
+
return !checked && subGroup.permissions.some((p) => value.includes(p.code));
|
|
73997
73986
|
};
|
|
73998
73987
|
const allPermissionIds = getAllPermissionIds();
|
|
73999
|
-
const isParentChecked = allPermissionIds.length > 0 && allPermissionIds.every((
|
|
74000
|
-
const isParentIndeterminate = !isParentChecked && allPermissionIds.some((
|
|
73988
|
+
const isParentChecked = allPermissionIds.length > 0 && allPermissionIds.every((code2) => value.includes(code2));
|
|
73989
|
+
const isParentIndeterminate = !isParentChecked && allPermissionIds.some((code2) => value.includes(code2));
|
|
74001
73990
|
const hasContent = permissions.length > 0 || isNested && subGroups.length > 0;
|
|
74002
73991
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-gray-200 rounded-lg bg-white overflow-hidden", children: [
|
|
74003
73992
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
74004
73993
|
"div",
|
|
74005
73994
|
{
|
|
74006
|
-
className:
|
|
73995
|
+
className: `flex items-center justify-between p-4 bg-gray-50 ${disabled ? "cursor-not-allowed" : "cursor-pointer hover:bg-gray-100"}`,
|
|
74007
73996
|
onClick: () => collapsible && hasContent && setIsExpanded(!isExpanded),
|
|
74008
73997
|
children: [
|
|
74009
73998
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
74010
73999
|
"label",
|
|
74011
74000
|
{
|
|
74012
|
-
className:
|
|
74001
|
+
className: `flex items-center gap-2 ${disabled ? "cursor-not-allowed" : "cursor-pointer"} flex-1`,
|
|
74013
74002
|
onClick: (e) => e.stopPropagation(),
|
|
74014
74003
|
children: [
|
|
74015
74004
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74016
74005
|
"input",
|
|
74017
74006
|
{
|
|
74018
74007
|
type: "checkbox",
|
|
74008
|
+
disabled,
|
|
74019
74009
|
checked: isParentChecked,
|
|
74020
74010
|
ref: (input) => {
|
|
74021
74011
|
if (input) {
|
|
74022
74012
|
input.indeterminate = isParentIndeterminate;
|
|
74023
74013
|
}
|
|
74024
74014
|
},
|
|
74025
|
-
onChange: (e) => handleParentChange(e.target.checked),
|
|
74026
|
-
className:
|
|
74015
|
+
onChange: (e) => !disabled && handleParentChange(e.target.checked),
|
|
74016
|
+
className: `w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 ${disabled ? "opacity-60" : ""}`
|
|
74027
74017
|
}
|
|
74028
74018
|
),
|
|
74029
74019
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-gray-900", children: label })
|
|
@@ -74049,45 +74039,42 @@ const PermissionCheckboxGroup = ({
|
|
|
74049
74039
|
!isNested && permissions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-3", children: permissions.map((permission) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
74050
74040
|
"label",
|
|
74051
74041
|
{
|
|
74052
|
-
className:
|
|
74042
|
+
className: `flex items-center gap-2 pl-6 ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
|
|
74053
74043
|
children: [
|
|
74054
74044
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74055
74045
|
"input",
|
|
74056
74046
|
{
|
|
74057
74047
|
type: "checkbox",
|
|
74058
|
-
|
|
74059
|
-
|
|
74060
|
-
|
|
74061
|
-
|
|
74062
|
-
permissions
|
|
74063
|
-
// Truyền list permissions cùng scope
|
|
74064
|
-
),
|
|
74065
|
-
className: "w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
74048
|
+
disabled,
|
|
74049
|
+
checked: value.includes(permission.code),
|
|
74050
|
+
onChange: (e) => !disabled && handlePermissionChange(permission.code, e.target.checked, permissions),
|
|
74051
|
+
className: `w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 ${disabled ? "opacity-60" : ""}`
|
|
74066
74052
|
}
|
|
74067
74053
|
),
|
|
74068
74054
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: permission.label })
|
|
74069
74055
|
]
|
|
74070
74056
|
},
|
|
74071
|
-
permission.
|
|
74057
|
+
permission.code
|
|
74072
74058
|
)) }),
|
|
74073
74059
|
isNested && subGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4 pl-6", children: subGroups.map((subGroup) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
74074
74060
|
"div",
|
|
74075
74061
|
{
|
|
74076
74062
|
className: "bg-gray-50 rounded-lg p-3 border border-gray-200",
|
|
74077
74063
|
children: [
|
|
74078
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className:
|
|
74064
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: `flex items-center gap-2 mb-2 ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`, children: [
|
|
74079
74065
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74080
74066
|
"input",
|
|
74081
74067
|
{
|
|
74082
74068
|
type: "checkbox",
|
|
74069
|
+
disabled,
|
|
74083
74070
|
checked: isSubGroupChecked(subGroup),
|
|
74084
74071
|
ref: (input) => {
|
|
74085
74072
|
if (input) {
|
|
74086
74073
|
input.indeterminate = isSubGroupIndeterminate(subGroup);
|
|
74087
74074
|
}
|
|
74088
74075
|
},
|
|
74089
|
-
onChange: (e) => handleSubGroupChange(subGroup, e.target.checked),
|
|
74090
|
-
className:
|
|
74076
|
+
onChange: (e) => !disabled && handleSubGroupChange(subGroup, e.target.checked),
|
|
74077
|
+
className: `w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 ${disabled ? "opacity-60" : ""}`
|
|
74091
74078
|
}
|
|
74092
74079
|
),
|
|
74093
74080
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-sm text-gray-800", children: subGroup.label })
|
|
@@ -74095,29 +74082,26 @@ const PermissionCheckboxGroup = ({
|
|
|
74095
74082
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2 pl-6", children: subGroup.permissions.map((permission) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
74096
74083
|
"label",
|
|
74097
74084
|
{
|
|
74098
|
-
className:
|
|
74085
|
+
className: `flex items-center gap-2 ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
|
|
74099
74086
|
children: [
|
|
74100
74087
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74101
74088
|
"input",
|
|
74102
74089
|
{
|
|
74103
74090
|
type: "checkbox",
|
|
74104
|
-
|
|
74105
|
-
|
|
74106
|
-
|
|
74107
|
-
|
|
74108
|
-
subGroup.permissions
|
|
74109
|
-
),
|
|
74110
|
-
className: "w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
74091
|
+
disabled,
|
|
74092
|
+
checked: value.includes(permission.code),
|
|
74093
|
+
onChange: (e) => !disabled && handlePermissionChange(permission.code, e.target.checked, subGroup.permissions),
|
|
74094
|
+
className: `w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 ${disabled ? "opacity-60" : ""}`
|
|
74111
74095
|
}
|
|
74112
74096
|
),
|
|
74113
74097
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: permission.label })
|
|
74114
74098
|
]
|
|
74115
74099
|
},
|
|
74116
|
-
permission.
|
|
74100
|
+
permission.code
|
|
74117
74101
|
)) })
|
|
74118
74102
|
]
|
|
74119
74103
|
},
|
|
74120
|
-
subGroup.
|
|
74104
|
+
subGroup.code
|
|
74121
74105
|
)) })
|
|
74122
74106
|
] })
|
|
74123
74107
|
] });
|
|
@@ -74127,7 +74111,7 @@ const getDefaultActivePermissions = (groups) => {
|
|
|
74127
74111
|
const findActiveIds = (permissions) => {
|
|
74128
74112
|
permissions.forEach((perm) => {
|
|
74129
74113
|
if (perm.active) {
|
|
74130
|
-
activeIds.push(perm.
|
|
74114
|
+
activeIds.push(perm.code);
|
|
74131
74115
|
}
|
|
74132
74116
|
});
|
|
74133
74117
|
};
|
|
@@ -74280,11 +74264,11 @@ const ROLE_FORM = {
|
|
|
74280
74264
|
};
|
|
74281
74265
|
const PERMISSION_GROUPS = [
|
|
74282
74266
|
{
|
|
74283
|
-
|
|
74267
|
+
code: "TONGQUAN",
|
|
74284
74268
|
label: "Tổng quan",
|
|
74285
74269
|
permissions: [
|
|
74286
74270
|
{
|
|
74287
|
-
|
|
74271
|
+
code: DASHBOARD_PERMISSIONS.OVERVIEW,
|
|
74288
74272
|
label: "Xem thông tin",
|
|
74289
74273
|
is_primary: true,
|
|
74290
74274
|
active: false,
|
|
@@ -74293,23 +74277,23 @@ const PERMISSION_GROUPS = [
|
|
|
74293
74277
|
]
|
|
74294
74278
|
},
|
|
74295
74279
|
{
|
|
74296
|
-
|
|
74280
|
+
code: "bao_cao",
|
|
74297
74281
|
label: "Báo cáo",
|
|
74298
74282
|
isNested: true,
|
|
74299
74283
|
subGroups: [
|
|
74300
74284
|
{
|
|
74301
|
-
|
|
74285
|
+
code: "BAOCAO_GIAODICH_THE",
|
|
74302
74286
|
label: "Giao dịch thẻ",
|
|
74303
74287
|
permissions: [
|
|
74304
74288
|
{
|
|
74305
|
-
|
|
74289
|
+
code: REPORT_PERMISSIONS.CARD_TRANSACTIONS_READ,
|
|
74306
74290
|
label: "Xem thông tin",
|
|
74307
74291
|
is_primary: true,
|
|
74308
74292
|
active: false,
|
|
74309
74293
|
max: 10
|
|
74310
74294
|
},
|
|
74311
74295
|
{
|
|
74312
|
-
|
|
74296
|
+
code: REPORT_PERMISSIONS.CARD_TRANSACTIONS_CREATE,
|
|
74313
74297
|
label: "Xuất báo cáo",
|
|
74314
74298
|
is_primary: false,
|
|
74315
74299
|
active: false,
|
|
@@ -74318,18 +74302,18 @@ const PERMISSION_GROUPS = [
|
|
|
74318
74302
|
]
|
|
74319
74303
|
},
|
|
74320
74304
|
{
|
|
74321
|
-
|
|
74305
|
+
code: "BAOCAO_GIAODICH_QR",
|
|
74322
74306
|
label: "Giao dịch QR",
|
|
74323
74307
|
permissions: [
|
|
74324
74308
|
{
|
|
74325
|
-
|
|
74309
|
+
code: REPORT_PERMISSIONS.QR_TRANSACTIONS_READ,
|
|
74326
74310
|
label: "Xem thông tin",
|
|
74327
74311
|
is_primary: true,
|
|
74328
74312
|
active: false,
|
|
74329
74313
|
max: 10
|
|
74330
74314
|
},
|
|
74331
74315
|
{
|
|
74332
|
-
|
|
74316
|
+
code: REPORT_PERMISSIONS.QR_TRANSACTIONS_CREATE,
|
|
74333
74317
|
label: "Xuất báo cáo",
|
|
74334
74318
|
is_primary: false,
|
|
74335
74319
|
active: false,
|
|
@@ -74340,16 +74324,16 @@ const PERMISSION_GROUPS = [
|
|
|
74340
74324
|
]
|
|
74341
74325
|
},
|
|
74342
74326
|
{
|
|
74343
|
-
|
|
74327
|
+
code: "shop_qr",
|
|
74344
74328
|
label: "ShopQR",
|
|
74345
74329
|
isNested: true,
|
|
74346
74330
|
subGroups: [
|
|
74347
74331
|
{
|
|
74348
|
-
|
|
74332
|
+
code: "QUANLY_TAIKHOAN_THANHTOAN",
|
|
74349
74333
|
label: "Tài khoản thanh toán",
|
|
74350
74334
|
permissions: [
|
|
74351
74335
|
{
|
|
74352
|
-
|
|
74336
|
+
code: PAYMENT_PERMISSIONS.PAYMENT_ACCOUNT_READ,
|
|
74353
74337
|
label: "Xem thông tin",
|
|
74354
74338
|
is_primary: true,
|
|
74355
74339
|
active: false,
|
|
@@ -74358,25 +74342,25 @@ const PERMISSION_GROUPS = [
|
|
|
74358
74342
|
]
|
|
74359
74343
|
},
|
|
74360
74344
|
{
|
|
74361
|
-
|
|
74345
|
+
code: "QUANLY_SHOPQR",
|
|
74362
74346
|
label: "Quản lý ShopQR",
|
|
74363
74347
|
permissions: [
|
|
74364
74348
|
{
|
|
74365
|
-
|
|
74349
|
+
code: PAYMENT_PERMISSIONS.SHOP_QR_READ,
|
|
74366
74350
|
label: "Xem thông tin",
|
|
74367
74351
|
is_primary: true,
|
|
74368
74352
|
active: false,
|
|
74369
74353
|
max: 10
|
|
74370
74354
|
},
|
|
74371
74355
|
{
|
|
74372
|
-
|
|
74356
|
+
code: PAYMENT_PERMISSIONS.SHOP_QR_CREATE,
|
|
74373
74357
|
label: "Tạo mới",
|
|
74374
74358
|
is_primary: false,
|
|
74375
74359
|
active: false,
|
|
74376
74360
|
max: null
|
|
74377
74361
|
},
|
|
74378
74362
|
{
|
|
74379
|
-
|
|
74363
|
+
code: PAYMENT_PERMISSIONS.SHOP_QR_DELETE,
|
|
74380
74364
|
label: "Xóa",
|
|
74381
74365
|
is_primary: false,
|
|
74382
74366
|
active: false,
|
|
@@ -74385,18 +74369,18 @@ const PERMISSION_GROUPS = [
|
|
|
74385
74369
|
]
|
|
74386
74370
|
},
|
|
74387
74371
|
{
|
|
74388
|
-
|
|
74372
|
+
code: "QUANLY_QR_THANHTOAN",
|
|
74389
74373
|
label: "Quản lý QR thanh toán",
|
|
74390
74374
|
permissions: [
|
|
74391
74375
|
{
|
|
74392
|
-
|
|
74376
|
+
code: PAYMENT_PERMISSIONS.QUANLY_QR_THANHTOAN_READ,
|
|
74393
74377
|
label: "Xem thông tin",
|
|
74394
74378
|
is_primary: true,
|
|
74395
74379
|
active: false,
|
|
74396
74380
|
max: 10
|
|
74397
74381
|
},
|
|
74398
74382
|
{
|
|
74399
|
-
|
|
74383
|
+
code: PAYMENT_PERMISSIONS.QUANLY_QR_THANHTOAN_CREATE,
|
|
74400
74384
|
label: "Tạo mới",
|
|
74401
74385
|
is_primary: false,
|
|
74402
74386
|
active: false,
|
|
@@ -74407,11 +74391,11 @@ const PERMISSION_GROUPS = [
|
|
|
74407
74391
|
]
|
|
74408
74392
|
},
|
|
74409
74393
|
{
|
|
74410
|
-
|
|
74394
|
+
code: "PAY_BY_LINK",
|
|
74411
74395
|
label: "Pay By Link",
|
|
74412
74396
|
permissions: [
|
|
74413
74397
|
{
|
|
74414
|
-
|
|
74398
|
+
code: PAYMENT_PERMISSIONS.PAY_BY_LINK_CREATE,
|
|
74415
74399
|
label: "Tạo Payment Link",
|
|
74416
74400
|
is_primary: false,
|
|
74417
74401
|
active: false,
|
|
@@ -74420,18 +74404,18 @@ const PERMISSION_GROUPS = [
|
|
|
74420
74404
|
]
|
|
74421
74405
|
},
|
|
74422
74406
|
{
|
|
74423
|
-
|
|
74407
|
+
code: "QUANLY_MAY_THANHTOAN_THE",
|
|
74424
74408
|
label: "Quản lý máy thanh toán thẻ",
|
|
74425
74409
|
permissions: [
|
|
74426
74410
|
{
|
|
74427
|
-
|
|
74411
|
+
code: EDC_PERMISSIONS.POS_MACHINE_READ,
|
|
74428
74412
|
label: "Xem thông tin",
|
|
74429
74413
|
is_primary: true,
|
|
74430
74414
|
active: false,
|
|
74431
74415
|
max: 10
|
|
74432
74416
|
},
|
|
74433
74417
|
{
|
|
74434
|
-
|
|
74418
|
+
code: EDC_PERMISSIONS.POS_MACHINE_UPDATE,
|
|
74435
74419
|
label: "Tích hợp ShopQR",
|
|
74436
74420
|
is_primary: false,
|
|
74437
74421
|
active: false,
|
|
@@ -74440,30 +74424,30 @@ const PERMISSION_GROUPS = [
|
|
|
74440
74424
|
]
|
|
74441
74425
|
},
|
|
74442
74426
|
{
|
|
74443
|
-
|
|
74427
|
+
code: "QUANLY_BANHANG",
|
|
74444
74428
|
label: "Quản lý bán hàng",
|
|
74445
74429
|
isNested: true,
|
|
74446
74430
|
subGroups: [
|
|
74447
74431
|
{
|
|
74448
|
-
|
|
74432
|
+
code: "QUANLY_KHACHHANG",
|
|
74449
74433
|
label: "Danh sách khách hàng",
|
|
74450
74434
|
permissions: [
|
|
74451
74435
|
{
|
|
74452
|
-
|
|
74436
|
+
code: SALES_PERMISSIONS.CUSTOMER_READ,
|
|
74453
74437
|
label: "Xem thông tin",
|
|
74454
74438
|
is_primary: true,
|
|
74455
74439
|
active: false,
|
|
74456
74440
|
max: 10
|
|
74457
74441
|
},
|
|
74458
74442
|
{
|
|
74459
|
-
|
|
74443
|
+
code: SALES_PERMISSIONS.CUSTOMER_CREATE,
|
|
74460
74444
|
label: "Tạo mới",
|
|
74461
74445
|
is_primary: false,
|
|
74462
74446
|
active: false,
|
|
74463
74447
|
max: null
|
|
74464
74448
|
},
|
|
74465
74449
|
{
|
|
74466
|
-
|
|
74450
|
+
code: SALES_PERMISSIONS.CUSTOMER_UPDATE,
|
|
74467
74451
|
label: "Chỉnh sửa",
|
|
74468
74452
|
is_primary: false,
|
|
74469
74453
|
active: false,
|
|
@@ -74472,25 +74456,25 @@ const PERMISSION_GROUPS = [
|
|
|
74472
74456
|
]
|
|
74473
74457
|
},
|
|
74474
74458
|
{
|
|
74475
|
-
|
|
74459
|
+
code: "EMENU",
|
|
74476
74460
|
label: "Danh sách sản phẩm",
|
|
74477
74461
|
permissions: [
|
|
74478
74462
|
{
|
|
74479
|
-
|
|
74463
|
+
code: "EMENU_READ",
|
|
74480
74464
|
label: "Xem thông tin",
|
|
74481
74465
|
is_primary: true,
|
|
74482
74466
|
active: false,
|
|
74483
74467
|
max: 10
|
|
74484
74468
|
},
|
|
74485
74469
|
{
|
|
74486
|
-
|
|
74470
|
+
code: "EMENU_CREATE",
|
|
74487
74471
|
label: "Tạo mới",
|
|
74488
74472
|
is_primary: false,
|
|
74489
74473
|
active: false,
|
|
74490
74474
|
max: null
|
|
74491
74475
|
},
|
|
74492
74476
|
{
|
|
74493
|
-
|
|
74477
|
+
code: "EMENU_UPDATE",
|
|
74494
74478
|
label: "Chỉnh sửa",
|
|
74495
74479
|
is_primary: false,
|
|
74496
74480
|
active: false,
|
|
@@ -74499,18 +74483,18 @@ const PERMISSION_GROUPS = [
|
|
|
74499
74483
|
]
|
|
74500
74484
|
},
|
|
74501
74485
|
{
|
|
74502
|
-
|
|
74486
|
+
code: "QUANLY_DONHANG",
|
|
74503
74487
|
label: "Danh sách đơn hàng",
|
|
74504
74488
|
permissions: [
|
|
74505
74489
|
{
|
|
74506
|
-
|
|
74490
|
+
code: SALES_PERMISSIONS.QUANLY_DONHANG_READ,
|
|
74507
74491
|
label: "Xem thông tin",
|
|
74508
74492
|
is_primary: true,
|
|
74509
74493
|
active: false,
|
|
74510
74494
|
max: 10
|
|
74511
74495
|
},
|
|
74512
74496
|
{
|
|
74513
|
-
|
|
74497
|
+
code: SALES_PERMISSIONS.QUANLY_DONHANG_CREATE,
|
|
74514
74498
|
label: "Tạo đơn",
|
|
74515
74499
|
is_primary: false,
|
|
74516
74500
|
active: false,
|
|
@@ -74519,32 +74503,32 @@ const PERMISSION_GROUPS = [
|
|
|
74519
74503
|
]
|
|
74520
74504
|
},
|
|
74521
74505
|
{
|
|
74522
|
-
|
|
74506
|
+
code: "QUANLY_BANHANG",
|
|
74523
74507
|
label: "Danh sách bàn",
|
|
74524
74508
|
permissions: [
|
|
74525
74509
|
{
|
|
74526
|
-
|
|
74510
|
+
code: SALES_PERMISSIONS.TABLE_READ,
|
|
74527
74511
|
label: "Xem thông tin",
|
|
74528
74512
|
is_primary: true,
|
|
74529
74513
|
active: false,
|
|
74530
74514
|
max: 10
|
|
74531
74515
|
},
|
|
74532
74516
|
{
|
|
74533
|
-
|
|
74517
|
+
code: SALES_PERMISSIONS.TABLE_CREATE,
|
|
74534
74518
|
label: "Tạo bàn",
|
|
74535
74519
|
is_primary: false,
|
|
74536
74520
|
active: false,
|
|
74537
74521
|
max: null
|
|
74538
74522
|
},
|
|
74539
74523
|
{
|
|
74540
|
-
|
|
74524
|
+
code: SALES_PERMISSIONS.TABLE_UPDATE,
|
|
74541
74525
|
label: "Chỉnh sửa bàn",
|
|
74542
74526
|
is_primary: false,
|
|
74543
74527
|
active: false,
|
|
74544
74528
|
max: null
|
|
74545
74529
|
},
|
|
74546
74530
|
{
|
|
74547
|
-
|
|
74531
|
+
code: SALES_PERMISSIONS.TABLE_DELETE,
|
|
74548
74532
|
label: "Xóa bàn",
|
|
74549
74533
|
is_primary: false,
|
|
74550
74534
|
active: false,
|
|
@@ -74553,25 +74537,25 @@ const PERMISSION_GROUPS = [
|
|
|
74553
74537
|
]
|
|
74554
74538
|
},
|
|
74555
74539
|
{
|
|
74556
|
-
|
|
74540
|
+
code: "THIETLAP_BANHANG",
|
|
74557
74541
|
label: "Thiết lập",
|
|
74558
74542
|
permissions: [
|
|
74559
74543
|
{
|
|
74560
|
-
|
|
74544
|
+
code: SETTINGS_PERMISSIONS.THIETLAP_BANHANG_READ,
|
|
74561
74545
|
label: "Xem thông tin",
|
|
74562
74546
|
is_primary: true,
|
|
74563
74547
|
active: false,
|
|
74564
74548
|
max: 10
|
|
74565
74549
|
},
|
|
74566
74550
|
{
|
|
74567
|
-
|
|
74551
|
+
code: SETTINGS_PERMISSIONS.THIETLAP_BANHANG_UPDATE,
|
|
74568
74552
|
label: "Chỉnh sửa",
|
|
74569
74553
|
is_primary: false,
|
|
74570
74554
|
active: false,
|
|
74571
74555
|
max: null
|
|
74572
74556
|
},
|
|
74573
74557
|
{
|
|
74574
|
-
|
|
74558
|
+
code: SETTINGS_PERMISSIONS.THIETLAP_BANHANG_CREATE,
|
|
74575
74559
|
label: "Thêm máy in",
|
|
74576
74560
|
is_primary: false,
|
|
74577
74561
|
active: false,
|
|
@@ -74582,16 +74566,16 @@ const PERMISSION_GROUPS = [
|
|
|
74582
74566
|
]
|
|
74583
74567
|
},
|
|
74584
74568
|
{
|
|
74585
|
-
|
|
74569
|
+
code: "thong_tin_ho_so",
|
|
74586
74570
|
label: "Thông tin hồ sơ",
|
|
74587
74571
|
isNested: true,
|
|
74588
74572
|
subGroups: [
|
|
74589
74573
|
{
|
|
74590
|
-
|
|
74574
|
+
code: "THONGTIN",
|
|
74591
74575
|
label: "Hồ sơ",
|
|
74592
74576
|
permissions: [
|
|
74593
74577
|
{
|
|
74594
|
-
|
|
74578
|
+
code: BUSINESS_PERMISSIONS.THONGTIN_READ,
|
|
74595
74579
|
label: "Xem thông tin",
|
|
74596
74580
|
is_primary: true,
|
|
74597
74581
|
active: false,
|
|
@@ -74600,11 +74584,11 @@ const PERMISSION_GROUPS = [
|
|
|
74600
74584
|
]
|
|
74601
74585
|
},
|
|
74602
74586
|
{
|
|
74603
|
-
|
|
74587
|
+
code: "QUANLY_CUAHANG",
|
|
74604
74588
|
label: "Quản lý cửa hàng",
|
|
74605
74589
|
permissions: [
|
|
74606
74590
|
{
|
|
74607
|
-
|
|
74591
|
+
code: BUSINESS_PERMISSIONS.STORE_READ,
|
|
74608
74592
|
label: "Xem thông tin",
|
|
74609
74593
|
is_primary: true,
|
|
74610
74594
|
active: false,
|
|
@@ -74613,39 +74597,39 @@ const PERMISSION_GROUPS = [
|
|
|
74613
74597
|
]
|
|
74614
74598
|
},
|
|
74615
74599
|
{
|
|
74616
|
-
|
|
74600
|
+
code: "QUANLY_NHANVIEN",
|
|
74617
74601
|
label: "Quản lý nhân viên",
|
|
74618
74602
|
permissions: [
|
|
74619
74603
|
{
|
|
74620
|
-
|
|
74604
|
+
code: BUSINESS_PERMISSIONS.STAFF_READ,
|
|
74621
74605
|
label: "Xem thông tin",
|
|
74622
74606
|
is_primary: true,
|
|
74623
74607
|
active: false,
|
|
74624
74608
|
max: 10
|
|
74625
74609
|
},
|
|
74626
74610
|
{
|
|
74627
|
-
|
|
74611
|
+
code: BUSINESS_PERMISSIONS.STAFF_CREATE,
|
|
74628
74612
|
label: "Tạo mới",
|
|
74629
74613
|
is_primary: false,
|
|
74630
74614
|
active: false,
|
|
74631
74615
|
max: null
|
|
74632
74616
|
},
|
|
74633
74617
|
{
|
|
74634
|
-
|
|
74618
|
+
code: BUSINESS_PERMISSIONS.STAFF_UPDATE,
|
|
74635
74619
|
label: "Chỉnh sửa",
|
|
74636
74620
|
is_primary: false,
|
|
74637
74621
|
active: false,
|
|
74638
74622
|
max: null
|
|
74639
74623
|
},
|
|
74640
74624
|
{
|
|
74641
|
-
|
|
74625
|
+
code: BUSINESS_PERMISSIONS.STAFF_DELETE,
|
|
74642
74626
|
label: "Xóa",
|
|
74643
74627
|
is_primary: false,
|
|
74644
74628
|
active: false,
|
|
74645
74629
|
max: null
|
|
74646
74630
|
},
|
|
74647
74631
|
{
|
|
74648
|
-
|
|
74632
|
+
code: BUSINESS_PERMISSIONS.STAFF_ACCOUNT,
|
|
74649
74633
|
label: "Cấp tài khoản/ Thu hồi",
|
|
74650
74634
|
is_primary: false,
|
|
74651
74635
|
active: false,
|
|
@@ -74656,30 +74640,30 @@ const PERMISSION_GROUPS = [
|
|
|
74656
74640
|
]
|
|
74657
74641
|
},
|
|
74658
74642
|
{
|
|
74659
|
-
|
|
74643
|
+
code: "hoa_don_dien_tu",
|
|
74660
74644
|
label: "Hóa đơn điện tử",
|
|
74661
74645
|
isNested: true,
|
|
74662
74646
|
subGroups: [
|
|
74663
74647
|
{
|
|
74664
|
-
|
|
74648
|
+
code: "HOA_DON_DIEN_TU",
|
|
74665
74649
|
label: "Danh sách hóa đơn điện tử",
|
|
74666
74650
|
permissions: [
|
|
74667
74651
|
{
|
|
74668
|
-
|
|
74652
|
+
code: EINVOICE_PERMISSIONS.EINVOICE_READ,
|
|
74669
74653
|
label: "Xem thông tin",
|
|
74670
74654
|
is_primary: true,
|
|
74671
74655
|
active: false,
|
|
74672
74656
|
max: 10
|
|
74673
74657
|
},
|
|
74674
74658
|
{
|
|
74675
|
-
|
|
74659
|
+
code: EINVOICE_PERMISSIONS.EINVOICE_CREATE,
|
|
74676
74660
|
label: "Xuất hóa đơn",
|
|
74677
74661
|
is_primary: false,
|
|
74678
74662
|
active: false,
|
|
74679
74663
|
max: null
|
|
74680
74664
|
},
|
|
74681
74665
|
{
|
|
74682
|
-
|
|
74666
|
+
code: EINVOICE_PERMISSIONS.EINVOICE_UPDATE,
|
|
74683
74667
|
label: "Ký hóa đơn",
|
|
74684
74668
|
is_primary: false,
|
|
74685
74669
|
active: false,
|
|
@@ -74734,32 +74718,19 @@ const createRoleService = (axiosClientPortal) => {
|
|
|
74734
74718
|
return response.data;
|
|
74735
74719
|
}),
|
|
74736
74720
|
create: (data) => __async(void 0, null, function* () {
|
|
74737
|
-
const response = yield axiosClientPortal.post(`/
|
|
74721
|
+
const response = yield axiosClientPortal.post(`/roles/`, data);
|
|
74738
74722
|
return response.data;
|
|
74739
74723
|
}),
|
|
74740
74724
|
update: (role_id, data) => __async(void 0, null, function* () {
|
|
74741
|
-
const response = yield axiosClientPortal.put(`/
|
|
74725
|
+
const response = yield axiosClientPortal.put(`/roles/${role_id}`, data);
|
|
74742
74726
|
return response.data;
|
|
74743
74727
|
}),
|
|
74744
74728
|
delete: (roleId) => __async(void 0, null, function* () {
|
|
74745
74729
|
const response = yield axiosClientPortal.delete(
|
|
74746
|
-
`/
|
|
74730
|
+
`/roles/${roleId}`
|
|
74747
74731
|
);
|
|
74748
74732
|
return response.data;
|
|
74749
|
-
})
|
|
74750
|
-
validateRoleData: (data) => {
|
|
74751
|
-
const errors = [];
|
|
74752
|
-
if (!data.role_name || data.role_name.trim().length === 0) {
|
|
74753
|
-
errors.push("Tên role không được để trống");
|
|
74754
|
-
}
|
|
74755
|
-
if (!data.permissions || data.permissions.length === 0) {
|
|
74756
|
-
errors.push("Phải chọn ít nhất một permission");
|
|
74757
|
-
}
|
|
74758
|
-
return {
|
|
74759
|
-
isValid: errors.length === 0,
|
|
74760
|
-
errors
|
|
74761
|
-
};
|
|
74762
|
-
}
|
|
74733
|
+
})
|
|
74763
74734
|
};
|
|
74764
74735
|
};
|
|
74765
74736
|
export {
|