11<script setup lang="ts">
2- import { ReviewDecisionTypes , ReviewStatusTypes } from ' @/composables' ;
3- import { enumToLabel } from ' @/utils' ;
42import { computed , watch } from ' vue' ;
5- import { useAnalystQueueStore } from ' @/store/analystQueue' ;
3+ import { enumToLabel } from ' @/utils/format-helper'
4+ import { ReviewDecisionTypes , ReviewStatusTypes } from ' @/composables' ;
65import { storeToRefs } from ' pinia' ;
6+ import { useAnalystQueueStore } from ' @/store/analystQueue' ;
77
88const { reviewDecision, validationErrors, isInReview } = storeToRefs (useAnalystQueueStore ())
99
10-
11- const isReadonly = computed (() => ! isInReview .value )
12- const isApproved = computed (() => reviewDecision .value .statusType === ReviewStatusTypes .APPROVED )
1310const isDeclined = computed (() => reviewDecision .value .statusType === ReviewStatusTypes .DECLINED )
1411
15- // / Options for the decline reason select dropdown
12+ // Options for the decline reason select dropdown
1613const declineReasonItems = computed (() => {
1714
1815 return Object .values (ReviewDecisionTypes ).map ((value ) => ({
@@ -21,14 +18,7 @@ const declineReasonItems = computed(() => {
2118 }))
2219})
2320
24- // / Label for the declined reason to show in readonly mode
25- const declinedReasonLabel = computed (() => {
26- return reviewDecision .value ?.declinedReasonType
27- ? enumToLabel (reviewDecision .value .declinedReasonType )
28- : ' '
29- })
30-
31- // / Update the review decision status type when a button is clicked
21+ // Update the review decision status type when a button is clicked
3222const updateReviewDecision = (statusType : ReviewStatusTypes ) => {
3323 if (! isInReview .value ) return
3424 reviewDecision .value = { ... reviewDecision .value , statusType }
@@ -55,127 +45,102 @@ watch(() => reviewDecision.value?.statusType, (val) => {
5545<template >
5646 <div
5747 :class =" validationErrors.general || validationErrors.declineReasonType ? 'border-error-left' : ''" >
58- <div :class =" 'font-bold text-gray-900 bg-bcGovColor-gray2 px-[1.4rem] py-[12px] rounded-t'" >
59- <div class =" flex justify-between" >
60- <div class =" flex" >
61- <UIcon name =" i-mdi-stamper" class =" w-6 h-6 text-blue-350" />
62- <div class =" ml-2" >Review Decision</div >
63- </div >
48+ <div :class =" 'font-bold text-gray-900 bg-bcGovColor-gray2 px-[1.4rem] py-[12px] rounded-t'" >
49+ <div class =" flex justify-between" >
50+ <div class =" flex" >
51+ <UIcon name =" i-mdi-stamper" class =" w-6 h-6 text-blue-350" />
52+ <div class =" ml-2" >Review Decision</div >
6453 </div >
6554 </div >
66- <div class =" w-full border-t bg-white pa-6" >
67- <div class =" grid grid-cols-12 gap-4" >
68- <div class =" col-span-3 flex" >
69- <span class =" text-gray-700 font-bold" >Review Decision</span >
70- </div >
71-
72- <div class =" col-span-9" >
73- <div v-if =" !isReadonly" class =" flex gap-[10px]" >
74- <UButton
75- size =" md"
76- color =" error"
77- :class =" [
78- 'rounded-sm flex-1 h-[44px] justify-center',
79- reviewDecision.statusType === ReviewStatusTypes.DECLINED ? 'bg-error/10' : ''
80- ]"
81- variant =" outline"
82- icon =" i-mdi-close"
83- @click =" updateReviewDecision(ReviewStatusTypes.DECLINED)"
84- >
85- Decline
86- </UButton >
87- <UButton
88- color =" success"
89- size =" md"
90- :class =" [
91- 'rounded-sm flex-1 h-[44px] justify-center text-bcGovGray-900',
92- reviewDecision.statusType === ReviewStatusTypes.APPROVED ? 'bg-success/10' : ''
93- ]"
94- variant =" outline"
95- icon =" i-mdi-check"
96- @click =" updateReviewDecision(ReviewStatusTypes.APPROVED)"
97- >
98- Approve
99- </UButton >
100- </div >
101-
102- <div v-else class =" text-gray-900" >
103- <div class =" font-bold" >{{ enumToLabel(reviewDecision.statusType) }}</div >
104- </div >
105-
106- <div v-if =" validationErrors.general" class =" text-red-600 text-sm mt-2" >
107- {{ validationErrors.general }}
108- </div >
109-
110- <div v-if =" isDeclined" class =" mt-4 rounded animate-slide-down" >
111-
112- <div class =" space-y-4" >
113- <template v-if =" ! isReadonly " >
114- <div v-if =" !isApproved" class =" space-y-4" >
115- <USelect
116- v-model =" reviewDecision.declinedReasonType"
117- :items =" declineReasonItems"
118- label-key =" text"
119- value-key =" value"
120- placeholder =" Reason for decline (will be included in client email)"
121- size =" lg"
122- :ui =" {
123- base: [
124- 'border-b-[1px] w-full h-[60px] focus:shadow-none data-[state=open]:shadow-none',
125- 'data-[state=open]:border-blue-350',
126- validationErrors.declineReasonType ? 'border-error' : ''
127- ],
128- item: 'hover:text-blue-500 hover:bg-bcGovGray-100',
129- placeholder: validationErrors.declineReasonType ? 'text-error' : 'text-bcGovGray-700'
130- }"
131- />
132- <div v-if =" validationErrors.declineReasonType" class =" text-red-600 text-sm mt-1" >
133- {{ validationErrors.declineReasonType }}
134- </div >
55+ </div >
56+ <div class =" w-full border-t bg-white pa-6" >
57+ <div class =" grid grid-cols-12 gap-4" >
58+ <div class =" col-span-3 flex" >
59+ <span class =" text-gray-700 font-bold" >Review Decision</span >
60+ </div >
61+
62+ <div class =" col-span-9" >
63+ <div class =" flex gap-[10px]" >
64+ <UButton
65+ size =" md"
66+ color =" error"
67+ :class =" [
68+ 'rounded-sm flex-1 h-[44px] justify-center',
69+ reviewDecision.statusType === ReviewStatusTypes.DECLINED ? 'bg-error/10' : ''
70+ ]"
71+ variant =" outline"
72+ icon =" i-mdi-close"
73+ @click =" updateReviewDecision(ReviewStatusTypes.DECLINED)"
74+ >
75+ Decline
76+ </UButton >
77+ <UButton
78+ color =" success"
79+ size =" md"
80+ :class =" [
81+ 'rounded-sm flex-1 h-[44px] justify-center text-bcGovGray-900',
82+ reviewDecision.statusType === ReviewStatusTypes.APPROVED ? 'bg-success/10' : ''
83+ ]"
84+ variant =" outline"
85+ icon =" i-mdi-check"
86+ @click =" updateReviewDecision(ReviewStatusTypes.APPROVED)"
87+ >
88+ Approve
89+ </UButton >
90+ </div >
91+
92+ <div v-if =" validationErrors.general" class =" text-red-600 text-sm mt-2" >
93+ {{ validationErrors.general }}
94+ </div >
95+
96+ <div v-if =" isDeclined" class =" mt-4 rounded animate-slide-down" >
97+ <div class =" space-y-4" >
98+ <USelect
99+ v-model =" reviewDecision.declinedReasonType"
100+ :items =" declineReasonItems"
101+ label-key =" text"
102+ value-key =" value"
103+ placeholder =" Reason for decline (will be included in client email)"
104+ size =" lg"
105+ :ui =" {
106+ base: [
107+ 'border-b-[1px] w-full h-[60px] focus:shadow-none data-[state=open]:shadow-none',
108+ 'data-[state=open]:border-blue-350',
109+ validationErrors.declineReasonType ? 'border-error' : ''
110+ ],
111+ item: 'hover:text-blue-500 hover:bg-bcGovGray-100',
112+ placeholder: validationErrors.declineReasonType ? 'text-error' : 'text-bcGovGray-700'
113+ }"
114+ />
115+ <div v-if =" validationErrors.declineReasonType" class =" text-red-600 text-sm mt-1" >
116+ {{ validationErrors.declineReasonType }}
135117 </div >
136118
137- <div v-if =" !isApproved" >
138- <UTextarea
139- v-model =" reviewDecision.staffNote"
140- placeholder =" Staff note (internal)"
141- size =" lg"
142- :rows =" 4"
143- :maxlength =" 2000"
144- class =" w-full"
145- :ui =" {
146- slots:{
147- base: [
148- 'border-bcGovGray-700 focus:shadow-none',
149- 'focus:border-blue-350 placeholder:text-bcGovGray-700'
150- ],
151- },
152- base: 'border-b-1 placeholder:text-bcGovGray-700'
153- }"
154- />
155- <div class =" text-xs text-gray-500 mt-1 text-end" >
156- {{ reviewDecision.staffNote?.length }} / 2000
157- </div >
158- </div >
159- </template >
160-
161- <template v-else >
162- <div v-if =" isDeclined" class =" space-y-4" >
163- <div >
164- <div class =" text-sm text-gray-500" >Reason for decline</div >
165- <div class =" font-bold" >{{ declinedReasonLabel || '—' }}</div >
166- </div >
167-
168- <div >
169- <div class =" text-sm text-gray-500" >Staff note (internal)</div >
170- <div class =" whitespace-pre-wrap" >{{ reviewDecision.staffNote || '—' }}</div >
171- </div >
119+ <UTextarea
120+ v-model =" reviewDecision.staffNote"
121+ placeholder =" Staff note (internal)"
122+ size =" lg"
123+ :rows =" 4"
124+ :maxlength =" 2000"
125+ class =" w-full"
126+ :ui =" {
127+ slots:{
128+ base: [
129+ 'border-bcGovGray-700 focus:shadow-none',
130+ 'focus:border-blue-350 placeholder:text-bcGovGray-700'
131+ ],
132+ },
133+ base: 'border-b-1 placeholder:text-bcGovGray-700'
134+ }"
135+ />
136+ <div class =" text-xs text-gray-500 mt-1 text-end" >
137+ {{ reviewDecision.staffNote?.length }} / 2000
172138 </div >
173- </template >
174- </div >
175- </div >
176- </div >
177- </div >
178- </div >
139+ </div >
140+ </div >
141+ </div >
142+ </div >
143+ </div >
179144 </div >
180145</template >
181146
0 commit comments