From cd49ebe7a66790e039baaa4b9280d0aa3f9b6d3f Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 3 Apr 2024 12:54:14 +0200 Subject: [PATCH 01/25] refs #6697 fix claimQuantity --- src/pages/Claim/Card/ClaimLines.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue index 70c257c69..4a1d9c9d0 100644 --- a/src/pages/Claim/Card/ClaimLines.vue +++ b/src/pages/Claim/Card/ClaimLines.vue @@ -20,7 +20,7 @@ const { t } = useI18n(); const stateStore = useStateStore(); const arrayData = useArrayData('ClaimLines'); const store = arrayData.store; - +let claimedDefault = 0; const claimFilter = { fields: ['ticketFk'], }; @@ -79,6 +79,7 @@ const columns = computed(() => [ label: t('Claimed'), field: (row) => row.quantity, sortable: true, + default: 0, }, { name: 'description', From 98f273cb938e32911370bf83f11c813409495a76 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 11 Apr 2024 18:04:11 -0300 Subject: [PATCH 02/25] WIP --- src/i18n/en/index.js | 13 ++ src/i18n/es/index.js | 13 ++ src/pages/Item/ItemRequest.vue | 244 +++++++++++++++++++++++++++++++++ src/router/modules/item.js | 11 +- 4 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 src/pages/Item/ItemRequest.vue diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index c9e141574..4c7734029 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -1220,6 +1220,7 @@ export default { diary: 'Diary', tags: 'Tags', create: 'Create', + buyRequest: 'Buy requests', }, descriptor: { item: 'Item', @@ -1250,6 +1251,18 @@ export default { producer: 'Producer', landed: 'Landed', }, + buyRequest: { + ticketId: 'Ticket ID', + shipped: 'Shipped', + requester: 'Requester', + requested: 'Requested', + price: 'Price', + attender: 'Atender', + item: 'Item', + achieved: 'Achieved', + concept: 'Concept', + state: 'State', + }, }, components: { topbar: {}, diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index d10f4c023..c9a8f875e 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -1219,6 +1219,7 @@ export default { diary: 'Histórico', tags: 'Etiquetas', create: 'Crear', + buyRequest: 'Peticiones de compra', }, descriptor: { item: 'Artículo', @@ -1249,6 +1250,18 @@ export default { producer: 'Productor', landed: 'F. entrega', }, + buyRequest: { + ticketId: 'ID Ticket', + shipped: 'F. envío', + requester: 'Solicitante', + requested: 'Solicitado', + price: 'Precio', + attender: 'Comprador', + item: 'Artículo', + achieved: 'Conseguido', + concept: 'Concepto', + state: 'Estado', + }, }, components: { topbar: {}, diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue new file mode 100644 index 000000000..79a93c7bf --- /dev/null +++ b/src/pages/Item/ItemRequest.vue @@ -0,0 +1,244 @@ + + + + + + + diff --git a/src/router/modules/item.js b/src/router/modules/item.js index d16022f79..daade4508 100644 --- a/src/router/modules/item.js +++ b/src/router/modules/item.js @@ -10,7 +10,7 @@ export default { component: RouterView, redirect: { name: 'ItemMain' }, menus: { - main: ['ItemList'], + main: ['ItemList', 'ItemRequest'], card: [], }, children: [ @@ -37,6 +37,15 @@ export default { }, component: () => import('src/pages/Item/ItemCreate.vue'), }, + { + path: 'request', + name: 'ItemRequest', + meta: { + title: 'buyRequest', + icon: 'vn:buyrequest', + }, + component: () => import('src/pages/Item/ItemRequest.vue'), + }, ], }, { From f72ea07b09045b2bc551d0ed5468cd04210e7581 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 12 Apr 2024 08:07:33 -0300 Subject: [PATCH 03/25] WIP --- src/pages/Item/ItemRequest.vue | 68 ++++++++++++++++++++++++-- src/pages/Item/ItemRequestDenyForm.vue | 57 +++++++++++++++++++++ 2 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 src/pages/Item/ItemRequestDenyForm.vue diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 79a93c7bf..8778d8f6a 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -1,12 +1,13 @@ @@ -216,7 +234,6 @@ onMounted(async () => {}); {}); {}); /> + + + + + + - +es: + Discard: Descartar diff --git a/src/pages/Item/ItemRequestDenyForm.vue b/src/pages/Item/ItemRequestDenyForm.vue new file mode 100644 index 000000000..f26edb845 --- /dev/null +++ b/src/pages/Item/ItemRequestDenyForm.vue @@ -0,0 +1,57 @@ + + + + + +es: + Specify the reasons to deny this request: Especifica las razones para descartar la petición + From 2699040f0e6d9a4350f08f35361ac912bed17401 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 12 Apr 2024 16:50:41 -0300 Subject: [PATCH 04/25] Item request view --- src/composables/getDateQBadgeColor.js | 11 ++++++++ src/pages/Item/ItemRequest.vue | 36 +++++++++++---------------- src/pages/Travel/TravelList.vue | 13 +--------- 3 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 src/composables/getDateQBadgeColor.js diff --git a/src/composables/getDateQBadgeColor.js b/src/composables/getDateQBadgeColor.js new file mode 100644 index 000000000..be9ef41b5 --- /dev/null +++ b/src/composables/getDateQBadgeColor.js @@ -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'; +} diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 8778d8f6a..dbf1a03c2 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -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)" /> - {}); {{ getState(row.isOk) }} -