diff --git a/src/i18n.ts b/src/i18n.ts index 39d62622..ed01dcae 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -27,11 +27,11 @@ const i18n = createI18n({ // TODO Check if this is needed in updated versions // Currently this method is added to be used in ts files -const translate = (key: string) => { +const translate = (key: string, named?: Record) => { if (!key) { return ''; } - return i18n.global.t(key); + return named ? i18n.global.t(key, named) : i18n.global.t(key); }; export { i18n as default, translate } \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 9d91566d..f20ff79e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -15,6 +15,7 @@ "Confirm": "Confirm", "Date Format": "Date Format", "Dismiss": "Dismiss", + "Enter mapping name": "Enter mapping name", "Enter a custom date time format that you want to use when uploading documents to HotWax Commerce.": "Enter a custom date time format that you want to use when uploading documents to HotWax Commerce.", "Facility": "Facility", "Facility ID": "Facility ID", @@ -29,6 +30,7 @@ "Leave page": "Leave page", "Login": "Login", "Logout": "Logout", + "Mapping name": "Mapping name", "Luxon date time formats can be found": "Luxon date time formats can be found", "Missing SKUs": "Missing SKUs", "No time zone found": "No time zone found", @@ -50,14 +52,17 @@ "Reset": "Reset", "Reset password": "Reset password", "Safety stock": "Safety stock", + "Save mapping": "Save mapping", "Sample": "Sample", "Save": "Save", "Search products": "Search products", "Search time zones": "Search time zones", "Select": "Select", + "Select mapping": "Select mapping", "Select all the fields to continue": "Select all the fields to continue", "Select time zone": "Select time zone", "Select the column index for the following information in the uploaded CSV.": "Select the column index for the following information in the uploaded CSV.", + "Some of the mapping fields are missing in the CSV: ": "Some of the mapping fields are missing in the CSV: {missingFields}", "Something went wrong": "Something went wrong", "Something went wrong, Please try again": "Something went wrong, Please try again", "Sorry, your username or password is incorrect. Please try again.": "Sorry, your username or password is incorrect. Please try again.", diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index a4a0f729..38e94750 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -3,5 +3,6 @@ export default interface UserState { current: object | null; currentFacility: object; instanceUrl: string; + fieldMappings: any; preferredDateTimeFormat: string; } \ No newline at end of file diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 665aa834..a6786b73 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -116,6 +116,10 @@ const actions: ActionTree = { */ setUserInstanceUrl ({ commit }, payload){ commit(types.USER_INSTANCE_URL_UPDATED, payload) + }, + + updateFieldMappings({ commit }, payload){ + commit(types.USER_FIELD_MAPPINGS_UPDATED, payload); } } diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index 1ba4aed6..2f8eb339 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -20,7 +20,10 @@ const getters: GetterTree = { }, getInstanceUrl (state) { const baseUrl = process.env.VUE_APP_BASE_URL; - return baseUrl ? baseUrl : state.instanceUrl; + return baseUrl ? baseUrl : state.instanceUrl; + }, + getFieldMappings(state) { + return state.fieldMappings; }, getDateTimeFormat (state) { return state.preferredDateTimeFormat; diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index ed5247b1..a3686410 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -12,6 +12,7 @@ const userModule: Module = { current: null, currentFacility: {}, instanceUrl: '', + fieldMappings: {}, preferredDateTimeFormat: '' }, getters, diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index 65cfd3c8..b39e0b69 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -4,4 +4,5 @@ export const USER_END_SESSION = SN_USER + '/END_SESSION' export const USER_INFO_UPDATED = SN_USER + '/INFO_UPDATED' export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATED' export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED' -export const USER_DATETIME_FORMAT_UPDATED = SN_USER + '/DATETIME_FORMAT_UPDATED' \ No newline at end of file +export const USER_FIELD_MAPPINGS_UPDATED = SN_USER + '/FIELD_MAPPINGS_UPDATED' +export const USER_DATETIME_FORMAT_UPDATED = SN_USER + '/DATETIME_FORMAT_UPDATED' diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index 9940d786..d621498e 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -20,6 +20,9 @@ const mutations: MutationTree = { [types.USER_INSTANCE_URL_UPDATED] (state, payload) { state.instanceUrl = payload; }, + [types.USER_FIELD_MAPPINGS_UPDATED] (state, payload) { + state.fieldMappings[payload.mappingPrefId] = payload; + }, [types.USER_DATETIME_FORMAT_UPDATED] (state, payload) { state.preferredDateTimeFormat = payload; } diff --git a/src/theme/variables.css b/src/theme/variables.css index c9177b47..33318e7d 100644 --- a/src/theme/variables.css +++ b/src/theme/variables.css @@ -286,6 +286,10 @@ body { justify-self: start } +.toast-message { + --white-space: pre-wrap !important; +} + @media (min-width: 700px) { .list-item { --col-calc: var(--columns-tablet); diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 13d8c2fe..b60789a0 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -10,65 +10,80 @@
- {{ file.name ? $t("Purchase order ") + file.name : $t('Purchase order') }} + {{ file.name ? $t("Purchase order") + file.name : $t('Purchase order') }} - + + + {{ $t("Select mapping") }} + + {{ mapping?.mappingPrefName }} + + {{ $t("Select the column index for the following information in the uploaded CSV.") }} + {{ $t("Order ID") }} - - {{ prop }} + + {{ prop }} {{ $t("Shopify product SKU") }} - + {{ prop }} {{ $t("Arrival date") }} - + {{ prop }} {{ $t("Ordered quantity") }} - + {{ prop }} {{ $t("Facility ID") }} - + {{ prop }} - + {{ $t("Review") }} + + + {{ $t("Mapping name") }} + + + {{ $t("Save mapping") }} +