mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
🔄 chore: sync swagger API clients with backend updates
- Regenerated all Swagger API clients (availability, checkout, crm, isa, print, wws) - Updated CRM loyalty card API endpoints (removed interests, added booking/bon management) - Temporarily disabled interests form block functionality due to API changes - Removed deprecated models (check-loyalty-card-result, loyalty-card-status, entity-key-value) - Added new loyalty booking and bon management models and services
This commit is contained in:
@@ -1,92 +1,99 @@
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { FormBlock } from '../form-block';
|
||||
import { InterestsFormBlockData } from './interests-form-block-data';
|
||||
import { LoyaltyCardService } from '@generated/swagger/crm-api';
|
||||
import { shareReplay } from 'rxjs/operators';
|
||||
import { isEqual } from 'lodash';
|
||||
import { memorize } from '@utils/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-interests-form-block',
|
||||
templateUrl: 'interests-form-block.component.html',
|
||||
styleUrls: ['interests-form-block.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: false,
|
||||
})
|
||||
export class InterestsFormBlockComponent extends FormBlock<InterestsFormBlockData, UntypedFormGroup> {
|
||||
private _interests: Map<string, string>;
|
||||
|
||||
get interests(): Map<string, string> {
|
||||
return this._interests;
|
||||
}
|
||||
set interests(value: Map<string, string>) {
|
||||
if (!isEqual(this._interests, value)) {
|
||||
this._interests = value;
|
||||
if (this.control) {
|
||||
this.updateInterestControls();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get tabIndexEnd() {
|
||||
return this.tabIndexStart + this.interests?.keys.length;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private _fb: UntypedFormBuilder,
|
||||
private _LoyaltyCardService: LoyaltyCardService,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.getInterests().subscribe({
|
||||
next: (response) => {
|
||||
const interests = new Map<string, string>();
|
||||
response.result.forEach((preference) => {
|
||||
interests.set(preference.key, preference.value);
|
||||
});
|
||||
this.interests = interests;
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@memorize({ ttl: 28800000 })
|
||||
getInterests() {
|
||||
return this._LoyaltyCardService.LoyaltyCardListInteressen().pipe(shareReplay(1));
|
||||
}
|
||||
|
||||
updateInterestControls() {
|
||||
const fData = this.data ?? {};
|
||||
this.interests?.forEach((value, key) => {
|
||||
if (!this.control.contains(key)) {
|
||||
this.control.addControl(key, new UntypedFormControl(fData[key] ?? false));
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(this.control.controls).forEach((key) => {
|
||||
if (!this.interests.has(key)) {
|
||||
this.control.removeControl(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initializeControl(data?: InterestsFormBlockData): void {
|
||||
const fData = data ?? {};
|
||||
this.control = this._fb.group({});
|
||||
|
||||
this.interests?.forEach((value, key) => {
|
||||
this.control.addControl(key, new UntypedFormControl(fData[key] ?? false));
|
||||
});
|
||||
}
|
||||
|
||||
_patchValue(update: { previous: InterestsFormBlockData; current: InterestsFormBlockData }): void {
|
||||
const fData = update.current ?? {};
|
||||
|
||||
this.interests?.forEach((value, key) => {
|
||||
this.control.get(key).patchValue(fData[key] ?? false);
|
||||
});
|
||||
}
|
||||
}
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import {
|
||||
UntypedFormBuilder,
|
||||
UntypedFormControl,
|
||||
UntypedFormGroup,
|
||||
} from '@angular/forms';
|
||||
import { FormBlock } from '../form-block';
|
||||
import { InterestsFormBlockData } from './interests-form-block-data';
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
@Component({
|
||||
selector: 'app-interests-form-block',
|
||||
templateUrl: 'interests-form-block.component.html',
|
||||
styleUrls: ['interests-form-block.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: false,
|
||||
})
|
||||
export class InterestsFormBlockComponent extends FormBlock<
|
||||
InterestsFormBlockData,
|
||||
UntypedFormGroup
|
||||
> {
|
||||
private _interests: Map<string, string>;
|
||||
|
||||
get interests(): Map<string, string> {
|
||||
return this._interests;
|
||||
}
|
||||
set interests(value: Map<string, string>) {
|
||||
if (!isEqual(this._interests, value)) {
|
||||
this._interests = value;
|
||||
if (this.control) {
|
||||
this.updateInterestControls();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get tabIndexEnd() {
|
||||
return this.tabIndexStart + this.interests?.keys.length;
|
||||
}
|
||||
|
||||
constructor(private _fb: UntypedFormBuilder) {
|
||||
super();
|
||||
|
||||
// this.getInterests().subscribe({
|
||||
// next: (response) => {
|
||||
// const interests = new Map<string, string>();
|
||||
// response.result.forEach((preference) => {
|
||||
// interests.set(preference.key, preference.value);
|
||||
// });
|
||||
// this.interests = interests;
|
||||
// },
|
||||
// error: (error) => {
|
||||
// console.error(error);
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
// @memorize({ ttl: 28800000 })
|
||||
// getInterests() {
|
||||
// return this._LoyaltyCardService.LoyaltyCardListInteressen().pipe(shareReplay(1));
|
||||
// }
|
||||
|
||||
updateInterestControls() {
|
||||
const fData = this.data ?? {};
|
||||
this.interests?.forEach((value, key) => {
|
||||
if (!this.control.contains(key)) {
|
||||
this.control.addControl(
|
||||
key,
|
||||
new UntypedFormControl(fData[key] ?? false),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(this.control.controls).forEach((key) => {
|
||||
if (!this.interests.has(key)) {
|
||||
this.control.removeControl(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initializeControl(data?: InterestsFormBlockData): void {
|
||||
const fData = data ?? {};
|
||||
this.control = this._fb.group({});
|
||||
|
||||
this.interests?.forEach((value, key) => {
|
||||
this.control.addControl(key, new UntypedFormControl(fData[key] ?? false));
|
||||
});
|
||||
}
|
||||
|
||||
_patchValue(update: {
|
||||
previous: InterestsFormBlockData;
|
||||
current: InterestsFormBlockData;
|
||||
}): void {
|
||||
const fData = update.current ?? {};
|
||||
|
||||
this.interests?.forEach((value, key) => {
|
||||
this.control.get(key).patchValue(fData[key] ?? false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user