This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
apps/admin-ui/src/spa/applications
packages/common/src/queries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,9 +342,11 @@ function SchedulesContent({
342342
343343function RejectOptionButton ( {
344344 option,
345+ applicationStatus,
345346 refetch,
346347} : {
347348 option : ReservationUnitOptionNode ;
349+ applicationStatus : ApplicationStatusChoice ;
348350 refetch : ( ) => Promise < ApolloQueryResult < Query > > ;
349351} ) {
350352 const [ mutation , { loading } ] = useMutation <
@@ -409,7 +411,8 @@ function RejectOptionButton({
409411 console . warn ( "no allocatedTimeSlots" , option ) ;
410412 }
411413
412- const isDisabled = option . allocatedTimeSlots ?. length > 0 ;
414+ const canReject = applicationStatus === ApplicationStatusChoice . InAllocation ;
415+ const isDisabled = ! canReject || option . allocatedTimeSlots ?. length > 0 ;
413416 return (
414417 < Button
415418 variant = "supplementary"
@@ -497,6 +500,9 @@ function ApplicationSectionDetails({
497500 return (
498501 < RejectOptionButton
499502 option = { reservationUnitOption }
503+ applicationStatus = {
504+ application . status ?? ApplicationStatusChoice . Draft
505+ }
500506 refetch = { refetch }
501507 />
502508 ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export const APPLICATION_ADMIN_QUERY = gql`
66 ${ APPLICATION_ADMIN_FRAGMENT }
77 query ApplicationAdmin($id: ID!) {
88 application(id: $id) {
9- ...ApplicationCommon
9+ ...ApplicationAdminFragment
1010 workingMemo
1111 }
1212 }
Original file line number Diff line number Diff line change @@ -200,8 +200,9 @@ const APPLICATION_ROUND_FRAGMENT = gql`
200200export const APPLICATION_ADMIN_FRAGMENT = gql `
201201 ${ APPLICANT_FRAGMENT }
202202 ${ APPLICATION_SECTION_UI_FRAGMENT }
203- fragment ApplicationCommon on ApplicationNode {
203+ fragment ApplicationAdminFragment on ApplicationNode {
204204 pk
205+ id
205206 status
206207 lastModifiedDate
207208 ...ApplicantFragment
@@ -215,6 +216,7 @@ export const APPLICATION_ADMIN_FRAGMENT = gql`
215216 rejected
216217 allocatedTimeSlots {
217218 pk
219+ id
218220 }
219221 }
220222 }
You can’t perform that action at this time.
0 commit comments