diff --git a/dependencies.txt b/dependencies.txt index e706105..f75f750 100755 --- a/dependencies.txt +++ b/dependencies.txt @@ -59,5 +59,6 @@ - vite-plugin-vue-devtools : [npm](https://www.npmjs.com/package/vite-plugin-vue-devtools), [GitHub](https://github.com/antfu/vite-plugin-vue-devtools) - Plugin Vite pour intégrer les outils de développement Vue.js - vite-plugin-vue-layouts : [npm](https://www.npmjs.com/package/vite-plugin-vue-layouts), [GitHub](https://github.com/JohnCampionJr/vite-plugin-vue-layouts) - Plugin Vite pour la gestion des mises en page Vue.js - vite-plugin-vuetify : [npm](https://www.npmjs.com/package/vite-plugin-vuetify), [GitHub](https://github.com/antfu/vite-plugin-vuetify) - Plugin Vite pour l'intégration de Vuetify +- vue-json-pretty : [npm](https://www.npmjs.com/package/vue-json-pretty), [GitHub](https://github.com/leezng/vue-json-pretty) - A pretty-print JSON Vue-component - vue-shepherd : [npm](https://www.npmjs.com/package/vue-shepherd), [GitHub](https://github.com/hipstersmoothie/vue-shepherd) - Tour de guide pour les applications Vue.js - vue-tsc : [npm](https://www.npmjs.com/package/vue-tsc), [GitHub](https://github.com/johnsoncodehk/vue-tsc) - Plugin TypeScript pour la compilation de fichiers `.vue` diff --git a/package.json b/package.json index f05270a..3c6a253 100755 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "vue-chartjs": "^5.2.0", "vue-flatpickr-component": "11.0.3", "vue-i18n": "^9.5.0", + "vue-json-pretty": "^2.3.0", "vue-prism-component": "^2.0.0", "vue-router": "^4.2.5", "vue3-apexcharts": "^1.4.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc00613..8bd006c 100755 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,6 +115,9 @@ dependencies: vue-i18n: specifier: ^9.5.0 version: 9.6.5(vue@3.3.8) + vue-json-pretty: + specifier: ^2.3.0 + version: 2.3.0(vue@3.3.8) vue-prism-component: specifier: ^2.0.0 version: 2.0.0 @@ -7978,6 +7981,15 @@ packages: '@vue/devtools-api': 6.5.1 vue: 3.3.8(typescript@5.2.2) + /vue-json-pretty@2.3.0(vue@3.3.8): + resolution: {integrity: sha512-iBul6Xg7vZfMV2MQC/gGtzbyg8FLk6cJ8KG91f37UEkQyXqHg91VQJ24bDBXNVuOSP04BUKxWagD3V2N/WEy0g==} + engines: {node: '>= 10.0.0', npm: '>= 5.0.0'} + peerDependencies: + vue: '>=3.0.0' + dependencies: + vue: 3.3.8(typescript@5.2.2) + dev: false + /vue-prism-component@2.0.0: resolution: {integrity: sha512-1ofrL+GCZOv4HqtX5W3EgkhSAgadSeuD8FDTXbwhLy8kS+28RCR8t2S5VTeM9U/peAaXLBpSgRt3J25ao8KTeg==} dev: false diff --git a/src/@core/initCore.ts b/src/@core/initCore.ts index 2b5d888..4ffdae8 100755 --- a/src/@core/initCore.ts +++ b/src/@core/initCore.ts @@ -1,4 +1,6 @@ import { useStorage } from '@vueuse/core' +import { setDefaultOptions } from 'date-fns' +import { enUS, fr } from 'date-fns/locale' import flatpickr from 'flatpickr' import { French } from 'flatpickr/dist/l10n/fr' import { useTheme } from 'vuetify' @@ -19,10 +21,14 @@ const _syncAppRtl = () => { if (locale.value === 'fr') { if (flatpickr.l10ns.fr) flatpickr.localize(French) + + setDefaultOptions({ locale: fr }) } else { if (flatpickr.l10ns.en) flatpickr.localize(flatpickr.l10ns.en) + + setDefaultOptions({ locale: enUS }) } // watch and change lang attribute of html on language change @@ -39,10 +45,14 @@ const _syncAppRtl = () => { if (storedLang.value === 'fr') { if (flatpickr.l10ns.fr) flatpickr.localize(flatpickr.l10ns.fr) + + setDefaultOptions({ locale: fr }) } else { if (flatpickr.l10ns.en) flatpickr.localize(flatpickr.l10ns.en) + + setDefaultOptions({ locale: enUS }) } // set isAppRtl value based on selected language diff --git a/src/assets/images/misc/logo-proximis.png b/src/assets/images/misc/logo-proximis.png new file mode 100644 index 0000000..0b1125c Binary files /dev/null and b/src/assets/images/misc/logo-proximis.png differ diff --git a/src/composables/useApi.ts b/src/composables/useApi.ts index af9ab8b..ecb9025 100755 --- a/src/composables/useApi.ts +++ b/src/composables/useApi.ts @@ -38,5 +38,13 @@ export const useApi = createFetch({ return { data: parsedData, response } }, + onFetchError(ctx) { + const errorData = ctx.data ? JSON.parse(ctx.data) : { title: 'Hunter x Hunter' } + const status = ctx.response ? ctx.response.status : 'unknown' + + ctx.error = { status, error: errorData.error || errorData.title } + + return ctx + }, }, }) diff --git a/src/models/Order.ts b/src/models/Order.ts index aa2affa..9bae701 100644 --- a/src/models/Order.ts +++ b/src/models/Order.ts @@ -12,9 +12,6 @@ interface transaction { transactionDate: Date transactionNo: string transactionTypeDescription: string - transactionSubtotal: number - transactionTax: number - transactionTotal: number } interface Common { @@ -22,8 +19,6 @@ interface Common { requestingLocationCd: string requestingSystemCd: string customerId: string - customerFirstName: string - customerLastName: string status: string submitOrdMsg: string fdateCreation: Date @@ -66,3 +61,26 @@ export interface Order { lines: Lines[] history: History[] } + +export interface OrderOms { + common: OrderOmsCommon + oms: Proximis +} + +export interface OrderOmsCommon { + urlApp: string +} + +export interface Proximis { + item: ProximisItem +} + +export interface ProximisItem { + id: number + modificationDate: Date + code: string + fulfillSystem: string + creationDate: Date + fulfillStoreCode: string + status: string +} diff --git a/src/pages/obi/order/details/[id].vue b/src/pages/obi/order/details/[id].vue index aaaeefc..d504584 100644 --- a/src/pages/obi/order/details/[id].vue +++ b/src/pages/obi/order/details/[id].vue @@ -16,12 +16,21 @@ const tabs = [ { title: 'Flow' }, ] -const { data, error } = await useApi(`/obi/order/${route.params.id}`) +const { data, error, execute: fetchOrder } = await useApi(`/obi/order/${route.params.id}`) -if (error.value) - console.log(error.value) -else if (data.value) - orderData.value = data.value +const handleData = () => { + if (error.value) + console.log(error.value) + else if (data.value) + orderData.value = data.value +} + +const refreshData = async () => { + await fetchOrder() + handleData() +} + +handleData() + +