Skip to content

Commit

Permalink
Merge pull request #217 from amansinghbais/154-shipping-name
Browse files Browse the repository at this point in the history
Implemented: support to allow user to set shipping name for facility address (#154)
  • Loading branch information
ymaheshwari1 authored Mar 15, 2024
2 parents 8ff237c + 1d1b73a commit b0afdef
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
17 changes: 15 additions & 2 deletions src/components/FacilityAddressModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<ion-item-divider color="light">
<ion-label>{{ translate("Address") }}</ion-label>
</ion-item-divider>
<ion-item>
<ion-label position="floating">{{ translate("Shipping name") }}</ion-label>
<ion-input v-model="address.toName" />
</ion-item>
<ion-item>
<ion-label position="floating">{{ translate("Address line 1") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input v-model="address.address1" />
Expand Down Expand Up @@ -128,7 +132,7 @@ export default defineComponent({
telecomNumberValue: {} as any
}
},
props: ['facilityId'],
props: ['facilityId', 'facilityName'],
beforeMount() {
this.address = JSON.parse(JSON.stringify(this.postalAddress))
this.telecomNumberValue = this.telecomNumber ? JSON.parse(JSON.stringify(this.telecomNumber)) : {}
Expand All @@ -139,6 +143,9 @@ export default defineComponent({
const country = this.countries.find((country: any) => country.geoId === this.address.countryGeoId)
this.telecomNumberValue.countryCode = getTelecomCountryCode(country.geoCode)
}
if(!this.address.toName) {
this.address.toName = this.facilityName
}
},
methods: {
closeModal() {
Expand Down Expand Up @@ -242,4 +249,10 @@ export default defineComponent({
};
},
});
</script>
</script>

<style scoped>
ion-content {
--padding-bottom: 80px;
}
</style>
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
"Settings": "Settings",
"Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.",
"Setup Store": "Setup Store",
"Shipping name": "Shipping name",
"Shopify": "Shopify",
"Shopify facility": "Shopify facility",
"Shopify location": "Shopify location",
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/facility/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const actions: ActionTree<FacilityState, RootState> = {
entityName: "FacilityContactDetailByPurpose",
orderBy: 'fromDate DESC',
filterByDate: 'Y',
fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoId', 'stateGeoName'],
fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoId', 'stateGeoName', 'toName'],
viewSize: 1
}

Expand Down
11 changes: 10 additions & 1 deletion src/views/AddFacilityAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<ion-card-title>{{ translate('Address') }}</ion-card-title>
</ion-card-header>
<ion-list>
<ion-item>
<ion-label position="floating">
{{ translate('Shipping name') }}
</ion-label>
<ion-input v-model="formData.toName" />
</ion-item>
<ion-item>
<ion-label position="floating">
{{ translate('Address line 1') }} <ion-text color="danger">*</ion-text>
Expand Down Expand Up @@ -163,12 +169,14 @@ export default defineComponent({
computed: {
...mapGetters({
countries: 'util/getCountries',
states: 'util/getStates'
states: 'util/getStates',
current: 'facility/getCurrent',
})
},
data() {
return {
formData: {
toName: '',
address1: '',
address2: '',
city: '',
Expand All @@ -184,6 +192,7 @@ export default defineComponent({
},
props: ['facilityId'],
async ionViewWillEnter() {
this.formData.toName = this.current?.facilityName ? this.current.facilityName : ''
await this.store.dispatch('util/fetchCountries', { countryGeoId: "USA" })
},
methods: {
Expand Down
1 change: 1 addition & 0 deletions src/views/CreateFacility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default defineComponent({
if (!hasError(resp)) {
const { facilityId } = resp.data
showToast(translate("Facility created successfully."))
this.store.dispatch('facility/updateCurrentFacility', payload),
this.router.replace(`/add-facility-address/${facilityId}`)
} else {
throw resp.data;
Expand Down
3 changes: 2 additions & 1 deletion src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<template v-if="postalAddress?.address1">
<ion-item lines="full">
<ion-label>
<h3>{{ postalAddress.toName }}</h3>
<h3>{{ postalAddress.address1 }}</h3>
<h3>{{ postalAddress.address2 }}</h3>
<p class="ion-text-wrap">{{ postalAddress.postalCode ? `${postalAddress.city}, ${postalAddress.postalCode}` : postalAddress.city }}</p>
Expand Down Expand Up @@ -739,7 +740,7 @@ export default defineComponent({
async openAddressModal() {
const addressModal = await modalController.create({
component: FacilityAddressModal,
componentProps: { facilityId: this.facilityId }
componentProps: { facilityId: this.facilityId, facilityName: this.current.facilityName }
})
addressModal.onDidDismiss().then(async(result) => {
Expand Down

0 comments on commit b0afdef

Please sign in to comment.