7383-testToMaster #370
|
@ -0,0 +1,11 @@
|
|||
export function getDateQBadgeColor(date) {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
let comparation = today - timeTicket;
|
||||
|
||||
if (comparation == 0) return 'warning';
|
||||
if (comparation < 0) return 'negative';
|
||||
}
|
|
@ -12,6 +12,7 @@ import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
|||
import { toDateFormat } from 'src/filters/date';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
|
@ -20,6 +21,7 @@ const { notify } = useNotify();
|
|||
|
||||
const denyFormRef = ref(null);
|
||||
const denyRequestId = ref(null);
|
||||
const denyRequestIndex = ref(null);
|
||||
const itemRequestsOptions = ref([]);
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -108,21 +110,7 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
const getDateQBadgeColor = (date) => {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
let comparation = today - timeTicket;
|
||||
|
||||
if (comparation == 0) return 'warning';
|
||||
if (comparation < 0) return 'negative';
|
||||
};
|
||||
|
||||
const changeQuantity = async (request) => {
|
||||
console.log('change quantity request:: ', request);
|
||||
|
||||
try {
|
||||
if (request.saleFk) {
|
||||
const params = {
|
||||
|
@ -134,12 +122,11 @@ const changeQuantity = async (request) => {
|
|||
confirmRequest(request);
|
||||
} else confirmRequest(request);
|
||||
} catch (error) {
|
||||
console.log('Error changing quantity:: ', error);
|
||||
console.error('Error changing quantity:: ', error);
|
||||
}
|
||||
};
|
||||
|
||||
const confirmRequest = async (request) => {
|
||||
console.log('confirm request:: ', request);
|
||||
try {
|
||||
if (request.itemFk && request.saleQuantity) {
|
||||
const params = {
|
||||
|
@ -157,7 +144,7 @@ const confirmRequest = async (request) => {
|
|||
notify(t('globals.dataSaved', 'positive'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error confirming request:: ', error);
|
||||
console.error('Error confirming request:: ', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -167,13 +154,19 @@ const getState = (isOk) => {
|
|||
else return 'Denied';
|
||||
};
|
||||
|
||||
const showDenyRequestForm = (requestId) => {
|
||||
const showDenyRequestForm = (requestId, rowIndex) => {
|
||||
denyRequestId.value = requestId;
|
||||
denyRequestIndex.value = rowIndex;
|
||||
denyFormRef.value.show();
|
||||
};
|
||||
|
||||
const onDenyAccept = (_, responseData) => {
|
||||
console.log('response data:: ', responseData);
|
||||
itemRequestsOptions.value[denyRequestIndex.value].isOk = responseData.isOk;
|
||||
itemRequestsOptions.value[denyRequestIndex.value].attenderFk =
|
||||
responseData.attenderFk;
|
||||
itemRequestsOptions.value[denyRequestIndex.value].response = responseData.response;
|
||||
denyRequestId.value = null;
|
||||
denyRequestIndex.value = null;
|
||||
};
|
||||
|
||||
onMounted(async () => {});
|
||||
|
@ -186,7 +179,6 @@ onMounted(async () => {});
|
|||
auto-load
|
||||
@on-fetch="(data) => (itemRequestsOptions = data)"
|
||||
/>
|
||||
<!-- TODO:: ADD SEARCHBAR -->
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="itemRequestsOptions"
|
||||
|
@ -262,7 +254,7 @@ onMounted(async () => {});
|
|||
<span>{{ getState(row.isOk) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-action="{ row }">
|
||||
<template #body-cell-action="{ row, rowIndex }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
v-if="row.response?.length"
|
||||
|
@ -280,7 +272,7 @@ onMounted(async () => {});
|
|||
color="primary"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
@click="showDenyRequestForm(row.id)"
|
||||
@click="showDenyRequestForm(row.id, rowIndex)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Discard') }}
|
||||
|
|
|
@ -13,6 +13,7 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate } from 'src/filters/index';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
@ -42,18 +43,6 @@ const getWarehouseName = (id) => {
|
|||
return warehouses.value.find((warehouse) => warehouse.id === id).name;
|
||||
};
|
||||
|
||||
const getDateQBadgeColor = (date) => {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
date = new Date(date);
|
||||
date.setHours(0, 0, 0, 0);
|
||||
|
||||
const timeDifference = today - date;
|
||||
if (timeDifference == 0) return 'warning';
|
||||
if (timeDifference < 0) return 'success';
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue