Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client
1 result
Show changes
Showing
with 452 additions and 51 deletions
......@@ -38,6 +38,11 @@
[form]="form"
(checkValidation)="checkValidation()"
></app-mediation-hours-selection>
<app-mediation-language-selection
*ngIf="currentStep === HotlineMediationStepsEnum.mediationLanguageSelection"
[form]="form"
(checkValidation)="checkValidation()"
></app-mediation-language-selection>
<app-mediation-recap
*ngIf="currentStep === HotlineMediationStepsEnum.mediationRecap"
[form]="form"
......
......@@ -69,6 +69,12 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
} else {
this.profile = await this.profileService.getProfile();
}
if (history.state.mediationNumerique) {
this.currentStep = 0;
this.needType = this.needEnum.learnSkills;
this.setCurrentNeedType(NeedsType.learnSkills);
}
}
ngAfterContentChecked() {
......@@ -292,13 +298,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
if (this.isStructureListForm()) {
if (this.currentStep === StructuresListSteps.structureChoice) {
this.fullScreen = false;
this.currentStep--;
return;
}
if (this.currentStep === StructuresListSteps.structureOrientator) {
this.fullScreen = true;
this.currentStep--;
return;
}
}
......@@ -310,6 +312,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
}
if (this.currentStep > 0) {
this.currentStep--;
this.checkLastStep();
}
}
......
......@@ -22,7 +22,7 @@ export class OrientationStructureListComponent {
public radioChange(event: { name: string; value: boolean }): void {
const { name, value } = event;
this.form.get(name).setValue(value);
this.checkValidation();
this.manualySetOfPmr(event);
}
public checkValidation(event?: any): void {
......@@ -35,4 +35,16 @@ export class OrientationStructureListComponent {
}
this.validatePage.emit(event);
}
private manualySetOfPmr(event: { name: string; value: boolean }): void {
// Handle special PMR access case
if (event.name === 'pmrAccess') {
if (event.value) {
this.filters.push(new Filter('pmrAccess', 'True', 'PMR'));
} else {
this.filters = this.filters.filter((module) => module.name !== 'pmrAccess');
}
}
this.checkValidation();
}
}
......@@ -24,6 +24,7 @@ import { OrientationRoutingModule } from './orientation-routing.module';
import { OrientationCommentsComponent } from './orientation-structure-list/orientation-comments/orientation-comments.component';
import { OrientationStructureAddressComponent } from './orientation-structure-list/orientation-structure-address/orientation-structure-address.component';
import { OrientationStructureListComponent } from './orientation-structure-list/orientation-structure-list.component';
import { MediationLanguageSelectionComponent } from './online-demarch/mediation-language-selection/mediation-language-selection.component';
import { SelectComponent } from './global-components/select/select.component';
@NgModule({
......@@ -50,6 +51,7 @@ import { SelectComponent } from './global-components/select/select.component';
OrientationCommentsComponent,
EquipmentAccessComponent,
BaseSkillsChoiceComponent,
MediationLanguageSelectionComponent,
SelectComponent,
],
imports: [OrientationRoutingModule, CartoModule, SharedModule],
......
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, UrlTree } from '@angular/router';
import { ProfileService } from '../profile/services/profile.service';
@Injectable({
providedIn: 'root',
})
export class IsPersonalOfferOwnerGuard implements CanActivate {
constructor(private router: Router, private profileService: ProfileService) {}
async canActivate(route: ActivatedRouteSnapshot): Promise<boolean | UrlTree> {
const personalOffer = route.params.id;
const isPersonalOfferOwner = await this.profileService.isPersonalOfferOwner(personalOffer);
if (isPersonalOfferOwner) {
return true;
}
return this.router.parseUrl('/home');
}
}
......@@ -74,7 +74,7 @@ export class Structure {
onlineProcedures: obj?.categories?.onlineProcedures || [],
publicOthers: obj?.categories?.publicOthers || [],
selfServiceMaterial: obj?.categories?.selfServiceMaterial || [],
equipmentsServices: obj?.categories?.equipmentsServices || [],
solidarityMaterial: obj?.categories?.solidarityMaterial || [],
},
});
}
......
......@@ -205,9 +205,10 @@
<!-- Footer -->
<div class="footer" *ngIf="currentTab !== tabsEnum.credentials">
<app-button [text]="'Annuler'" (action)="cancel()"></app-button>
<app-button [text]="'Annuler'" [iconBtn]="'close'" (action)="cancel()"></app-button>
<app-button
[text]="'Valider'"
[iconBtn]="'check'"
[disabled]="!isPageValid()"
(action)="confirm()"
[style]="buttonTypeEnum.Primary"
......
<div fxLayout="column" class="content-container full-screen">
<div class="edit-personal-offer">
<div class="header">
<div class="title">
<a routerLink="/profile">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/ico/sprite.svg#arrowBack'"></use>
</svg>
</a>
<h1>Gérer mon offre de service</h1>
</div>
</div>
<!-- Navigation -->
<div class="navigation">
<span
[ngClass]="{ tab: true, selected: currentTab === tabsEnum.onlineProcedures }"
(click)="navigateTo(tabsEnum.onlineProcedures)"
>Démarches en ligne</span
>
<span
[ngClass]="{ tab: true, selected: currentTab === tabsEnum.digitalSkills }"
(click)="navigateTo(tabsEnum.digitalSkills)"
>Compétences numériques</span
>
</div>
<!-- Content of tabs -->
<div class="content">
<div *ngIf="currentTab === tabsEnum.onlineProcedures">
<app-accompaniment-picker
*ngIf="personalOfferForm"
[personalOfferForm]="personalOfferForm"
[onlineProcedures]="onlineProcedures"
></app-accompaniment-picker>
</div>
<div *ngIf="currentTab === tabsEnum.digitalSkills">
<app-training-type-picker
*ngIf="personalOfferForm"
[baseSkills]="personalOfferForm.get('categories').get('baseSkills').value"
[advancedSkills]="personalOfferForm.get('categories').get('advancedSkills').value"
[trainingCategories]="trainingCategories"
(selectedType)="setTrainingsFromCategories($event)"
></app-training-type-picker>
</div>
</div>
<!-- Footer -->
<div class="footer">
<app-button
[text]="'Annuler'"
[iconBtn]="'close'"
(action)="cancel()"
[disabled]="personalOfferForm?.pristine"
></app-button>
<app-button
[text]="'Valider'"
[iconBtn]="'check'"
(action)="confirm()"
[style]="buttonTypeEnum.Primary"
[disabled]="personalOfferForm?.pristine"
>
</app-button>
</div>
</div>
</div>
@import '../../../assets/scss/color';
@import '../../../assets/scss/typography';
@import '../../../assets/scss/hyperlink';
@import '../../../assets/scss/shapes';
@import '../../../assets/scss/breakpoint';
.edit-personal-offer {
display: flex;
flex-direction: column;
flex: 1;
max-width: 980px;
width: 100%;
margin: 16px auto 8px auto;
padding: 40px;
padding-bottom: 0px;
background: $white;
border: 1px solid $grey-6;
border-radius: 8px;
@media #{$tablet} {
margin: 0px 4px 4px 4px;
padding: 16px;
padding-bottom: 0px;
width: auto;
}
.header,
.navigation,
.title {
display: flex;
}
.header {
justify-content: space-between;
padding-bottom: 18px;
align-items: center;
.title {
align-items: center;
h1 {
color: $grey-1;
font-weight: lighter;
@media #{$tablet} {
@include lato-regular-20;
}
}
svg {
stroke: $black;
height: 40px;
width: 40px;
margin-right: 14px;
cursor: pointer;
}
}
}
.navigation {
justify-content: flex-start;
overflow-x: auto;
white-space: nowrap;
border-bottom: 1px solid $grey-4;
&::-webkit-scrollbar {
height: 8px;
margin-right: 4px;
}
.tab {
color: $grey-3;
margin-right: 40px;
padding-bottom: 8px;
&:hover {
cursor: pointer;
}
&.selected {
color: $grey-1;
border-bottom: 2px solid $grey-1;
}
}
}
.content {
padding-top: 24px;
flex: 1;
max-width: 600px;
}
.footer {
padding: 16px;
display: flex;
gap: 24px;
justify-content: center;
flex-wrap: wrap;
border-top: 1px solid $grey-4;
//To fit border to parent div
margin: 0 -40px;
@media #{$tablet} {
margin: 0 -16px;
}
::ng-deep div svg {
height: 22px;
}
}
}
import { Component, OnInit } from '@angular/core';
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { ActivatedRoute, Data } from '@angular/router';
import { CategoriesToggle } from '../../models/categoriesToggle.model';
import { NotificationService } from '../../services/notification.service';
import { ButtonType } from '../../shared/components/button/buttonType.enum';
import { CategoryEnum } from '../../shared/enum/category.enum';
import { Category } from '../../structure-list/models/category.model';
import { SearchService } from '../../structure-list/services/search.service';
import { PersonalOffer } from './../../models/personalOffer.model';
import { PersonalOfferService } from './../../services/personal-offer.service';
enum tabsEnum {
onlineProcedures,
digitalSkills,
}
@Component({
selector: 'app-personal-offer-edition',
templateUrl: './personal-offer-edition.component.html',
styleUrls: ['./personal-offer-edition.component.scss'],
})
export class PersonalOfferEditionComponent implements OnInit {
public buttonTypeEnum = ButtonType;
public tabsEnum = tabsEnum;
public currentTab: tabsEnum = tabsEnum.onlineProcedures;
public personalOffer: PersonalOffer;
public personalOfferForm: UntypedFormGroup = null;
private initialPersonalOffer;
public onlineProcedures: Category;
public trainingCategories: CategoriesToggle[] = [];
constructor(
private route: ActivatedRoute,
private searchService: SearchService,
private personalOfferService: PersonalOfferService,
private notificationService: NotificationService
) {}
ngOnInit(): void {
this.route.data.subscribe(async (data: Data & { personalOffer: PersonalOffer }) => {
if (data.personalOffer) {
await this.setCategories();
this.personalOffer = data.personalOffer;
this.personalOfferForm = this.createPersonalOfferForm(this.personalOffer);
this.initialPersonalOffer = this.personalOfferForm.value;
}
});
}
private createPersonalOfferForm(personalOfferState): UntypedFormGroup {
return new UntypedFormGroup({
categories: new UntypedFormGroup({
onlineProcedures: new UntypedFormControl(personalOfferState.categories.onlineProcedures),
baseSkills: new UntypedFormControl(personalOfferState.categories.baseSkills),
advancedSkills: new UntypedFormControl(personalOfferState.categories.advancedSkills),
}),
});
}
async setCategories(): Promise<void> {
const categories = await this.searchService.getCategories().toPromise();
categories.forEach((categ) => {
switch (categ.id) {
case CategoryEnum.onlineProcedures: {
this.onlineProcedures = categ;
break;
}
case CategoryEnum.baseSkills:
case CategoryEnum.advancedSkills: {
this.trainingCategories.push({ category: categ, openned: false });
break;
}
default:
break;
}
});
}
public navigateTo(tab: tabsEnum): void {
this.currentTab = tab;
}
public cancel(): void {
this.personalOfferForm = this.createPersonalOfferForm(this.initialPersonalOffer);
}
public confirm(): void {
this.personalOfferService
.updatePersonalOffer(this.personalOffer._id, this.personalOfferForm.get('categories').value)
.subscribe(() => {
this.notificationService.showSuccess('Vos informations ont bien été enregistrées');
this.initialPersonalOffer = this.personalOfferForm.value;
this.personalOfferForm.markAsPristine();
});
}
public setTrainingsFromCategories(categories: Category[]) {
for (const categorie of categories) {
const moduleIds: string[] = categorie.modules.map((module) => module.id);
if (this.personalOfferForm.get('categories').get(categorie.id)) {
this.personalOfferForm.get('categories').get(categorie.id).patchValue(moduleIds);
this.personalOfferForm.get('categories').get(categorie.id).markAsDirty();
}
}
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule, Route } from '@angular/router';
import { Route, RouterModule, Routes } from '@angular/router';
import { FooterComponent } from '../footer/footer.component';
import { AuthGuard } from '../guards/auth.guard';
import { IsPersonalOfferOwnerGuard } from '../guards/isPersonalOfferOwner.guard';
import { RoleGuard } from '../guards/role.guard';
import { PersonalOfferResolver } from '../resolvers/personal-offer.resolver';
import { StructureResolver } from '../resolvers/structure.resolver';
import { RouteRole } from '../shared/enum/routeRole.enum';
import { StructureMembersManagementComponent } from './structure-members-management/structure-members-management.component';
import { StructuresManagementComponent } from './structures-management/structures-management.component';
import { EditComponent } from './edit/edit.component';
import { PersonalOfferEditionComponent } from './personal-offer-edition/personal-offer-edition.component';
import { ProfileComponent } from './profile.component';
import { StructureEditionSummaryComponent } from './structure-edition-summary/structure-edition-summary.component';
import { AuthGuard } from '../guards/auth.guard';
import { EditComponent } from './edit/edit.component';
import { FooterComponent } from '../footer/footer.component';
import { StructureMembersManagementComponent } from './structure-members-management/structure-members-management.component';
import { StructuresManagementComponent } from './structures-management/structures-management.component';
const footerOutletRoute: Route = {
path: '',
......@@ -50,6 +53,14 @@ const routes: Routes = [
structure: StructureResolver,
},
},
{
path: 'edit-personal-offer/:id',
component: PersonalOfferEditionComponent,
canActivate: [IsPersonalOfferOwnerGuard],
resolve: {
personalOffer: PersonalOfferResolver,
},
},
{
path: 'structure-members-management/:id',
component: StructureMembersManagementComponent,
......
......@@ -8,7 +8,7 @@
[iconBtn]="'edit'"
[text]="'Modifier mon offre'"
[style]="buttonTypeEnum.SecondaryWide"
[disabled]="true"
routerLink="./edit-personal-offer/{{ this.personalOffer._id }}"
></app-button>
<app-button
*ngIf="!isPublic"
......@@ -16,7 +16,7 @@
[type]="'button'"
[iconBtn]="'edit'"
[style]="buttonTypeEnum.SecondaryOnlyIcon"
[disabled]="true"
routerLink="./edit-personal-offer/{{ this.personalOffer._id }}"
></app-button>
</div>
<div class="content">
......
......@@ -110,6 +110,7 @@
[style]="buttonTypeEnum.SecondaryOnlyIcon"
routerLink="./structure-members-management/{{ structure._id }}"
[routerLinkActive]="'active'"
(click)="goToOffer()"
></app-button>
</div>
<div class="sectionContent members">
......
......@@ -66,10 +66,19 @@ export class ProfileStructureComponent implements OnInit {
public async getSharedPersonalOffer(): Promise<PersonalOffer> {
// Check if user has personal offers
if (!this.userProfile.job.hasPersonalOffer || this.userProfile.personalOffers.length === 0) return null;
if (
!this.userProfile ||
!this.userProfile.job ||
!this.userProfile.personalOffers ||
!this.userProfile.job.hasPersonalOffer ||
this.userProfile.personalOffers.length === 0
)
return null;
// Check if structure has personal offers
if (this.structure.personalOffers.length === 0) return null;
// Return personnal offer if the user has one in this structure
// Return personal offer if the user has one in this structure
const personalOffer = this.structure.personalOffers.filter((structureOffer) =>
this.userProfile.personalOffers.includes(structureOffer._id)
)[0];
......@@ -86,6 +95,9 @@ export class ProfileStructureComponent implements OnInit {
public goToEdit(step: structureFormStep): void {
this.router.navigate(['/form/structure', this.structureWithOwners.structure._id, structureFormStep[step]]);
}
public goToOffer(): void {
this.router.navigate(['/form/personaloffer'], { state: { structure: this.structure } });
}
public isValid(): boolean {
return this.structureForm.valid;
}
......
......@@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
import { EditComponent } from './edit/edit.component';
import { PersonalOfferEditionComponent } from './personal-offer-edition/personal-offer-edition.component';
import { ProfileRoutingModule } from './profile-routing.module';
import { PersonalOfferComponent } from './profile-structure/personal-offer/personal-offer.component';
import { ProfileStructureMemberComponent } from './profile-structure/profile-structure-member/profile-structure-member.component';
......@@ -27,6 +28,7 @@ import { StructuresManagementComponent } from './structures-management/structure
StructureMembersManagementComponent,
StructuresManagementComponent,
PersonalOfferComponent,
PersonalOfferEditionComponent,
],
imports: [CommonModule, ProfileRoutingModule, SharedModule],
})
......
......@@ -136,4 +136,9 @@ export class ProfileService {
})
);
}
public async isPersonalOfferOwner(personalOfferId: string): Promise<boolean> {
await this.getProfile();
return this.currentProfile.personalOffers.includes(personalOfferId);
}
}
......@@ -294,6 +294,11 @@
<p>{{ public }}</p>
</div>
</ng-container>
<ng-container *ngIf="!isFieldValid('age', 'categories') && structure.categoriesDisplay.age">
<app-no-information *ngIf="!structure.otherDescription"></app-no-information>
<app-missing-information></app-missing-information>
</ng-container>
</div>
<div class="content">
<ng-container
......@@ -557,37 +562,30 @@
</div>
</div>
</div>
<div class="section otherServices">
<div class="section solidarityMaterial">
<div class="sectionHeader">
<p>Autres services proposés</p>
<p>Vente de matériel à prix solidaire</p>
<app-button
class="hide-on-mobile"
[text]="'Modifier'"
[style]="buttonTypeEnum.Secondary"
[extraClass]="'editButton'"
(action)="goToEdit(structureFormStep.structureOtherServices)"
(action)="goToEdit(structureFormStep.structureSolidarityMaterial)"
></app-button>
<app-button
class="hide-on-desktop"
[iconBtn]="'edit'"
[style]="buttonTypeEnum.SecondaryOnlyIcon"
(action)="goToEdit(structureFormStep.structureOtherServices)"
(action)="goToEdit(structureFormStep.structureSolidarityMaterial)"
></app-button>
</div>
<div class="content">
<app-no-information
*ngIf="
structure.categoriesDisplay.equipmentsServices &&
structure.categoriesDisplay.equipmentsServices.length === 0
"
></app-no-information>
<div *ngFor="let equipement of structure.categoriesDisplay.equipmentsServices" class="list">
<p>{{ equipement }}</p>
<app-no-information *ngIf="structure.categoriesDisplay.solidarityMaterial.length === 0"></app-no-information>
<div *ngFor="let material of structure.categoriesDisplay.solidarityMaterial" class="list">
<p>{{ material }}</p>
</div>
</div>
</div>
<div class="section covid">
<div class="sectionHeader">
<p>Informations spécifiques à la période COVID</p>
......@@ -659,7 +657,7 @@
<div class="footer">
<ng-container *ngIf="isUpdateStructure">
<p class="warning" *ngIf="!isFormValid()">
Vous pourrez valider après avoir renseigner l’intégralité des champs obligatoires.
Vous pourrez valider après avoir renseigné l’intégralité des champs obligatoires.
</p>
<div class="buttons">
<app-button [text]="'Retour'" [iconBtn]="'close'" (click)="goBack()"></app-button>
......@@ -668,7 +666,7 @@
[iconBtn]="'check'"
[style]="buttonTypeEnum.Primary"
[disabled]="!isFormValid()"
(click)="updateStructure()"
(click)="updateStructureUpdateDate()"
></app-button>
</div>
</ng-container>
......
......@@ -6,7 +6,6 @@ import { DateTime } from 'luxon';
import { structureFormStep } from '../../form/form-view/structure-form/structureFormStep.enum';
import { Owner } from '../../models/owner.model';
import { Structure } from '../../models/structure.model';
import { StructureWithOwners } from '../../models/structureWithOwners.model';
import { NotificationService } from '../../services/notification.service';
import { StructureService } from '../../services/structure.service';
import { ButtonType } from '../../shared/components/button/buttonType.enum';
......@@ -15,7 +14,6 @@ import { FreeWorkshop } from '../../shared/enum/freeWorkshop.enum';
import { AccessModality } from '../../structure-list/enum/access-modality.enum';
import { Equipment } from '../../structure-list/enum/equipment.enum';
import { Category } from '../../structure-list/models/category.model';
import { SearchService } from '../../structure-list/services/search.service';
import { formUtils, IStructureSummary } from '../../utils/formUtils';
import { Utils } from '../../utils/utils';
......@@ -52,7 +50,6 @@ export class StructureEditionSummaryComponent implements OnInit {
constructor(
private notificationService: NotificationService,
private route: ActivatedRoute,
private searchService: SearchService,
private structureService: StructureService,
private utils: Utils,
public router: Router
......@@ -95,7 +92,7 @@ export class StructureEditionSummaryComponent implements OnInit {
return true;
}
public updateStructure(): void {
public updateStructureUpdateDate(): void {
this.structureService.editStructure({}, this.structure._id).subscribe(() => {
this.notificationService.showSuccess('La structure a bien été mise à jour.', '');
this.isUpdateStructure = false;
......@@ -169,23 +166,16 @@ export class StructureEditionSummaryComponent implements OnInit {
return this.utils.getWorkshopPricingLabel(freeWorkshop);
}
public hasWifi(equipmentsAndServices: string[]) {
return this.utils.hasWifi(equipmentsAndServices);
public hasWifi(selfServiceMaterial: string[]) {
return this.utils.hasWifi(selfServiceMaterial);
}
public hasEquipments(structure: Structure): boolean {
return this.utils.hasEquipments(
structure.categories.selfServiceMaterial,
structure.nbComputers,
structure.nbPrinters,
structure.nbScanners
);
return this.utils.hasEquipments(structure.nbComputers, structure.nbPrinters, structure.nbScanners);
}
public filterOnlyEquipments(equipmentsAndServices: string[]): string[] {
return this.utils.filterOnlyEquipments(equipmentsAndServices);
public filterOnlyEquipments(selfServiceMaterial: string[]): string[] {
return this.utils.filterOnlyEquipments(selfServiceMaterial);
}
public getEquipmentsLabelAndValue(equipment: Equipment, number: number): string {
return this.utils.getEquipmentsLabelAndValue(equipment, number);
}
......
import { PersonalOffer } from './../models/personalOffer.model';
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router';
import { forkJoin, Observable, Subject } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { PersonalOfferService } from '../services/personal-offer.service';
import { SearchService } from '../structure-list/services/search.service';
import { Utils } from '../utils/utils';
@Injectable()
export class PersonalOfferResolver implements Resolve<PersonalOffer> {
public subject: Subject<PersonalOffer> = new Subject();
constructor(
private personalOfferService: PersonalOfferService,
private searchService: SearchService,
private router: Router,
public utils: Utils
) {}
resolve(route: ActivatedRouteSnapshot): Observable<PersonalOffer> {
const personalOfferId = route.params.id;
if (personalOfferId) {
forkJoin({
personalOffer: this.personalOfferService.getPersonalOffer(personalOfferId).pipe(
map((res) => res),
catchError(() => {
this.router.navigate(['/home']);
return new Observable<PersonalOffer>();
})
),
categories: this.searchService.getCategories(),
}).subscribe((res) => {
const personalOffer = this.utils.setServiceCategories(res.categories, res.personalOffer) as PersonalOffer;
this.setSubject(personalOffer);
});
return this.getSubject();
}
}
setSubject(personalOffer: PersonalOffer): void {
this.subject.next(personalOffer);
}
getSubject(): Observable<PersonalOffer> {
return this.subject.asObservable();
}
}
......@@ -2,14 +2,26 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PersonalOffer } from '../models/personalOffer.model';
import { Category } from '../structure-list/models/category.model';
@Injectable({
providedIn: 'root',
})
export class PersonalOfferService {
private readonly baseUrl = 'api/personal-offers';
constructor(private http: HttpClient) {}
public createPersonalOffer(structureId: string, personalOffer: PersonalOffer): Observable<any> {
return this.http.post<any>(`api/personal-offers/`, { structureId: structureId, personalOffer: personalOffer });
public createPersonalOffer(structureId: string, personalOffer: PersonalOffer): Observable<PersonalOffer> {
return this.http.post<PersonalOffer>(this.baseUrl, { structureId: structureId, personalOffer: personalOffer });
}
public getPersonalOffer(id: string): Observable<PersonalOffer> {
return this.http.get<PersonalOffer>(`${this.baseUrl}/${id}`);
}
public updatePersonalOffer(id: string, categories: Category[]): Observable<PersonalOffer> {
return this.http.put<PersonalOffer>(`${this.baseUrl}/${id}`, {
categories: categories,
});
}
}