From a904db9ff3b1b319c6b5d62431b02bf4bcf7414d Mon Sep 17 00:00:00 2001
From: horatio
Date: Mon, 28 Oct 2024 22:00:09 -0400
Subject: [PATCH] passing borough and applicant type to form args working
---
.../app/components/packages/projects/new.hbs | 3 +-
.../app/components/packages/projects/new.js | 75 ++++++++++---------
.../projects/projects-new-information.hbs | 28 +++----
client/app/routes/projects/new.js | 4 +
4 files changed, 59 insertions(+), 51 deletions(-)
diff --git a/client/app/components/packages/projects/new.hbs b/client/app/components/packages/projects/new.hbs
index 7d9a10c9..3ca49ed7 100644
--- a/client/app/components/packages/projects/new.hbs
+++ b/client/app/components/packages/projects/new.hbs
@@ -20,7 +20,8 @@
Planning will contact you with the next steps.
-
- this.store.queryRecord('contact', {
- email: contact.email,
- includeAllStatusCodes: true,
- })
+ const contactPromises = contactInputs.map(
+ (contact) => this.store.queryRecord('contact',
+ {
+ email: contact.email,
+ includeAllStatusCodes: true,
+ }),
);
const contacts = await Promise.all(contactPromises);
@@ -95,9 +80,27 @@ export default class ProjectsNewFormComponent extends Component {
}
return contact;
});
- await Promise.all(verifiedContactPromises);
- } catch {
- console.log('Save new project package error');
+
+ const saveProjectInformation = () => {
+ const projectModel = this.store.createRecord('project', {
+ dcpProjectName: projectInformation.projectName,
+ dcpBorough: projectInformation.borough,
+ dcoApplicantType: projectInformation.applicantType,
+ });
+ return projectModel.save();
+ };
+
+ await Promise.all(
+ [
+ verifiedContactPromises,
+ saveProjectInformation,
+ ],
+ )
+ .then(
+ await this.args.package.submit(),
+ );
+ } catch (error) {
+ console.log('Save new project package error', error);
}
}
}
diff --git a/client/app/components/packages/projects/projects-new-information.hbs b/client/app/components/packages/projects/projects-new-information.hbs
index 13b10922..c69c5328 100644
--- a/client/app/components/packages/projects/projects-new-information.hbs
+++ b/client/app/components/packages/projects/projects-new-information.hbs
@@ -4,7 +4,6 @@
Project Name
-
Borough
-
- {{borough.label}}
+
+ {{borough.label}}
+
Applicant Type
@@ -39,10 +39,10 @@
diff --git a/client/app/routes/projects/new.js b/client/app/routes/projects/new.js
index d2673806..98fd5baf 100644
--- a/client/app/routes/projects/new.js
+++ b/client/app/routes/projects/new.js
@@ -6,8 +6,12 @@ export default class ProjectsNewRoute extends Route.extend(AuthenticatedRouteMix
@service store;
async model() {
+ // console.log(`store`, this.store);
+ // console.log(`model`, this.model);
return {
projectName: '',
+ borough: '',
+ applicantType: '',
primaryContactFirstName: '',
primaryContactLastName: '',
primaryContactEmail: '',