From 24aa9fb7f2b4e47b06cb3f637714f0bbfa21c48c Mon Sep 17 00:00:00 2001 From: "zeinab.ashrafi" Date: Wed, 9 Apr 2025 09:52:44 +0330 Subject: [PATCH 1/2] fix : add logs --- resources/js/show/config/urls.js | 2 +- resources/js/show/router/paths.js | 71 +++++++------- resources/js/show/views/Item/ShowItem.vue | 9 +- resources/js/show/views/Label/ShowLabel.vue | 2 +- .../js/show/views/Package/ShowPackage.vue | 92 ++++++++++--------- 5 files changed, 97 insertions(+), 79 deletions(-) diff --git a/resources/js/show/config/urls.js b/resources/js/show/config/urls.js index 8efc0d69..00d317f6 100644 --- a/resources/js/show/config/urls.js +++ b/resources/js/show/config/urls.js @@ -4,7 +4,7 @@ const urls = { }, showItem: function(id) { // return `/ShowItem/${id}`; - return `/show-item/${id}`; + return `/api/show-item/${id}`; }, showPackage: function(id) { diff --git a/resources/js/show/router/paths.js b/resources/js/show/router/paths.js index f211f21b..27c9509b 100644 --- a/resources/js/show/router/paths.js +++ b/resources/js/show/router/paths.js @@ -5,37 +5,42 @@ */ export default [ - { - path: '/', - name: 'home', - view: 'Home/Intro', - // meta : { - // onlyWhenLoggedOut : true - // } - }, - { - path: '/Show/Item/:item', - name: 'ShowItem', - view: 'Item/ShowItem' - }, - { - path: '/Show/Package/:package', - name: 'ShowPackage', - view: 'Package/ShowPackage' - }, - { - path: '/Show/Label/:label', - name: 'ShowLabel', - view: 'Label/ShowLabel' - }, - { - path: '/Show/Cycle/:cycle', - name: 'ShowCycle', - view: 'Cycle/ShowCycle' - }, - { - path: '/Show/TestResult/:id', - name: 'ShowTestResult', - view: 'TestResult/ShowTestResult' - }, + { + path: '/', + name: 'home', + view: 'Home/Intro', + // meta : { + // onlyWhenLoggedOut : true + // } + }, + { + path: '/Show/Item/:item', + name: 'ShowItem', + view: 'Item/ShowItem', + meta: {public: true} + }, + { + path: '/Show/Package/:package', + name: 'ShowPackage', + view: 'Package/ShowPackage', + meta: { public: true } + }, + { + path: '/Show/Label/:label', + name: 'ShowLabel', + view: 'Label/ShowLabel', + meta: { public: true } + }, + { + path: '/Show/Cycle/:cycle', + name: 'ShowCycle', + view: 'Cycle/ShowCycle', + meta: { public: true } + }, + { + path: '/Show/TestResult/:id', + name: 'ShowTestResult', + view: 'TestResult/ShowTestResult', + meta: { public: true } + }, ] diff --git a/resources/js/show/views/Item/ShowItem.vue b/resources/js/show/views/Item/ShowItem.vue index b3750af9..cdd26ba1 100644 --- a/resources/js/show/views/Item/ShowItem.vue +++ b/resources/js/show/views/Item/ShowItem.vue @@ -112,9 +112,12 @@ export default { try { const result = await axios.get(urls.showItem(id)); if (result.status == 200) { - this.data = result.data.data; - this.generateBarcode(this.data.id); - this.MedicalCenter = this.data.user.medical_center.name; + this.data = result.data.data|{}; + console.log(result,'result') + if(this.data){ + this.generateBarcode(this.data.id); + this.MedicalCenter = this.data.user.medical_center.name; + } } } catch (error) { console.error("Error loading data:", error); diff --git a/resources/js/show/views/Label/ShowLabel.vue b/resources/js/show/views/Label/ShowLabel.vue index fd334c7d..6b185db5 100644 --- a/resources/js/show/views/Label/ShowLabel.vue +++ b/resources/js/show/views/Label/ShowLabel.vue @@ -227,8 +227,8 @@ export default { } }, created() { + console.log(this.$route.params.label,'this.$route.params'); if (this.$route.params.label) { - console.log(this.$route.params); this.load(this.$route.params.label); } }, diff --git a/resources/js/show/views/Package/ShowPackage.vue b/resources/js/show/views/Package/ShowPackage.vue index 8d956829..82a7c47c 100644 --- a/resources/js/show/views/Package/ShowPackage.vue +++ b/resources/js/show/views/Package/ShowPackage.vue @@ -1,6 +1,6 @@