Skip to content

Commit

Permalink
Improved: code to display the rejection reason description in place o…
Browse files Browse the repository at this point in the history
…f reason id on rejections page(#921)
  • Loading branch information
ymaheshwari1 committed Jan 28, 2025
1 parent de05586 commit 94d5978
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/store/modules/rejection/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { escapeSolrSpecialChars, prepareSolrQuery } from '@/utils/solrHelper'
import { UtilService } from '@/services/UtilService'
import logger from '@/logger'
import { getCurrentFacilityId } from '@/utils'
import store from '@/store'

const actions: ActionTree<RejectionState, RootState> = {
async fetchRejectionStats({ commit, state }) {
Expand Down Expand Up @@ -67,7 +68,7 @@ const actions: ActionTree<RejectionState, RootState> = {
},
"fieldList": ["description", "enumId", "enumName", "enumTypeId", "sequenceNum"],
"distinct": "Y",
"entityName": "EnumTypeChildAndEnum",
"entityName": "Enumeration",
"viewSize": reasonIds.length, //There won't we rejection reasons more than 20, hence fetching detail for all the reasons at once
"orderBy": "sequenceNum"
}
Expand All @@ -79,6 +80,7 @@ const actions: ActionTree<RejectionState, RootState> = {
return reasonDetail;
}, {});
usedRejectionReasons = resp.data.docs
await store.dispatch("util/updateRejectReasons", usedRejectionReasons)
usedRejectionReasons.map((rejectionReason: any) => {
rejectionReason.count = reasonCountDetail[rejectionReason.enumId]?.count
})
Expand All @@ -98,8 +100,6 @@ const actions: ActionTree<RejectionState, RootState> = {
async fetchRejectedOrders({ commit, dispatch, state }, payload) {
let orders = [] as any, orderList = [] as any, total = 0
const rejectedOrderQuery = JSON.parse(JSON.stringify(state.rejectedOrders.query))



const filters = {
rejectedFrom_txt_en: { value: escapeSolrSpecialChars(getCurrentFacilityId()) },
Expand Down Expand Up @@ -136,6 +136,8 @@ const actions: ActionTree<RejectionState, RootState> = {
total = resp.data.grouped.orderId_s.ngroups
orders = resp.data.grouped.orderId_s.groups

const rejectionReasons = store.getters["util/getRejectReasons"]

orders = orders.map((order: any) => {
const orderItemDocs = order.doclist.docs.map((doc: any) => {
return {
Expand All @@ -148,7 +150,7 @@ const actions: ActionTree<RejectionState, RootState> = {
rejectedBy: doc.rejectedBy_txt_en,
rejectedAt: doc.rejectedAt_dt,
rejectionReasonId: doc.rejectionReasonId_txt_en,
rejectionReasonDesc: doc.rejectionReasonDesc_txt_en,
rejectionReasonDesc: rejectionReasons?.find((reason: any) => reason.enumId === doc.rejectionReasonId_txt_en)?.description || doc.rejectionReasonId_txt_en,
brokeredAt: doc.brokeredAt_dt,
brokeredBy: doc.brokeredBy_txt_en,
};
Expand Down

0 comments on commit 94d5978

Please sign in to comment.