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