Skip to content

Commit

Permalink
added companyNameRegistered to datamodel and frontend
Browse files Browse the repository at this point in the history
projectName now exported to Project Name input in frontend
company name input now connected to companyNameRegistered
  • Loading branch information
wilwong89 committed Feb 7, 2024
1 parent b75bd7f commit c1f4eec
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 13 deletions.
3 changes: 2 additions & 1 deletion app/src/controllers/chefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const controller = {
return {
formId: x.id,
submissionId: data.form.submissionId,
companyNameRegistered: data.companyNameRegistered,
confirmationId: data.form.confirmationId,
contactEmail: data.contactEmail,
contactPhoneNumber: data.contactPhoneNumber,
Expand All @@ -37,7 +38,7 @@ const controller = {
latitude: data.latitude,
longitude: data.longitude,
naturalDisaster: data.naturalDisasterInd,
projectName: data.companyNameRegistered,
projectName: data.projectName,
queuePriority: data.queuePriority,
singleFamilyUnits: data.singleFamilyUnits ?? data.multiFamilyUnits,
streetAddress: data.streetAddress,
Expand Down
1 change: 1 addition & 0 deletions app/src/db/migrations/20231212000000_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function up(knex: Knex): Promise<void> {
table.timestamp('submittedAt', { useTz: true }).notNullable();
table.text('submittedBy').notNullable();
table.text('locationPIDs');
table.text('companyNameRegistered');
table.text('contactName');
table.text('contactPhoneNumber');
table.text('contactEmail');
Expand Down
4 changes: 3 additions & 1 deletion app/src/db/models/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ export default {
return {
submissionId: input.submissionId,
confirmationId: input.confirmationId,
projectName: input.projectName,
submittedAt: new Date(input.submittedAt ?? Date.now()),
submittedBy: input.submittedBy,
locationPIDs: input.locationPIDs,
contactName: input.contactName,
contactPhoneNumber: input.contactPhoneNumber,
contactEmail: input.contactEmail,
projectName: input.projectName,
companyNameRegistered: input.companyNameRegistered,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
latitude: input.latitude,
Expand Down Expand Up @@ -88,6 +89,7 @@ export default {
contactPhoneNumber: input.contactPhoneNumber,
contactEmail: input.contactEmail,
projectName: input.projectName,
companyNameRegistered: input.companyNameRegistered,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
latitude: input.latitude,
Expand Down
1 change: 1 addition & 0 deletions app/src/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ model submission {
submittedAt DateTime @db.Timestamptz(6)
submittedBy String
locationPIDs String?
companyNameRegistered String?
contactName String?
contactPhoneNumber String?
contactEmail String?
Expand Down
3 changes: 2 additions & 1 deletion app/src/services/chefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const service = {
submissionId: response.submission.id,
applicationStatus: APPLICATION_STATUS_LIST.NEW,
confirmationId: response.submission.confirmationId,
companyNameRegistered: submission.companyNameRegistered,
contactEmail: submission.contactEmail,
contactPhoneNumber: submission.contactPhoneNumber,
contactName: `${submission.contactFirstName} ${submission.contactLastName}`,
Expand All @@ -127,7 +128,7 @@ const service = {
latitude: parseInt(submission.latitude),
longitude: parseInt(submission.longitude),
naturalDisaster: submission.naturalDisasterInd,
projectName: submission.companyNameRegistered,
projectName: submission.projectName,
queuePriority: parseInt(submission.queuePriority),
singleFamilyUnits: maxUnits,
streetAddress: submission.streetAddress,
Expand Down
4 changes: 3 additions & 1 deletion app/src/services/permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const service = {
submissionId: submissionId
},
orderBy: {
updatedAt: 'asc'
permit_type: {
name: 'asc'
}
}
});

Expand Down
1 change: 1 addition & 0 deletions app/src/types/ChefsSubmissionForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type ChefsSubmissionForm = {
submittedAt: string;
submittedBy: string;
locationPIDs: string | null;
companyNameRegistered: string | null;
contactName: string | null;
contactPhoneNumber: string | null;
contactEmail: string | null;
Expand Down
1 change: 1 addition & 0 deletions app/src/types/ChefsSubmissionFormExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type ChefsSubmissionFormExport = {
latitude: number;
longitude: number;
naturalDisasterInd: boolean;
projectName: string;
companyNameRegistered: string;
queuePriority: number;
singleFamilyUnits: string;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/submission/SubmissionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const formSchema = object({
confirmationId: string().required().label('Confirmation ID'),
contactEmail: string().email().label('Contact Email'),
intakeStatus: string().oneOf(IntakeStatusList).label('Intake state'),
companyNameRegistered: string().notRequired().label('Company'),
latitude: number().notRequired().min(48).max(60).label('Latitude'),
longitude: number().notRequired().min(-139).max(-114).label('Longitude'),
projectName: string().notRequired().label('Project Name'),
Expand Down Expand Up @@ -188,7 +189,7 @@ const onSubmit = (values: any) => {
/>
<InputText
class="col-4"
name="projectName"
name="companyNameRegistered"
label="Company"
:disabled="!props.editable"
/>
Expand All @@ -198,7 +199,6 @@ const onSubmit = (values: any) => {
label="Units"
:disabled="!props.editable"
/>
<div class="col-4" />
<InputText
class="col-4"
name="streetAddress"
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/submission/SubmissionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ const filters = ref({
</div>
</template>
</Column>
<Column
field="projectName"
header="Project Name"
:sortable="true"
style="min-width: 200px"
/>
<Column
field="contactName"
header="Contact"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/ChefsSubmissionForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type ChefsSubmissionForm = {
contactPhoneNumber?: string;
contactEmail?: string;
projectName?: string;
companyNameRegistered?: string;
singleFamilyUnits?: string;
streetAddress?: string;
latitude?: number;
Expand Down
17 changes: 10 additions & 7 deletions frontend/src/views/SubmissionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ async function onPermitSubmit(data: any) {
const result = (await permitService.createPermit({ ...data, submissionId: props.submissionId })).data;
toast.success('Permit saved');
permits.value.push(result);
sortPermits();
permitModalVisible.value = false;
}
Expand All @@ -56,10 +55,6 @@ async function onSubmissionSubmit(data: any) {
toast.success('Form saved');
}
const sortPermits = (): void => {
permits.value.sort((a: Permit, b: Permit) => a.permitType?.name.localeCompare(b.permitType?.name ?? '') || 0);
};
onMounted(async () => {
submission.value = (await chefsService.getSubmission(props.formId, props.submissionId)).data;
documents.value = (await documentService.listDocuments(props.submissionId)).data;
Expand All @@ -77,8 +72,16 @@ onMounted(async () => {
</router-link>
<h1>
Activity submission:
<span v-if="submission?.confirmationId">{{ submission.confirmationId }}</span>
<span v-if="submission?.projectName">&nbsp;- {{ submission.projectName }}</span>
<span
v-if="submission?.confirmationId"
class="mr-1"
>
{{ submission.confirmationId }}
</span>
<span v-if="submission?.projectName">
-
<span class="ml-1">{{ submission.projectName }}</span>
</span>
</h1>

<TabView>
Expand Down

0 comments on commit c1f4eec

Please sign in to comment.