Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Aug 26, 2024
2 parents d67d90f + f6742da commit cc90e5e
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 6 deletions.
143 changes: 143 additions & 0 deletions src/components/TrackingCodeModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<template>
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-button @click="closeModal">
<ion-icon slot="icon-only" :icon="closeOutline" />
</ion-button>
</ion-buttons>
<ion-title>{{ translate("Adding tracking code") }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-list lines="none">
<ion-item>
<ion-input :label="translate('Tracking code')" :helper-text="translate('Carrier:', { carrierName: getCarrierInfo() ? getCarrierInfo().groupName : '' })" v-model="trackingCode" />
</ion-item>
<ion-item>
<ion-label color="medium">
{{ translate("Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.") }}
</ion-label>
</ion-item>
<ion-item>
<ion-button fill="clear" :disabled="!trackingCode.trim()" @click="redirectToTrackingUrl()" size="default">
{{ translate("Test tracking url") }}
<ion-icon :icon="openOutline" slot="end" />
</ion-button>
</ion-item>
</ion-list>
</ion-content>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="saveTrackingCode()" :disabled="!trackingCode.trim()">
<ion-icon :icon="saveOutline" />
</ion-fab-button>
</ion-fab>
</template>

<script lang="ts">
import {
IonContent,
IonFab,
IonFabButton,
IonHeader,
IonIcon,
IonInput,
IonLabel,
IonTitle,
IonToolbar,
modalController,
IonButton,
IonButtons,
IonItem,
IonList
} from "@ionic/vue";
import { defineComponent } from "vue";
import { closeOutline, copyOutline, openOutline, saveOutline } from "ionicons/icons";
import { translate } from "@hotwax/dxp-components";
import { mapGetters, useStore } from "vuex";
import { OrderService } from '@/services/OrderService';
import logger from "@/logger";
import { showToast } from "@/utils";
export default defineComponent({
name: "TrackingCodeModal",
components: {
IonContent,
IonFab,
IonFabButton,
IonHeader,
IonIcon,
IonInput,
IonLabel,
IonTitle,
IonToolbar,
IonButton,
IonButtons,
IonItem,
IonList
},
computed: {
...mapGetters({
order: "order/getCurrent",
facilityCarriers: 'carrier/getFacilityCarriers',
})
},
data() {
return {
trackingCode: ""
}
},
props: ["carrierPartyId"],
methods: {
closeModal() {
modalController.dismiss({ dismissed: true });
},
async saveTrackingCode() {
try {
for (const shipmentPackage of this.order.shipmentPackages) {
await OrderService.addTrackingCode({
"shipmentId": shipmentPackage.shipmentId,
"shipmentRouteSegmentId": shipmentPackage.shipmentRouteSegmentId,
"shipmentPackageSeqId": shipmentPackage.shipmentPackageSeqId,
"trackingCode": this.trackingCode.trim()
});
}
//fetching updated shipment packages
showToast(translate("Tracking code added successfully."));
await this.store.dispatch('order/updateShipmentPackageDetail', this.order)
this.closeModal();
} catch (error: any) {
logger.error('Failed to add tracking code', error);
showToast(translate("Failed to add tracking code."));
}
},
getCarrierInfo() {
return this.facilityCarriers.find((carrier: any) => carrier.partyId === this.carrierPartyId)
},
redirectToTrackingUrl() {
const trackingUrl = this.getCarrierInfo()?.trackingUrl
if(!trackingUrl) {
showToast(translate("Tracking url is not configured for following carrier."));
return;
}
window.open(trackingUrl.replace("${trackingNumber}", this.trackingCode), "_blank");
}
},
setup() {
const store = useStore();
return {
closeOutline,
copyOutline,
openOutline,
saveOutline,
store,
translate
};
},
});
</script>
10 changes: 9 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"doesn't have any transfer orders right now.": "{facilityName} doesn't have any transfer orders right now.",
"Add Box": "Add Box",
"Add custom field": "Add custom field",
"Add tracking code manually": "Add tracking code manually",
"Adding tracking code": "Adding tracking code",
"Additional documents": "Additional documents",
"Additional data": "Additional data",
"Address 1": "Address 1",
Expand Down Expand Up @@ -53,6 +55,7 @@
"Cancel": "Cancel",
"Cancelled": "Cancelled",
"Carrier": "Carrier",
"Carrier:": "Carrier: {carrierName}",
"Carrier and shipment method association updated successfully.": "Carrier and shipment method association updated successfully.",
"Carrier and shipment methods have been set up successfully.": "Carrier and shipment methods have been set up successfully.",
"carrier code": "carrier code",
Expand Down Expand Up @@ -139,6 +142,7 @@
"Email": "Email",
"Enter key": "Enter key",
"Enter mapping name": "Enter mapping name",
"Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.": "Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.",
"Enter value": "Enter value",
"Error getting preferred product store.": "Error getting preferred product store.",
"Error getting user profile.": "Error getting user profile.",
Expand Down Expand Up @@ -224,6 +228,7 @@
"ID": "ID",
"ID cannot be more than 20 characters.": "ID cannot be more than 20 characters.",
"Imported from Shopify": "Imported from Shopify",
"Individual items within an order will be rejected without affecting the other items in the order.": "Individual items within an order will be rejected without affecting the other items in the order.",
"is identified as unfulfillable. other containing this product will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } { orders } other { orderText } containing this product will be unassigned from this store and sent to be rebrokered.",
"is identified as unfulfillable. This order item will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } This order item will be unassigned from this store and sent to be rebrokered.",
"is identified as. This order item will be unassigned from the store and sent to be rebrokered.": "{ productName } is identified as { rejectReason }. This order item will be unassigned from the store and sent to be rebrokered.",
Expand Down Expand Up @@ -401,7 +406,6 @@
"Reject in progress orders.": "Reject { ordersCount } in progress orders.",
"Reject open orders.": "Reject { ordersCount } open orders.",
"Reject order": "Reject order",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "Rejecting has been started. All in progress orders will be rejected shortly.",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "Rejecting has been started. All outstanding orders will be rejected shortly.",
"Rejection reason created successfully.": "Rejection reason created successfully.",
Expand Down Expand Up @@ -522,6 +526,7 @@
"Store pickup": "Store pickup",
"Store Pickup": "Store Pickup",
"STAY": "STAY",
"Test tracking url": "Test tracking url",
"The import orders has been uploaded successfully": "The import orders has been uploaded successfully",
"The picked quantity cannot exceed the ordered quantity.": "The picked quantity cannot exceed the ordered quantity.",
"The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.",
Expand All @@ -537,10 +542,13 @@
"To": "To",
"to": "to",
"To Name": "To Name",
"Tracking code": "Tracking code",
"Tracking code added successfully.": "Tracking code added successfully.",
"Tracking Code": "Tracking Code",
"Tracking code settings updated successfully.": "Tracking code settings updated successfully.",
"Tracking ID": "Tracking ID",
"Tracking URL:": "Tracking URL: {trackingUrl}",
"Tracking url is not configured for following carrier.": "Tracking url is not configured for following carrier.",
"Transfer Orders": "Transfer Orders",
"Transfer Order Details": "Transfer Order Details",
"Turn off eCom inventory": "Turn off eCom inventory",
Expand Down
10 changes: 9 additions & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"doesn't have any transfer orders right now.": "{facilityName} no tiene ninguna orden de transferencia en este momento.",
"Add Box": "Agregar Caja",
"Add custom field": "Agregar campo personalizado",
"Add tracking code manually": "Add tracking code manually",
"Adding tracking code": "Adding tracking code",
"Additional data": "Datos adicionales",
"Additional documents": "Documentos adicionales",
"Address 1": "Dirección 1",
Expand Down Expand Up @@ -52,6 +54,7 @@
"Cancel": "Cancelar",
"Cancelled": "Cancelado",
"Carrier": "Transportadora",
"Carrier:": "Carrier: {carrierName}",
"Carrier and shipment method association updated successfully.": "Carrier and shipment method association updated successfully.",
"Carrier and shipment methods have been set up successfully.": "Carrier and shipment methods have been set up successfully.",
"carrier code": "carrier code",
Expand Down Expand Up @@ -137,6 +140,7 @@
"Email": "Correo Electrónico",
"Enter key": "Ingresar clave",
"Enter mapping name": "Insertar nombre de mapeo",
"Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.": "Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.",
"Enter value": "Ingresar valor",
"Error getting preferred product store.": "Error al obtener la tienda de productos preferida.",
"Error getting user profile.": "Error al obtener el perfil de usuario.",
Expand Down Expand Up @@ -220,6 +224,7 @@
"ID": "ID",
"ID cannot be more than 20 characters.": "ID cannot be more than 20 characters.",
"Imported from Shopify": "Importado desde Shopify",
"Individual items within an order will be rejected without affecting the other items in the order.": "Individual items within an order will be rejected without affecting the other items in the order.",
"is identified as unfulfillable. other containing this product will be unassigned from this store and sent to be rebrokered.": "{ productName } Se identifica como no cumplible { space } { orders } otros { orderText } que contienen este producto se desasignarán de esta tienda y se enviarán para ser revendidos.",
"is identified as unfulfillable. This order item will be unassigned from this store and sent to be rebrokered.": "{ productName } se identifica como no cumplible. { space } Este elemento del pedido se desasignará de esta tienda y se enviará para ser revendido.",
"is identified as. This order item will be unassigned from the store and sent to be rebrokered.": "{ productName } se identifica como { rejectReason }. Este elemento del pedido se desasignará de la tienda y se enviará para ser revendido.",
Expand Down Expand Up @@ -399,7 +404,6 @@
"Reject open orders.": "Rechazar { ordersCount } pedidos abiertos.",
"Reject order": "Rechazar pedido",
"Rejected": "Rechazado",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "Se ha iniciado el proceso de rechazo. Todos los pedidos en curso se rechazarán en breve.",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "Se ha iniciado el proceso de rechazo. Todos los pedidos pendientes se rechazarán en breve.",
"Rejection reason created successfully.": "Rejection reason created successfully.",
Expand Down Expand Up @@ -519,6 +523,7 @@
"Store": "Tienda",
"Store pickup": "Recoger en tienda",
"Store Pickup": "Recoger en tienda",
"Test tracking url": "Test tracking url",
"The import orders has been uploaded successfully": "Los pedidos de importación se han cargado exitosamente",
"The picked quantity cannot exceed the ordered quantity.": "La cantidad seleccionada no puede exceder la cantidad pedida.",
"The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "La zona horaria que seleccione se utiliza para garantizar que las automatizaciones que programe siempre sean precisas para la hora que seleccione.",
Expand All @@ -534,10 +539,13 @@
"To": "A",
"to": "a",
"To Name": "Nombrar",
"Tracking code": "Tracking code",
"Tracking code added successfully.": "Tracking code added successfully.",
"Tracking Code": "Código de Seguimiento",
"Tracking code settings updated successfully.": "Tracking code settings updated successfully.",
"Tracking ID": "ID de Seguimiento",
"Tracking URL:": "Tracking URL: {trackingUrl}",
"Tracking url is not configured for following carrier.": "Tracking url is not configured for following carrier.",
"Transfer Orders": "Transferir Ordenes",
"Transfer Order Details": "Transferir los Detalles del Pedido",
"Turn off eCom inventory": "Desactivar el inventario de eCom",
Expand Down
10 changes: 9 additions & 1 deletion src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"doesn't have any outstanding orders right now.": "{facilityName}には現在未処理の注文はありません。",
"Add Box": "ボックスを追加",
"Add custom field": "カスタムフィールドを追加",
"Add tracking code manually": "Add tracking code manually",
"Adding tracking code": "Adding tracking code",
"Additional documents": "追加文書",
"Additional data": "追加データ",
"Address 1": "住所 1",
Expand Down Expand Up @@ -53,6 +55,7 @@
"Cancel": "キャンセル",
"Cancelled": "キャンセル済み",
"Carrier": "配送者",
"Carrier:": "Carrier: {carrierName}",
"Carrier and shipment method association updated successfully.": "配送者と出荷方法の関連付けが正常に更新されました。",
"Carrier and shipment methods have been set up successfully.": "配送業者と発送方法が正常に設定されました。",
"carrier code": "配送者コード",
Expand Down Expand Up @@ -139,6 +142,7 @@
"Email": "メール",
"Enter key": "キーを入力",
"Enter mapping name": "マッピング名を入力",
"Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.": "Enter tracking details for shipping labels generated outside of the fulfillment app. This tracking code will be shared with customers when you complete the fulfillment of the order.",
"Enter value": "値を入力",
"Error getting preferred product store.": "優先製品ストアの取得エラー。",
"Error getting user profile.": "ユーザープロファイルの取得エラー。",
Expand Down Expand Up @@ -224,6 +228,7 @@
"ID": "ID",
"ID cannot be more than 20 characters.": "IDは20文字以内でなければなりません。",
"Imported from Shopify": "Shopifyからインポート",
"Individual items within an order will be rejected without affecting the other items in the order.": "Individual items within an order will be rejected without affecting the other items in the order.",
"is identified as unfulfillable. other containing this product will be unassigned from this store and sent to be rebrokered.": "{ productName }は出荷不可能と判定されました。他の{ space }{ orders }件の{ orderText }がこのストアから解除され、再仲介のために送られます。",
"is identified as unfulfillable. This order item will be unassigned from this store and sent to be rebrokered.": "{ productName }は出荷不可能と判定されました。{ space }この注文項目はこのストアから解除され、再仲介のために送られます。",
"is identified as. This order item will be unassigned from the store and sent to be rebrokered.": "{ productName }は{ rejectReason }と判定されました。この注文項目はこのストアから解除され、再仲介のために送られます。",
Expand Down Expand Up @@ -399,7 +404,6 @@
"Reject in progress orders.": "進行中の{ordersCount}件の注文を拒否。",
"Reject open orders.": "オープンの{ordersCount}件の注文を拒否。",
"Reject order": "注文を拒否",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "拒否が開始されました。進行中のすべての注文はまもなく拒否されます。",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "拒否が開始されました。未処理のすべての注文はまもなく拒否されます。",
"Rejection reason created successfully.": "拒否理由が正常に作成されました。",
Expand Down Expand Up @@ -520,6 +524,7 @@
"Store pickup": "ストア受け取り",
"Store Pickup": "店頭受け取り",
"STAY": "滞在",
"Test tracking url": "Test tracking url",
"The import orders has been uploaded successfully": "インポート注文が正常にアップロードされました",
"The picked quantity cannot exceed the ordered quantity.": "選ばれた数量は注文された数量を超えることはできません。",
"The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "選択したタイムゾーンは、スケジュールした自動化が常に選択した時間に正確であることを保証するために使用されます。",
Expand All @@ -535,10 +540,13 @@
"To": "宛先",
"to": "宛先",
"To Name": "宛先名",
"Tracking code": "Tracking code",
"Tracking code added successfully.": "Tracking code added successfully.",
"Tracking Code": "追跡コード",
"Tracking code settings updated successfully.": "追跡コード設定が正常に更新されました。",
"Tracking ID": "追跡ID",
"Tracking URL:": "Tracking URL: {trackingUrl}",
"Tracking url is not configured for following carrier.": "Tracking url is not configured for following carrier.",
"Transfer Orders": "転送注文",
"Transfer Order Details": "転送注文の詳細",
"Turn off eCom inventory": "EC在庫をオフにする",
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/carrier/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ const actions: ActionTree<CarrierState, RootState> = {
"systemPropertyId": "%trackingUrl%",
"systemPropertyId_op": "like"
},
"fieldList": ["systemResourceId", "systemPropertyValue"]
"fieldList": ["systemResourceId", "systemPropertyId", "systemPropertyValue"]
})

if(!hasError(resp)) {
Expand Down
Loading

0 comments on commit cc90e5e

Please sign in to comment.