Skip to content

Commit

Permalink
Align submission/activity view with new UX design
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle1morel committed Dec 27, 2023
1 parent 896a3f6 commit 6c7a3e9
Show file tree
Hide file tree
Showing 29 changed files with 590 additions and 599 deletions.
31 changes: 20 additions & 11 deletions app/src/db/migrations/20231212000000_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,35 @@ export async function up(knex: Knex): Promise<void> {
table.uuid('submissionId').primary();
table.uuid('assignedToUserId').references('userId').inTable('user').onUpdate('CASCADE').onDelete('CASCADE');
table.text('confirmationId').notNullable();
table.text('contactEmail');
table.timestamp('submittedAt', { useTz: true }).notNullable();
table.text('submittedBy').notNullable();
table.text('locationPIDs');
table.text('contactName');
table.text('contactPhoneNumber');
table.text('contactFirstName');
table.text('contactLastName');
table.text('intakeStatus');
table.text('contactEmail');
table.text('projectName');
table.integer('queuePriority');
table.text('singleFamilyUnits');
table.text('streetAddress');
table.text('atsClientNumber');
table.integer('latitude');
table.integer('longitude');
table.integer('queuePriority');
table.text('relatedPermits');
table.text('astNotes');
table.boolean('astUpdated');
table.boolean('addedToATS');
table.text('atsClientNumber');
table.boolean('ltsaCompleted');
table.boolean('naturalDisaster');
table.boolean('financiallySupported');
table.text('applicationStatus');
table.text('relatedPermits');
table.boolean('updatedAai');
table.boolean('financiallySupportedBC');
table.boolean('financiallySupportedIndigenous');
table.boolean('financiallySupportedNonProfit');
table.boolean('financiallySupportedHousingCoop');
table.text('waitingOn');
table.timestamp('submittedAt', { useTz: true }).notNullable();
table.text('submittedBy').notNullable();
table.timestamp('bringForwardDate', { useTz: true });
table.text('notes');
table.text('intakeStatus');
table.text('applicationStatus');
stamps(knex, table);
})
)
Expand Down
75 changes: 46 additions & 29 deletions app/src/db/models/submission.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Prisma } from '@prisma/client';
import { default as user } from './user';
import disconnectRelation from '../utils/disconnectRelation';
import { fromYrn, toYrn } from '../../components/utils';

import type { IStamps } from '../../interfaces/IStamps';
import type { ChefsSubmissionForm } from '../../types';
Expand Down Expand Up @@ -33,57 +32,75 @@ export default {
return {
submissionId: input.submissionId,
confirmationId: input.confirmationId,
contactEmail: input.contactEmail,
submittedAt: new Date(input.submittedAt),
submittedBy: input.submittedBy,
locationPIDs: input.locationPIDs,
contactName: input.contactName,
contactPhoneNumber: input.contactPhoneNumber,
contactFirstName: input.contactFirstName,
contactLastName: input.contactLastName,
intakeStatus: input.intakeStatus,
contactEmail: input.contactEmail,
projectName: input.projectName,
queuePriority: input.queuePriority,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
atsClientNumber: input.atsClientNumber,
addedToATS: fromYrn(input.addedToATS),
financiallySupported: fromYrn(input.financiallySupported),
applicationStatus: input.applicationStatus,
latitude: input.latitude,
longitude: input.longitude,
queuePriority: input.queuePriority,
relatedPermits: input.relatedPermits,
updatedAai: fromYrn(input.updatedAai),
astNotes: input.astNotes,
astUpdated: input.astUpdated,
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
financiallySupportedIndigenous: input.financiallySupportedIndigenous,
financiallySupportedNonProfit: input.financiallySupportedNonProfit,
financiallySupportedHousingCoop: input.financiallySupportedHousingCoop,
waitingOn: input.waitingOn,
submittedAt: new Date(input.submittedAt),
submittedBy: input.submittedBy,
bringForwardDate: input.bringForwardDate ? new Date(input.bringForwardDate) : null,
notes: input.notes,
user: input.user?.userId ? { connect: { userId: input.user.userId } } : disconnectRelation
user: input.user?.userId ? { connect: { userId: input.user.userId } } : disconnectRelation,
intakeStatus: input.intakeStatus,
applicationStatus: input.applicationStatus
};
},

fromDBModel(input: Submission | null): ChefsSubmissionForm | null {
if (!input) return null;

return {
submissionId: input.submissionId as string,
confirmationId: input.confirmationId as string,
contactEmail: input.contactEmail,
submissionId: input.submissionId,
confirmationId: input.confirmationId,
submittedAt: input.submittedAt?.toISOString() as string,
submittedBy: input.submittedBy as string,
locationPIDs: input.locationPIDs,
contactName: input.contactName,
contactPhoneNumber: input.contactPhoneNumber,
contactFirstName: input.contactFirstName,
contactLastName: input.contactLastName,
intakeStatus: input.intakeStatus,
contactEmail: input.contactEmail,
projectName: input.projectName,
queuePriority: input.queuePriority,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
atsClientNumber: input.atsClientNumber,
addedToATS: toYrn(input.addedToATS as boolean | null),
financiallySupported: toYrn(input.financiallySupported as boolean | null),
applicationStatus: input.applicationStatus,
latitude: input.latitude,
longitude: input.longitude,
queuePriority: input.queuePriority,
relatedPermits: input.relatedPermits,
updatedAai: toYrn(input.updatedAai as boolean | null),
astNotes: input.astNotes,
astUpdated: input.astUpdated,
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
financiallySupportedIndigenous: input.financiallySupportedIndigenous,
financiallySupportedNonProfit: input.financiallySupportedNonProfit,
financiallySupportedHousingCoop: input.financiallySupportedHousingCoop,
waitingOn: input.waitingOn,
submittedAt: input.submittedAt?.toISOString() as string,
submittedBy: input.submittedBy as string,
bringForwardDate: input.bringForwardDate?.toISOString() ?? null,
notes: input.notes,
user: user.fromDBModel(input.user)
user: user.fromDBModel(input.user),
intakeStatus: input.intakeStatus,
applicationStatus: input.applicationStatus
};
}
};
65 changes: 37 additions & 28 deletions app/src/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,43 @@ model knex_migrations_lock {
}

model submission {
submissionId String @id @db.Uuid
assignedToUserId String? @db.Uuid
confirmationId String
contactEmail String?
contactPhoneNumber String?
contactFirstName String?
contactLastName String?
intakeStatus String?
projectName String?
queuePriority Int?
singleFamilyUnits String?
streetAddress String?
atsClientNumber String?
addedToATS Boolean?
financiallySupported Boolean?
applicationStatus String?
relatedPermits String?
updatedAai Boolean?
waitingOn String?
submittedAt DateTime @db.Timestamptz(6)
submittedBy String
bringForwardDate DateTime? @db.Timestamptz(6)
notes String?
createdBy String? @default("00000000-0000-0000-0000-000000000000")
createdAt DateTime? @default(now()) @db.Timestamptz(6)
updatedBy String?
updatedAt DateTime? @db.Timestamptz(6)
user user? @relation(fields: [assignedToUserId], references: [userId], onDelete: Cascade, map: "submission_assignedtouserid_foreign")
submissionId String @id @db.Uuid
assignedToUserId String? @db.Uuid
confirmationId String
submittedAt DateTime @db.Timestamptz(6)
submittedBy String
locationPIDs String?
contactName String?
contactPhoneNumber String?
contactEmail String?
projectName String?
singleFamilyUnits String?
streetAddress String?
latitude Int?
longitude Int?
queuePriority Int?
relatedPermits String?
astNotes String?
astUpdated Boolean?
addedToATS Boolean?
atsClientNumber String?
ltsaCompleted Boolean?
naturalDisaster Boolean?
financiallySupported Boolean?
financiallySupportedBC Boolean?
financiallySupportedIndigenous Boolean?
financiallySupportedNonProfit Boolean?
financiallySupportedHousingCoop Boolean?
waitingOn String?
bringForwardDate DateTime? @db.Timestamptz(6)
notes String?
intakeStatus String?
applicationStatus String?
createdBy String? @default("00000000-0000-0000-0000-000000000000")
createdAt DateTime? @default(now()) @db.Timestamptz(6)
updatedBy String?
updatedAt DateTime? @db.Timestamptz(6)
user user? @relation(fields: [assignedToUserId], references: [userId], onDelete: Cascade, map: "submission_assignedtouserid_foreign")
}

model user {
Expand Down
17 changes: 9 additions & 8 deletions app/src/services/chefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ const service = {
const response = (await chefsAxios(formId).get(`submissions/${submissionId}`)).data;
const status = (await chefsAxios(formId).get(`submissions/${submissionId}/status`)).data;

const submission = response.submission.submission.data;

await prisma.submission.create({
data: {
submissionId: response.submission.id,
confirmationId: response.submission.confirmationId,
contactEmail: response.submission.submission.data.contactEmail,
contactPhoneNumber: response.submission.submission.data.contactPhoneNumber,
contactFirstName: response.submission.submission.data.contactFirstName,
contactLastName: response.submission.submission.data.contactLastName,
contactEmail: submission.contactEmail,
contactPhoneNumber: submission.contactPhoneNumber,
contactName: `${submission.contactFirstName} ${submission.contactLastName}`,
intakeStatus: status[0].code,
projectName: response.submission.submission.data.projectName,
queuePriority: parseInt(response.submission.submission.data.queuePriority),
singleFamilyUnits: response.submission.submission.data.singleFamilyUnits,
streetAddress: response.submission.submission.data.streetAddress,
projectName: submission.projectName,
queuePriority: parseInt(submission.queuePriority),
singleFamilyUnits: submission.singleFamilyUnits,
streetAddress: submission.streetAddress,
submittedAt: response.submission.createdAt,
submittedBy: response.submission.createdBy
}
Expand Down
38 changes: 23 additions & 15 deletions app/src/types/ChefsSubmissionForm.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
import { User } from './User';
import { YRN } from './YRN';
import { IStamps } from '../interfaces/IStamps';

export type ChefsSubmissionForm = {
submissionId: string; // Primary Key
submissionId: string;
confirmationId: string;
contactEmail: string | null;
submittedAt: string;
submittedBy: string;
locationPIDs: string | null;
contactName: string | null;
contactPhoneNumber: string | null;
contactFirstName: string | null;
contactLastName: string | null;
intakeStatus: string | null;
contactEmail: string | null;
projectName: string | null;
queuePriority: number | null;
singleFamilyUnits: string | null;
streetAddress: string | null;
atsClientNumber: string | null;
addedToATS: YRN;
financiallySupported: YRN;
applicationStatus: string | null;
latitude: number | null;
longitude: number | null;
queuePriority: number | null;
relatedPermits: string | null;
updatedAai: YRN;
astNotes: string | null;
astUpdated: boolean | null;
addedToATS: boolean | null;
atsClientNumber: string | null;
ltsaCompleted: boolean | null;
naturalDisaster: boolean | null;
financiallySupported: boolean | null;
financiallySupportedBC: boolean | null;
financiallySupportedIndigenous: boolean | null;
financiallySupportedNonProfit: boolean | null;
financiallySupportedHousingCoop: boolean | null;
waitingOn: string | null;
submittedAt: string;
submittedBy: string;
bringForwardDate: string | null;
notes: string | null;
user: User | null;
user: User | null; // assigned to
intakeStatus: string | null;
applicationStatus: string | null;
} & Partial<IStamps>;
4 changes: 4 additions & 0 deletions frontend/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ a:visited {
}
}

label {
color: #38598a;
}

.wrap-block {
display: inline-block;
overflow-wrap: break-word;
Expand Down
42 changes: 0 additions & 42 deletions frontend/src/components/demo/DemoButtons.vue

This file was deleted.

Loading

0 comments on commit 6c7a3e9

Please sign in to comment.