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