changes
This commit is contained in:
@@ -140,9 +140,9 @@ if (topmenus.length === 0) {
|
|||||||
|
|
||||||
topmenus.forEach((topmenu) => {
|
topmenus.forEach((topmenu) => {
|
||||||
let submenus = $filter($store.common, { category: "submenu", classify: topmenu.code });
|
let submenus = $filter($store.common, { category: "submenu", classify: topmenu.code });
|
||||||
if ($store.rights.length > 0) {
|
// if ($store.rights.length > 0) {
|
||||||
submenus = submenus.filter((x) => $findIndex($store.rights, { setting: x.id }) >= 0);
|
// submenus = submenus.filter((x) => $findIndex($store.rights, { setting: x.id }) >= 0);
|
||||||
}
|
// }
|
||||||
topmenu.submenu = submenus.length > 0 ? submenus : null;
|
topmenu.submenu = submenus.length > 0 ? submenus : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import useOrderInfo from "~/components/pos/composables/useOrderInfo";
|
|||||||
export default function usePlaceOrder({ onSuccess }) {
|
export default function usePlaceOrder({ onSuccess }) {
|
||||||
const { $dayjs, $id, $getdata, $insertapi, $patchapi, $deleteapi, $snackbar } = useNuxtApp();
|
const { $dayjs, $id, $getdata, $insertapi, $patchapi, $deleteapi, $snackbar } = useNuxtApp();
|
||||||
|
|
||||||
|
const store = useStore();
|
||||||
|
const pendingInvoiceStatus = store.Invoice_Status.find(({ code }) => code === "DRAFT");
|
||||||
|
const pendingPaymentStatus = store.Payment_Status.find(({ code }) => code === "PENDING");
|
||||||
|
const pendingDeliveryStatus = store.Delivery_Status.find(({ code }) => code === "PENDING");
|
||||||
|
|
||||||
const posStore = usePosStore();
|
const posStore = usePosStore();
|
||||||
const { invalidCartItems, orderInfo } = storeToRefs(posStore);
|
const { invalidCartItems, orderInfo } = storeToRefs(posStore);
|
||||||
const { activeCart, activeCartItems, subtotal } = useActiveCart();
|
const { activeCart, activeCartItems, subtotal } = useActiveCart();
|
||||||
@@ -51,8 +56,8 @@ export default function usePlaceOrder({ onSuccess }) {
|
|||||||
discount_amount: 0,
|
discount_amount: 0,
|
||||||
final_amount: total.value,
|
final_amount: total.value,
|
||||||
order_type: "pos",
|
order_type: "pos",
|
||||||
status: "pending",
|
invoice_status: pendingInvoiceStatus.id,
|
||||||
payment_status: 1,
|
payment_status: pendingPaymentStatus.id,
|
||||||
staff: 1,
|
staff: 1,
|
||||||
ordered_at: new Date(),
|
ordered_at: new Date(),
|
||||||
paid_at: null,
|
paid_at: null,
|
||||||
@@ -167,7 +172,7 @@ export default function usePlaceOrder({ onSuccess }) {
|
|||||||
shipping_fee: orderInfo.value.shipping_fee,
|
shipping_fee: orderInfo.value.shipping_fee,
|
||||||
carrier: orderInfo.value.deliveryMethod.id,
|
carrier: orderInfo.value.deliveryMethod.id,
|
||||||
tracking_code: $id(),
|
tracking_code: $id(),
|
||||||
status: "pending",
|
delivery_status: pendingDeliveryStatus.id,
|
||||||
staff: 1,
|
staff: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ const props = defineProps({
|
|||||||
error: Object,
|
error: Object,
|
||||||
});
|
});
|
||||||
console.error(props.error);
|
console.error(props.error);
|
||||||
const router = useRouter();
|
|
||||||
const { $createMeta } = useNuxtApp();
|
const { $createMeta } = useNuxtApp();
|
||||||
const description =
|
const description =
|
||||||
"Rất tiếc! Có vẻ như đã xảy ra sự cố. Vui lòng thử lại hoặc liên hệ quản trị viên nếu lỗi tiếp tục.";
|
"Rất tiếc! Có vẻ như đã xảy ra sự cố. Vui lòng thử lại hoặc liên hệ quản trị viên nếu lỗi tiếp tục.";
|
||||||
|
|
||||||
useHead(
|
useHead(
|
||||||
$createMeta({
|
$createMeta({
|
||||||
title: props.error.message,
|
title: props.error.message,
|
||||||
@@ -15,10 +15,6 @@ useHead(
|
|||||||
type: "website",
|
type: "website",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
function reload() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -35,8 +31,8 @@ function reload() {
|
|||||||
{{ description }}
|
{{ description }}
|
||||||
</p>
|
</p>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button
|
<a
|
||||||
@click="reload"
|
href=""
|
||||||
class="button"
|
class="button"
|
||||||
>
|
>
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
@@ -46,9 +42,9 @@ function reload() {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span>Thử lại</span>
|
<span>Thử lại</span>
|
||||||
</button>
|
</a>
|
||||||
<button
|
<a
|
||||||
@click="router.push('/')"
|
href="/"
|
||||||
class="button"
|
class="button"
|
||||||
>
|
>
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
@@ -58,7 +54,7 @@ function reload() {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span>Trang chủ</span>
|
<span>Trang chủ</span>
|
||||||
</button>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ async function checkRedirect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkLogin() {
|
async function checkLogin() {
|
||||||
if ($store.login ? $store.login.token : false) {
|
if ($store.login?.token) {
|
||||||
$store.commit("rights", await $getdata("grouprights", { filter: { group: $store.login.type } }));
|
$store.commit("rights", await $getdata("grouprights", { filter: { group: $store.login.type } }));
|
||||||
let authtoken = await $getdata("token", { first: true, filter: { token: $store.login.token } });
|
const authtoken = await $getdata("token", { first: true, filter: { token: $store.login.token } });
|
||||||
if (authtoken ? authtoken.expiry : true) return; /* $requestLogin(); */
|
if (authtoken?.expiry) return; /* $requestLogin(); */
|
||||||
authorized.value = true;
|
authorized.value = true;
|
||||||
}
|
}
|
||||||
// else $requestLogin();
|
// else $requestLogin();
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
{ name: "local", url: "http://localhost:8000/" },
|
{ name: "local", url: "http://localhost:8000/" },
|
||||||
{ name: "prod", url: "https://erpapi.bigdatatech.vn/" },
|
{ name: "prod", url: "https://erpapi.bigdatatech.vn/" },
|
||||||
];
|
];
|
||||||
const path = paths.find((v) => v.name === mode).url;
|
|
||||||
|
const store = useStore();
|
||||||
const { $copy, $updateSeriesFields, $snackbar, $store, $remove, $dialog } = nuxtApp;
|
const { $copy, $updateSeriesFields, $snackbar, $store, $remove, $dialog } = nuxtApp;
|
||||||
|
|
||||||
const requestLogin = function () {
|
const requestLogin = function () {
|
||||||
@@ -18,9 +19,8 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
window.location.href = `https://${mode === "dev" ? "dev." : ""}login.utopia.com.vn/signin?module=${module}&link=${window.location.origin}`;
|
window.location.href = `https://${mode === "dev" ? "dev." : ""}login.utopia.com.vn/signin?module=${module}&link=${window.location.origin}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getpath = function (name = mode) {
|
const getpath = (name = mode) => paths.find((v) => v.name === name).url;
|
||||||
return paths.find((v) => v.name === name).url;
|
const path = getpath();
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ApiName | ApiName[]} name
|
* @param {ApiName | ApiName[]} name
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
"colorchoice",
|
"colorchoice",
|
||||||
"menuchoice",
|
"menuchoice",
|
||||||
"colorscheme",
|
"colorscheme",
|
||||||
|
"Invoice_Status",
|
||||||
|
"Payment_Status",
|
||||||
|
"Delivery_Status",
|
||||||
]);
|
]);
|
||||||
const notReadyConns = connlist.filter((v) => !v.ready);
|
const notReadyConns = connlist.filter((v) => !v.ready);
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,27 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
export const useStore = defineStore("maindev", {
|
export const useStore = defineStore("erp-dev", {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
ready: false,
|
ready: false,
|
||||||
viewport: undefined,
|
viewport: null,
|
||||||
login: undefined,
|
login: null,
|
||||||
token: undefined,
|
token: null,
|
||||||
common: undefined,
|
showmodal: null,
|
||||||
|
snackbar: null,
|
||||||
settings: [],
|
settings: [],
|
||||||
showmodal: undefined,
|
|
||||||
snackbar: undefined,
|
|
||||||
country: undefined,
|
|
||||||
lang: "vi",
|
lang: "vi",
|
||||||
branch: {},
|
// set by api-loader
|
||||||
rights: [],
|
common: null,
|
||||||
product: [],
|
tablesetting: null,
|
||||||
|
datatype: null,
|
||||||
|
settingtype: null,
|
||||||
|
settingclass: null,
|
||||||
|
colorchoice: null,
|
||||||
|
menuchoice: null,
|
||||||
|
colorscheme: null,
|
||||||
|
Invoice_Status: null,
|
||||||
|
Payment_Status: null,
|
||||||
|
Delivery_Status: null,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
commit(name, data) {
|
commit(name, data) {
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ export default /** @type {const} */ ([
|
|||||||
url_detail: "data-detail/Approve_Status/",
|
url_detail: "data-detail/Approve_Status/",
|
||||||
params: {},
|
params: {},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "bizrights",
|
|
||||||
url: "data/Biz_Rights/",
|
|
||||||
url_detail: "data-detail/Biz_Rights/",
|
|
||||||
params: { sort: "-id" },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "documenttype",
|
name: "documenttype",
|
||||||
url: "data/Document_Type/",
|
url: "data/Document_Type/",
|
||||||
@@ -80,8 +74,8 @@ export default /** @type {const} */ ([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "country",
|
name: "country",
|
||||||
url: "data/Country/",
|
|
||||||
commit: "country",
|
commit: "country",
|
||||||
|
url: "data/Country/",
|
||||||
params: {
|
params: {
|
||||||
sort: "id",
|
sort: "id",
|
||||||
values: "id,code,name,en,create_time",
|
values: "id,code,name,en,create_time",
|
||||||
@@ -493,7 +487,7 @@ export default /** @type {const} */ ([
|
|||||||
url_detail: "data-detail/Invoice/",
|
url_detail: "data-detail/Invoice/",
|
||||||
params: {
|
params: {
|
||||||
values:
|
values:
|
||||||
"delivery,delivery__receiver_name,delivery__receiver_phone,delivery__tracking_code,delivery__expected_date,delivery__delivered_date,delivery__status,payments,history,id,code,customer,staff,staff__fullname,staff__phone,staff__email,voucher,customer_name,customer_phone,customer_email,shipping_address,product_amount,shipping_fee,total_amount,discount_amount,final_amount,order_type,status,payment_status,payment_status__code,payment_status__name,note,ordered_at,paid_at,creator,updater,deleted,delivery_method,create_time,update_time",
|
"delivery,delivery__receiver_name,delivery__receiver_phone,delivery__tracking_code,delivery__expected_date,delivery__delivered_date,delivery__delivery_status,payments,history,id,code,customer,staff,staff__fullname,staff__phone,staff__email,voucher,customer_name,customer_phone,customer_email,shipping_address,product_amount,shipping_fee,total_amount,discount_amount,final_amount,order_type,invoice_status,invoice_status__code,invoice_status__name,invoice_status__color,payment_status,payment_status__code,payment_status__name,payment_status__color,note,ordered_at,paid_at,creator,updater,deleted,delivery_method,create_time,update_time",
|
||||||
sort: "-id",
|
sort: "-id",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -506,6 +500,13 @@ export default /** @type {const} */ ([
|
|||||||
"id,code,invoice,variant,variant__code,variant__product,variant__product__name,variant__color,variant__color__name,variant__ram__code,variant__ram__capacity,variant__internal_storage__code,variant__internal_storage__capacity,variant__price,variant__image__path,imei_sold,price,status,note,deleted,create_time,update_time",
|
"id,code,invoice,variant,variant__code,variant__product,variant__product__name,variant__color,variant__color__name,variant__ram__code,variant__ram__capacity,variant__internal_storage__code,variant__internal_storage__capacity,variant__price,variant__image__path,imei_sold,price,status,note,deleted,create_time,update_time",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Invoice_Status",
|
||||||
|
commit: "Invoice_Status",
|
||||||
|
url: "data/Invoice_Status/",
|
||||||
|
url_detail: "data-detail/Invoice_Status/",
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Manufacturer",
|
name: "Manufacturer",
|
||||||
url: "data/Manufacturer/",
|
url: "data/Manufacturer/",
|
||||||
@@ -662,6 +663,7 @@ export default /** @type {const} */ ([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Payment_Status",
|
name: "Payment_Status",
|
||||||
|
commit: "Payment_Status",
|
||||||
url: "data/Payment_Status/",
|
url: "data/Payment_Status/",
|
||||||
url_detail: "data-detail/Payment_Status/",
|
url_detail: "data-detail/Payment_Status/",
|
||||||
params: {},
|
params: {},
|
||||||
@@ -684,6 +686,13 @@ export default /** @type {const} */ ([
|
|||||||
url_detail: "data-detail/Delivery_Method/",
|
url_detail: "data-detail/Delivery_Method/",
|
||||||
params: {},
|
params: {},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Delivery_Status",
|
||||||
|
commit: "Delivery_Status",
|
||||||
|
url: "data/Delivery_Status/",
|
||||||
|
url_detail: "data-detail/Delivery_Status/",
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Cart",
|
name: "Cart",
|
||||||
url: "data/Cart/",
|
url: "data/Cart/",
|
||||||
|
|||||||
12
envdev.py
12
envdev.py
@@ -10,16 +10,6 @@ def search_text(file, text, new_text):
|
|||||||
file = './app/plugins/02-connection.js'
|
file = './app/plugins/02-connection.js'
|
||||||
text1 = 'mode = "prod"'
|
text1 = 'mode = "prod"'
|
||||||
newtext1 = 'mode = "dev"'
|
newtext1 = 'mode = "dev"'
|
||||||
newtext2 = 'module = "application"'
|
|
||||||
text2 = 'module = "dealer"'
|
|
||||||
newtext3 = 'Biz_Setting'
|
|
||||||
text3 = 'Dealer_Setting'
|
|
||||||
newtext4 = 'Biz_Rights'
|
|
||||||
text4 = 'Dealer_Rights'
|
|
||||||
search_text(file, text1, newtext1)
|
search_text(file, text1, newtext1)
|
||||||
search_text(file, text2, newtext2)
|
|
||||||
search_text(file, text3, newtext3)
|
|
||||||
search_text(file, text4, newtext4)
|
|
||||||
file = './app/assets/styles/main.scss'
|
|
||||||
file = './app/stores/index.js'
|
file = './app/stores/index.js'
|
||||||
search_text(file,'export const useStore = defineStore("main", {','export const useStore = defineStore("maindev", {')
|
search_text(file,'defineStore("erp"','defineStore("erp-dev"')
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
def search_text(file, text, new_text):
|
|
||||||
f = open(file, 'r', newline='\n')
|
|
||||||
content = f.read()
|
|
||||||
print(text, content.find(new_text))
|
|
||||||
content = content.replace(text, new_text)
|
|
||||||
f.close()
|
|
||||||
with open(file, 'w', newline='\n') as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
file = './app/plugins/02-connection.js'
|
|
||||||
|
|
||||||
text1 = 'mode = "prod"'
|
|
||||||
newtext1 = 'mode = "dev"'
|
|
||||||
text2 = 'module = "application"'
|
|
||||||
newtext2 = 'module = "dealer"'
|
|
||||||
text3 = 'Biz_Setting'
|
|
||||||
newtext3 = 'Dealer_Setting'
|
|
||||||
text4 = 'Biz_Rights'
|
|
||||||
newtext4 = 'Dealer_Rights'
|
|
||||||
search_text(file, text1, newtext1)
|
|
||||||
search_text(file, text2, newtext2)
|
|
||||||
search_text(file, text3, newtext3)
|
|
||||||
search_text(file, text4, newtext4)
|
|
||||||
file = './app/assets/styles/main.scss'
|
|
||||||
file = './app/stores/index.js'
|
|
||||||
search_text(file,'export const useStore = defineStore("main", {','export const useStore = defineStore("maindev", {')
|
|
||||||
14
envprod.py
14
envprod.py
@@ -8,18 +8,8 @@ def search_text(file, text, new_text):
|
|||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
file = './app/plugins/02-connection.js'
|
file = './app/plugins/02-connection.js'
|
||||||
newtext1 = 'mode = "prod"'
|
|
||||||
text1 = 'mode = "dev"'
|
text1 = 'mode = "dev"'
|
||||||
newtext2 = 'module = "application"'
|
newtext1 = 'mode = "prod"'
|
||||||
text2 = 'module = "dealer"'
|
|
||||||
newtext3 = 'Biz_Setting'
|
|
||||||
text3 = 'Dealer_Setting'
|
|
||||||
newtext4 = 'Biz_Rights'
|
|
||||||
text4 = 'Dealer_Rights'
|
|
||||||
search_text(file, text1, newtext1)
|
search_text(file, text1, newtext1)
|
||||||
search_text(file, text2, newtext2)
|
|
||||||
search_text(file, text3, newtext3)
|
|
||||||
search_text(file, text4, newtext4)
|
|
||||||
file = './app/assets/styles/main.scss'
|
|
||||||
file = './app/stores/index.js'
|
file = './app/stores/index.js'
|
||||||
search_text(file,'export const useStore = defineStore("maindev", {','export const useStore = defineStore("main", {')
|
search_text(file,'defineStore("erp-dev"','defineStore("erp"')
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
def search_text(file, text, new_text):
|
|
||||||
f = open(file, 'r', newline='\n')
|
|
||||||
content = f.read()
|
|
||||||
print(text, content.find(new_text))
|
|
||||||
content = content.replace(text, new_text)
|
|
||||||
f.close()
|
|
||||||
with open(file, 'w', newline='\n') as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
file = './app/plugins/02-connection.js'
|
|
||||||
text1 = 'mode = "dev"'
|
|
||||||
text2 = 'module = "application"'
|
|
||||||
newtext1 = 'mode = "prod"'
|
|
||||||
newtext2 = 'module = "dealer"'
|
|
||||||
text3 = 'Biz_Setting'
|
|
||||||
newtext3 = 'Dealer_Setting'
|
|
||||||
text4 = 'Biz_Rights'
|
|
||||||
newtext4 = 'Dealer_Rights'
|
|
||||||
search_text(file, text1, newtext1)
|
|
||||||
search_text(file, text2, newtext2)
|
|
||||||
search_text(file, text3, newtext3)
|
|
||||||
search_text(file, text4, newtext4)
|
|
||||||
file = './app/assets/styles/main.scss'
|
|
||||||
file = './app/stores/index.js'
|
|
||||||
search_text(file,'export const useStore = defineStore("maindev", {','export const useStore = defineStore("main", {')
|
|
||||||
Reference in New Issue
Block a user