This commit is contained in:
Viet An
2026-06-20 14:48:35 +07:00
parent 7402e61906
commit b596ea0a0f
31 changed files with 5911 additions and 13522 deletions

View File

@@ -1,6 +1,6 @@
import { defineStore } from "pinia";
export const useStore = defineStore("maindev", {
export const useStore = defineStore("hrm-dev", {
state: () => ({
viewport: undefined,
login: undefined,
@@ -10,62 +10,117 @@ export const useStore = defineStore("maindev", {
settings: [],
showmodal: undefined,
snackbar: undefined,
productdocument: undefined,
applicationstatus: undefined,
applicationproduct: undefined,
lastlegendfiltertab: 'Giỏ hàng',
layersetting: undefined,
country: undefined,
lang: "vi",
branch: {},
rights: [],
product: [],
cart: [],
selectedPaymentSchedulesForEmailInDue: [],
selectedPaymentSchedulesForEmailInOverdue: [],
selectedProductsForHandoverEmail: [],
menu: [
{
id: 1,
category: "topmenu",
classify: "left",
code: "dashboard",
vi: "Dashboard",
link: null,
view: true,
detail: {
base: "Dashboard",
component: "DashboardMaster",
},
},
{
id: 2,
category: "topmenu",
classify: "left",
code: "hrm",
vi: "Quản lý nhân sự",
link: null,
view: true,
detail: {
base: "HRM",
component: "HRMMaster",
},
},
{
id: 3,
category: "topmenu",
classify: "left",
code: "rollcall",
vi: "Chấm công",
link: null,
view: true,
detail: {
base: "Rollcall",
component: "RollcallMaster",
},
},
{
id: 4,
category: "topmenu",
classify: "left",
code: "salary",
vi: "Tính lương",
link: null,
view: false,
detail: {
base: "Salary",
component: "SalaryMaster",
},
},
{
id: 5,
category: "topmenu",
classify: "left",
code: "kpi_efficiency",
vi: "KPI & Hiệu suất",
link: null,
view: false,
detail: {
base: "Kpi",
component: "KpiMaster",
},
},
{
id: 6,
category: "topmenu",
classify: "left",
code: "employee",
vi: "Cổng nhân viên",
link: null,
view: false,
detail: {
base: "Employee",
component: "EmployeeMaster",
},
},
{
id: 7,
category: "topmenu",
classify: "left",
code: "rights",
vi: "Phân quyền",
link: null,
view: false,
detail: {
base: "Rights",
component: "RightsMaster",
},
},
],
}),
actions: {
commit(name, data) {
this[name] = data;
},
removeSnackbar() {
this.snackbar = undefined;
},
updateProduct(products) {
this.product = products;
},
updateCart(carts) {
this.cart = carts;
},
updateSingleProduct(updatedProduct) {
const index = this.product.findIndex(p => p.id === updatedProduct.id);
if (index !== -1) {
this.product[index] = updatedProduct;
} else {
this.product.push(updatedProduct);
}
},
removeProduct(productId) {
this.product = this.product.filter(p => p.id !== productId);
},
},
persist: {
pick: [
"token",
"login",
"lang",
"dealer",
"lastlegendfiltertab",
"layersetting"
],
pick: ["token", "login", "lang", "menu"],
storage: piniaPluginPersistedstate.localStorage(),
},
});
});