From c5fd952ef995bd15f9f0beab61aeb6f108415830 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 23 Oct 2023 14:16:39 +0530 Subject: [PATCH] Improved: runtime logic and bottom sheet modal (#620) --- src/components/BatchModal.vue | 42 +++++++++++++---------------------- src/locales/en.json | 3 +-- src/views/Brokering.vue | 11 +++------ 3 files changed, 20 insertions(+), 36 deletions(-) diff --git a/src/components/BatchModal.vue b/src/components/BatchModal.vue index 921dc1b1..79235003 100644 --- a/src/components/BatchModal.vue +++ b/src/components/BatchModal.vue @@ -10,7 +10,7 @@ - + {{ $t('Name') }} @@ -27,14 +27,12 @@ {{ $t('Unfillable orders') }} - + - - {{ 'More Parameters' }} - + {{ $t('More parameters') }} @@ -43,7 +41,7 @@ {{ parameter.name }} - + {{ parameter.type }} @@ -51,10 +49,9 @@ {{ $t('Optional Parameters') }} - + {{ parameter.name }} - - + {{ parameter.type }} @@ -73,7 +70,7 @@ {{ $t('Run time') }} - {{ $t(runTime.label) }} + {{ runTime.label }} @@ -95,9 +92,8 @@ - - + @@ -135,7 +131,7 @@ import { defineComponent } from 'vue'; import { closeOutline, checkmarkDoneOutline, ticketOutline, timeOutline, timerOutline, warningOutline } from 'ionicons/icons'; import { mapGetters, useStore } from 'vuex'; import { DateTime } from 'luxon'; -import { handleDateTimeInput, generateAllowedFrequencies, generateAllowedRunTimes, generateJobCustomParameters, generateJobCustomOptions, getNowTimestamp, hasJobDataError, isCustomRunTime, showToast } from '@/utils'; +import { handleDateTimeInput, generateAllowedFrequencies, generateAllowedRunTimes, generateJobCustomParameters, generateJobCustomOptions, getNowTimestamp, hasJobDataError, isCustomRunTime, isFutureDate, showToast } from '@/utils'; import { translate } from '@/i18n' import CustomFrequencyModal from '@/components/CustomFrequencyModal.vue'; import { Actions, hasPermission } from '@/authorization' @@ -242,9 +238,12 @@ export default defineComponent({ // return if job has missing data or error if (hasJobDataError(job)) return; - - if (this.runTime) { - job['runTime'] = DateTime.now().toMillis() + this.runTime + + job.runTime = this.runTime != 0 ? (!isCustomRunTime(this.runTime) ? DateTime.now().toMillis() + this.runTime : this.runTime) : '' + + // if job runTime is not a valid date then making runTime as empty + if (job?.runTime && !isFutureDate(job?.runTime)) { + job.runTime = '' } job['jobStatus'] = this.jobStatus !== 'SERVICE_DRAFT' ? this.jobStatus : 'HOURLY'; @@ -314,13 +313,4 @@ export default defineComponent({ }; }, }); - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 17c21f51..0cda6951 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -33,7 +33,6 @@ "Automatically ship orders that are packed and have a tracking number if required.": "Automatically ship orders that are packed and have a tracking number if required.", "Back-order parking": "Back-order parking", "Backorder": "Backorder", - "Batch name": "Batch name", "Batches": "Batches", "before auto cancelation": "before auto cancelation", "Before importing historical orders in bulk, make sure all products are set up or else order import will not run correctly.": "Before importing historical orders in bulk, make sure all products are set up or else order import will not run correctly.", @@ -129,6 +128,7 @@ "Miscellaneous": "Miscellaneous", "Miscellaneous jobs": "Miscellaneous jobs", "More jobs": "More jobs", + "More parameters": "More parameters", "More options": "More options", "Name": "Name", "New broker run": "New broker run", @@ -152,7 +152,6 @@ "Open": "Open", "Optional Parameters": "Optional Parameters", "Order parking": "Order parking", - "Order queue": "Order queue", "Order status": "Order status", "Orders": "Orders", "Order fulfillment": "Order fulfillment", diff --git a/src/views/Brokering.vue b/src/views/Brokering.vue index 24e67f3b..38d9cf61 100644 --- a/src/views/Brokering.vue +++ b/src/views/Brokering.vue @@ -97,7 +97,7 @@ import { useRouter } from 'vue-router' import { mapGetters } from "vuex"; import JobConfiguration from '@/components/JobConfiguration.vue'; import { DateTime } from 'luxon'; -import { generateJobCustomOptions, generateJobCustomParameters, hasError, isFutureDate, showToast } from '@/utils'; +import { generateJobCustomOptions, generateJobCustomParameters, isFutureDate } from '@/utils'; import emitter from '@/event-bus'; import MoreJobs from '@/components/MoreJobs.vue'; import { Actions, hasPermission } from '@/authorization' @@ -152,15 +152,10 @@ export default defineComponent({ }, methods: { async addBatch() { - const batchmodal = await modalController.create({ - component: BatchModal - }); - return batchmodal.present(); - }, - async editBatch(id: string, enumId: string) { const batchmodal = await modalController.create({ component: BatchModal, - componentProps: {id, enumId} + breakpoints: [0, 0.25, 0.5, 0.75, 1], + initialBreakpoint: 1 }); return batchmodal.present(); },