diff --git a/src/components/ClosePurchaseOrderModal.vue b/src/components/ClosePurchaseOrderModal.vue new file mode 100644 index 00000000..0d2229af --- /dev/null +++ b/src/components/ClosePurchaseOrderModal.vue @@ -0,0 +1,186 @@ + + + \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 8f41e7d0..7ced93e4 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -5,6 +5,7 @@ "Add to Shipment": "Add to Shipment", "App": "App", "Authenticating": "Authenticating", + "Are you sure you have received the purchase order for the selected items? Once closed, the shipments for the selected items wont be available for receiving later.": "Are you sure you have received the purchase order for the selected items? { space } Once closed, the shipments for the selected items won't be available for receiving later.", "Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to {timeZoneId}?", "Arrival date": "Arrival date", "Cancel": "Cancel", @@ -12,10 +13,12 @@ "Choosing a product identifier allows you to view products with your preferred identifiers.": "Choosing a product identifier allows you to view products with your preferred identifiers.", "Click the backdrop to dismiss.": "Click the backdrop to dismiss.", "Complete": "Complete", + "Completed": "Completed", "COMPLETED: ITEM": "COMPLETED: {itemsCount} ITEM", "COMPLETED: ITEMS": "COMPLETED: {itemsCount} ITEMS", "Confirm": "Confirm", "Copied": "Copied { value }", + "Close purchase order items": "Close purchase order items", "eCom Store": "eCom Store", "Enter a custom date time format that you want to use when uploading documents to HotWax Commerce.": "Enter a custom date time format that you want to use when uploading documents to HotWax Commerce.", "External ID": "External ID", @@ -64,7 +67,9 @@ "Purchase Order Details": "Purchase Order Details", "Purchase Orders": "Purchase Orders", "Qty": "Qty", + "Receive": "Receive", "Receive All": "Receive All", + "Receive And Close": "Receive And Close", "Receive inventory": "Receive inventory", "received": "received", "Receive Shipment": "Receive Shipment", @@ -76,6 +81,7 @@ "Returns": "Returns", "Returns not found": "Returns not found", "rejected": "rejected", + "Rejected": "Rejected", "returned": "returned", "Scan": "Scan", "Scan ASN to start receiving": "Scan ASN to start receiving", @@ -87,6 +93,7 @@ "Search time zones": "Search time zones", "Search SKU or product name": "Search SKU or product name", "Secondary Product Identifier": "Secondary Product Identifier", + "Select all": "Select all", "Select facility": "Select facility", "Select store": "Select store", "Select time zone": "Select time zone", @@ -112,6 +119,7 @@ "This return has been and cannot be edited.": "This return has been {status} and cannot be edited.", "Timezone": "Timezone", "Time zone updated successfully": "Time zone updated successfully", + "To close the purchase order, select all.": "To close the purchase order, select all.", "Unable to update product identifier preference": "Unable to update product identifier preference", "Update time zone": "Update time zone", "Username": "Username", diff --git a/src/services/OrderService.ts b/src/services/OrderService.ts index 676cbd23..a10e0bc1 100644 --- a/src/services/OrderService.ts +++ b/src/services/OrderService.ts @@ -32,10 +32,18 @@ const fetchPOHistory = async (payload: any): Promise => { }) } +const updatePOItemStatus = async (payload: any): Promise => { + return api({ + url: "service/changeOrderItemStatus", + method: "POST", + data: payload + }) +} export const OrderService = { fetchPurchaseOrders, fetchPODetail, createPurchaseShipment, - fetchPOHistory + fetchPOHistory, + updatePOItemStatus } \ No newline at end of file diff --git a/src/views/PurchaseOrderDetail.vue b/src/views/PurchaseOrderDetail.vue index 03aea839..6cd4a563 100644 --- a/src/views/PurchaseOrderDetail.vue +++ b/src/views/PurchaseOrderDetail.vue @@ -142,13 +142,16 @@ - - - - - - + + + + + {{ $t("Receive And Close") }} + {{ $t("Receive") }} + + + @@ -162,8 +165,7 @@ import { IonChip, IonContent, IonHeader, - IonFab, - IonFabButton, + IonFooter, IonIcon, IonItem, IonInput, @@ -174,8 +176,8 @@ import { IonThumbnail, IonTitle, IonToolbar, - modalController, alertController, + modalController } from '@ionic/vue'; import { defineComponent } from 'vue'; import { addOutline, cameraOutline, checkmarkDone, copyOutline, eyeOffOutline, eyeOutline, locationOutline, saveOutline, timeOutline } from 'ionicons/icons'; @@ -185,6 +187,7 @@ import { useStore, mapGetters } from 'vuex'; import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue" import AddProductToPOModal from '@/views/AddProductToPOModal.vue' +import ClosePurchaseOrderModal from '@/components/ClosePurchaseOrderModal.vue' import LocationPopover from '@/components/LocationPopover.vue' import ImageModal from '@/components/ImageModal.vue'; import { copyToClipboard, hasError, productHelpers } from '@/utils'; @@ -202,8 +205,7 @@ export default defineComponent({ IonChip, IonContent, IonHeader, - IonFab, - IonFabButton, + IonFooter, IonIcon, IonItem, IonInput, @@ -302,6 +304,16 @@ export default defineComponent({ }); return alert.present(); }, + async closePO() { + const modal = await modalController.create({ + component: ClosePurchaseOrderModal, + componentProps: { + isEligibileForCreatingShipment: this.isEligibileForCreatingShipment() + } + }) + + return modal.present(); + }, async createShipment() { const eligibleItems = this.order.items.filter((item: any) => item.quantityAccepted > 0) const resp = await this.store.dispatch('order/createPurchaseShipment', { items: eligibleItems, orderId: this.order.orderId })