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',