Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
Browse files Browse the repository at this point in the history
… fulfillment-pwa/#178-productIdentifier
  • Loading branch information
amansinghbais committed Oct 11, 2023
2 parents d43b226 + 0794027 commit be5716c
Show file tree
Hide file tree
Showing 34 changed files with 904 additions and 218 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ VUE_APP_VIEW_SIZE=10
VUE_APP_BASE_URL=
VUE_APP_PERMISSION_ID=
VUE_APP_ALIAS={}
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_MAPPING_TYPES={"IMPORD": "IMP_ORD_MAPPING_PREF","EXPORD": "EXP_PKD_ORD_MAPPING_PREF"}
VUE_APP_MAPPING_IMPORD={"orderId": { "label": "Order ID", "value": "" }, "facilityId": { "label": "Facility ID", "value": "" },"trackingCode": { "label": "Tracking Code", "value": "" }}
VUE_APP_MAPPING_EXPORD={"shipment-id": { "label": "Shipment ID", "value": "" }, "order-id": { "label": "Order ID", "value": "" },"to-name": { "label": "To Name", "value": "" },"address1": { "label": "Address 1", "value": "" },"address2": { "label": "Address 2", "value": "" },"city": { "label": "City", "value": "" },"state": { "label": "State", "value": "" },"zip-code": { "label": "Zip Code", "value": "" },"country-code": { "label": "Country Code", "value": "" },"full-to-address": { "label": "Full Address", "value": "" },"phone-number": { "label": "Phone Number", "value": "" },"email-address": { "label": "Email", "value": "" },"weight": { "label": "Weight", "value": "" },"quantity": { "label": "Quantity", "value": "" },"product-name": { "label": "Product Name", "value": "" },"product-sku": { "label": "Product Sku", "value": "" },"shipping-method": { "label": "Shipping Method", "value": "" },"facility-name": { "label": "Facility Name", "value": "" },"facility-address1": { "label": "Facility Address 1", "value": "" },"facility-address2": { "label": "Facility Address 2", "value": "" },"facility-city": { "label": "Facility City", "value": "" },"facility-state": { "label": "Facility State", "value": "" },"facility-zip-code": { "label": "Facility Zip Code", "value": "" },"facility-phone": { "label": "Facility Phone", "value": "" },"facility-full-address": { "label": "Facility Full Address", "value": "" }}
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fulfillment",
"version": "1.10.0",
"version": "1.13.1",
"private": true,
"description": "An Ionic project",
"scripts": {
Expand All @@ -16,7 +16,7 @@
"@capacitor/core": "^2.4.7",
"@casl/ability": "^6.0.0",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/dxp-components": "^1.7.0",
"@hotwax/dxp-components": "^1.7.5",
"@hotwax/oms-api": "^1.10.0",
"@ionic/core": "6.7.5",
"@ionic/vue": "6.7.5",
Expand Down
12 changes: 8 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ export default defineComponent({
})
},
methods: {
async presentLoader() {
async presentLoader(options = { message: '', backdropDismiss: true }) {
// When having a custom message remove already existing loader
if(options.message && this.loader) this.dismissLoader();
if (!this.loader) {
this.loader = await loadingController
.create({
message: this.$t("Click the backdrop to dismiss."),
message: options.message ? this.$t(options.message) : this.$t("Click the backdrop to dismiss."),
translucent: true,
backdropDismiss: true
backdropDismiss: options.backdropDismiss
});
}
this.loader.present();
Expand All @@ -59,7 +62,8 @@ export default defineComponent({
}
},
async unauthorised() {
this.store.dispatch("user/logout");
// Mark the user as unauthorised, this will help in not making the logout api call in actions
this.store.dispatch("user/logout", { isUserUnauthorised: true });
const redirectUrl = window.location.origin + '/login';
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?redirectUrl=${redirectUrl}`;
},
Expand Down
3 changes: 2 additions & 1 deletion src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { api, client, getConfig, getProductIdentificationPref, hasError, initialise, resetConfig, setProductIdentificationPref, updateInstanceUrl, updateToken, getUserFacilities } from '@hotwax/oms-api'
import { api, client, getConfig, getProductIdentificationPref, hasError, initialise, logout, resetConfig, setProductIdentificationPref, updateInstanceUrl, updateToken, getUserFacilities } from '@hotwax/oms-api'

export {
api,
Expand All @@ -7,6 +7,7 @@ export {
getProductIdentificationPref,
hasError,
initialise,
logout,
resetConfig,
setProductIdentificationPref,
updateInstanceUrl,
Expand Down
3 changes: 2 additions & 1 deletion src/authorization/Actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
"APP_TURN_OFF_STORE": "APP_TURN_OFF_STORE",
"APP_UPDT_STR_FULFLMNT_CONFIG": "APP_UPDT_STR_FULFLMNT_CONFIG",
"APP_UPDT_ECOM_INV_CONFIG": "APP_UPDT_ECOM_INV_CONFIG",
"APP_UNPACK_ORDER": "APP_UNPACK_ORDER",
"APP_RECYCLE_ORDER": "APP_RECYCLE_ORDER",
}
3 changes: 2 additions & 1 deletion src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
"APP_EXIM_VIEW": "",
"APP_UPLOAD_IMPORT_ORDERS_VIEW": "",
"APP_DOWNLOAD_PACKED_ORDERS_VIEW": "",
"APP_TURN_OFF_STORE": "COMMON_ADMIN",
"APP_UPDT_STR_FULFLMNT_CONFIG": "COMMON_ADMIN",
"APP_UPDT_ECOM_INV_CONFIG": "COMMON_ADMIN",
"APP_UNPACK_ORDER": "COMMON_ADMIN",
"APP_RECYCLE_ORDER": "COMMON_ADMIN",
"APP_STOREFULFILLMENT_ADMIN": "STOREFULFILLMENT_ADMIN",
Expand Down
8 changes: 6 additions & 2 deletions src/components/CreateMappingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default defineComponent({
},
props: ["content", "mappings", "mappingType"],
mounted() {
// mappings needs to be in format { <key>: { value: <value>, label: <label>, isSelected | optional: <boolean> }}
// mappings needs to be in format { <key>: { value: <value>, label: <label>, isSelected | optional: <boolean>, isCustomField | optional: <boolean> }}
this.fieldMapping = JSON.parse(JSON.stringify(this.mappings));
this.fileColumns = Object.keys(this.content[0]);
},
Expand All @@ -115,7 +115,11 @@ export default defineComponent({
// removing label from mappings as we don't need to save label with the mappings as it will just increase the size of the value
Object.keys(this.fieldMapping).map((mapping) => {
mappings[mapping] = {
mappings[mapping] = this.fieldMapping[mapping].isCustomField ? {
value: this.fieldMapping[mapping].value,
isSelected: this.fieldMapping[mapping].isSelected,
isCustomField: this.fieldMapping[mapping].isCustomField
} : {
value: this.fieldMapping[mapping].value,
isSelected: this.fieldMapping[mapping].isSelected
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ion-menu side="start" content-id="main-content" type="overlay" :disabled="!isUserAuthenticated">
<ion-header>
<ion-toolbar>
<ion-title>{{ currentFacility.name }}</ion-title>
<ion-title>{{ currentFacility.facilityName }}</ion-title>
</ion-toolbar>
</ion-header>

Expand Down
73 changes: 73 additions & 0 deletions src/components/OrderActionsPopover.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template>
<ion-content>
<ion-list>
<ion-list-header>{{ $t('Options') }}</ion-list-header>
<ion-item button @click="copyInfo">
<ion-icon slot="end" :icon="copyOutline" />
{{ $t("Copy ID") }}
</ion-item>
<ion-item button lines="none" @click="assignPickers">
<ion-icon slot="end" :icon="bagCheckOutline" />
{{ $t("Pick order") }}
</ion-item>
</ion-list>
</ion-content>
</template>

<script lang="ts">
import {
IonContent,
IonIcon,
IonItem,
IonList,
IonListHeader,
modalController,
popoverController,
} from "@ionic/vue";
import { defineComponent } from "vue";
import { bagCheckOutline, copyOutline } from 'ionicons/icons'
import { copyToClipboard } from "@/utils";
import AssignPickerModal from '@/views/AssignPickerModal.vue';
export default defineComponent({
name: "OrderActionsPopover",
components: {
IonContent,
IonIcon,
IonItem,
IonList,
IonListHeader
},
props: ["order"],
methods: {
closePopover() {
popoverController.dismiss();
},
copyInfo() {
this.copyToClipboard(this.order.doclist.docs[0].orderName, 'Copied to clipboard')
// closing the popover after copy action
this.closePopover();
},
async assignPickers() {
const assignPickerModal = await modalController.create({
component: AssignPickerModal,
componentProps: { order: this.order }
});
// dismissing the popover once the picker modal is closed
assignPickerModal.onDidDismiss().finally(() => {
this.closePopover();
});
return assignPickerModal.present();
},
},
setup() {
return {
bagCheckOutline,
copyOutline,
copyToClipboard
}
}
});
</script>
116 changes: 116 additions & 0 deletions src/components/OrderLimitPopover.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<template>
<ion-content>
<ion-list>
<ion-list-header>
{{ $t("Fulfillment capacity") }}
</ion-list-header>
<ion-item button @click="updateOrderLimitType('unlimited')">
<ion-icon slot="end" :icon="lockOpenOutline" />
{{ $t("Unlimited Capacity") }}
</ion-item>
<ion-item button @click="updateOrderLimitType('no-capacity')">
{{ $t("No Capacity") }}
<ion-icon slot="end" :icon="lockClosedOutline" />
</ion-item>
<ion-item button lines="none" @click="updateOrderLimitType('custom')">
{{ $t("Custom") }}
</ion-item>
</ion-list>
</ion-content>
</template>

<script lang="ts">
import {
IonContent,
IonIcon,
IonItem,
IonList,
IonListHeader,
alertController,
popoverController
} from "@ionic/vue";
import { defineComponent } from "vue";
import { lockClosedOutline, lockOpenOutline } from 'ionicons/icons'
import { translate } from '@/i18n';
import { showToast } from '@/utils';
export default defineComponent({
name: "OrderLimitPopover",
components: {
IonContent,
IonIcon,
IonItem,
IonList,
IonListHeader
},
setup() {
return {
lockClosedOutline,
lockOpenOutline
}
},
props: ['fulfillmentOrderLimit'],
data() {
return {
setLimit: this.fulfillmentOrderLimit as any
}
},
methods: {
async updateOrderLimitType(orderLimitType: string) {
let header = "Unlimited fulfillment capacity"
let message = "Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option."
let showInput = false
if (orderLimitType === 'custom') {
header = "Custom fulfillment capacity"
message = ""
showInput = true
} else if (orderLimitType === 'no-capacity') {
this.setLimit = 0
header = "No fulfillment capacity"
message = "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option."
} else if (orderLimitType === 'unlimited') {
this.setLimit = ""
}
this.showOrderLimitAlert(header, message, showInput)
},
async showOrderLimitAlert(header: string, message: string, showInput: boolean) {
const alert = await alertController.create({
header: translate(header),
message: translate(message, {space: '</br></br>'}),
inputs: showInput ? [{
name: "setLimit",
placeholder: translate("Order fulfillment capacity"),
type: "number",
min: 0
}] : [],
buttons: [{
text: translate('Cancel'),
role: "cancel"
},
{
text: translate('Apply'),
handler: (data) => {
let setLimit = this.setLimit as any;
if(data) {
if(data.setLimit === '') {
showToast(translate('Please provide a value'))
return false;
} else if(data.setLimit <= 0) {
showToast(translate('Provide a value greater than 0'))
return false;
} else {
setLimit = data.setLimit
}
}
popoverController.dismiss(setLimit)
}
}]
})
await alert.present()
}
}
});
</script>
Loading

0 comments on commit be5716c

Please sign in to comment.