Skip to content

Commit

Permalink
Improved: Added a min-date check on ion-datetime, implemented an acti…
Browse files Browse the repository at this point in the history
…on to clear the status description state on logout, corrected indentation issues, and added localized text (#304)
  • Loading branch information
R-Sourabh committed Jan 6, 2025
1 parent a678fd5 commit 6e96c4f
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 30 deletions.
1 change: 1 addition & 0 deletions src/components/ScheduledRestockPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
id="schedule-datetime"
show-default-buttons
hour-cycle="h23"
:min="DateTime.now().toISO()"
:value="job.runTime ? getDateTime(job.runTime) : getDateTime(DateTime.now().toMillis())"
@ionChange="changeJobRunTime($event)"
/>
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Add to shipment":"Add to shipment",
"Adjust": "Adjust",
"Adjust Inventory": "Adjust Inventory",
"Adjust inventory": "Adjust inventory",
"All": "All",
"App": "App",
"Apply": "Apply",
Expand Down Expand Up @@ -68,6 +69,7 @@
"Facilities": "Facilities",
"Facility ID": "Facility ID",
"Facility Location": "Facility Location",
"Failed": "Failed",
"Failed records": "Failed records",
"Failed to add product to shipment": "Failed to add product to shipment",
"Failed to save CSV mapping.": "Failed to save CSV mapping.",
Expand Down Expand Up @@ -196,6 +198,7 @@
"Required": "Required",
"Run once": "Run once",
"Run now": "Run now",
"Running": "Running",
"Running this job now will not replace this job. A copy of this job will be created and run immediately. You may not be able to reverse this action.": "Running this job now will not replace this job. A copy of this job will be created and run immediately. You may not be able to reverse this action.",
"Safety stock": "Safety stock",
"Save mapping": "Save mapping",
Expand All @@ -217,6 +220,7 @@
"Schedule Inventory": "Schedule Inventory",
"Scheduled inventory": "Scheduled inventory",
"Scheduled product launch": "Scheduled product launch",
"Scheduled restock": "Scheduled restock",
"Select": "Select",
"Select mapping": "Select mapping",
"Select SKU": "Select SKU",
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const routes: Array<RouteRecordRaw> = [
beforeEnter: authGuard,
},
{
path: '/adjust-inventory_history',
path: '/adjust-inventory-history',
name: 'AdjustInventoryHistory',
component: AdjustInventoryHistory,
beforeEnter: authGuard,
Expand Down
3 changes: 1 addition & 2 deletions src/store/modules/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ const actions: ActionTree<ProductState, RootState> = {
}
} catch (error) {
commit(types.PRODUCT_LIST_UPDATED, { products: [], total: 0 });
} finally {
if (payload.viewIndex === 0) emitter.emit("dismissLoader");
}

if (payload.viewIndex === 0) emitter.emit("dismissLoader");
return resp;
},
async clearProducts({ commit }) {
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const actions: ActionTree<UserState, RootState> = {
this.dispatch('order/updatePurchaseOrders', {parsed: {}, original: {}, unidentifiedItems: []});
this.dispatch('util/clearFacilities');
this.dispatch('util/clearProductStores');
this.dispatch('util/clearStatusDesc');
// clearing field mappings and current mapping when the user logout
commit(types.USER_FIELD_MAPPINGS_UPDATED, {})
commit(types.USER_CURRENT_FIELD_MAPPING_UPDATED, {id: '', mappingType: '', name: '', value: {}})
Expand Down
7 changes: 5 additions & 2 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const actions: ActionTree<UtilState, RootState> = {
commit(types.UTIL_PRODUCT_STORES_UPDATED, productStores);
},
// Retrieves service status descriptions
async getServiceStatusDesc ({ commit }) {
async getServiceStatusDesc({ commit }) {
try{
const resp = await UtilService.getServiceStatusDesc({
"inputFields": {
Expand All @@ -147,6 +147,9 @@ const actions: ActionTree<UtilState, RootState> = {
logger.error(err)
}
},
async clearStatusDesc({ commit }) {
commit(types.UTIL_SERVICE_STATUS_DESC_CLEARED)
},
// Fetches shipment items by shipmentId
async fetchShipmentItems({ commit }, shipmentId) {
let shipmentItems = [];
Expand All @@ -159,7 +162,7 @@ const actions: ActionTree<UtilState, RootState> = {
throw resp.data
}
} catch (err) {
logger.error(err)
logger.error(err)
}
commit(types.UTIL_SHIPMENT_ITEMS_UPDATED, shipmentItems);
},
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/util/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const UTIL_PRODUCT_STORES_UPDATED = SN_UTIL + '/PRODUCT_STORES_UPDATED'
export const UTIL_DATA_MANAGER_CONFIG_UPDATED = SN_UTIL + '/DATA_MANAGER_CONFIG_UPDATED'
export const UTIL_EXACT_INVENTORY_TYPE_UPDATED = SN_UTIL + '/EXACT_INVENTORY_TYPE_UPDATED'
export const UTIL_SERVICE_STATUS_DESC_UPDATED = SN_UTIL + '/SERVICE_STATUS_DESC_UPDATED'
export const UTIL_SERVICE_STATUS_DESC_CLEARED = SN_UTIL + '/SERVICE_STATUS_DESC_CLEARED'
export const UTIL_SHIPMENT_ITEMS_UPDATED = SN_UTIL + '/SHIPMENT_ITEMS_UPDATED'
3 changes: 3 additions & 0 deletions src/store/modules/util/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const mutations: MutationTree <UtilState> = {
state.statusDesc[status.statusId] = status.description;
})
},
[types.UTIL_SERVICE_STATUS_DESC_CLEARED] (state) {
state.statusDesc = {}
},
[types.UTIL_DATA_MANAGER_CONFIG_UPDATED] (state, payload) {
state.configDetails = payload;
}
Expand Down
9 changes: 5 additions & 4 deletions src/views/AdjustInventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</ion-item>
</ion-list>

<ion-button color="medium" size="large" expand="block" class="review" @click="upload">
<ion-button :disabled="!this.content.length" color="medium" size="large" expand="block" class="review" @click="upload">
{{ translate("Upload") }}
<ion-icon slot="end" :icon="cloudUploadOutline" />
</ion-button>
Expand Down Expand Up @@ -94,9 +94,9 @@
</ion-item>
<ion-item lines="none" class="adjust-buttons">
<!-- TODO: we need to discuss this button's function & how to enable the job -->
<ion-button color="medium" size="medium" fill="outline" @click="enableJob()">
<!-- <ion-button color="medium" size="medium" fill="outline" @click="enableJob()">
{{ translate("Enable") }}
</ion-button>
</ion-button> -->
<ion-button color="medium" size="medium" fill="outline" @click="runNow('draft')">
{{ translate("Run once") }}
</ion-button>
Expand Down Expand Up @@ -171,9 +171,10 @@ export default defineComponent({
},
computed: {
...mapGetters({
configDetails: 'util/getDataManagerConfig',
fieldMappings: 'user/getFieldMappings',
goodIdentificationTypes: 'util/getGoodIdentificationTypes',
configDetails: 'util/getDataManagerConfig'
instanceUrl: 'user/getInstanceUrl',
})
},
mixins:[ parseFileMixin ],
Expand Down
10 changes: 5 additions & 5 deletions src/views/AdjustInventoryHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</ion-chip>
<ion-button slot="end" fill="outline" size="medium" @click="router.replace({ name: 'AdjustInventory' })">
{{ translate("Upload file") }}
<ion-icon :icon="cloudUploadOutline"/>
<ion-icon slot="end" :icon="cloudUploadOutline"/>
</ion-button>
</ion-item>

Expand Down Expand Up @@ -150,17 +150,17 @@ export default defineComponent ({
if(this.filteredDataManagerLogList) {
await this.fetchDataResource(this.filteredDataManagerLogList)
}
this.filterDataManagerLogs('ALL');
this.filterDataManagerLogs("ALL");
this.isLoading = false;
},
methods: {
filterDataManagerLogs(id) {
this.selectedFilter = id;
if (id === 'ALL') {
if (id === "ALL") {
this.filteredDataManagerLogList = [...this.dataManagerLogList]
} else if (id === 'FAILED_LOGS') {
} else if (id === "FAILED_LOGS") {
this.filteredDataManagerLogList = this.dataManagerLogList.filter(log => log.statusId === 'SERVICE_FAILED')
} else if (id === 'FAILED_RECORDS') {
} else if (id === "FAILED_RECORDS") {
this.filteredDataManagerLogList = this.dataManagerLogList.filter(log => log.errorRecordContentId !== null)
}
},
Expand Down
1 change: 1 addition & 0 deletions src/views/InventoryReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export default defineComponent({
const params = {
"configId": this.exactInventoryType.configId
} as any
const alert = await alertController.create({
header: translate("Reset inventory"),
message: translate("Make sure all the data you have entered is correct."),
Expand Down
2 changes: 1 addition & 1 deletion src/views/SavedMappings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</ion-list>
<!-- TODO: need to make the enumId for this field mapping -->
<ion-list v-if="Object.keys(fieldMappings('ADJINV')).length">
<ion-list-header>{{ translate("Scheduled restock") }}</ion-list-header>
<ion-list-header>{{ translate("Adjust inventory") }}</ion-list-header>
<ion-item v-for="(mapping, index) in fieldMappings('ADJINV')" :key="index" @click="viewMappingConfiguration(index, 'ADJINV')" detail button>
<ion-label>{{ mapping.name }}</ion-label>
</ion-item>
Expand Down
17 changes: 9 additions & 8 deletions src/views/ScheduledIncomingInventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
</ion-button>

<ion-list v-if="jobs.length" class="job-section">
<template v-if="scheduledJobs.length">
<template v-if="pendingJobs.length">
<ion-list-header>
<ion-label>{{ translate("Scheduled inventory") }}</ion-label>
<!-- TODO: we need to discuss and make this button dynamic -->
<!-- <ion-button>{{ translate("Show completed launches") }}</ion-button> -->
</ion-list-header>

<ion-item v-for="job in scheduledJobs" :key="job.jobId">
<ion-item v-for="job in pendingJobs" :key="job.jobId">
<ion-label>
<p class="overline">{{ job.jobId }}</p>
{{ job.jobName }}
Expand All @@ -40,18 +40,19 @@
id="schedule-datetime"
show-default-buttons
hour-cycle="h23"
:min="DateTime.now().toISO()"
:value="currentJob?.runTime ? getDateTime(currentJob.runTime) : getDateTime(DateTime.now().toMillis())"
@ionChange="changeJobRunTime($event)"
/>
</ion-content>
</ion-modal>
</template>

<template v-if="receivedJobs.length">
<template v-if="finishedJobs.length">
<ion-item-divider color="light">
<ion-label>{{ translate("Received inventory") }}</ion-label>
</ion-item-divider>
<ion-item button detail v-for="job in receivedJobs" :key="job.jobId" @click="reviewJobItems(job.jobId)">
<ion-item button detail v-for="job in finishedJobs" :key="job.jobId" @click="reviewJobItems(job.jobId)">
<ion-label>
<p class="overline">{{ job.jobId }}</p>
{{ job.jobName }}
Expand Down Expand Up @@ -124,8 +125,8 @@ export default defineComponent({
return {
currentJob: {},
isUpdateDateTimeModalOpen: false,
scheduledJobs: [],
receivedJobs: []
pendingJobs: [],
finishedJobs: []
}
},
computed: {
Expand All @@ -140,8 +141,8 @@ export default defineComponent({
},
methods: {
updateJobsByStatus() {
this.scheduledJobs = this.jobs.filter(job => job.statusId === "SERVICE_PENDING");
this.receivedJobs = this.jobs.filter(job => job.statusId === "SERVICE_FINISHED");
this.pendingJobs = this.jobs.filter(job => job.statusId === "SERVICE_PENDING");
this.finishedJobs = this.jobs.filter(job => job.statusId === "SERVICE_FINISHED");
},
changeRunTime(job) {
this.currentJob = job
Expand Down
15 changes: 8 additions & 7 deletions src/views/ScheduledRestock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@
</ion-item-divider>
<ion-item>
<ion-label>{{ translate("Schedule") }}</ion-label>
<ion-button slot="end" class="date-time-button" @click="updateTime">{{ schedule ? getTime(schedule) : translate("Select time") }}</ion-button>
<ion-button slot="end" class="date-time-button" @click="updateTime()">{{ schedule ? getTime(schedule) : translate("Select time") }}</ion-button>
<ion-modal class="date-time-modal" :is-open="isDateTimeModalOpen" @didDismiss="() => isDateTimeModalOpen = false">
<ion-content force-overscroll="false">
<ion-datetime
id="schedule-datetime"
show-default-buttons
hour-cycle="h23"
:min="DateTime.now().toISO()"
:value="schedule ? getDateTime(schedule) : getDateTime(DateTime.now().toMillis())"
@ionChange="updateCustomTime($event)"
/>
Expand All @@ -100,7 +101,7 @@
</ion-item>
</ion-list>

<ion-button :disabled="!this.content.length" color="medium" expand="block" class="review" @click="upload">
<ion-button :disabled="!this.content.length" color="medium" expand="block" class="upload-button" @click="upload">
{{ translate("Upload") }}
<ion-icon slot="end" :icon="cloudUploadOutline" />
</ion-button>
Expand Down Expand Up @@ -307,7 +308,7 @@ export default defineComponent({
}
})
const items = await this.store.dispatch('stock/processUpdateRestockItems', restockItems);
const items = await this.store.dispatch("stock/processUpdateRestockItems", restockItems);
const destinationFacilityId = this.selectedFacility;
const uploadData = {
Expand All @@ -323,7 +324,7 @@ export default defineComponent({
buttons: [
{
text: translate("Cancel"),
role: 'cancel',
role: "cancel",
},
{
text: translate("Upload"),
Expand All @@ -346,10 +347,10 @@ export default defineComponent({
}
} catch(err) {
showToast(translate("Failed to schedule job"))
logger.error('Failed to create shipment', err)
logger.error("Failed to create shipment", err)
}
emitter.emit("dismissLoader")
this.router.push('/scheduled-incoming-inventory')
this.router.push("/scheduled-incoming-inventory")
}
},
],
Expand Down Expand Up @@ -402,7 +403,7 @@ main {
margin: var(--spacer-sm) auto 0;
}
.review {
.upload-button {
margin: var(--spacer-base) var(--spacer-sm);
}
Expand Down
1 change: 1 addition & 0 deletions src/views/ScheduledRestockReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
id="schedule-datetime"
show-default-buttons
hour-cycle="h23"
:min="DateTime.now().toISO()"
:value="currentJob?.runTime ? getDateTime(currentJob.runTime) : getDateTime(DateTime.now().toMillis())"
@ionChange="changeJobRunTime($event)"
/>
Expand Down

0 comments on commit 6e96c4f

Please sign in to comment.