tickera-angular-components 0.0.1-dev.195 → 0.0.1-dev.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3224,22 +3224,17 @@ class PriceZoneService {
3224
3224
  constructor(apiService) {
3225
3225
  this.apiService = apiService;
3226
3226
  }
3227
- fetchPriceZones({ roomMapId, page, search, limit, } = {}) {
3228
- const queryParams = new URLSearchParams();
3229
- if (roomMapId)
3230
- queryParams.append('room_map_id', roomMapId.toString());
3231
- if (page)
3232
- queryParams.append('page', page.toString());
3233
- if (search)
3234
- queryParams.append('search', search);
3235
- if (limit)
3236
- queryParams.append('limit', limit.toString());
3227
+ fetchPriceZones(params = {}) {
3228
+ const queryParams = transformUrlParams(params);
3229
+ if (params.show_ids?.length) {
3230
+ params.show_ids.forEach((showId) => queryParams.append('show_ids', showId.toString()));
3231
+ }
3237
3232
  const queryString = queryParams.toString();
3238
3233
  const apiRoute = `${PRICE_ZONES_API_ROUTES.FIND_ALL}${queryString ? '?' + queryString : ''}`;
3239
3234
  return this.apiService.get(apiRoute);
3240
3235
  }
3241
- loadPriceZones({ roomMapId, page, search, limit } = {}) {
3242
- this.fetchPriceZones({ roomMapId, page, search, limit }).subscribe({
3236
+ loadPriceZones(params = {}) {
3237
+ this.fetchPriceZones(params).subscribe({
3243
3238
  next: ({ data }) => {
3244
3239
  this.priceZonesSubject.next(data?.price_zones ?? []);
3245
3240
  },
@@ -7740,15 +7735,20 @@ class AsyncSelectComponent {
7740
7735
  if (!this.config)
7741
7736
  return of([]);
7742
7737
  const mergedParams = { ...params };
7743
- if (this.parentId != null && mergedParams.parentId == null) {
7738
+ if (this.hasParentId() && mergedParams.parentId == null) {
7744
7739
  mergedParams.parentId = this.parentId;
7745
7740
  }
7746
7741
  return this.config.load(mergedParams).pipe(map((res) => this.config.map(res)), catchError(() => of([])));
7747
7742
  }
7743
+ hasParentId() {
7744
+ if (this.parentId == null)
7745
+ return false;
7746
+ return Array.isArray(this.parentId) ? this.parentId.length > 0 : true;
7747
+ }
7748
7748
  handleParentIdChange() {
7749
7749
  this.value = this.multiple ? [] : null;
7750
7750
  this.onChange(this.value);
7751
- if (this.parentId != null && this.config) {
7751
+ if (this.hasParentId() && this.config) {
7752
7752
  this.loadAndMap({ parentId: this.parentId });
7753
7753
  }
7754
7754
  else if (this.config) {
@@ -9279,6 +9279,7 @@ class PriceZoneSelectComponent {
9279
9279
  showError = true;
9280
9280
  customClass = '';
9281
9281
  control = null;
9282
+ showIds = [];
9282
9283
  priceZoneChange = new EventEmitter();
9283
9284
  priceZones = signal([], ...(ngDevMode ? [{ debugName: "priceZones" }] : []));
9284
9285
  loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
@@ -9294,7 +9295,10 @@ class PriceZoneSelectComponent {
9294
9295
  }
9295
9296
  ngOnInit() {
9296
9297
  if (isPlatformBrowser(this.platformId)) {
9297
- this.priceZoneService.loadPriceZones({ search: this.searchTerm });
9298
+ this.priceZoneService.loadPriceZones({
9299
+ search: this.searchTerm,
9300
+ show_ids: this.showIds,
9301
+ });
9298
9302
  this.priceZoneService.priceZones$
9299
9303
  .pipe(takeUntil(this.destroy$))
9300
9304
  .subscribe((priceZones) => {
@@ -9308,7 +9312,20 @@ class PriceZoneSelectComponent {
9308
9312
  .pipe(debounceTime(400), distinctUntilChanged(), takeUntil(this.destroy$))
9309
9313
  .subscribe((search) => {
9310
9314
  this.searchTerm = search;
9311
- this.priceZoneService.loadPriceZones({ search: this.searchTerm });
9315
+ this.priceZoneService.loadPriceZones({
9316
+ search: this.searchTerm,
9317
+ show_ids: this.showIds,
9318
+ });
9319
+ });
9320
+ }
9321
+ }
9322
+ ngOnChanges(changes) {
9323
+ if (changes['showIds'] &&
9324
+ !changes['showIds'].firstChange &&
9325
+ isPlatformBrowser(this.platformId)) {
9326
+ this.priceZoneService.loadPriceZones({
9327
+ search: this.searchTerm,
9328
+ show_ids: this.showIds,
9312
9329
  });
9313
9330
  }
9314
9331
  }
@@ -9351,7 +9368,7 @@ class PriceZoneSelectComponent {
9351
9368
  return false;
9352
9369
  }
9353
9370
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PriceZoneSelectComponent, deps: [{ token: PLATFORM_ID }, { token: PriceZoneService }], target: i0.ɵɵFactoryTarget.Component });
9354
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: PriceZoneSelectComponent, isStandalone: true, selector: "price-zone-select", inputs: { label: "label", placeholder: "placeholder", name: "name", required: "required", readonly: "readonly", showError: "showError", customClass: "customClass", control: "control" }, outputs: { priceZoneChange: "priceZoneChange" }, providers: [
9371
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: PriceZoneSelectComponent, isStandalone: true, selector: "price-zone-select", inputs: { label: "label", placeholder: "placeholder", name: "name", required: "required", readonly: "readonly", showError: "showError", customClass: "customClass", control: "control", showIds: "showIds" }, outputs: { priceZoneChange: "priceZoneChange" }, providers: [
9355
9372
  {
9356
9373
  provide: NG_VALUE_ACCESSOR,
9357
9374
  useExisting: forwardRef(() => PriceZoneSelectComponent),
@@ -9362,7 +9379,7 @@ class PriceZoneSelectComponent {
9362
9379
  useExisting: forwardRef(() => PriceZoneSelectComponent),
9363
9380
  multi: true,
9364
9381
  },
9365
- ], ngImport: i0, template: "<form-select\n [label]=\"label\"\n [placeholder]=\"placeholder\"\n [name]=\"name || 'price_zone_id'\"\n [class]=\"customClass\"\n [options]=\"priceZones()\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [formControl]=\"formControl\"\n (change)=\"onPriceZoneSelected($event)\"\n></form-select>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FormSelectComponent, selector: "form-select", inputs: ["label", "name", "id", "placeholder", "required", "disabled", "readonly", "options", "fieldGroupClass", "showDefaultOption", "defaultOptionLabel"] }] });
9382
+ ], usesOnChanges: true, ngImport: i0, template: "<form-select\n [label]=\"label\"\n [placeholder]=\"placeholder\"\n [name]=\"name || 'price_zone_id'\"\n [class]=\"customClass\"\n [options]=\"priceZones()\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [formControl]=\"formControl\"\n (change)=\"onPriceZoneSelected($event)\"\n></form-select>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FormSelectComponent, selector: "form-select", inputs: ["label", "name", "id", "placeholder", "required", "disabled", "readonly", "options", "fieldGroupClass", "showDefaultOption", "defaultOptionLabel"] }] });
9366
9383
  }
9367
9384
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PriceZoneSelectComponent, decorators: [{
9368
9385
  type: Component,
@@ -9397,6 +9414,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
9397
9414
  type: Input
9398
9415
  }], control: [{
9399
9416
  type: Input
9417
+ }], showIds: [{
9418
+ type: Input
9400
9419
  }], priceZoneChange: [{
9401
9420
  type: Output
9402
9421
  }] } });