Skip to content

Commit

Permalink
update filing json, poa logic
Browse files Browse the repository at this point in the history
Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>
  • Loading branch information
ArwenQin committed Dec 13, 2024
1 parent 382d580 commit 84795b7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
3 changes: 3 additions & 0 deletions src/components/NoticeOfWithdrawal/PlanOfArrangement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ export default class PlanOfArrangement extends Vue {
(v: string) => (!v || !(v.length < 5)) || 'Court order number is invalid', // too short
(v: string) => (!v || !(v.length > 20)) || 'Court order number is invalid' // too long
]
if (this.planOfArrangement) {
this.courtOrderNumRules.push((v: string) => !!v || 'A Court Order number is required')
}
this.$refs.courtNumRef.validate()
}
Expand Down
3 changes: 2 additions & 1 deletion src/enums/effectOfOrderTypes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export enum EffectOfOrderTypes {
PLAN_OF_ARRANGEMENT = 'planOfArrangement'
PLAN_OF_ARRANGEMENT = 'planOfArrangement',
ARRANGEMENT_EFFECT = 'arrangementEffect'
}
5 changes: 5 additions & 0 deletions src/services/enum-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ export default class EnumUtilities {
return (effectOfOrder === EffectOfOrderTypes.PLAN_OF_ARRANGEMENT)
}

/** Returns True if one or more of the POA have come into effect. */
static isArrangementComeIntoEffect (effectOfOrder: EffectOfOrderTypes): boolean {
return (effectOfOrder === EffectOfOrderTypes.ARRANGEMENT_EFFECT)
}

//
// Conversion helpers
//
Expand Down
41 changes: 16 additions & 25 deletions src/views/NoticeOfWithdrawal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@
>
<PlanOfArrangement
:autoValidation="showErrors"
:draftCourtOrderNumber="courOrderNumber"
:draftCourtOrderNumber="courtOrderNumber"
:hasDraftPlanOfArrangement="hasPlanOfArrangement"
:hasDraftComeIntoEffect="hasComeIntoEffect"
@courtNumber="courOrderNumber=$event"
@courtNumber="courtOrderNumber=$event"
@planOfArrangement="hasPlanOfArrangement=$event"
@comeIntoEffect="hasComeIntoEffect=$event"
@valid="poaValid=$event"
Expand Down Expand Up @@ -321,8 +321,8 @@ import StaffPayment from '@/components/NoticeOfWithdrawal/StaffPayment.vue'
import { ConfirmDialog, StaffRoleErrorDialog, PaymentErrorDialog, ResumeErrorDialog, SaveErrorDialog }
from '@/components/dialogs'
import { CommonMixin, DateMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
import { LegalServices } from '@/services/'
import { FilingStatus, SaveErrorReasons } from '@/enums'
import { EnumUtilities, LegalServices } from '@/services/'
import { EffectOfOrderTypes, FilingStatus, SaveErrorReasons } from '@/enums'
import { FilingCodes, FilingTypes, StaffPaymentOptions } from '@bcrs-shared-components/enums'
import { ConfirmDialogType, StaffPaymentIF } from '@/interfaces'
import { DocumentDelivery } from '@bcrs-shared-components/document-delivery'
Expand Down Expand Up @@ -368,7 +368,7 @@ export default class NoticeOfWithdrawal extends Mixins(CommonMixin, DateMixin, F
// variables for Court Order and POA component
poaValid = true
courOrderNumber = ''
courtOrderNumber = ''
hasPlanOfArrangement = false
hasComeIntoEffect = false
Expand Down Expand Up @@ -544,17 +544,11 @@ export default class NoticeOfWithdrawal extends Mixins(CommonMixin, DateMixin, F
}
// load Court Order, POA and arrangement properties
const courtOrderNumber = filing.noticeOfWithdrawal.courtOrderNumber
const hasPlanOfArrangement = filing.noticeOfWithdraw.hasPlanOfArrangement
const hasComeIntoEffect = filing.noticeOfWithdraw.hasComeIntoEffect
if (hasPlanOfArrangement) {
this.hasPlanOfArrangement = true
if (hasComeIntoEffect) {
this.hasComeIntoEffect = true
}
}
if (courtOrderNumber) {
this.courOrderNumber = courtOrderNumber
const courtOrder = filing.consentContinuationOut.courtOrder
if (courtOrder) {
this.courtOrderNumber = courtOrder.fileNumber
this.hasPlanOfArrangement = EnumUtilities.isEffectOfOrderPlanOfArrangement(courtOrder.effectOfOrder)
this.hasComeIntoEffect = EnumUtilities.isArrangementComeIntoEffect(courtOrder.effectOfArrangement)
}
// load Folio/Reference Number properties
Expand Down Expand Up @@ -800,22 +794,19 @@ export default class NoticeOfWithdrawal extends Mixins(CommonMixin, DateMixin, F
const data: any = {
noticeOfWithdrawal: {
filingToBeWithdrawn: this.filingToBeWithdrawn
filingId: this.filingToBeWithdrawn
}
}
if (this.referenceNumber !== '') {
data.noticeOfWithdrawal.referenceNumber = this.referenceNumber
}
if (this.courOrderNumber !== '') {
data.noticeOfWithdrawal.courtOrderNumber = this.courOrderNumber
}
if (this.hasPlanOfArrangement) {
data.noticeOfWithdrawal.hasPlanOfArrangement = true
if (this.hasComeIntoEffect) {
data.noticeOfWithdrawal.hasComeIntoEffect = true
if (this.courtOrderNumber !== '') {
data.consentContinuationOut.courtOrder = {
fileNumber: this.courtOrderNumber,
effectOfOrder: (this.hasPlanOfArrangement ? EffectOfOrderTypes.PLAN_OF_ARRANGEMENT : '') as string,
effectOfArrangement: (this.hasComeIntoEffect ? EffectOfOrderTypes.ARRANGEMENT_EFFECT : '') as string
}
}
Expand Down

0 comments on commit 84795b7

Please # to comment.