forked from hotwax/order-routing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented: popover to update the group status and add runNow support(…
- Loading branch information
1 parent
987aa95
commit a701c89
Showing
3 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template> | ||
<ion-content> | ||
<ion-list> | ||
<ion-list-header>{{ group.groupName }}</ion-list-header> | ||
<ion-item button> | ||
<ion-icon slot="start" :icon="flashOutline" /> | ||
{{ translate("Run now") }} | ||
</ion-item> | ||
<ion-item lines="none" button v-if="group.schedule?.paused === 'N'" @click="updateGroupStatus('Y')"> | ||
<ion-icon slot="start" :icon="pauseOutline" /> | ||
{{ translate("Move to Draft") }} | ||
</ion-item> | ||
<ion-item lines="none" button v-else @click="updateGroupStatus('N')"> | ||
<ion-icon slot="start" :icon="playOutline" /> | ||
{{ translate("Activate") }} | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { | ||
IonContent, | ||
IonIcon, | ||
IonItem, | ||
IonList, | ||
IonListHeader, | ||
popoverController | ||
} from "@ionic/vue"; | ||
import { flashOutline, pauseOutline, playOutline } from 'ionicons/icons' | ||
import { translate } from "@/i18n" | ||
import { defineProps } from "vue" | ||
import { OrderRoutingService } from "@/services/RoutingService"; | ||
import { hasError, showToast } from "@/utils"; | ||
import logger from "@/logger"; | ||
import store from "@/store"; | ||
const props = defineProps(["group"]) | ||
async function updateGroupStatus(paused: string) { | ||
let routingGroups = []; | ||
const payload = { | ||
routingGroupId: props.group.routingGroupId, | ||
paused | ||
} | ||
try { | ||
const resp = await OrderRoutingService.scheduleBrokering(payload) | ||
if(!hasError(resp)){ | ||
showToast(translate("Group status updated")) | ||
routingGroups = await store.dispatch("orderRouting/updateGroupStatus", { routingGroupId: props.group.routingGroupId, value: paused }) | ||
} else { | ||
throw resp.data | ||
} | ||
} catch(err) { | ||
showToast(translate("Failed to update group status")) | ||
logger.error(err) | ||
} | ||
popoverController.dismiss({ routingGroups }); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters