Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: added the functionality to the popover buttons in the mobile view of completed orders page (#244) #256

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
2731188
Implemented: added the functionality to the buttons in mobile view in…
amansinghbais Aug 25, 2023
6cb5b87
Fixed: added the event parameter in shippingPopover to position the p…
amansinghbais Aug 25, 2023
234d6e5
Merge branch 'fulfillment-pwa/#244-completedpage' of https://github.c…
amansinghbais Aug 31, 2023
7755b1d
Fixed: removed the icons from the mobile view popover and update the …
amansinghbais Aug 31, 2023
d71cdf0
Fixed: update the shipping label error case and its translation (#244)
amansinghbais Aug 31, 2023
1f55c7d
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
amansinghbais Aug 31, 2023
4039e58
Merge branch 'fulfillment-pwa/#244-completedpage' of https://github.c…
amansinghbais Aug 31, 2023
30ec930
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
amansinghbais Sep 15, 2023
d452472
Improved: code for mobile view of completed page (#244)
amansinghbais Sep 15, 2023
02b4f4d
Improved: shipped button styling in mobile view (#244)
amansinghbais Sep 15, 2023
99f8cd7
Improved: called methods after dismissing popover instead of passing …
amansinghbais Sep 21, 2023
8c0348f
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
amansinghbais Oct 9, 2023
f3dba0c
Improved: making async await shipping function call (#244)
amansinghbais Oct 9, 2023
b9f48de
Improved: logic to handle if no popover button selected (#244)
amansinghbais Oct 9, 2023
914ed05
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
amansinghbais Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/views/Completed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ import {
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { printOutline, downloadOutline, pricetagOutline, ellipsisVerticalOutline, checkmarkDoneOutline, optionsOutline } from 'ionicons/icons'
import Popover from '@/views/ShippingPopover.vue'
import ShippingPopover from '@/views/ShippingPopover.vue'
import { useRouter } from 'vue-router';
import { mapGetters, useStore } from 'vuex'
import { copyToClipboard, formatUtcDate, getFeature, showToast } from '@/utils'
Expand Down Expand Up @@ -367,22 +367,27 @@ export default defineComponent({

async shippingPopover(ev: Event, order:any) {
const popover = await popoverController.create({
component: Popover,
component: ShippingPopover,
componentProps: {
hasPackedShipments: this.hasPackedShipments,
order,
printPackingSlip: this.printPackingSlip,
regenerateShippingLabel: this.regenerateShippingLabel,
showShippingLabelErrorModal: this.showShippingLabelErrorModal,
unpackOrder: this.unpackOrder
hasPackedShipments: this.hasPackedShipments(order),
order
},
event: ev,
translucent: true,
showBackdrop: false,
});

popover.onDidDismiss().then((result) => {
const selectedMethod = result.data.selectedMethod

// Calls method which is clicked on the popover, functions name returns when popover dismiss.
if(typeof(this[selectedMethod]) === 'function') {
(this as any)[selectedMethod](order);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions can be async also.

}
})

return popover.present();
},

async fetchShipmentMethods() {
const payload = prepareOrderQuery({
viewSize: "0", // passing viewSize as 0, as we don't want to fetch any data
Expand Down
26 changes: 13 additions & 13 deletions src/views/ShippingPopover.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<ion-content>
<ion-list>
<ion-item button :disabled="order.hasMissingShipmentInfo || order.hasMissingPackageInfo" @click="regenerateShippingLabel(order)">
<ion-item button :disabled="order.hasMissingShipmentInfo || order.hasMissingPackageInfo" @click="closeModal('regenerateShippingLabel')">
{{ $t("Regenerate shipping label") }}
</ion-item>
<ion-item button :disabled="order.hasMissingShipmentInfo || order.hasMissingPackageInfo" @click="printPackingSlip(order)">
<ion-item button :disabled="order.hasMissingShipmentInfo || order.hasMissingPackageInfo" @click="closeModal('printPackingSlip')">
{{ $t("Print customer letter") }}
</ion-item>
<ion-item button :disabled="!hasPermission(Actions.APP_UNPACK_ORDER) || order.hasMissingShipmentInfo || order.hasMissingPackageInfo || !hasPackedShipments(order)" @click="unpackOrder(order)">
<ion-item button :disabled="!hasPermission(Actions.APP_UNPACK_ORDER) || order.hasMissingShipmentInfo || order.hasMissingPackageInfo || !hasPackedShipments" @click="closeModal('unpackOrder')">
{{ $t("Unpack") }}
</ion-item>
<ion-item button v-if="order.missingLabelImage" lines="none" @click="showShippingLabelErrorModal(order)">
<ion-item button v-if="order.missingLabelImage" lines="none" @click="closeModal('showShippingLabelErrorModal')">
{{ $t("Shipping label error") }}
</ion-item>
</ion-list>
Expand All @@ -26,13 +26,21 @@ import {
import { defineComponent } from "vue";
import { printOutline, lockOpenOutline, receiptOutline, warningOutline } from 'ionicons/icons'
import { Actions, hasPermission } from '@/authorization'
import { popoverController } from "@ionic/core";
export default defineComponent({
name: "ShippingPopover",
components: {
IonContent,
IonItem,
IonList,
},
props: ['hasPackedShipments', 'order'],
methods: {
closeModal(eventName: string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
closeModal(eventName: string) {
closeModal(selectedMethod: string) {

// Sending function name to be called after popover dismiss.
popoverController.dismiss({selectedMethod: eventName})
}
},
setup() {
return {
Actions,
Expand All @@ -42,14 +50,6 @@ export default defineComponent({
receiptOutline,
warningOutline
}
},
props: [
'hasPackedShipments',
'order',
'printPackingSlip',
'regenerateShippingLabel',
'showShippingLabelErrorModal',
'unpackOrder'
]
}
});
</script>