Skip to content

Commit

Permalink
Fixed: the scheduled datetime issue(hotwax#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Sourabh committed May 30, 2024
1 parent dc903c4 commit c704633
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/views/ScheduledRestock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
show-default-buttons
hour-cycle="h23"
presentation="date-time"
:value="schedule ? getTime(schedule) : DateTime.now()"
:value="schedule ? getDateTime(schedule) : getDateTime(DateTime.now().toMillis())"
@ionChange="updateCustomTime($event)"
/>
</ion-content>
Expand All @@ -84,7 +84,7 @@
</ion-select>
</ion-item>
<ion-item lines="full">
<ion-input label="Restock name" placeholder='Created' v-model="restockName"></ion-input>
<ion-input label="Restock name" :placeholder='getPlaceholder()' v-model="restockName"></ion-input>
</ion-item>
</ion-list>

Expand Down Expand Up @@ -209,6 +209,9 @@ export default defineComponent({
},
methods: {
getPlaceholder() {
return `Created ${this.getTime(this.schedule ? this.schedule : DateTime.now().toMillis())}`
},
async fetchShopifyShops(productStoreId) {
let shopifyShops = []
try {
Expand Down Expand Up @@ -359,7 +362,7 @@ export default defineComponent({
productStoreId: this.selectedProductStoreId,
shopId: this.selectedShopifyShopId,
restockName: this.restockName,
scheduledTime: this.schedule ? this.schedule : DateTime.now().toMillis()
scheduledTime: this.schedule
})
this.router.push({
name:'ScheduledRestockDetail'
Expand Down
21 changes: 13 additions & 8 deletions src/views/ScheduledRestockReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
<ion-item>
<ion-icon slot="start" :icon="timerOutline"/>
<ion-label> Schedule </ion-label>
<ion-button class="date-time-button" slot="end" @click="updateTime()">{{ schedule.scheduledTime ? getTime(schedule.scheduledTime) : 'Select time' }}</ion-button>
<ion-button class="date-time-button" slot="end" @click="updateTime()">{{ scheduledTime ? getTime(scheduledTime) : '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"
presentation="date-time"
:value="schedule.scheduledTime ? getDateTime(schedule.scheduledTime) : getDateTime(DateTime.now().toMillis())"
:value="scheduledTime ? getDateTime(scheduledTime) : getDateTime(DateTime.now().toMillis())"
@ionChange="updateCustomTime($event)"
/>
</ion-content>
Expand Down Expand Up @@ -62,7 +62,7 @@
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-input label="Restock name" placeholder="name" v-model="restockName"></ion-input>
<ion-input label="Restock name" :placeholder="getPlaceholder()" v-model="restockName"></ion-input>
</ion-item>
</ion-list>
</div>
Expand Down Expand Up @@ -212,6 +212,10 @@ export default defineComponent({
// }
// },
methods: {
getPlaceholder() {
return `Created ${this.getTime(this.scheduledTime ? this.scheduledTime : DateTime.now().toMillis())}`
},
getFilteredRestockItems() {
const filteredItems = {};
Expand Down Expand Up @@ -240,9 +244,14 @@ export default defineComponent({
showToast('Please provide a future date and time');
return;
}
this.schedule.scheduledTime = setTime;
this.scheduledTime = setTime;
},
async save() {
if(!this.scheduledTime) {
showToast(translate("Please select a schedule time"));
return;
}
if(!this.selectedProductStoreId) {
showToast(translate("Please select product store"));
return;
Expand All @@ -253,10 +262,6 @@ export default defineComponent({
return;
}
if(!this.scheduledTime) {
showToast(translate("Please select a schedule time"));
return;
}
const groupedItems = Object.keys(this.parsedItems).reduce((result, key) => {
const items = this.parsedItems[key].filter(item => item.isSelected);
items.forEach(item => {
Expand Down

0 comments on commit c704633

Please sign in to comment.