Skip to content

Commit

Permalink
Implemented: logic for reroute fulfillment app v2 (hotwax#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Sep 26, 2024
1 parent a5afa74 commit 22fec9d
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 296 deletions.
45 changes: 14 additions & 31 deletions src/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,28 @@ const getProductStoreSetting = async (payload: any): Promise<any> => {
});
}

const fetchOrderFacilityChangeHistory = async (payload: any): Promise<any> => {
let baseURL = store.getters['user/getInstanceUrl'];
baseURL = baseURL && baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`;


return client({
url: "performFind",
method: "POST",
data: payload,
baseURL,
headers: {
Authorization: 'Bearer ' + process.env.VUE_APP_BASE,
'Content-Type': 'application/json'
}
})
const getRerouteOrderBrokeringHistory = async (payload: any): Promise<any> => {
return api({
url: "getRerouteOrderBrokeringHistory",
method: "post",
data: payload
});
}

const releaseOrderItem = async (payload: any): Promise<any> => {
let baseURL = store.getters['user/getInstanceUrl'];
baseURL = baseURL && baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`;

return client({
url: "releaseOrderItem",
method: "POST",
data: payload,
baseURL,
headers: {
Authorization: 'Bearer ' + process.env.VUE_APP_BASE,
'Content-Type': 'application/json'
}
const releaseRerouteOrderItem = async (payload: any): Promise<any> => {
return api({
url: "releaseRerouteOrderItem",
method: "post",
data: payload
});
}
}

export const OrderService = {
fetchOrderFacilityChangeHistory,
getOrder,
getRerouteOrderBrokeringHistory,
updateShippingAddress,
updatePickupFacility,
cancelOrderItem,
getProductStoreSetting,
releaseOrderItem
releaseRerouteOrderItem
}
9 changes: 9 additions & 0 deletions src/theme/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,13 @@ http://ionicframework.com/docs/theming/ */

--ion-card-background: #1e1e1e;
}
}

.empty-state {
max-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}
84 changes: 39 additions & 45 deletions src/views/AddressModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,39 @@
<ion-title>{{ translate("Shipping address") }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-list>
<ion-item>
<ion-input :label="translate('First name')" class="ion-text-right" name="firstName" v-model="address.firstName" id="firstName" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('Last name')" class="ion-text-right" name="lastName" v-model="address.lastName" id="lastName" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('Street')" class="ion-text-right" name="street" v-model="address.address1" id="address1" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('City')" class="ion-text-right" name="city" v-model="address.city" id="city" type="text"/>
</ion-item>
<ion-item>
<ion-select :label="translate('State')" :placeholder="translate('Select')" interface="popover" v-model="address.stateProvinceGeoId">
<ion-select-option v-for="state in states" :key="state.geoId" :value="state.geoId" >{{ state.geoName }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-input :label="translate('Zipcode')" class="ion-text-right" name="zipcode" v-model="address.postalCode" id="postalCode"/>
</ion-item>
</ion-list>
<div class="ion-text-center">
<ion-button @click="updateAddress()">{{ translate("Save shipping address") }}</ion-button>
<div v-if="isLoading" class="empty-state">
<ion-spinner name="crescent" />
<ion-label>{{ translate("Loading address.") }}</ion-label>
</div>
<template v-else>
<ion-list>
<ion-item>
<ion-input :label="translate('First name')" class="ion-text-right" name="firstName" v-model="address.firstName" id="firstName" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('Last name')" class="ion-text-right" name="lastName" v-model="address.lastName" id="lastName" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('Street')" class="ion-text-right" name="street" v-model="address.address1" id="address1" type="text"/>
</ion-item>
<ion-item>
<ion-input :label="translate('City')" class="ion-text-right" name="city" v-model="address.city" id="city" type="text"/>
</ion-item>
<ion-item>
<ion-select :label="translate('State')" :placeholder="translate('Select')" interface="popover" v-model="address.stateProvinceGeoId">
<ion-select-option v-for="state in states" :key="state.geoId" :value="state.geoId" >{{ state.geoName }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-input :label="translate('Zipcode')" class="ion-text-right" name="zipcode" v-model="address.postalCode" id="postalCode"/>
</ion-item>
</ion-list>
<div class="ion-text-center ion-margin">
<ion-button @click="updateAddress()">{{ translate("Save shipping address") }}</ion-button>
</div>
</template>
</ion-content>
</template>

Expand All @@ -47,17 +54,17 @@ import {
IonIcon,
IonItem,
IonInput,
IonLabel,
IonList,
IonSelect,
IonSelectOption,
IonSpinner,
IonTitle,
IonToolbar,
modalController,
loadingController
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { closeOutline } from 'ionicons/icons';
import { useRouter } from "vue-router";
import { useStore } from "@/store";
import { translate } from '@/i18n';
import { hasError, showToast } from '@/utils';
Expand All @@ -73,9 +80,11 @@ export default defineComponent({
IonIcon,
IonItem,
IonInput,
IonLabel,
IonList,
IonSelect,
IonSelectOption,
IonSpinner,
IonTitle,
IonToolbar
},
Expand All @@ -92,15 +101,15 @@ export default defineComponent({
} as any,
contactMechId: '',
states: [] as any,
loader: null as any
isLoading: false
};
},
props: ["shipGroup", "token", "updatedAddress"],
async mounted() {
this.presentLoader()
this.isLoading = true;
await this.getAssociatedStates()
this.prepareAddress();
this.dismissLoader()
this.isLoading = false;
},
methods: {
async updateAddress() {
Expand All @@ -116,7 +125,7 @@ export default defineComponent({
this.closeModal(this.address);
},
prepareAddress() {
if(this.updatedAddress) {
if(this.updatedAddress.address1) {
this.address = this.updatedAddress
return;
}
Expand Down Expand Up @@ -152,26 +161,11 @@ export default defineComponent({
closeModal(address?: any) {
modalController.dismiss({ dismissed: true, updatedAddress: address });
},
async presentLoader() {
this.loader = await loadingController
.create({
message: this.translate("Fetching address")
});
await this.loader.present();
},
dismissLoader() {
if (this.loader) {
this.loader.dismiss();
this.loader = null;
}
},
},
setup() {
const router = useRouter();
const store = useStore();
return {
closeOutline,
router,
store,
translate
};
Expand Down
Loading

0 comments on commit 22fec9d

Please sign in to comment.