Skip to content

Commit

Permalink
changes after code review (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzlucas authored Dec 10, 2024
1 parent 8f46cfc commit 1806ebd
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 39 deletions.
17 changes: 12 additions & 5 deletions client/wfprev-war/src/main/angular/src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ const PANEL_ROUTES: Routes = [
loadChildren: () =>
import('src/app/components/edit-project.module').then(m => m.EditProjectModule),
},
{ path: '', redirectTo: ResourcesRoutes.MAP, pathMatch: 'full' }, // Default route to map

{ path: '',
redirectTo: ResourcesRoutes.MAP,
pathMatch: 'full' } // Default route to map
{
path: '',
canActivate: [PrevAuthGuard], // Guard the empty path
data: { scopes: PROFILE_SCOPES },
children: [
{
path: '',
redirectTo: ResourcesRoutes.MAP,
pathMatch: 'full',
}
]
}
];

export const ROUTING = RouterModule.forRoot(PANEL_ROUTES, {});
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,15 @@
</select>
</div>

<!-- <div class="form-item full-width">
<label for="projectDescription">Project Description</label>
<textarea
id="projectDescription"
formControlName="projectDescription"
placeholder="Enter Description"
></textarea>
</div> -->

<!-- <button mat-button type="submit" [disabled]="detailsForm.invalid">
Save
</button>
<button mat-button type="button" (click)="onCancel()">Cancel</button> -->
<div class="footer">
<div class="button-row">
<button class="secondary" (click)="onCancel()">Cancel</button>
<button
[disabled]="!detailsForm.valid || !detailsForm.dirty"
class="primary">Save
</button>
</div>
<div class="footer">
<div class="button-row">
<button class="secondary" (click)="onCancel()">Cancel</button>
<button
[disabled]="!detailsForm.valid || !detailsForm.dirty"
class="primary">Save
</button>
</div>
</div>
</form>
</div>
<div class="description-map-section">
Expand Down Expand Up @@ -206,12 +193,12 @@
<div id="map"></div>
<div class="latlong-section">
<form [formGroup]="detailsForm">
<label for="coordinats">Latitude/Longitude:</label>
<label for="coordinates">Latitude/Longitude:</label>
<div class="input-group">
<input
type="text"
id="coordinats"
formControlName="coordinats"
id="coordinates"
formControlName="coordinates"
placeholder="Enter Latitude/Longitude"
/>
<!-- <button type="button" (click)="onSaveLatLong()">Save</button> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ProjectDetailsComponent', () => {
expect(formValues.projectTypeCode).toEqual(
component.sampleData.projectTypeCode.projectTypeCode
);
expect(formValues.coordinats).toEqual(component.sampleData.coordinats);
expect(formValues.coordinates).toEqual(component.sampleData.coordinates);
});

it('should mark the form as invalid if required fields are missing', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Default: Story = {
totalFundingRequestAmount: [0, [Validators.required, Validators.min(0)]],
totalAllocatedAmount: [0, [Validators.required, Validators.min(0)]],
projectDescription: ['', []],
coordinats: ['', []],
coordinates: ['', []],
}),
},
};
Expand All @@ -59,7 +59,7 @@ export const WithPrepopulatedForm: Story = {
totalFundingRequestAmount: [100000, [Validators.required, Validators.min(0)]],
totalAllocatedAmount: [95000, [Validators.required, Validators.min(0)]],
projectDescription: ['This is a sample project.', []],
coordinats: ['48.407326,-123.329773', []],
coordinates: ['48.407326,-123.329773', []],
}),
},
};
Expand All @@ -81,7 +81,7 @@ export const FormWithErrors: Story = {
totalFundingRequestAmount: [-100, [Validators.required, Validators.min(0)]], // Invalid value
totalAllocatedAmount: [-50, [Validators.required, Validators.min(0)]], // Invalid value
projectDescription: ['', []],
coordinats: ['', []],
coordinates: ['', []],
}),
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class ProjectDetailsComponent implements OnInit, AfterViewInit{
fireCentreOrgUnitId: 3001,
bcParksRegionOrgUnitId: 4001,
bcParksSectionOrgUnitId: 5001,
coordinats:[48.407326,-123.329773],
coordinates:[48.407326,-123.329773],
primaryObjective: 'Objective1'
};

Expand Down Expand Up @@ -84,7 +84,7 @@ export class ProjectDetailsComponent implements OnInit, AfterViewInit{
this.sampleData.totalAllocatedAmount,
],
projectDescription: [this.sampleData.projectDescription],
coordinats :[this.sampleData.coordinats],
coordinates :[this.sampleData.coordinates],
primaryObjective: [this.sampleData.primaryObjective, [Validators.required]]
});

Expand All @@ -102,7 +102,7 @@ export class ProjectDetailsComponent implements OnInit, AfterViewInit{
return;
}
this.map = L.map('map', {
center: [this.sampleData.coordinats[0], this.sampleData.coordinats[1]],
center: [this.sampleData.coordinates[0], this.sampleData.coordinates[1]],
zoom: 13,
zoomControl: false,
});
Expand All @@ -113,7 +113,7 @@ export class ProjectDetailsComponent implements OnInit, AfterViewInit{


// Add a marker at the project's coordinates
L.marker([this.sampleData.coordinats[0], this.sampleData.coordinats[1]]).addTo(this.map);
L.marker([this.sampleData.coordinates[0], this.sampleData.coordinates[1]]).addTo(this.map);

// Bind a popup to the marker
// marker.bindPopup('Project Location: ' + this.sampleData.projectName).openPopup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<img alt="detail-icon" class="icon" src="/assets/detail-icon.svg" />
<span>Details</span>
</div>
<div class="action-item" (click)="editProject(project)" #stopPropagation>
<div class="action-item" (click)="editProject(project, $event)">
<img alt="edit-icon" class="icon" src="/assets/edit-icon.svg" />
<span>Edit</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export class ProjectsListComponent {
console.log('Sync with map:', this.syncWithMap ? 'On' : 'Off');
}

editProject(project: any) {
editProject(project: any, event:Event) {
event.stopPropagation();
this.router.navigate([ResourcesRoutes.EDIT_PROJECT], {
queryParams: { projectNumber: project.projectNumber, name: project.projectName}
});
Expand Down

0 comments on commit 1806ebd

Please sign in to comment.