Skip to content

Commit

Permalink
project form completed with all required fields
Browse files Browse the repository at this point in the history
  • Loading branch information
horatiorosa committed Oct 19, 2024
1 parent 80910ef commit 4a716ab
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
6 changes: 5 additions & 1 deletion client/app/components/packages/projects/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
@form={{saveableProjectsNewForm}}
@boroughOptions={{this.boroughOptions}}
@onBoroughChange={{this.handleBoroughChange}}
@selectedBorough={{this.selectedBorough}} />
@selectedBorough={{this.selectedBorough}}
@onApplicantTypeSelection={{this.handleApplicantTypeChange}}
@selectedApplicantType={{this.selectedApplicantType}}
@applicantOptions={{this.applicantOptions}}
/>
<Packages::Projects::ProjectsNewAddContacts
@form={{saveableProjectsNewForm}} />
</div>
Expand Down
18 changes: 18 additions & 0 deletions client/app/components/packages/projects/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ export default class ProjectsNewFormComponent extends Component {
@tracked
selectedBorough = null;

@tracked
selectedApplicantType = null;

get boroughOptions() {
return optionset(['project', 'boroughs', 'list']);
}

get applicantOptions() {
return optionset(['applicant', 'dcpApplicantType', 'list']);
}

@action
handleBoroughChange(selectedBorough) {
console.log('Selected borough:', selectedBorough);

Check warning on line 36 in client/app/components/packages/projects/new.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Unexpected console statement

Check warning on line 36 in client/app/components/packages/projects/new.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Unexpected console statement
Expand All @@ -35,6 +42,17 @@ export default class ProjectsNewFormComponent extends Component {
}
}

@action
handleApplicantTypeChange(selectedApplicantType) {
console.log('Selected Applicant Type:', selectedApplicantType);

Check warning on line 47 in client/app/components/packages/projects/new.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Unexpected console statement

Check warning on line 47 in client/app/components/packages/projects/new.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Unexpected console statement

this.selectedApplicantType = selectedApplicantType;

if (this.args.form) {
this.args.form.set('dcpApplicantType', selectedApplicantType);
}
}

@action
async submitPackage() {
const primaryContactInput = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{{#let @form as |form|}}
<form.Section @title="Project Information">
<form.Section @title='Project Information'>
<Ui::Question @required={{true}} as |Q|>
<Q.Label>
Project Name
</Q.Label>

<form.Field
@attribute="projectName"
@type="text-input"
@attribute='projectName'
@type='text-input'
id={{Q.questionId}}
@showCounter={{true}}
@maxlength="50"
@maxlength='50'
placeholder="project name"
/>
</Ui::Question>
<Ui::Question @required={{true}} as |Q|>
Expand All @@ -21,13 +22,27 @@
@options={{@boroughOptions}}
@onChange={{@onBoroughChange}}
@selected={{@selectedBorough}}
@searchField="label"
@placeholder="Select a borough"
as |borough|
>
@searchField='label'
@placeholder='select a borough' as |borough| >
{{borough.label}}
</PowerSelect>
</Ui::Question>
<Ui::Question @required={{true}} as |Q|>
<Q.Label>
Applicant Type
</Q.Label>
<p class='q-help'>
Identify if you represent a public agency or are a private entity.
</p>
<PowerSelect
@options={{@applicantOptions}}
@onChange={{@onApplicantTypeSelection}}
@selected={{@selectedApplicantType}}
@searchField='label'
@placeholder='select applicant type' as |applicantType| >
{{applicantType.label}}
</PowerSelect>
</Ui::Question>
</form.Section>
{{/let}}

1 change: 1 addition & 0 deletions client/app/helpers/optionset.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const OPTIONSET_LOOKUP = {
applicant: {
dcpState: APPLICANT_OPTIONSETS.DCPSTATE,
dcpType: APPLICANT_OPTIONSETS.DCPTYPE,
dcpApplicantType: APPLICANT_OPTIONSETS.DCP_APPLICANTTYPE,
},
bbl: {
boroughs: BBL_OPTIONSETS.BOROUGHS,
Expand Down
12 changes: 12 additions & 0 deletions client/app/optionsets/applicant.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,21 @@ export const DCPSTATE = {
},
};

export const DCP_APPLICANTTYPE = {
OTHER_PUBLIC_AGENCY: {
label: "Other Public Agency",

Check failure on line 253 in client/app/optionsets/applicant.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Strings must use singlequote

Check failure on line 253 in client/app/optionsets/applicant.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Strings must use singlequote
code: 717170001,
},
PRIVATE: {
label: "Private",

Check failure on line 257 in client/app/optionsets/applicant.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Strings must use singlequote

Check failure on line 257 in client/app/optionsets/applicant.js

View workflow job for this annotation

GitHub Actions / 🧪 Test client code

Strings must use singlequote
code: 717170002,
},
};

const APPLICANT_OPTIONSETS = {
DCPTYPE,
DCPSTATE,
DCP_APPLICANTTYPE,
};

export default APPLICANT_OPTIONSETS;

0 comments on commit 4a716ab

Please sign in to comment.