diff --git a/webUI/src/views/acc/storeroom/io/complete.vue b/webUI/src/views/acc/storeroom/io/complete.vue index 0483928..a0201be 100644 --- a/webUI/src/views/acc/storeroom/io/complete.vue +++ b/webUI/src/views/acc/storeroom/io/complete.vue @@ -123,7 +123,7 @@ - + @@ -302,7 +302,7 @@ mdi-check-circle
پروسه با موفقیت تکمیل شد
- + حواله انبار با موفقیت تکمیل شد و گارانتی‌ها تخصیص داده شدند. @@ -412,6 +412,7 @@ const warrantySettings = ref({ requireWarrantyOnDelivery: false, matchWarrantyToSerial: false }) +const plugins = ref({}) const item = ref({ ticket: { @@ -462,13 +463,16 @@ const currentBarcodeScannerContext = ref<{ rowIndex: number; lineIndex: number } const loadData = async () => { loading.value = true try { - const [ticketResponse, businessResponse, warrantyResponse, allocatedWarrantiesResponse] = await Promise.all([ + const [ticketResponse, businessResponse, warrantyResponse, allocatedWarrantiesResponse, pluginsResponse] = await Promise.all([ axios.post(`/api/storeroom/tickets/info/${route.params.id}`), axios.post(`/api/business/get/info/${localStorage.getItem('activeBid')}`), axios.get('/api/plugins/warranty/settings/get').catch(() => ({ data: { requireWarrantyOnDelivery: false, matchWarrantyToSerial: false } })), - axios.get(`/api/plugins/warranty/serials/by-storeroom-ticket/${route.params.id}`).catch(() => ({ data: { items: [] } })) + axios.get(`/api/plugins/warranty/serials/by-storeroom-ticket/${route.params.id}`).catch(() => ({ data: { items: [] } })), + axios.post('/api/plugin/get/actives') ]) + plugins.value = pluginsResponse.data + item.value.ticket = ticketResponse.data.ticket item.value.person = ticketResponse.data.person item.value.transferType = ticketResponse.data.transferType @@ -483,7 +487,7 @@ const loadData = async () => { bid.value = businessResponse.data warrantySettings.value.requireWarrantyOnDelivery = !!(warrantyResponse?.data?.requireWarrantyOnDelivery) warrantySettings.value.matchWarrantyToSerial = !!(warrantyResponse?.data?.matchWarrantyToSerial) - + // Get already allocated warranties const allocatedWarranties = allocatedWarrantiesResponse?.data?.items || [] @@ -687,7 +691,7 @@ const canComplete = computed(() => { if (loading.value || completing.value) return false // Only check warranty requirements if requireWarrantyOnDelivery is enabled - if (warrantySettings.value.requireWarrantyOnDelivery) { + if (isPluginActive('warranty') && warrantySettings.value.requireWarrantyOnDelivery) { for (const row of item.value.rows) { if (isWarrantyRequired(row)) { for (const line of row.warrantyLines || []) { @@ -765,6 +769,10 @@ const formatDate = (dateVal: any) => { onMounted(() => { loadData() }) + +const isPluginActive = (plugName: string) => { + return plugins.value[plugName] !== undefined +}