Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19361 - UXA add Returned Undeliverable to FAS #230

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lib.umd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/lib.umd.min.js.map

Large diffs are not rendered by default.

47 changes: 38 additions & 9 deletions src/components/ViewRoutingSlip/RefundRequestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<v-col
data-test="rsDetail"
class="col-3 font-weight-bold pb-0"
v-if="canEdit || address"
v-if="showAddress"
>
{{ 'Address' }}
</v-col>
Expand Down Expand Up @@ -64,7 +64,7 @@
close-on-content-click
offset-y
v-model="isExpanded"
v-if="!canEdit && currentRefundStatusLabel !== RoutingSlipRefundCodes.PROCESSING"
v-if="!canEdit && currentRefundStatusLabel && currentRefundStatusLabel !== RoutingSlipRefundCodes.PROCESSING"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
Expand All @@ -73,17 +73,19 @@
v-on="on"
small
class="hover-btn ml-2"
color="primary"
@click="expendStatus"
>
Update Status
<v-icon dense>{{ isExpanded ? 'mdi-menu-up' : 'mdi-menu-down' }}</v-icon>
</v-btn>
</template>
<v-list>
<v-list
class="status-list"
>
<v-list-item
v-for="status in filteredStatuses"
:key="status.code"
class="menu-list"
@click="updateRefundStatus(status.code)"
>
<v-list-item-title>{{ status.text }}</v-list-item-title>
Expand Down Expand Up @@ -123,11 +125,12 @@ import { computed, defineComponent, reactive, toRefs } from '@vue/composition-ap
import { useRefundRequestForm, useRoutingSlipInfo } from '@/composables/ViewRoutingSlip'
import AddressForm from '@/components/common/AddressForm.vue'
import { GetRoutingSlipRequestPayload, RefundRequestDetails } from '@/models/RoutingSlip'
import { RoutingSlipRefundCodes, RoutingSlipRefundStatus } from '@/util/constants'
import { RoutingSlipRefundCodes, RoutingSlipRefundStatus, SlipStatus } from '@/util/constants'
import { useRoutingSlip } from '@/composables/useRoutingSlip'
import { useSearch } from '@/composables/Dashboard/useSearch'

export default defineComponent({
name: 'RefundRequestForm',
components: {
AddressForm
},
Expand All @@ -153,11 +156,22 @@ export default defineComponent({

const state = reactive({
currentRefundStatus: routingSlipState.routingSlipDetails.value?.refundStatus,
currentStatus: routingSlipState.routingSlipDetails.value?.status,
isExpanded: false,
...refundRequestFormState
})

const currentRefundStatusLabel = computed(() => searchState.getRefundStatusText(state.currentRefundStatus))
const currentRefundStatusLabel = computed(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const currentRefundStatusLabel = computed(() => {
  const statusMap = {
    [SlipStatus.REFUNDAUTHORIZED]: RoutingSlipRefundCodes.PROCESSING,
    [SlipStatus.REFUNDREQUEST]: RoutingSlipRefundCodes.PROCESSING,
    [SlipStatus.REFUNDUPLOADED]: RoutingSlipRefundCodes.PROCESSING,
    [SlipStatus.REFUNDPROCESSED]: searchState.getRefundStatusText(state.currentRefundStatus)
  }
  return statusMap[state.currentStatus] || null
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! that looks really good

const refundInProgress = [SlipStatus.REFUNDAUTHORIZED, SlipStatus.REFUNDREQUEST, SlipStatus.REFUNDUPLOADED].includes(state.currentStatus as SlipStatus)
const refundComplete = [SlipStatus.REFUNDPROCESSED].includes(state.currentStatus as SlipStatus)
if (refundInProgress) {
return RoutingSlipRefundCodes.PROCESSING
} else if (refundComplete) {
return searchState.getRefundStatusText(state.currentRefundStatus)
} else {
return null
}
})

const expendStatus = () => {
state.isExpanded = !state.isExpanded
Expand All @@ -171,6 +185,7 @@ export default defineComponent({
await routingSlipOperations.updateRoutingSlipRefundStatus(status)
const comment = `Refund status updated from ${searchState.getRefundStatusText(state.currentRefundStatus)} to ${searchState.getRefundStatusText(status)}`
await routingSlipOperations.updateRoutingSlipComments(comment)
context.emit('commentsUpdated')
state.currentRefundStatus = status
if (routingSlipOperations.routingSlip.value?.number) {
const getRoutingSlipRequestPayload: GetRoutingSlipRequestPayload = { routingSlipNumber: routingSlipOperations.routingSlip.value?.number }
Expand All @@ -179,7 +194,7 @@ export default defineComponent({
}

return {
...toRefs(state), // Convert all reactive properties to refs
...toRefs(state),
currentRefundStatusLabel,
filteredStatuses,
expendStatus,
Expand All @@ -193,10 +208,24 @@ export default defineComponent({
</script>

<style lang="scss" scoped>
.hover-btn {
font-size: 16px !important;
text-transform: none;
}

.hover-btn:before {
background-color: transparent !important;
}
.menu-list {
font-size: 10px;

.status-list {
seeker25 marked this conversation as resolved.
Show resolved Hide resolved
margin: 0 !important;
padding: 0 !important;
min-width: auto !important;
}

.status-list .v-list-item__title {
color: #1669BB !important;
font-size: 16px !important;
padding: 8px 16px !important;
}
</style>
1 change: 1 addition & 0 deletions src/components/ViewRoutingSlip/RoutingSlipInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
@update:refundRequestDetails="refundRequestDetails = $event"
:isApprovalFlow="isApprovalFlow"
:routingSlipDetails="routingSlipDetails"
@commentsUpdated="$emit('commentsUpdated')"
>
</RefundRequestForm>
</template>
Expand Down
6 changes: 3 additions & 3 deletions src/composables/Dashboard/useSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export function useSearch (props, context) {
reachedEnd.value = await infiniteScrollCallback()
}, 100) // Adjust the wait time as needed

function getRefundStatusText (statusCode: string): string {
const status = RoutingSlipRefundStatus.find(item => item.code === statusCode)
return status.text ? status.text : RoutingSlipRefundCodes.PROCESSING
function getRefundStatusText (statusCode: string | undefined): string {
const refundStatus = RoutingSlipRefundStatus.find(item => item.code === statusCode)
seeker25 marked this conversation as resolved.
Show resolved Hide resolved
return refundStatus.text ? refundStatus.text : RoutingSlipRefundCodes.PROCESSING
}

function getStatusFromRefundStatus (statusCode: string): SlipStatus {
Expand Down
9 changes: 7 additions & 2 deletions src/composables/ViewRoutingSlip/useRefundRequestForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ export default function useRefundRequestForm (props, context) {
const chequeAdviceRules = CommonUtils.optionalFieldRule('This field should be maximum of 40 characters', 40)

const name = ref<string>('')
const address = ref<Address>(undefined)
const address = ref<Address>({})
const chequeAdvice = ref<string>('')

const canEdit = computed(() => {
// except "chequeAdvice" , all other field are not editable in approval process
return !isApprovalFlow.value && isEditing.value
})

const showAddress = computed(() => {
return canEdit.value || (address.value && Object.values(address.value).some(value => !!value))
})

function addressValidity (isValid: boolean): void {
isAddressValid.value = isValid
}
Expand Down Expand Up @@ -69,6 +73,7 @@ export default function useRefundRequestForm (props, context) {
addressForm,
addressValidity,
isValid,
canEdit
canEdit,
showAddress
}
}
1 change: 1 addition & 0 deletions src/composables/useRoutingSlip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const useRoutingSlip = () => {

const getRoutingSlip = async (getRoutingSlipRequestPayload: GetRoutingSlipRequestPayload) => {
try {
routingSlip.value = null
const response = await RoutingSlipService.getRoutingSlip(
getRoutingSlipRequestPayload.routingSlipNumber,
getRoutingSlipRequestPayload?.showGlobalLoader
Expand Down
33 changes: 23 additions & 10 deletions src/views/ViewRoutingSlip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
</header>
</v-col>
<v-col cols="12" class="mb-1 py-0 pl-0">
<staff-comments :routingSlipNumber="slipId" />
<StaffComments :routingSlipNumber="slipId" :key="commentsKey" />
</v-col>
<v-col cols="12" class="mb-5">
<routing-slip-info />
<RoutingSlipInfo @commentsUpdated="refreshComments" />
</v-col>
<v-col cols="12" class="my-5">
<payment-information />
<PaymentInformation />
</v-col>
<v-col cols="12" class="my-5">
<link-routing-slip />
<LinkRoutingSlip />
</v-col>
<v-col cols="12" class="my-5">
<routing-slip-transaction />
<RoutingSlipTransaction />
</v-col>
</v-row>
</v-container>
</div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { defineComponent, ref } from '@vue/composition-api'
import {
RoutingSlipInfo,
PaymentInformation,
Expand All @@ -42,19 +42,32 @@ import {
} from '@/components/ViewRoutingSlip'
import { useViewRoutingSlip } from '@/composables/ViewRoutingSlip'

@Component({
export default defineComponent({
name: 'ViewRoutingSlip',
components: {
RoutingSlipInfo,
PaymentInformation,
RoutingSlipTransaction,
LinkRoutingSlip,
StaffComments
},
props: {
slipId: {
type: String,
required: true
}
},
setup (props) {
useViewRoutingSlip(props)
// Reactive key for forcing re-render
const commentsKey = ref(0)
const refreshComments = () => {
commentsKey.value += 1
}
return {
commentsKey,
refreshComments
}
}
})
export default class ViewRoutingSlip extends Vue {
@Prop() slipId: string
}
</script>
Loading