Skip to content

Commit 0e1f005

Browse files
committed
Better handle Archived Form A
1 parent 505917a commit 0e1f005

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

api/src/data/models/position-group.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export interface PositionGroup extends MongoEntity {
2525
create_date_display?: string;
2626
positions?: Array<Position>;
2727
authority_lines?: Array<any>;
28+
29+
archive_date?: Date;
2830
}
2931

3032
export interface ElectronicApproval {

api/src/routes/form-a-router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ formARouter.post("/auto-archive", checkJwt, loadUser, isSystemAdmin, async (req:
153153
if (groupPositions.length == 0 && groupPositions2.length == 0) {
154154
if (group._id) {
155155
group.status = "Archived";
156+
group.archive_date = new Date();
156157
archiveList.push(group);
157158
await groupDb.update(group._id.toString(), group);
158159
}
@@ -494,6 +495,7 @@ formARouter.put(
494495
if (groupPositions.length == 0 && groupPositions2.length == 0) {
495496
if (group._id) {
496497
group.status = "Archived";
498+
group.archive_date = new Date();
497499
await groupDb.update(group._id.toString(), group);
498500
}
499501
}

web/src/modules/departments/views/DepartmentPendingGroupDetail.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
<v-divider></v-divider>
5050

5151
<v-stepper-step step="5" :complete="stepperValue > 5">
52-
Active
52+
{{ item.status == "Archived" ? "Archived" : "Active" }}
53+
<small>{{ archiveDate }}</small>
5354
</v-stepper-step>
5455
</v-stepper-header>
5556
</v-stepper>
@@ -164,7 +165,7 @@
164165
:headers="headers"
165166
:items="item.positions"
166167
@click:row="openFormA"
167-
class="row-clickable"
168+
:class="{ 'row-clickable': item.status != 'Archived' }"
168169
:footer-props="{
169170
'items-per-page-options': [25, 50, 75, -1],
170171
}"
@@ -523,6 +524,15 @@ export default {
523524
}
524525
return "";
525526
},
527+
archiveDate() {
528+
if (this.item.status == "Archived") {
529+
if (this.item.archive_date) {
530+
return "On " + moment(this.item.archive_date).format("MMM D, YYYY @ h:mm a");
531+
}
532+
return "Date Not Recorded"
533+
}
534+
return "";
535+
},
526536
},
527537
methods: {
528538
...mapActions("department", [
@@ -544,6 +554,7 @@ export default {
544554
this.loading = false;
545555
},
546556
openFormA(item) {
557+
if (this.item.status == "Archived") return;
547558
this.$router.push(`/departments/${this.departmentId}/positions/${item._id}`);
548559
},
549560
showPreview() {

0 commit comments

Comments
 (0)