Skip to content
Snippets Groups Projects
Commit 308a49ef authored by Etienne LOUPIAS's avatar Etienne LOUPIAS
Browse files

create or add personalOffer

parent 508554f6
No related branches found
No related tags found
1 merge request!936Resolve "[modification fiche structure] - Offre structure vs. Offre accompagnant numérique + ordre des blocs"
......@@ -181,7 +181,12 @@ export class FormViewComponent implements OnInit, AfterViewInit {
}
if (this.routeParam === formTypeParam.personaloffer) {
this.nbSteps = personalOfferFormSteps;
this.currentPage = personalOfferFormStep.personalOfferAccompaniment;
if (this.isPersonalOfferProfile && history.state.page) {
// Convert string 'personalOfferTrainingType' to enum
this.currentPage = personalOfferFormStep[history.state.page as keyof typeof personalOfferFormStep];
} else {
this.currentPage = personalOfferFormStep.personalOfferAccompaniment;
}
this.currentFormType = formType.personaloffer;
this.createPersonalOfferForm(new PersonalOffer());
this.currentForm = this.personalOfferForm;
......
......@@ -13,7 +13,8 @@ export class PersonalOfferGuard {
(this.router.routerState.snapshot.url === '/profil' ||
this.router.routerState.snapshot.url === '/formulaire/profil' ||
this.router.routerState.snapshot.url === '/formulaire/structure' ||
this.router.routerState.snapshot.url.includes('/join-request/'))
this.router.routerState.snapshot.url.includes('/join-request/') ||
this.router.routerState.snapshot.url.includes('/edition-structure/'))
) {
return true;
}
......
......@@ -5,6 +5,7 @@
<p>Facultatif</p>
</div>
<app-training-type-picker
*ngIf="trainingCategories?.length > 0"
[baseSkills]="personalOfferForm.get('categories').get('baseSkills').value"
[advancedSkills]="personalOfferForm.get('categories').get('advancedSkills').value"
[trainingCategories]="trainingCategories"
......
......@@ -40,6 +40,7 @@ export class PersonalOfferEditionComponent implements OnInit {
) {}
ngOnInit(): void {
// eslint-disable-next-line rxjs/no-async-subscribe
this.route.data.subscribe(async (data: Data & { personalOffer: PersonalOffer }) => {
if (data.personalOffer) {
await this.setCategories();
......@@ -49,6 +50,10 @@ export class PersonalOfferEditionComponent implements OnInit {
}
});
this.structureName = history.state.structureName;
if (history.state.tab) {
// Convert string 'digitalSkills' to enum
this.currentTab = tabsEnum[history.state.tab as keyof typeof tabsEnum];
}
}
public getTabsNames(): string[] {
......
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { PersonalOffer } from './../../../models/personalOffer.model';
@Component({
......@@ -11,12 +10,4 @@ export class PersonalOfferComponent {
@Input() public personalOffer: PersonalOffer;
@Input() public isPublic: boolean;
@Input() public structureName?: string;
constructor(private router: Router) {}
public goToEditPersonalOffer(): void {
this.router.navigateByUrl(`/profil/edition-offre-personnelle/${this.personalOffer._id}`, {
state: { structureName: this.structureName },
});
}
}
......@@ -167,11 +167,19 @@ export class StructureEditionSummaryComponent implements OnInit {
this.isGoToEdit = true;
if (offer?.user) {
if (offer.offers._id) {
this.router.navigateByUrl(`/profil/edition-offre-personnelle/${offer.offers._id}`, {
state: { structureName: this.structure.structureName },
this.router.navigate([`/profil/edition-offre-personnelle/${offer.offers._id}`], {
state: {
structureName: this.structure.structureName,
tab: step === structureFormStep.structureTrainingType ? 'digitalSkills' : '',
},
});
} else {
this.router.navigate(['/formulaire/offre-personnelle'], { state: { structure: this.structure } });
this.router.navigate(['/formulaire/offre-personnelle'], {
state: {
structure: this.structure,
page: step === structureFormStep.structureTrainingType ? 'personalOfferTrainingType' : '',
},
});
}
} else {
this.router.navigate(['/formulaire/structure', this.structure.permalink, structureFormStep[step]]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment