generated from bcgov/bcrs-template-ui
-
Notifications
You must be signed in to change notification settings - Fork 51
/
TodoList.vue
1797 lines (1604 loc) · 64 KB
/
TodoList.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<template>
<div id="todo-list">
<AddCommentDialog
:dialog="addCommentDialog"
:filing="currentFiling"
@close="hideCommentDialog($event)"
attach="#todo-list"
/>
<ConfirmDialog
ref="confirm"
attach="#todo-list"
/>
<DeleteErrorDialog
:dialog="deleteErrorDialog"
:errors="deleteErrors"
:warnings="deleteWarnings"
@okay="resetErrors()"
attach="#todo-list"
/>
<CancelPaymentErrorDialog
:dialog="cancelPaymentErrorDialog"
:errors="cancelPaymentErrors"
@okay="resetCancelPaymentErrors()"
attach="#todo-list"
/>
<ActionRequired v-if="isActionRequired"/>
<v-expansion-panels v-if="showTodoPanel" accordion v-model="panel">
<v-expansion-panel
class="align-items-top todo-item px-6 py-5"
v-for="(item, index) in orderBy(todoItems, 'order')"
:key="index"
:class="{
'disabled': !item.enabled,
'pay-error': isStatusDraft(item) && isPayError(item)
}"
>
<v-expansion-panel-header
class="no-dropdown-icon pa-0"
:class="{'invalid-section': isTypeAlteration(item) && requiresAlteration && !item.goodStanding}"
>
<div class="list-item">
<div class="todo-label">
<!-- title -->
<h3 class="list-item__title">{{item.title}}
<v-btn v-if="isStatusDraft(item) && isTypeCorrection(item)"
class="expand-btn ml-0"
outlined
color="red"
:ripple=false
>
<v-icon left>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</h3>
<!-- BCOMP AR special case -->
<div v-if="businessId && isBComp && item.enabled && isTypeAnnualReport(item) && isStatusNew(item)"
class="bcorps-ar-subtitle"
>
<p>Verify your Office Address and Current Directors before filing your Annual Report.</p>
<v-checkbox
id="enable-checkbox"
class="todo-list-checkbox"
label="All information about the Office Addresses and Current Directors is correct."
:disabled="!item.enabled || isCoaPending"
v-model="enableCheckbox[index]"
@click.native.stop
/>
</div>
<div v-else class="list-item__subtitle">
<!-- NB: blocks below are mutually exclusive, and order is important -->
<!-- new task -->
<div v-if="isStatusNew(item) && !!item.subtitle" class="todo-subtitle">
<span>{{ item.subtitle }}</span>
</div>
<!-- draft alteration not in good stating -->
<div v-else-if="isStatusDraft(item) && isTypeAlteration(item) && !item.goodStanding"
class="todo-list-detail body-2"
>
<p class="app-red font-weight-bold">
<v-icon small color="error">mdi-alert</v-icon>
This business is not in good standing.
</p>
<p>
Before you can alter your business, it must be in good standing with the Business
Registry. There may be several reasons why a business is not in good standing, but
the most common reason is an overdue annual report.
</p>
<p>To resolve this issue, you MUST contact BC Registries staff:</p>
<ContactInfo class="mt-4" />
</div>
<!-- alteration in good standing -->
<div v-else-if="isTypeAlteration(item) && item.goodStanding && !isBComp && !isCoop"
class="todo-subtitle my-4"
>
<span>
Your business is ready to alter from a {{ item.legalType }} to a BC
Benefit Company. Select "Alter Now" to begin your alteration. You will not be able to make
any other changes to your business until the alteration is complete.
</span>
<v-btn
v-if="item.comments.length > 0"
class="expand-btn"
outlined
color="primary"
:ripple=false
>
<v-icon small left style="padding-top: 2px">mdi-message-reply</v-icon>
<span>{{item.comments.length > 1 ? "Details" : "Detail"}} ({{item.comments.length}})</span>
</v-btn>
</div>
<!-- draft correction or alteration -->
<div v-else-if="isStatusDraft(item) && (isTypeCorrection(item) || isTypeAlteration(item))"
class="todo-subtitle"
>
<div>DRAFT</div>
<v-btn
v-if="item.comments.length > 0"
class="expand-btn"
outlined
color="primary"
:ripple=false
>
<v-icon small left style="padding-top: 2px">mdi-message-reply</v-icon>
<span>{{item.comments.length > 1 ? "Details" : "Detail"}} ({{item.comments.length}})</span>
</v-btn>
</div>
<!-- draft with pay error -->
<div v-else-if="isStatusDraft(item) && isPayError(item)" class="todo-subtitle">
<div>PAYMENT INCOMPLETE</div>
<v-btn
class="expand-btn"
outlined
color="red darken-4"
:ripple=false
@click.stop="togglePanel(index)"
>
<v-icon>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</div>
<!-- draft incorporation -->
<div v-else-if="isStatusDraft(item) &&
(isTypeIncorporationApplication(item) || isTypeRegistration(item))"
class="todo-subtitle"
>
<div>{{ item.subtitle }}</div>
<div v-if="item.nameRequest" class="payment-status">
<v-btn
class="expand-btn"
outlined
color="blue darken-2"
:ripple=false
@click.stop="togglePanel(index)"
>
<v-icon left>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</div>
</div>
<!-- draft other -->
<div v-else-if="isStatusDraft(item)" class="todo-subtitle">
<div>DRAFT</div>
</div>
<!-- pending filing - correction or alteration, or payment incomplete -->
<div v-else-if="isStatusPending(item)" class="todo-subtitle">
<template v-if="isTypeCorrection(item) || isTypeAlteration(item)">
<div>FILING PENDING</div>
<v-btn
v-if="item.comments.length > 0"
class="expand-btn"
outlined
color="primary"
:ripple=false
>
<v-icon small left style="padding-top: 2px">mdi-message-reply</v-icon>
<span>{{item.comments.length > 1 ? "Details" : "Detail"}} ({{item.comments.length}})</span>
</v-btn>
</template>
<template v-else>
<div>FILING PENDING</div>
<div class="vert-pipe"></div>
<div class="payment-status" v-if="inProcessFiling === item.filingId">
PROCESSING...
</div>
<div class="payment-status" v-else>
<span v-if="isPayMethodOnlineBanking(item)">ONLINE BANKING PAYMENT PENDING</span>
<span v-else>PAYMENT INCOMPLETE</span>
<v-btn
class="expand-btn"
outlined
color="blue darken-2"
:ripple=false
@click.stop="togglePanel(index)"
>
<v-icon left>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</div>
</template>
</div>
<!-- pending filing - payment unsuccessful -->
<div v-else-if="isStatusError(item)" class="todo-subtitle">
<div>FILING PENDING</div>
<div class="vert-pipe"></div>
<div class="payment-status" v-if="inProcessFiling === item.filingId">
PROCESSING...
</div>
<div class="payment-status" v-else>
<span>PAYMENT UNSUCCESSFUL</span>
<v-btn
class="expand-btn"
outlined
color="red darken-4"
:ripple=false
@click.stop="togglePanel(index)"
>
<v-icon left>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</div>
</div>
<!-- pending filing - paid -->
<div v-else-if="isStatusPaid(item)" class="todo-subtitle">
<div>FILING PENDING</div>
<div class="vert-pipe"></div>
<div class="payment-status" v-if="inProcessFiling === item.filingId">
PROCESSING...
</div>
<div class="payment-status" v-else>
<span>PAID</span>
<v-btn
class="expand-btn"
outlined
color="red darken-4"
:ripple=false
@click.stop="togglePanel(index)"
>
<v-icon left>mdi-information-outline</v-icon>
<span>{{ (panel === index) ? "Hide Details" : "View Details" }}</span>
</v-btn>
</div>
</div>
</div> <!-- end of other subtitles -->
</div> <!-- end of todo label -->
<div class="list-item__actions">
<div style="width:100%">
<!-- BCOMP AR special case -->
<template v-if="isBComp && item.enabled && isTypeAnnualReport(item) && isStatusNew(item)">
<p class="date-subtitle">Due: {{item.arDueDate}}</p>
</template>
<!-- NB: blocks below are mutually exclusive, and order is important -->
<!-- this loading button pre-empts all buttons below -->
<template v-if="inProcessFiling === item.filingId">
<v-btn text loading disabled />
</template>
<template v-else-if="isRoleStaff && (isTypeCorrection(item) || isTypeAlteration(item)) &&
isStatusDraft(item)"
>
<v-btn class="btn-corr-draft-resume"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"
>
<span>Resume</span>
</v-btn>
<v-menu offset-y left>
<template v-slot:activator="{ on }">
<v-btn color="primary" class="actions__more-actions__btn px-0"
v-on="on" id="menu-activator-staff" :disabled="!item.enabled"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="actions__more-actions">
<v-list-item
v-if="businessId"
id="btn-delete-draft-staff"
@click="confirmDeleteDraft(item)"
>
<v-icon class="pr-1" color="primary" size="18px">mdi-delete-forever</v-icon>
<v-list-item-title>Delete Draft</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
<template v-else-if="isTypeCorrection(item)">
<!-- no action button in this case -->
</template>
<!-- Alteration Actions -->
<template v-else-if="isTypeAlteration(item) && isStatusDraft(item)">
<v-btn class="btn-alt-draft-resume"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"
>
<span>{{alterationBtnLabel}}</span>
</v-btn>
<v-menu v-if="!requiresAlteration" offset-y left>
<template v-slot:activator="{ on }">
<v-btn color="primary" class="actions__more-actions__btn px-0"
v-on="on" id="menu-activator-alt" :disabled="!item.enabled"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="actions__more-actions">
<v-list-item
v-if="businessId"
id="btn-delete-draft-alt"
@click="confirmDeleteDraft(item)"
>
<v-icon class="pr-1" color="primary" size="18px">mdi-delete-forever</v-icon>
<v-list-item-title>Delete changes to company information</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
<template v-else-if="isStatusDraft(item)">
<v-btn class="btn-draft-resume"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"
>
<template v-if="isTypeIncorporationApplication(item) && item.isEmptyFiling">
<span v-if="nameRequest">Incorporate using this NR</span>
<span v-else>Incorporate a Numbered Company</span>
</template>
<template v-else-if="isTypeRegistration(item) && item.isEmptyFiling">
<span>Register using this NR</span>
</template>
<span v-else>Resume</span>
</v-btn>
<!-- dropdown menu -->
<v-menu offset-y left>
<template v-slot:activator="{ on }">
<v-btn color="primary" class="actions__more-actions__btn px-0"
v-on="on" id="menu-activator" :disabled="!item.enabled"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="actions__more-actions py-2">
<v-list-item
class="dissolution-drop-down"
v-if="businessId"
id="btn-delete-draft"
@click="confirmDeleteDraft(item)"
>
<v-icon class="pr-1" color="primary" size="18px">mdi-delete-forever</v-icon>
<template v-if="isTypeDissolution(item)">
<v-list-item-title>Delete {{ toDoListTitle }}</v-list-item-title>
</template>
<template v-else-if="isTypeSpecialResolution(item)">
<v-list-item-title>Delete Special Resolution</v-list-item-title>
</template>
<v-list-item-title v-else>Delete Draft</v-list-item-title>
</v-list-item>
<v-list-item
v-if="tempRegNumber"
id="btn-delete-application"
@click="confirmDeleteApplication(item)"
>
<v-icon class="pr-1" color="primary" size="18px">mdi-delete-forever</v-icon>
<v-list-item-title>Delete {{filingTypeToName(item.name)}}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
<template v-else-if="isStatusPending(item)">
<v-btn v-if="isPayMethodOnlineBanking(item)"
class="btn-change-payment-type"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"
>
<span>Change Payment Type</span>
</v-btn>
<v-btn v-else
class="btn-resume-payment"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"
>
<span>Resume Payment</span>
</v-btn>
<!-- dropdown menu -->
<v-menu offset-y left>
<template v-slot:activator="{ on }">
<v-btn color="primary"
v-on="on" id="pending-item-menu-activator"
:disabled="!item.enabled"
class="actions__more-actions__btn px-0"
data-test-id="btn-pending-filing-menu"
@click.native.stop
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="actions__more-actions">
<v-list-item id="btn-cancel-payment"
data-test-id="btn-cancel-payment"
@click="confirmCancelPayment(item)"
>
<v-list-item-title>Cancel Payment</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
<template v-else-if="isStatusError(item)">
<v-btn class="btn-retry-payment"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"
>
<span>Retry Payment</span>
</v-btn>
</template>
<template v-else-if="isStatusPaid(item)">
<!-- no action button in this case -->
</template>
<template v-else-if="isStatusNew(item) && isTypeAnnualReport(item)">
<v-btn class="btn-file-now"
color="primary"
:disabled="isFileAnnualReportDisabled(item, index)"
@click.native.stop="doFileNow(item)"
>
<span>File Annual Report</span>
</v-btn>
</template>
</div>
</div> <!-- end of actions -->
</div> <!-- end of list item -->
</v-expansion-panel-header>
<v-expansion-panel-content>
<!-- NB: blocks below are mutually exclusive, and order is important -->
<template v-if="isStatusDraft(item) && isPayError(item)">
<PaymentIncomplete :filing=item />
</template>
<template v-else-if="isTypeCorrection(item)">
<div v-if="isStatusDraft(item)" data-test-class="correction-draft" class="todo-list-detail body-2">
<p class="list-item__subtitle">This filing is in review and has been saved as a draft.<br />
Normal processing times are 2 to 5 business days. Priority processing times are 1 to 2 business days.
</p>
<v-divider class="my-6"></v-divider>
<!-- the detail comments section -->
<DetailsList
:filing=item
:isTask="true"
@showCommentDialog="showCommentDialog($event)"
/>
</div>
<div v-else data-test-class="correction-pending" class="todo-list-detail body-2">
<p class="list-item__subtitle">This filing is pending review by Registry Staff.<br />
Normal processing times are 2 to 5 business days. Priority processing times are 1 to 2 business days.
</p>
<v-divider class="my-6"></v-divider>
<!-- the detail comments section -->
<DetailsList
:filing=item
:isTask="true"
@showCommentDialog="showCommentDialog($event)"
/>
</div>
</template>
<template v-else-if="isStatusPending(item)">
<PaymentPendingOnlineBanking v-if="isPayMethodOnlineBanking(item)" :filing=item class="mb-6" />
<PaymentPending v-else />
</template>
<template v-else-if="isStatusError(item)">
<PaymentUnsuccessful />
</template>
<template v-else-if="isStatusPaid(item)">
<PaymentPaid />
</template>
<template v-else-if="isStatusDraft(item) &&
(isTypeIncorporationApplication(item) || isTypeRegistration(item))">
<NameRequestInfo :nameRequest="item.nameRequest" />
</template>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<!-- No Results Message -->
<v-card class="no-results" flat v-if="!showTodoPanel && !isActionRequired">
<v-card-text>
<div class="no-results__title">You don't have anything to do yet</div>
<div class="no-results__subtitle">Filings that require your attention will appear here</div>
</v-card-text>
</v-card>
</div>
</template>
<script lang="ts">
// Libraries
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import { Action, Getter, State } from 'vuex-class'
import axios from '@/axios-auth'
import Vue2Filters from 'vue2-filters' // needed for orderBy
import { navigate } from '@/utils'
// Dialogs and Components
import { AddCommentDialog, CancelPaymentErrorDialog, ConfirmDialog, DeleteErrorDialog } from '@/components/dialogs'
import { DetailsList, NameRequestInfo, ContactInfo } from '@/components/common'
import PaymentIncomplete from './TodoList/PaymentIncomplete.vue'
import PaymentPaid from './TodoList/PaymentPaid.vue'
import PaymentPending from './TodoList/PaymentPending.vue'
import PaymentPendingOnlineBanking from './TodoList/PaymentPendingOnlineBanking.vue'
import PaymentUnsuccessful from './TodoList/PaymentUnsuccessful.vue'
import ActionRequired from '@/components/Dashboard/ActionRequired.vue'
// Mixins, Enums and Interfaces
import { AllowableActionsMixin, DateMixin, EnumMixin, FilingMixin, LegalApiMixin, PayApiMixin } from '@/mixins'
import { AllowableActions, CorpTypeCd, FilingNames, FilingStatus, FilingTypes, Routes } from '@/enums'
import { ActionBindingIF, ApiTaskIF, BusinessIF, ConfirmDialogType, TodoItemIF, TodoListResourceIF } from '@/interfaces'
@Component({
components: {
// dialogs
AddCommentDialog,
CancelPaymentErrorDialog,
ConfirmDialog,
DeleteErrorDialog,
// components
DetailsList,
NameRequestInfo,
ContactInfo,
PaymentIncomplete,
PaymentPaid,
PaymentPending,
PaymentPendingOnlineBanking,
PaymentUnsuccessful,
ActionRequired
},
mixins: [
Vue2Filters.mixin
]
})
export default class TodoList extends Mixins(
AllowableActionsMixin, DateMixin, EnumMixin, FilingMixin, LegalApiMixin, PayApiMixin
) {
// Refs
$refs!: {
confirm: ConfirmDialogType
}
// local properties
protected addCommentDialog = false
protected todoItems: Array<TodoItemIF> = []
protected deleteErrors: Array<any> = []
protected deleteWarnings: Array<any> = []
protected deleteErrorDialog = false
protected cancelPaymentErrors: Array<any> = []
protected cancelPaymentErrorDialog = false
protected enableCheckbox: Array<any> = []
protected confirmEnabled = false
protected currentFiling: TodoItemIF = null
protected panel: number = null // currently expanded panel
protected checkTimer: number = null
protected inProcessFiling: number = null
@Prop({ default: null }) readonly highlightId: number
@Getter getCurrentYear!: number
@Getter getTasks!: Array<ApiTaskIF>
@Getter getEntityName!: string
@Getter isCoaPending!: boolean
@Getter getTodoListResource!: TodoListResourceIF
@Getter isNotInCompliance!: boolean
@State nameRequest!: any
@State lastAnnualReportDate!: string
@Action setARFilingYear!: ActionBindingIF
@Action setArMinDate!: ActionBindingIF
@Action setArMaxDate!: ActionBindingIF
@Action setNextARDate!: ActionBindingIF
@Action setCurrentFilingStatus!: ActionBindingIF
@Action setHasBlockerTask!: ActionBindingIF
/** The Auth Web URL string. */
get authWebUrl (): string {
return sessionStorage.getItem('AUTH_WEB_URL')
}
/** The Edit URL string. */
get editUrl (): string {
return sessionStorage.getItem('EDIT_URL')
}
/** The Create URL string. */
get createUrl (): string {
return sessionStorage.getItem('CREATE_URL')
}
/** The My Business Registry URL string. */
get myBusinessRegistryUrl (): string {
return sessionStorage.getItem('AUTH_WEB_URL') + 'business'
}
/** The BCROS Home URL string. */
get bcrosHomeUrl (): string {
return sessionStorage.getItem('BUSINESSES_URL')
}
/** The Base URL string. */
get baseUrl (): string {
return sessionStorage.getItem('BASE_URL')
}
/** The Business ID string. */
get businessId (): string {
return sessionStorage.getItem('BUSINESS_ID')
}
/** The Incorporation Application's Temporary Registration Number string. */
get tempRegNumber (): string {
return sessionStorage.getItem('TEMP_REG_NUMBER')
}
/** Whether filing an Alteration is required (ie, there is a Todo filing). */
get requiresAlteration (): boolean {
if (this.isBcCompany || this.isUlc) {
return this.getTasks.some(task => task.task?.filing?.header?.name === FilingTypes.ALTERATION)
}
return false
}
/** Alteration action button label. */
get alterationBtnLabel (): string {
return this.requiresAlteration ? 'Alter Now' : 'Resume'
}
/** Show action required only for SP/GP with Compliance warning. */
get isActionRequired (): boolean {
return this.isFirm && this.isNotInCompliance
}
get showTodoPanel () {
return this.todoItems && this.todoItems.length > 0
}
/** Whether the File Annual Report button should be disabled. */
protected isFileAnnualReportDisabled (item: TodoItemIF, index: number): boolean {
return (
!item.enabled ||
(this.isBComp && !this.enableCheckbox[index]) ||
!this.isAllowed(AllowableActions.FILE_ANNUAL_REPORT)
)
}
private async loadData (): Promise<void> {
this.todoItems = []
// create 'task items' list from 'tasks' array from API
for (const task of this.getTasks) {
if (task.task?.todo) {
this.loadTodoItem(task)
} else if (task.task?.filing) {
await this.loadFilingItem(task)
} else {
// eslint-disable-next-line no-console
console.log('ERROR - got unknown task =', task)
}
}
// Add todo items count +1 when SP/GP with compliance warning
const todoLength = this.isActionRequired ? this.todoItems.length + 1 : this.todoItems.length
// report number of items back to parent (dashboard)
this.$emit('todo-count', todoLength)
// Check if there is a draft/pending/error/paid/correction/alteration task.
// This is a blocker because it needs to be completed first.
const blockerTask = this.todoItems.find(task => {
return (this.isStatusDraft(task) || this.isStatusPending(task) || this.isStatusError(task) ||
this.isStatusPaid(task) || this.isTypeCorrection(task) || this.isTypeAlteration(task))
})
this.setHasBlockerTask(!!blockerTask)
// if needed, highlight a specific task
if (this.highlightId) this.highlightTask(this.highlightId)
}
/**
* Identifies the specified task as "in progress" and starts a
* process to check if the task changes to a completed filing.
*/
private highlightTask (id: number): void {
const index = this.todoItems.findIndex(h => h.filingId === id)
if (index >= 0) {
this.inProcessFiling = id
// start check process
this.checkIfCompleted(id, 0)
}
}
/**
* Checks whether the subject filing is now Completed.
* Retries after 1 second for up to 10 iterations.
*/
private checkIfCompleted (id: number, count: number): void {
// stop this cycle after 10 iterations
if (++count > 10) {
this.inProcessFiling = null
return
}
// get filing's status
let url = `businesses/${this.getIdentifier}/filings/${id}`
this.fetchFiling(url).then(filing => {
// if the filing is now COMPLETED, emit event to reload all data
if (filing?.header?.status === FilingStatus.COMPLETED) {
this.$root.$emit('reloadData')
} else {
throw new Error('Filing not yet completed')
}
}).catch(() => {
// call this function again in 1 second
this.checkTimer = setTimeout(() => {
this.checkIfCompleted(id, count)
}, 1000)
})
}
private loadTodoItem (task: ApiTaskIF): void {
const todo = task.task.todo
const header = todo.header
if (header) {
switch (header.name) {
case FilingTypes.ANNUAL_REPORT:
this.loadAnnualReportTodo(task)
break
case FilingTypes.CONVERSION:
break
default:
// eslint-disable-next-line no-console
console.log('ERROR - invalid name in todo header =', header)
break
}
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header in todo =', todo)
}
}
private expiresText (nameRequest: any): string {
const date = this.apiToDate(nameRequest.expirationDate)
const expireDays = this.daysFromToday(date)
// NB: 0 means NR expires today
if (isNaN(expireDays) || expireDays < 0) {
return 'Expired'
} else if (expireDays < 1) {
return 'Expires today'
} else if (expireDays < 2) {
return 'Expires tomorrow'
} else {
return `Expires in ${expireDays} days`
}
}
/** Loads a NEW Annual Report todo. */
private loadAnnualReportTodo (task: ApiTaskIF): void {
const todo = task.task.todo
const business = todo.business as BusinessIF
const header = todo.header
if (business && header) {
const ARFilingYear = header.ARFilingYear
const subtitle: string = (task.enabled && !this.isBComp) ? '(including Address and/or Director Change)' : null
const item: TodoItemIF = {
filingId: -1, // not falsy
name: FilingTypes.ANNUAL_REPORT,
title: `File ${ARFilingYear} Annual Report`,
draftTitle: null,
subtitle,
ARFilingYear,
// NB: get min/max AR dates from header object (not business object)
// same as loading a draft AR
arMinDate: header.arMinDate, // COOP only
arMaxDate: header.arMaxDate, // COOP only
status: header.status || FilingStatus.NEW,
enabled: task.enabled,
order: task.order,
nextArDate: this.apiToYyyyMmDd(business.nextAnnualReport), // BCOMP only
arDueDate: this.formatYyyyMmDd(header.arMaxDate),
commentsLink: null // cannot add comments to Todo item
}
this.todoItems.push(item)
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header or business in todo =', todo)
}
}
private async loadFilingItem (task: ApiTaskIF): Promise<void> {
const filing = task.task.filing
const header = filing.header
if (header) {
switch (header.name) {
case FilingTypes.ANNUAL_REPORT:
await this.loadAnnualReport(task)
break
case FilingTypes.CHANGE_OF_DIRECTORS:
await this.loadChangeOfDirectors(task)
break
case FilingTypes.CHANGE_OF_ADDRESS:
await this.loadChangeOfAddress(task)
break
case FilingTypes.CORRECTION:
await this.loadCorrection(task)
break
case FilingTypes.INCORPORATION_APPLICATION:
await this.loadIncorporationApplication(task)
break
case FilingTypes.ALTERATION:
await this.loadAlteration(task)
break
case FilingTypes.DISSOLUTION:
await this.loadDissolution(task)
break
case FilingTypes.REGISTRATION:
await this.loadRegistration(task)
break
case FilingTypes.CHANGE_OF_REGISTRATION:
await this.loadChangeOfRegistration(task)
break
case FilingTypes.CONVERSION:
await this.loadConversion(task)
break
case FilingTypes.SPECIAL_RESOLUTION:
await this.loadSpecialResolution(task)
break
default:
// eslint-disable-next-line no-console
console.log('ERROR - invalid name in filing header =', header)
break
}
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header in filing =', filing)
}
}
private async loadDissolution (task: ApiTaskIF): Promise<void> {
const filing = task.task.filing
const dissolution = filing.dissolution
const business = filing.business
const header = filing.header
if (dissolution && business && header) {
if (!this.isGoodStanding && this.isStatusDraft(header)) {
task.enabled = false
}
const corpTypeDescription = this.getCorpTypeDescription(business.legalType)
const paymentStatusCode = header.paymentStatusCode
const payErrorObj = paymentStatusCode ? await this.getPayErrorObj(paymentStatusCode) : null
const item: TodoItemIF = {
name: FilingTypes.DISSOLUTION,
filingId: header.filingId,
legalType: corpTypeDescription,
title: this.getTodoListResource?.title,
draftTitle: this.filingTypeToName(FilingTypes.DISSOLUTION),
status: header.status,
enabled: task.enabled,
order: task.order,
goodStanding: this.isGoodStanding,
paymentMethod: header.paymentMethod || null,
paymentToken: header.paymentToken || null,
payErrorObj,
comments: this.flattenAndSortComments(header.comments),
commentsLink: `businesses/${this.getIdentifier}/filings/${header.filingId}/comments`
}
this.todoItems.push(item)
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header or dissolution or business in task =', task)
}
}
private async loadAlteration (task: ApiTaskIF): Promise<void> {
const filing = task.task.filing
const alteration = filing.alteration
const business = filing.business
const header = filing.header
if (alteration && business && header) {
if (!this.isGoodStanding && this.isStatusDraft(header)) {
task.enabled = false
}
const corpTypeDescription = this.getCorpTypeDescription(business.legalType)
const paymentStatusCode = header.paymentStatusCode
const payErrorObj = paymentStatusCode ? await this.getPayErrorObj(paymentStatusCode) : null
const item: TodoItemIF = {
name: FilingTypes.ALTERATION,
filingId: header.filingId,
legalType: corpTypeDescription,
title: this.alterationTitle(header.priority, corpTypeDescription),
draftTitle: this.filingTypeToName(FilingTypes.ALTERATION),
status: header.status,
enabled: task.enabled,
order: task.order,
goodStanding: this.isGoodStanding,
paymentMethod: header.paymentMethod || null,
paymentToken: header.paymentToken || null,
payErrorObj,
comments: this.flattenAndSortComments(header.comments),
commentsLink: `businesses/${this.getIdentifier}/filings/${header.filingId}/comments`
}
this.todoItems.push(item)
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header or alteration or business in task =', task)
}
}
/**
* Loads a DRAFT/PENDING/ERROR/PAID Annual Report filing.
* (Currently used for Coop ARs only, as BComps can't save draft ARs.)
*/
private async loadAnnualReport (task: ApiTaskIF): Promise<void> {
const filing = task.task.filing
const annualReport = filing.annualReport
const business = filing.business
const header = filing.header
if (annualReport && business && header) {
const ARFilingYear = header.ARFilingYear
const paymentStatusCode = header.paymentStatusCode
const payErrorObj = paymentStatusCode ? await this.getPayErrorObj(paymentStatusCode) : null
const item: TodoItemIF = {
name: FilingTypes.ANNUAL_REPORT,
filingId: header.filingId,
title: `File ${ARFilingYear} Annual Report`,
draftTitle: `${ARFilingYear} Annual Report`,
ARFilingYear,
arMinDate: header.arMinDate, // COOP only
arMaxDate: header.arMaxDate, // COOP only
status: header.status || FilingStatus.NEW,
enabled: task.enabled,
order: task.order,
paymentMethod: header.paymentMethod || null,
paymentToken: header.paymentToken || null,
payErrorObj,
commentsLink: `businesses/${this.getIdentifier}/filings/${header.filingId}/comments`
}
this.todoItems.push(item)
} else {
// eslint-disable-next-line no-console
console.log('ERROR - invalid header or annualReport or business in filing =', filing)
}
}