Skip to content

Commit

Permalink
Implemented: service for fetching routeFilters, defined type for rout…
Browse files Browse the repository at this point in the history
…eFilters, defined env entry to map filter with id and its code and added support to dynamically fetch the filters value(#24)
  • Loading branch information
ymaheshwari1 committed Jan 17, 2024
1 parent bb2e984 commit ecb32c3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_CACHE_MAX_AGE=3600
VUE_APP_VIEW_SIZE=10
VUE_APP_PERMISSION_ID=
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_RULE_ENUMS={"FILTER":"ENTCT_FILTER","SORT":"ENTCT_SORT_BY","QUEUE":{"id":"OIP_QUEUE","code":"facilityId"},"SHIPPING_METHOD":{"id":"OIP_SHIP_METH_TYPE","code":"shipmentMethodTypeId"},"PRIORITY":{"id":"OIP_PRIORITY","code":"priority"},"PROMISE_DATE":{"id":"OIP_PROMISE_DATE","code":"promiseDaysCutoff"},"SALES_CHANNEL":{"id":"OIP_SALES_CHANNEL","code":"salesChannelEnumId"},"SHIP_BY":{"id":"OSP_SHIP_BY","code":"shipBeforeDate"},"SHIP_AFTER":{"id":"OSP_SHIP_AFTER","code":"shipAfterDate"},"ORDER_DATE":{"id":"OSP_ORDER_DATE","code":"orderDate"},"SHIPPING_METHOD_SORT":{"id":"OSP_SHIP_METH","code":"deliveryDays"}}
9 changes: 9 additions & 0 deletions src/services/RoutingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ const fetchRoutingRules = async (payload: any): Promise<any> => {
});
}

const fetchRoutingFilters = async (payload: any): Promise<any> => {
return api({
url: `routings/${payload.orderRoutingId}/filter-conditions`,
method: "GET",
query: payload
});
}

export const OrderRoutingService = {
createRoutingGroup,
fetchOrderRoutings,
fetchRoutingFilters,
fetchRoutingGroups,
fetchRoutingRules
}
13 changes: 13 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,23 @@ type Rule = {
lastUpdatedStamp: string
}

type RouteFilter = {
orderRoutingId: string,
conditionSeqId: string,
conditionTypeEnumId: string,
fieldName: string,
operator: string,
fieldValue: string,
sequenceNum: number,
createdDate: string,
lastUpdatedStamp: string
}

export {
Enumeration,
EnumerationAndType,
Group,
Route,
RouteFilter,
Rule
}
19 changes: 12 additions & 7 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="menu">
<ion-item lines="none">
<ion-label>{{ currentRouting.routeName }}</ion-label>
<ion-chip slot="end" outline @click="router.push('route')">
<ion-chip slot="end" outline @click="router.go(-1)">
{{ "2/4" }}
<ion-icon :icon="chevronUpOutline" />
</ion-chip>
Expand All @@ -16,26 +16,26 @@
<ion-label>{{ "Filters" }}</ion-label>
</ion-item-divider>
<ion-item>
<ion-select label="Queue" value="Brokering Queue">
<ion-select label="Queue" :value="routingFilters[enums['FILTER']]?.[enums['QUEUE'].code]">
<ion-select-option value="Brokering Queue">{{ "Brokering Queue" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-select label="Shipping method" value="Next Day">
<ion-select label="Shipping method" :value="routingFilters[enums['FILTER']]?.[enums['SHIPPING_METHOD'].code]">
<ion-select-option value="Next Day">{{ "Next Day" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-select label="Order priority" value="High">
<ion-select label="Order priority" :value="routingFilters[enums['FILTER']]?.[enums['PRIORITY'].code]">
<ion-select-option value="High">{{ "High" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>{{ "Promise date" }}</ion-label>
<ion-chip>{{ "select date" }}</ion-chip>
<ion-chip>{{ routingFilters[enums['FILTER']]?.[enums['PROMISE_DATE'].code] }}</ion-chip>
</ion-item>
<ion-item>
<ion-select label="Queue" value="Brokering Queue">
<ion-select label="Queue" :value="routingFilters[enums['FILTER']]?.[enums['SALES_CHANNEL'].code]">
<ion-select-option value="Brokering Queue">{{ "Brokering Queue" }}</ion-select-option>
</ion-select>
</ion-item>
Expand Down Expand Up @@ -69,7 +69,8 @@
<ion-reorder-group :disabled="false">
<ion-item v-for="rule in routingRules" :key="rule.routingRuleId">
<ion-label>{{ rule.ruleName }}</ion-label>
<ion-reorder />
<!-- Don't display reordering option when there is a single rule -->
<ion-reorder v-show="routingRules.length > 1" />
</ion-item>
</ion-reorder-group>
</ion-list>
Expand Down Expand Up @@ -196,11 +197,15 @@ const props = defineProps({
}
})
const enums = JSON.parse(process.env?.VUE_APP_RULE_ENUMS as string)
const currentRouting = computed(() => store.getters["orderRouting/getCurrentOrderRouting"])
const routingRules = computed(() => store.getters["orderRouting/getRoutingRules"])
const routingFilters = computed(() => store.getters["orderRouting/getCurrentRouteFilters"])
onIonViewWillEnter(async () => {
await store.dispatch("orderRouting/fetchRoutingRules", props.orderRoutingId)
await store.dispatch("orderRouting/fetchRoutingFilters", props.orderRoutingId)
})
</script>
Expand Down

0 comments on commit ecb32c3

Please sign in to comment.