From 9a477c2c2513a3d4accbca01be8855540680019b Mon Sep 17 00:00:00 2001 From: Kevin Martinez Date: Mon, 11 Dec 2023 10:47:16 -0400 Subject: [PATCH 01/10] Create order page --- src/components/FormModel.vue | 16 +- src/components/ui/VnPaginate.vue | 4 +- src/i18n/en/index.js | 49 ++++ src/pages/Order/Card/OrderBasicData.vue | 12 + src/pages/Order/Card/OrderCard.vue | 36 +++ src/pages/Order/Card/OrderDescriptor.vue | 128 ++++++++++ src/pages/Order/Card/OrderDescriptorMenu.vue | 65 +++++ src/pages/Order/Card/OrderFilter.vue | 245 +++++++++++++++++++ src/pages/Order/Card/OrderForm.vue | 209 ++++++++++++++++ src/pages/Order/Card/OrderSearchbar.vue | 25 ++ src/pages/Order/Card/OrderSummary.vue | 161 ++++++++++++ src/pages/Order/OrderList.vue | 150 ++++++++++++ src/pages/Order/OrderMain.vue | 17 ++ src/router/modules/index.js | 2 + src/router/modules/order.js | 69 ++++++ src/router/routes.js | 2 + src/stores/useNavigationStore.js | 1 + 17 files changed, 1186 insertions(+), 5 deletions(-) create mode 100644 src/pages/Order/Card/OrderBasicData.vue create mode 100644 src/pages/Order/Card/OrderCard.vue create mode 100644 src/pages/Order/Card/OrderDescriptor.vue create mode 100644 src/pages/Order/Card/OrderDescriptorMenu.vue create mode 100644 src/pages/Order/Card/OrderFilter.vue create mode 100644 src/pages/Order/Card/OrderForm.vue create mode 100644 src/pages/Order/Card/OrderSearchbar.vue create mode 100644 src/pages/Order/Card/OrderSummary.vue create mode 100644 src/pages/Order/OrderList.vue create mode 100644 src/pages/Order/OrderMain.vue create mode 100644 src/router/modules/order.js diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 453b3ffe1..1345ec955 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -55,6 +55,10 @@ const $props = defineProps({ description: 'Esto se usa principalmente para permitir guardar sin hacer cambios (Útil para la feature de clonar ya que en este caso queremos poder guardar de primeras)', }, + mapper: { + type: Function, + default: null, + } }); const emit = defineEmits(['onFetch']); @@ -83,6 +87,7 @@ onUnmounted(() => { const isLoading = ref(false); // Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas +const isResetting = ref(false); const hasChanges = ref(!$props.observeFormChanges); const originalData = ref({...$props.formInitialData}); const formData = computed(() => state.get($props.model)); @@ -92,7 +97,10 @@ const startFormWatcher = () => { watch( () => formData.value, (val) => { - if (val) hasChanges.value = true; + if (!isResetting.value && val) { + hasChanges.value = true; + } + isResetting.value = false; }, { deep: true } ); @@ -121,11 +129,12 @@ async function save() { isLoading.value = true; try { + const body = $props.mapper ? $props.mapper(formData.value) : formData.value if ($props.urlCreate) { - await axios.post($props.urlCreate, formData.value); + await axios.post($props.urlCreate, body); notify('globals.dataCreated', 'positive'); } else { - await axios.patch($props.urlUpdate || $props.url, formData.value); + await axios.patch($props.urlUpdate || $props.url, body); } } catch (err) { notify('errors.create', 'negative'); @@ -143,6 +152,7 @@ function reset() { emit('onFetch', state.get($props.model)); if ($props.observeFormChanges) { hasChanges.value = false; + isResetting.value = true; } } diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index c75761462..0849cebe5 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -31,7 +31,7 @@ const props = defineProps({ default: null, }, order: { - type: String, + type: [String, Array], default: '', }, limit: { @@ -149,7 +149,7 @@ async function onLoad(...params) { v-if="props.skeleton && props.autoLoad && !store.data" class="card-list q-gutter-y-md" > - + diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index fb603deca..05a2622f1 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -473,6 +473,55 @@ export default { recyclable: 'Recyclable', }, }, + order: { + pageTitles: { + order: 'Orders', + orderList: 'List', + create: 'Create', + summary: 'Summary', + basicData: 'Basic Data', + }, + field: { + salesPersonFk: 'Sales Person', + clientFk: 'Client', + isConfirmed: 'Confirmed', + created: 'Created', + landed: 'Landed', + hour: 'Hour', + agency: 'Agency', + total: 'Total' + }, + form: { + clientFk: 'Client', + addressFk: 'Address', + landed: 'Landed', + agencyModeFk: 'Agency', + }, + list: { + newOrder: 'New Order' + }, + summary: { + basket: 'Basket', + nickname: 'Nickname', + company: 'Company', + confirmed: 'Confirmed', + notConfirmed: 'Not confirmed', + created: 'Created', + landed: 'Landed', + phone: 'Phone', + createdFrom: 'Created From', + address: 'Address', + notes: 'Notes', + subtotal: 'Subtotal', + total: 'Total', + vat: 'VAT', + state: 'State', + alias: 'Alias', + items: 'Items', + orderTicketList: 'Order Ticket List', + details: 'Details', + } + }, worker: { pageTitles: { workers: 'Workers', diff --git a/src/pages/Order/Card/OrderBasicData.vue b/src/pages/Order/Card/OrderBasicData.vue new file mode 100644 index 000000000..0611fa874 --- /dev/null +++ b/src/pages/Order/Card/OrderBasicData.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/pages/Order/Card/OrderCard.vue b/src/pages/Order/Card/OrderCard.vue new file mode 100644 index 000000000..5a9a6452a --- /dev/null +++ b/src/pages/Order/Card/OrderCard.vue @@ -0,0 +1,36 @@ + + + + +es: + Search claim: Buscar reclamación + You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente + Details: Detalles + Notes: Notas + Action: Acción + diff --git a/src/pages/Order/Card/OrderDescriptor.vue b/src/pages/Order/Card/OrderDescriptor.vue new file mode 100644 index 000000000..3b6d91cb4 --- /dev/null +++ b/src/pages/Order/Card/OrderDescriptor.vue @@ -0,0 +1,128 @@ + + + diff --git a/src/pages/Order/Card/OrderDescriptorMenu.vue b/src/pages/Order/Card/OrderDescriptorMenu.vue new file mode 100644 index 000000000..267c47c1d --- /dev/null +++ b/src/pages/Order/Card/OrderDescriptorMenu.vue @@ -0,0 +1,65 @@ + + + + +{ + "en": { + "deleteOrder": "Delete order", + "confirmDeletion": "Confirm deletion", + "confirmDeletionMessage": "Are you sure you want to delete this order?" + }, + "es": { + "deleteOrder": "Eliminar pedido", + "confirmDeletion": "Confirmar eliminación", + "confirmDeletionMessage": "Seguro que quieres eliminar este pedido?" + } +} + diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue new file mode 100644 index 000000000..60f087b98 --- /dev/null +++ b/src/pages/Order/Card/OrderFilter.vue @@ -0,0 +1,245 @@ + + + + + +en: + params: + search: Contains + clientFk: Customer + clientName: Customer + salesPersonFk: Salesperson + attenderFk: Attender + claimResponsibleFk: Responsible + claimStateFk: State + created: Created +es: + params: + search: Contiene + clientFk: Cliente + clientName: Cliente + salesPersonFk: Comercial + attenderFk: Asistente + claimResponsibleFk: Responsable + claimStateFk: Estado + created: Creada + Customer ID: ID cliente + Client Name: Nombre del cliente + Salesperson: Comercial + Attender: Asistente + Responsible: Responsable + State: Estado + Item: Artículo + Created: Creada + More options: Más opciones + diff --git a/src/pages/Order/Card/OrderForm.vue b/src/pages/Order/Card/OrderForm.vue new file mode 100644 index 000000000..4c7e2c326 --- /dev/null +++ b/src/pages/Order/Card/OrderForm.vue @@ -0,0 +1,209 @@ + + + diff --git a/src/pages/Order/Card/OrderSearchbar.vue b/src/pages/Order/Card/OrderSearchbar.vue new file mode 100644 index 000000000..4d354603b --- /dev/null +++ b/src/pages/Order/Card/OrderSearchbar.vue @@ -0,0 +1,25 @@ + + + + + + +en: + search-order: Search order + search-order-info: You can search orders by reference +es: + Search shelving: Buscar orden + You can search by shelving reference: Puedes buscar por referencia de la orden + diff --git a/src/pages/Order/Card/OrderSummary.vue b/src/pages/Order/Card/OrderSummary.vue new file mode 100644 index 000000000..7902204ef --- /dev/null +++ b/src/pages/Order/Card/OrderSummary.vue @@ -0,0 +1,161 @@ + + + + diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue new file mode 100644 index 000000000..f7ff4b9e8 --- /dev/null +++ b/src/pages/Order/OrderList.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/pages/Order/OrderMain.vue b/src/pages/Order/OrderMain.vue new file mode 100644 index 000000000..66ce78f23 --- /dev/null +++ b/src/pages/Order/OrderMain.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/router/modules/index.js b/src/router/modules/index.js index 156f0d104..72d53af81 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -8,6 +8,7 @@ import Wagon from './wagon'; import Route from './route'; import Supplier from './Supplier'; import Travel from './travel'; +import Order from './order'; export default [ Customer, @@ -20,4 +21,5 @@ export default [ Route, Supplier, Travel, + Order, ]; diff --git a/src/router/modules/order.js b/src/router/modules/order.js new file mode 100644 index 000000000..ffbc1665e --- /dev/null +++ b/src/router/modules/order.js @@ -0,0 +1,69 @@ +import { RouterView } from 'vue-router'; + +export default { + path: '/order', + name: 'Order', + meta: { + title: 'order', + icon: 'vn:basket', + }, + component: RouterView, + redirect: { name: 'OrderMain' }, + menus: { + main: ['OrderList'], + card: ['OrderBasicData'], + }, + children: [ + { + path: '', + name: 'OrderMain', + component: () => import('src/pages/Order/OrderMain.vue'), + redirect: { name: 'OrderList' }, + children: [ + { + path: 'list', + name: 'OrderList', + meta: { + title: 'orderList', + icon: 'view_list', + }, + component: () => import('src/pages/Order/OrderList.vue'), + }, + { + path: 'create', + name: 'OrderCreate', + meta: { + title: 'create', + }, + component: () => import('src/pages/Order/Card/OrderForm.vue'), + }, + ], + }, + { + name: 'OrderCard', + path: ':id', + component: () => import('src/pages/Order/Card/OrderCard.vue'), + redirect: { name: 'OrderSummary' }, + children: [ + { + name: 'OrderSummary', + path: 'summary', + meta: { + title: 'summary', + icon: 'launch', + }, + component: () => import('src/pages/Order/Card/OrderSummary.vue'), + }, + { + name: 'OrderBasicData', + path: 'basic-data', + meta: { + title: 'basicData', + icon: 'vn:settings', + }, + component: () => import('src/pages/Order/Card/OrderForm.vue'), + }, + ], + }, + ], +}; diff --git a/src/router/routes.js b/src/router/routes.js index 25d605af8..9582b8d97 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -8,6 +8,7 @@ import supplier from './modules/Supplier'; import route from './modules/route'; import travel from './modules/travel'; import shelving from 'src/router/modules/shelving'; +import order from "src/router/modules/order"; const routes = [ { @@ -54,6 +55,7 @@ const routes = [ shelving, invoiceOut, wagon, + order, route, supplier, travel, diff --git a/src/stores/useNavigationStore.js b/src/stores/useNavigationStore.js index b4882c685..41ba43940 100644 --- a/src/stores/useNavigationStore.js +++ b/src/stores/useNavigationStore.js @@ -13,6 +13,7 @@ export const useNavigationStore = defineStore('navigationStore', () => { 'invoiceOut', 'worker', 'shelving', + 'order', 'wagon', 'route', 'supplier', From 17dd42dd5c6506b9ca033921e3443c2e5899eb2b Mon Sep 17 00:00:00 2001 From: Kevin Martinez Date: Thu, 14 Dec 2023 21:53:47 -0400 Subject: [PATCH 02/10] Create order filter --- src/components/FetchData.vue | 6 +- src/pages/Order/Card/OrderFilter.vue | 275 +++++++++++++-------------- src/pages/Order/OrderList.vue | 50 ++--- 3 files changed, 165 insertions(+), 166 deletions(-) diff --git a/src/components/FetchData.vue b/src/components/FetchData.vue index f0d908972..b8e7c2ac3 100644 --- a/src/components/FetchData.vue +++ b/src/components/FetchData.vue @@ -27,6 +27,10 @@ const $props = defineProps({ type: String, default: '', }, + params: { + type: Object, + default: null, + } }); const emit = defineEmits(['onFetch']); @@ -46,7 +50,7 @@ async function fetch() { if ($props.limit) filter.limit = $props.limit; const { data } = await axios.get($props.url, { - params: { filter: JSON.stringify(filter) }, + params: { filter: JSON.stringify(filter), ...$props.params }, }); emit('onFetch', data); diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue index 60f087b98..0d12f31da 100644 --- a/src/pages/Order/Card/OrderFilter.vue +++ b/src/pages/Order/Card/OrderFilter.vue @@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'; import FetchData from 'components/FetchData.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue'; +import VnInputDate from "components/common/VnInputDate.vue"; const { t } = useI18n(); const props = defineProps({ @@ -13,10 +14,6 @@ const props = defineProps({ }, }); -const workers = ref(); -const states = ref(); - -// New const agencyFilter = { fields: ['id', 'name'] }; const agencyList = ref(null); const salesPersonFilter = { @@ -24,12 +21,12 @@ const salesPersonFilter = { }; const salesPersonList = ref(null); const sourceFilter = { fields: ['value'] }; -const sourceList = ref(null) +const sourceList = ref(null); - From a65db2f4cf49deb0314ee0c7f6d643a4b0b8b775 Mon Sep 17 00:00:00 2001 From: Kevin Martinez Date: Tue, 19 Dec 2023 09:15:54 -0400 Subject: [PATCH 04/10] Create order catalog section --- src/i18n/en/index.js | 1 + src/pages/Order/Card/OrderCard.vue | 6 +- src/pages/Order/Card/OrderCatalogItem.vue | 182 ++++++++++++++++++ .../Order/Card/OrderCatalogItemDialog.vue | 83 ++++++++ src/pages/Order/Card/OrderSummary.vue | 20 +- src/pages/Order/OrderCatalog.vue | 81 ++++++++ src/router/modules/order.js | 11 +- 7 files changed, 373 insertions(+), 11 deletions(-) create mode 100644 src/pages/Order/Card/OrderCatalogItem.vue create mode 100644 src/pages/Order/Card/OrderCatalogItemDialog.vue create mode 100644 src/pages/Order/OrderCatalog.vue diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 21cb2ea74..752314813 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -555,6 +555,7 @@ export default { create: 'Create', summary: 'Summary', basicData: 'Basic Data', + catalog: 'Catalog', }, field: { salesPersonFk: 'Sales Person', diff --git a/src/pages/Order/Card/OrderCard.vue b/src/pages/Order/Card/OrderCard.vue index 5a9a6452a..f6288207d 100644 --- a/src/pages/Order/Card/OrderCard.vue +++ b/src/pages/Order/Card/OrderCard.vue @@ -1,15 +1,11 @@ - + @@ -80,6 +84,9 @@ const sourceList = ref(null); :options="agencyList" option-value="id" option-label="name" + dense + outlined + rounded emit-value map-options use-input @@ -98,6 +105,9 @@ const sourceList = ref(null); :options="salesPersonList" option-value="id" option-label="name" + dense + outlined + rounded emit-value map-options use-input @@ -123,22 +133,31 @@ const sourceList = ref(null); + :label="t('fromLanded')" + dense + outlined + rounded /> + :label="t('toLanded')" + dense + outlined + rounded /> - @@ -152,6 +171,9 @@ const sourceList = ref(null); emit-value map-options use-input + dense + outlined + rounded :input-debounce="0" /> @@ -190,6 +212,14 @@ const sourceList = ref(null); + + en: params: From 4e40fbbfe035bf3f5e9f3b7f65221dc099393901 Mon Sep 17 00:00:00 2001 From: Kevin Martinez Date: Wed, 20 Dec 2023 08:41:18 -0400 Subject: [PATCH 10/10] Update dash --- src/pages/Order/Card/OrderFilter.vue | 23 +++++++++-------------- src/pages/Order/Card/OrderSummary.vue | 14 +++++++++----- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue index d35072519..b49f0b115 100644 --- a/src/pages/Order/Card/OrderFilter.vue +++ b/src/pages/Order/Card/OrderFilter.vue @@ -4,8 +4,8 @@ import { useI18n } from 'vue-i18n'; import FetchData from 'components/FetchData.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue'; -import VnInputDate from "components/common/VnInputDate.vue"; -import VnInput from "components/common/VnInput.vue"; +import VnInputDate from 'components/common/VnInputDate.vue'; +import VnInput from 'components/common/VnInput.vue'; const { t } = useI18n(); const props = defineProps({ @@ -63,9 +63,7 @@ const sourceList = ref(null); + rounded + /> @@ -146,7 +145,8 @@ const sourceList = ref(null); :label="t('toLanded')" dense outlined - rounded /> + rounded + /> @@ -155,9 +155,7 @@ const sourceList = ref(null); :label="t('orderId')" v-model="params.orderFk" lazy-rules - dense - outlined - rounded + is-outlined /> @@ -201,10 +199,7 @@ const sourceList = ref(null); - + diff --git a/src/pages/Order/Card/OrderSummary.vue b/src/pages/Order/Card/OrderSummary.vue index 0d10110eb..464ab3dfc 100644 --- a/src/pages/Order/Card/OrderSummary.vue +++ b/src/pages/Order/Card/OrderSummary.vue @@ -3,7 +3,7 @@ import { computed, ref } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useStateStore } from 'stores/useStateStore'; -import { toCurrency, toDateHour } from 'src/filters'; +import { dashIfEmpty, toCurrency, toDateHour } from 'src/filters'; import VnLv from 'components/ui/VnLv.vue'; import CardSummary from 'components/ui/CardSummary.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; @@ -64,10 +64,10 @@ const detailsColumns = ref([