changes
This commit is contained in:
@@ -140,9 +140,9 @@ if (topmenus.length === 0) {
|
||||
|
||||
topmenus.forEach((topmenu) => {
|
||||
let submenus = $filter($store.common, { category: "submenu", classify: topmenu.code });
|
||||
if ($store.rights.length > 0) {
|
||||
submenus = submenus.filter((x) => $findIndex($store.rights, { setting: x.id }) >= 0);
|
||||
}
|
||||
// if ($store.rights.length > 0) {
|
||||
// submenus = submenus.filter((x) => $findIndex($store.rights, { setting: x.id }) >= 0);
|
||||
// }
|
||||
topmenu.submenu = submenus.length > 0 ? submenus : null;
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@ import useOrderInfo from "~/components/pos/composables/useOrderInfo";
|
||||
export default function usePlaceOrder({ onSuccess }) {
|
||||
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 { invalidCartItems, orderInfo } = storeToRefs(posStore);
|
||||
const { activeCart, activeCartItems, subtotal } = useActiveCart();
|
||||
@@ -51,8 +56,8 @@ export default function usePlaceOrder({ onSuccess }) {
|
||||
discount_amount: 0,
|
||||
final_amount: total.value,
|
||||
order_type: "pos",
|
||||
status: "pending",
|
||||
payment_status: 1,
|
||||
invoice_status: pendingInvoiceStatus.id,
|
||||
payment_status: pendingPaymentStatus.id,
|
||||
staff: 1,
|
||||
ordered_at: new Date(),
|
||||
paid_at: null,
|
||||
@@ -167,7 +172,7 @@ export default function usePlaceOrder({ onSuccess }) {
|
||||
shipping_fee: orderInfo.value.shipping_fee,
|
||||
carrier: orderInfo.value.deliveryMethod.id,
|
||||
tracking_code: $id(),
|
||||
status: "pending",
|
||||
delivery_status: pendingDeliveryStatus.id,
|
||||
staff: 1,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ const props = defineProps({
|
||||
error: Object,
|
||||
});
|
||||
console.error(props.error);
|
||||
const router = useRouter();
|
||||
const { $createMeta } = useNuxtApp();
|
||||
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.";
|
||||
|
||||
useHead(
|
||||
$createMeta({
|
||||
title: props.error.message,
|
||||
@@ -15,10 +15,6 @@ useHead(
|
||||
type: "website",
|
||||
}),
|
||||
);
|
||||
|
||||
function reload() {
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -35,8 +31,8 @@ function reload() {
|
||||
{{ description }}
|
||||
</p>
|
||||
<div class="buttons">
|
||||
<button
|
||||
@click="reload"
|
||||
<a
|
||||
href=""
|
||||
class="button"
|
||||
>
|
||||
<span class="icon">
|
||||
@@ -46,9 +42,9 @@ function reload() {
|
||||
/>
|
||||
</span>
|
||||
<span>Thử lại</span>
|
||||
</button>
|
||||
<button
|
||||
@click="router.push('/')"
|
||||
</a>
|
||||
<a
|
||||
href="/"
|
||||
class="button"
|
||||
>
|
||||
<span class="icon">
|
||||
@@ -58,7 +54,7 @@ function reload() {
|
||||
/>
|
||||
</span>
|
||||
<span>Trang chủ</span>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -69,10 +69,10 @@ async function checkRedirect() {
|
||||
}
|
||||
|
||||
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 } }));
|
||||
let authtoken = await $getdata("token", { first: true, filter: { token: $store.login.token } });
|
||||
if (authtoken ? authtoken.expiry : true) return; /* $requestLogin(); */
|
||||
const authtoken = await $getdata("token", { first: true, filter: { token: $store.login.token } });
|
||||
if (authtoken?.expiry) return; /* $requestLogin(); */
|
||||
authorized.value = true;
|
||||
}
|
||||
// else $requestLogin();
|
||||
|
||||
@@ -10,7 +10,8 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
{ name: "local", url: "http://localhost:8000/" },
|
||||
{ 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 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}`;
|
||||
};
|
||||
|
||||
const getpath = function (name = mode) {
|
||||
return paths.find((v) => v.name === name).url;
|
||||
};
|
||||
const getpath = (name = mode) => paths.find((v) => v.name === name).url;
|
||||
const path = getpath();
|
||||
|
||||
/**
|
||||
* @param {ApiName | ApiName[]} name
|
||||
|
||||
@@ -10,6 +10,9 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
"colorchoice",
|
||||
"menuchoice",
|
||||
"colorscheme",
|
||||
"Invoice_Status",
|
||||
"Payment_Status",
|
||||
"Delivery_Status",
|
||||
]);
|
||||
const notReadyConns = connlist.filter((v) => !v.ready);
|
||||
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useStore = defineStore("maindev", {
|
||||
export const useStore = defineStore("erp-dev", {
|
||||
state: () => ({
|
||||
ready: false,
|
||||
viewport: undefined,
|
||||
login: undefined,
|
||||
token: undefined,
|
||||
common: undefined,
|
||||
viewport: null,
|
||||
login: null,
|
||||
token: null,
|
||||
showmodal: null,
|
||||
snackbar: null,
|
||||
settings: [],
|
||||
showmodal: undefined,
|
||||
snackbar: undefined,
|
||||
country: undefined,
|
||||
lang: "vi",
|
||||
branch: {},
|
||||
rights: [],
|
||||
product: [],
|
||||
// set by api-loader
|
||||
common: null,
|
||||
tablesetting: null,
|
||||
datatype: null,
|
||||
settingtype: null,
|
||||
settingclass: null,
|
||||
colorchoice: null,
|
||||
menuchoice: null,
|
||||
colorscheme: null,
|
||||
Invoice_Status: null,
|
||||
Payment_Status: null,
|
||||
Delivery_Status: null,
|
||||
}),
|
||||
actions: {
|
||||
commit(name, data) {
|
||||
|
||||
@@ -66,12 +66,6 @@ export default /** @type {const} */ ([
|
||||
url_detail: "data-detail/Approve_Status/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "bizrights",
|
||||
url: "data/Biz_Rights/",
|
||||
url_detail: "data-detail/Biz_Rights/",
|
||||
params: { sort: "-id" },
|
||||
},
|
||||
{
|
||||
name: "documenttype",
|
||||
url: "data/Document_Type/",
|
||||
@@ -80,8 +74,8 @@ export default /** @type {const} */ ([
|
||||
},
|
||||
{
|
||||
name: "country",
|
||||
url: "data/Country/",
|
||||
commit: "country",
|
||||
url: "data/Country/",
|
||||
params: {
|
||||
sort: "id",
|
||||
values: "id,code,name,en,create_time",
|
||||
@@ -493,7 +487,7 @@ export default /** @type {const} */ ([
|
||||
url_detail: "data-detail/Invoice/",
|
||||
params: {
|
||||
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",
|
||||
},
|
||||
},
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Invoice_Status",
|
||||
commit: "Invoice_Status",
|
||||
url: "data/Invoice_Status/",
|
||||
url_detail: "data-detail/Invoice_Status/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "Manufacturer",
|
||||
url: "data/Manufacturer/",
|
||||
@@ -662,6 +663,7 @@ export default /** @type {const} */ ([
|
||||
},
|
||||
{
|
||||
name: "Payment_Status",
|
||||
commit: "Payment_Status",
|
||||
url: "data/Payment_Status/",
|
||||
url_detail: "data-detail/Payment_Status/",
|
||||
params: {},
|
||||
@@ -684,6 +686,13 @@ export default /** @type {const} */ ([
|
||||
url_detail: "data-detail/Delivery_Method/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "Delivery_Status",
|
||||
commit: "Delivery_Status",
|
||||
url: "data/Delivery_Status/",
|
||||
url_detail: "data-detail/Delivery_Status/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "Cart",
|
||||
url: "data/Cart/",
|
||||
|
||||
Reference in New Issue
Block a user