| @@ -152,6 +152,31 @@ paths: | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| delete: | |||
| operationId: api_locations_id_delete | |||
| tags: | |||
| - Location | |||
| responses: | |||
| '204': | |||
| description: 'Location resource deleted' | |||
| '404': | |||
| description: 'Resource not found' | |||
| summary: 'Removes the Location resource.' | |||
| description: 'Removes the Location resource.' | |||
| parameters: | |||
| - | |||
| name: id | |||
| in: path | |||
| description: 'Location identifier' | |||
| required: true | |||
| deprecated: false | |||
| allowEmptyValue: false | |||
| schema: | |||
| type: string | |||
| style: simple | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| patch: | |||
| operationId: api_locations_id_patch | |||
| tags: | |||
| @@ -509,6 +534,31 @@ paths: | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| delete: | |||
| operationId: api_shipping_companies_id_delete | |||
| tags: | |||
| - ShippingCompany | |||
| responses: | |||
| '204': | |||
| description: 'ShippingCompany resource deleted' | |||
| '404': | |||
| description: 'Resource not found' | |||
| summary: 'Removes the ShippingCompany resource.' | |||
| description: 'Removes the ShippingCompany resource.' | |||
| parameters: | |||
| - | |||
| name: id | |||
| in: path | |||
| description: 'ShippingCompany identifier' | |||
| required: true | |||
| deprecated: false | |||
| allowEmptyValue: false | |||
| schema: | |||
| type: string | |||
| style: simple | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| patch: | |||
| operationId: api_shipping_companies_id_patch | |||
| tags: | |||
| @@ -1004,6 +1054,31 @@ paths: | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| delete: | |||
| operationId: api_users_id_delete | |||
| tags: | |||
| - User | |||
| responses: | |||
| '204': | |||
| description: 'User resource deleted' | |||
| '404': | |||
| description: 'Resource not found' | |||
| summary: 'Removes the User resource.' | |||
| description: 'Removes the User resource.' | |||
| parameters: | |||
| - | |||
| name: id | |||
| in: path | |||
| description: 'User identifier' | |||
| required: true | |||
| deprecated: false | |||
| allowEmptyValue: false | |||
| schema: | |||
| type: string | |||
| style: simple | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| patch: | |||
| operationId: api_users_id_patch | |||
| tags: | |||
| @@ -1636,6 +1711,31 @@ paths: | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| delete: | |||
| operationId: api_vessels_id_delete | |||
| tags: | |||
| - Vessel | |||
| responses: | |||
| '204': | |||
| description: 'Vessel resource deleted' | |||
| '404': | |||
| description: 'Resource not found' | |||
| summary: 'Removes the Vessel resource.' | |||
| description: 'Removes the Vessel resource.' | |||
| parameters: | |||
| - | |||
| name: id | |||
| in: path | |||
| description: 'Vessel identifier' | |||
| required: true | |||
| deprecated: false | |||
| allowEmptyValue: false | |||
| schema: | |||
| type: string | |||
| style: simple | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| patch: | |||
| operationId: api_vessels_id_patch | |||
| tags: | |||
| @@ -1821,6 +1921,31 @@ paths: | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| delete: | |||
| operationId: api_zones_id_delete | |||
| tags: | |||
| - Zone | |||
| responses: | |||
| '204': | |||
| description: 'Zone resource deleted' | |||
| '404': | |||
| description: 'Resource not found' | |||
| summary: 'Removes the Zone resource.' | |||
| description: 'Removes the Zone resource.' | |||
| parameters: | |||
| - | |||
| name: id | |||
| in: path | |||
| description: 'Zone identifier' | |||
| required: true | |||
| deprecated: false | |||
| allowEmptyValue: false | |||
| schema: | |||
| type: string | |||
| style: simple | |||
| explode: false | |||
| allowReserved: false | |||
| deprecated: false | |||
| patch: | |||
| operationId: api_zones_id_patch | |||
| tags: | |||
| @@ -0,0 +1,64 @@ | |||
| import { Directive, EventEmitter, Input, Output, OnInit } from '@angular/core'; | |||
| import { FormGroup } from '@angular/forms'; | |||
| import { ModalStatus } from '@app/_helpers/modal.states'; | |||
| import { Observable } from 'rxjs'; | |||
| export type SaveFunction<T> = (item: T) => Observable<T>; | |||
| export type UpdateFunction<T> = (id: string | number, item: T) => Observable<T>; | |||
| export enum FormMode { | |||
| Create = 'create', | |||
| Edit = 'edit' | |||
| } | |||
| @Directive() | |||
| export abstract class AbstractDataFormComponent<T extends { [key: string]: any }> implements OnInit { | |||
| @Input() data?: T; | |||
| @Input() mode: FormMode = FormMode.Create; | |||
| @Input() id?: string | number; | |||
| @Output() submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| protected form!: FormGroup; | |||
| constructor( | |||
| protected formConfig: FormGroup, | |||
| protected createFn: SaveFunction<T>, | |||
| protected updateFn: UpdateFunction<T> | |||
| ) { | |||
| this.form = formConfig; | |||
| } | |||
| ngOnInit(): void { | |||
| if (this.data) { | |||
| this.form.patchValue(this.data); | |||
| } else if (this.mode === FormMode.Create) { | |||
| this.data = this.getInitialData(); | |||
| this.form.patchValue(this.data); | |||
| } | |||
| } | |||
| protected abstract getInitialData(): T; | |||
| onSubmit(): void { | |||
| if (!this.form.valid) return; | |||
| const formData = this.form.value as T; | |||
| const request$ = this.mode === FormMode.Create | |||
| ? this.createFn(formData) | |||
| : this.updateFn(this.id!, formData); | |||
| request$.subscribe({ | |||
| next: () => { | |||
| // this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| }, | |||
| error: (error) => { | |||
| console.error('Error saving data:', error); | |||
| } | |||
| }); | |||
| } | |||
| isEditMode(): boolean { | |||
| return this.mode === FormMode.Edit; | |||
| } | |||
| } | |||
| @@ -5,7 +5,7 @@ | |||
| [hidePageSize]="hidePageSize" | |||
| [displayOptions]="displayOptions" | |||
| [defaultDisplayOption]="defaultDisplayOption" | |||
| [showCreateDataButton]="createDataComponent !== undefined" | |||
| [showCreateDataButton]="dataFormComponent !== undefined" | |||
| (createNewData)="onCreateData()" | |||
| (displayOptionChange)="onDisplayOptionChange($event)" | |||
| > | |||
| @@ -114,9 +114,20 @@ | |||
| </ng-container> | |||
| <ng-container *ngSwitchCase="COLUMN_TYPE_DETAIL_LINK"> | |||
| <a class="btn btn-primary spt-icon-details" data-type="user-tool" data-a3ction="edit" | |||
| <a *ngIf="!getCustomDetailLinkFunction" | |||
| class="btn btn-primary spt-icon-details" | |||
| data-type="user-tool" | |||
| data-action="edit" | |||
| target="_blank" | |||
| [routerLink]="[appHelperService.getLink(element, column.url)]"> | |||
| </a> | |||
| <a *ngIf="getCustomDetailLinkFunction" | |||
| class="btn btn-primary spt-icon-details" | |||
| data-type="user-tool" | |||
| data-action="edit" | |||
| target="_blank" | |||
| [routerLink]="['/' + getCustomDetailLinkFunction(element)]"> | |||
| </a> | |||
| </ng-container> | |||
| <ng-container *ngSwitchCase="COLUMN_TYPE_IMAGE"> | |||
| @@ -9,7 +9,7 @@ import {ListUpdateElementFunctionType} from "@app/_components/list/list-update-e | |||
| import {FilterBarComponent} from "@app/_components/filter-bar/filter-bar.component"; | |||
| import { Router } from '@angular/router'; | |||
| import {interval, Subscription} from "rxjs"; | |||
| import {AbstractCreateDataComponent} from "@app/_interfaces/AbstractCreateDataComponent"; | |||
| import {AbstractDataFormComponent} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| @Component({ | |||
| selector: 'app-list', | |||
| @@ -22,12 +22,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { | |||
| @Input() public getDataFunction!: ListGetDataFunctionType; | |||
| @Input() public onSortFunction!: Function; | |||
| @Input() public onNavigateToDetailsFunction!: Function; | |||
| @Input() public getCustomDetailLinkFunction!: Function; | |||
| @Input() public onRemoveItemFunction!: Function; | |||
| @Input() public onEditFunction!: Function; | |||
| @Input() public onDownloadFunction!: Function; | |||
| @Input() public onRowSelectedFunction!: Function; | |||
| @Input() public onUpdateBooleanStateFunction!: ListUpdateElementFunctionType; | |||
| @Input() public createDataComponent!: Type<AbstractCreateDataComponent<any>>; | |||
| @Input() public dataFormComponent!: Type<AbstractDataFormComponent<any>>; | |||
| @Input() public searchable: boolean; | |||
| @Input() public showDetailButton: boolean; | |||
| @Input() public showPosition: boolean; | |||
| @@ -98,8 +99,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { | |||
| this.listColDefinitions.unshift(ListComponent.getDefaultColPosition()); | |||
| } | |||
| if (this.showDetailButton) { | |||
| // this.listColDefinitions.unshift(ListComponent.getDefaultColDetailBtn()); | |||
| this.listColDefinitions.unshift(ListComponent.getDefaultColDetailBtnLink(this.router.routerState.snapshot.url)); | |||
| const url = this.getCustomDetailLinkFunction !== undefined ? '' : this.router.routerState.snapshot.url; | |||
| this.listColDefinitions.unshift(ListComponent.getDefaultColDetailBtnLink(url)); | |||
| } | |||
| if (this.displayOptions !== undefined) { | |||
| this.currentGroup = this.defaultDisplayOption || Object.keys(this.displayOptions)[0] || ''; | |||
| @@ -387,7 +388,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { | |||
| public onCreateData() { | |||
| this.appHelperService.openModal( | |||
| this.createDataComponent, | |||
| this.dataFormComponent, | |||
| null, | |||
| this.getData | |||
| ); | |||
| @@ -0,0 +1,3 @@ | |||
| import {Observable} from "rxjs"; | |||
| export type FetchDataFunction = (page: number, search?: string) => Observable<any>; | |||
| @@ -0,0 +1,39 @@ | |||
| <div class="paging-container"> | |||
| @if (showSearch) { | |||
| <div class="form-wrapper"> | |||
| <div class="search-controls"> | |||
| <input | |||
| type="text" | |||
| [(ngModel)]="searchTerm" | |||
| (ngModelChange)="onSearch($event)" | |||
| placeholder="SBC suchen..." | |||
| class="search-input" | |||
| > | |||
| @if (searchTerm) { | |||
| <button class="clear-button" (click)="clearSearch()">×</button> | |||
| } | |||
| </div> | |||
| </div> | |||
| } | |||
| <ng-content></ng-content> | |||
| <div class="paging-controls"> | |||
| @if (currentPage > 1) { | |||
| <button class="paging-button" (click)="goToFirstPage()"> <<</button> | |||
| <button class="paging-button" (click)="onPageChange(-1)"> <</button> | |||
| } | |||
| <span class="page-info"> | |||
| Seite {{ currentPage }} | |||
| </span> | |||
| @if (hasNextPage()) { | |||
| <button class="paging-button" (click)="onPageChange(1)"> ></button> | |||
| <button class="paging-button" (click)="goToLastPage()"> >></button> | |||
| } | |||
| <span class="total-info"> | |||
| {{ totalItems }} Einträge | |||
| </span> | |||
| </div> | |||
| </div> | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { SimplePagingComponent } from './simple-paging.component'; | |||
| describe('SimplePagingComponent', () => { | |||
| let component: SimplePagingComponent; | |||
| let fixture: ComponentFixture<SimplePagingComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| imports: [SimplePagingComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(SimplePagingComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,82 @@ | |||
| import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; | |||
| import { CommonModule } from '@angular/common'; | |||
| import { FormsModule } from '@angular/forms'; | |||
| import {FetchDataFunction} from "@app/_components/simple-paging/paging-get-data-function"; | |||
| @Component({ | |||
| selector: 'app-simple-paging', | |||
| standalone: true, | |||
| imports: [CommonModule, FormsModule], | |||
| templateUrl: './simple-paging.component.html', | |||
| styleUrls: ['./simple-paging.component.scss'] | |||
| }) | |||
| export class SimplePagingComponent implements OnInit { | |||
| @Input({ required: true }) fetchDataFunction!: FetchDataFunction; | |||
| @Input() showSearch: boolean = true; | |||
| @Output() dataChange = new EventEmitter<any[]>(); | |||
| protected searchTerm = ''; | |||
| protected totalItems = 0; | |||
| protected currentPage = 1; | |||
| protected lastPage = 1; | |||
| ngOnInit() { | |||
| this.loadData(); | |||
| } | |||
| protected loadData() { | |||
| this.fetchDataFunction(this.currentPage, this.searchTerm || undefined).subscribe({ | |||
| next: (data) => { | |||
| this.totalItems = data.totalItems ?? 0; | |||
| if (data.view?.last) { | |||
| const pageMatch = data.view?.last.match(/page=(\d+)/); | |||
| if (pageMatch) { | |||
| this.lastPage = parseInt(pageMatch[1]); | |||
| } | |||
| } | |||
| this.dataChange.emit(data.member); | |||
| }, | |||
| error: (error) => { | |||
| console.error('Error loading data:', error); | |||
| } | |||
| }); | |||
| } | |||
| protected onPageChange(step: number) { | |||
| this.currentPage += step; | |||
| this.loadData(); | |||
| } | |||
| protected onSearch(term: string) { | |||
| this.searchTerm = term; | |||
| this.currentPage = 1; | |||
| this.loadData(); | |||
| } | |||
| protected hasNextPage(): boolean { | |||
| return this.currentPage < this.lastPage; | |||
| } | |||
| protected goToFirstPage() { | |||
| if (this.currentPage !== 1) { | |||
| this.currentPage = 1; | |||
| this.loadData(); | |||
| } | |||
| } | |||
| protected goToLastPage() { | |||
| if (this.currentPage !== this.lastPage) { | |||
| this.currentPage = this.lastPage; | |||
| this.loadData(); | |||
| } | |||
| } | |||
| protected clearSearch() { | |||
| if (this.searchTerm) { | |||
| this.searchTerm = ''; | |||
| this.currentPage = 1; | |||
| this.loadData(); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,17 +0,0 @@ | |||
| import { TestBed } from '@angular/core/testing'; | |||
| import { CanActivateFn } from '@angular/router'; | |||
| import { gameAccountOwnerGuard } from './game-account-owner.guard'; | |||
| describe('gameAccountOwnerGuard', () => { | |||
| const executeGuard: CanActivateFn = (...guardParameters) => | |||
| TestBed.runInInjectionContext(() => gameAccountOwnerGuard(...guardParameters)); | |||
| beforeEach(() => { | |||
| TestBed.configureTestingModule({}); | |||
| }); | |||
| it('should be created', () => { | |||
| expect(executeGuard).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -1,27 +0,0 @@ | |||
| import { CanActivateFn, Router } from '@angular/router'; | |||
| import { inject } from "@angular/core"; | |||
| import { map } from 'rxjs/operators'; | |||
| import {GameAccountService} from "@app/core/api/v1"; | |||
| export const gameAccountOwnerGuard: CanActivateFn = (route, state) => { | |||
| const gameAccountService = inject(GameAccountService); | |||
| const router = inject(Router); | |||
| const gameAccountId = route.paramMap.get('id'); | |||
| if (!gameAccountId) { | |||
| router.navigate(['/error']); // Oder eine andere geeignete Route | |||
| return false; | |||
| } | |||
| return gameAccountService.gameAccountsIdGet(gameAccountId).pipe( | |||
| map(gameAccount => { | |||
| return true; | |||
| // if (isOwner) { | |||
| // return true; | |||
| // } else { | |||
| // router.navigate(['/' + ROUTE_DASHBOARD]); // Oder eine andere geeignete Route | |||
| // return false; | |||
| // } | |||
| }) | |||
| ); | |||
| }; | |||
| @@ -1,116 +0,0 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {TranslateService} from "@ngx-translate/core"; | |||
| import {PriceError} from "@app/_models/priceError"; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class PriceCalculatorService { | |||
| constructor( | |||
| protected translateService: TranslateService, | |||
| ) { | |||
| } | |||
| public getCorrectPrice(event: FocusEvent, form: FormGroup) { | |||
| const eventElement = event.target as HTMLInputElement; | |||
| if (form.get(eventElement.id)?.value !== null && form.get(eventElement.id)?.value !== '') { | |||
| let validPrice = this.calculateValidPrice(Number(eventElement.value)); | |||
| form.get(eventElement.id)?.setValue(validPrice); | |||
| } | |||
| } | |||
| public calculateValidPrice(price: number): number { | |||
| price = Math.floor(price); | |||
| if (price < 150) return 150; | |||
| if (price < 1000) return price - (price % 50); | |||
| if (price < 10000) return price - (price % 100); | |||
| if (price < 50000) return price - (price % 250); | |||
| if (price < 100000) return price - (price % 500); | |||
| return price - (price % 1000); | |||
| } | |||
| public checkPriceConstellation( | |||
| sellStartingBid: number | string, | |||
| sellPriceBin: number | string, | |||
| lastFoundMinRange: number | string | undefined, | |||
| lastFoundMaxRange: number | string | undefined, | |||
| ): PriceError { | |||
| let res = { | |||
| message: '', | |||
| error: false | |||
| } as PriceError; | |||
| if ((sellStartingBid !== null && sellStartingBid !== '') && (sellPriceBin === null || sellPriceBin === '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellPriceBinSellStartingBid'); | |||
| return res; | |||
| } | |||
| if ((sellPriceBin !== null && sellPriceBin !== '') && (sellStartingBid === null || sellStartingBid === '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellStartingBidSellPriceBin'); | |||
| return res; | |||
| } | |||
| if (sellPriceBin <= sellStartingBid && (sellStartingBid !== null && sellStartingBid !== '') && (sellPriceBin !== null && sellPriceBin !== '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellPriceBinSmallerSellStartingBid'); | |||
| return res; | |||
| } | |||
| if (sellStartingBid >= sellPriceBin && (sellStartingBid !== null && sellStartingBid !== '') && (sellPriceBin !== null && sellPriceBin !== '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellStartingBidLargerSellPriceBin'); | |||
| return res; | |||
| } | |||
| if (lastFoundMinRange) { | |||
| if (sellStartingBid < lastFoundMinRange && (sellStartingBid !== null && sellStartingBid !== '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellStartingBidSmallerLastFoundMinRange'); | |||
| return res; | |||
| } | |||
| } | |||
| if (lastFoundMaxRange) { | |||
| if (sellPriceBin > lastFoundMaxRange && (sellPriceBin !== null && sellPriceBin !== '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellPriceBinLargerLastFoundMaxRange'); | |||
| return res; | |||
| } | |||
| } | |||
| if (lastFoundMinRange && lastFoundMaxRange) { | |||
| if (lastFoundMaxRange <= lastFoundMinRange) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.sellStartingBidSellPriceBin'); | |||
| return res; | |||
| } | |||
| if (lastFoundMinRange >= lastFoundMaxRange) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.lastFoundMinRangeLargerLastFoundMaxRange'); | |||
| return res; | |||
| } | |||
| if ((lastFoundMinRange !== '') && (lastFoundMaxRange === '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.lastFoundMaxRangeLastFoundMinRange'); | |||
| return res; | |||
| } | |||
| if ((lastFoundMaxRange !== null && lastFoundMaxRange !== '') && (lastFoundMinRange === '')) { | |||
| res.error = true; | |||
| res.message = this.translateService.instant('errors.lastFoundMinRangeLastFoundMaxRange'); | |||
| return res; | |||
| } | |||
| } | |||
| return res; | |||
| } | |||
| } | |||
| @@ -1,20 +0,0 @@ | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {Directive, EventEmitter} from "@angular/core"; | |||
| import {CreateDataComponentInterface} from "@app/_interfaces/CreateDataComponentInterface"; | |||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | |||
| @Directive() | |||
| export abstract class AbstractCreateDataComponent<T> implements CreateDataComponentInterface<T> { | |||
| data!: T; | |||
| submit = new EventEmitter<ModalStatus>(); | |||
| form!: FormGroup; | |||
| ngOnInit(): void { | |||
| this.data = this.getInitialData(); | |||
| this.form = FormGroupInitializer.initFormGroup(this.form, this.data); | |||
| } | |||
| abstract getInitialData(): T; | |||
| abstract onSubmit(): void; | |||
| } | |||
| @@ -1,12 +1,16 @@ | |||
| import {FormMode} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| import {EventEmitter} from "@angular/core"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {EventEmitter} from "@angular/core"; | |||
| export interface CreateDataComponentInterface<T> { | |||
| data: T; | |||
| export interface DataFormComponent<T> { | |||
| data?: T; | |||
| mode: FormMode; | |||
| id?: string | number; | |||
| submit: EventEmitter<ModalStatus>; | |||
| form: FormGroup; | |||
| onSubmit(): void; | |||
| ngOnInit(): void; | |||
| getInitialData(): T; | |||
| isEditMode(): boolean; | |||
| } | |||
| @@ -1,65 +0,0 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import {HttpClient, HttpHeaders} from "@angular/common/http"; | |||
| import {User} from "@app/_models"; | |||
| import {environment} from "@environments/environment"; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class DataImportService { | |||
| constructor( | |||
| private httpClient: HttpClient | |||
| ) { | |||
| } | |||
| futwizImport( | |||
| futwizCandidateUrl: string, | |||
| futbinCandidateUrl: string, | |||
| updateCandidate: boolean = false, | |||
| buyCandidate: boolean = false, | |||
| relevantCandidate: boolean = false, | |||
| futwizCandidateHtml: string | null, | |||
| bid: number | null, | |||
| bin: number | null, | |||
| optionalEaResourceId: number | null, | |||
| ) { | |||
| const formData = new FormData(); | |||
| formData.append('futwizCandidateUrl', futwizCandidateUrl); | |||
| formData.append('futbinCandidateUrl', futbinCandidateUrl); | |||
| formData.append('updateCandidate', updateCandidate ? '1' : '0'); | |||
| formData.append('buyCandidate', buyCandidate ? '1' : '0'); | |||
| formData.append('relevantCandidate', relevantCandidate ? '1' : '0'); | |||
| if (futwizCandidateHtml !== null && futwizCandidateHtml !== "") { | |||
| formData.append('futwizCandidateHtml', futwizCandidateHtml); | |||
| } | |||
| if (bid !== null) { | |||
| formData.append('bid', bid.toString()); | |||
| } | |||
| if (bin !== null) { | |||
| formData.append('bin', bin.toString()); | |||
| } | |||
| if (optionalEaResourceId !== null) { | |||
| formData.append('optionalEaResourceId', optionalEaResourceId.toString()); | |||
| } | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/data-import/import-futwiz-player`, | |||
| formData | |||
| ); | |||
| } | |||
| eaDataImport() { | |||
| return this.httpClient.get( | |||
| `${environment.apiUrl}/data-import/import-ea-data` | |||
| ); | |||
| } | |||
| futwizRaritiesImport() { | |||
| return this.httpClient.get( | |||
| `${environment.apiUrl}/data-import/import-futwiz-rarities` | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,35 +0,0 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import {HttpClient, HttpHeaders} from "@angular/common/http"; | |||
| import {User} from "@app/_models"; | |||
| import {environment} from "@environments/environment"; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class EaDataConnectService { | |||
| constructor( | |||
| private httpClient: HttpClient | |||
| ) { | |||
| } | |||
| connectAccount(accountId: string) { | |||
| const formData = new FormData(); | |||
| formData.append('accountId', accountId.toString()); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/ea-data-connect/connect-account`, | |||
| formData | |||
| ); | |||
| } | |||
| deleteCachefile(accountId: string) { | |||
| const formData = new FormData(); | |||
| formData.append('accountId', accountId.toString()); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/ea-data-connect/delete-cache-file`, | |||
| formData | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import {HttpClient, HttpHeaders} from "@angular/common/http"; | |||
| import {User} from "@app/_models"; | |||
| import {environment} from "@environments/environment"; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class SnipingService { | |||
| constructor( | |||
| private httpClient: HttpClient | |||
| ) { | |||
| } | |||
| snipingPrepare( | |||
| accountIdsJson: number[] | |||
| ) { | |||
| const formData = new FormData(); | |||
| formData.append('accountIdsJson', JSON.stringify(accountIdsJson)); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/sniping/prepare`, | |||
| formData | |||
| ); | |||
| } | |||
| snipingExecute( | |||
| eaResourceId: number, | |||
| snipeTimeMin: number, | |||
| snipeTimeMax: number, | |||
| buyItemsMax: number, | |||
| buyBin: number, | |||
| sellBin: number, | |||
| accountIdsJson: number[], | |||
| round: number, | |||
| gapTimeMin: number, | |||
| gapTimeMax: number, | |||
| putOnTpOnly: boolean, | |||
| priceCheckBin: number | undefined, | |||
| doPriceCheck: boolean, | |||
| ) { | |||
| const formData = new FormData(); | |||
| formData.append('eaResourceId', eaResourceId.toString()); | |||
| formData.append('snipeTimeMin', snipeTimeMin.toString()); | |||
| formData.append('snipeTimeMax', snipeTimeMax.toString()); | |||
| formData.append('buyItemsMax', buyItemsMax.toString()); | |||
| formData.append('buyBin', buyBin.toString()); | |||
| formData.append('sellBin', sellBin.toString()); | |||
| formData.append('accountIdsJson', JSON.stringify(accountIdsJson)); | |||
| formData.append('round', round.toString()); | |||
| formData.append('gapTimeMin', gapTimeMin.toString()); | |||
| formData.append('gapTimeMax', gapTimeMax.toString()); | |||
| formData.append('putOnTpOnly', putOnTpOnly ? "1" : "0"); | |||
| if (priceCheckBin) { | |||
| formData.append('priceCheckBin', priceCheckBin.toString()); | |||
| } | |||
| formData.append('doPriceCheck', doPriceCheck ? "1" : "0"); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/sniping/execute`, | |||
| formData | |||
| ); | |||
| } | |||
| snipingStop( | |||
| accountIdsJson: number[] | |||
| ) { | |||
| const formData = new FormData(); | |||
| formData.append('accountIdsJson', JSON.stringify(accountIdsJson)); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/sniping/stop`, | |||
| formData | |||
| ); | |||
| } | |||
| checkPrice( | |||
| accountId: number, | |||
| eaResourceId: number, | |||
| priceCheckBin: number, | |||
| ) { | |||
| const formData = new FormData(); | |||
| formData.append('accountId', accountId.toString()); | |||
| formData.append('eaResourceId', eaResourceId.toString()); | |||
| formData.append('priceCheckBin', priceCheckBin.toString()); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/sniping/check-bin-price`, | |||
| formData | |||
| ); | |||
| } | |||
| updateAccountSnipingCounts() { | |||
| const formData = new FormData(); | |||
| return this.httpClient.post( | |||
| `${environment.apiUrl}/sniping/update-account-sniping-counts`, | |||
| formData | |||
| ); | |||
| } | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| @if (location) { | |||
| <div class="spt-container"> | |||
| <app-location-form | |||
| [data]="location" | |||
| [mode]="FormMode.Edit" | |||
| [id]="appHelperService.extractId(location.id!)" | |||
| (submit)="onFormSubmit()" | |||
| ></app-location-form> | |||
| <div class="mt-4 flex gap-2"> | |||
| <button (click)="apiDeleteLocation()" class="spt-button spt-button-danger"> | |||
| {{ 'basic.delete' | translate }} {{ 'model.location' | translate }} | |||
| </button> | |||
| </div> | |||
| </div> | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { LocationDetailComponent } from './location-detail.component'; | |||
| describe('LocationDetailComponent', () => { | |||
| let component: LocationDetailComponent; | |||
| let fixture: ComponentFixture<LocationDetailComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [LocationDetailComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(LocationDetailComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,55 @@ | |||
| import {Component, OnInit} from '@angular/core'; | |||
| import {LocationJsonld, LocationService} from "@app/core/api/v1"; | |||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | |||
| import {ActivatedRoute, Router} from "@angular/router"; | |||
| import {ROUTE_LOCATIONS} from "@app/app-routing.module"; | |||
| import {TranslateService} from "@ngx-translate/core"; | |||
| import {FormMode} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| @Component({ | |||
| selector: 'app-location-detail', | |||
| templateUrl: './location-detail.component.html' | |||
| }) | |||
| export class LocationDetailComponent implements OnInit { | |||
| protected location!: LocationJsonld; | |||
| protected readonly FormMode = FormMode; | |||
| constructor( | |||
| private locationService: LocationService, | |||
| protected appHelperService: AppHelperService, | |||
| protected translateService: TranslateService, | |||
| private route: ActivatedRoute, | |||
| protected router: Router | |||
| ) {} | |||
| ngOnInit() { | |||
| this.route.params.subscribe(params => { | |||
| this.apiGetLocationData(params['id']); | |||
| }); | |||
| } | |||
| apiGetLocationData(locationId: string) { | |||
| this.locationService.locationsIdGet(locationId).subscribe( | |||
| data => { | |||
| console.log(data); | |||
| this.location = data; | |||
| } | |||
| ); | |||
| } | |||
| apiDeleteLocation() { | |||
| this.translateService.get('basic.delete_confirm').subscribe((confirmMessage: string) => { | |||
| if (confirm(confirmMessage)) { | |||
| this.locationService.locationsIdDelete( | |||
| this.appHelperService.extractId(this.location.id!) | |||
| ).subscribe(() => { | |||
| this.router.navigate(['/' + ROUTE_LOCATIONS]); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| onFormSubmit() { | |||
| this.apiGetLocationData(this.appHelperService.extractId(this.location.id!)); | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| <h2>{{ 'basic.new' | translate }} {{ 'model.location' | translate }}</h2> | |||
| <h2>{{ (isEditMode() ? 'basic.edit' : 'basic.new') | translate }} {{ 'model.location' | translate }}</h2> | |||
| <div class="spt-form"> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| @@ -11,19 +11,20 @@ | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="zone" class="form-label">{{ 'model.zone' | translate }}:</label> | |||
| <app-search-select #locationSearchSelect | |||
| [formId]="'zone'" | |||
| [formLabelLangKey]="'model.zone'" | |||
| [documentForm]="form" | |||
| [getDataFunction]="getZones" | |||
| [displayedDataField]="'name'" | |||
| [listColDefinitions]="zoneColDefinitions" | |||
| <app-search-select #zoneSearchSelect | |||
| [formId]="'zone'" | |||
| [formLabelLangKey]="'model.zone'" | |||
| [documentForm]="form" | |||
| [getDataFunction]="getZones" | |||
| [displayedDataField]="'name'" | |||
| [listColDefinitions]="zoneColDefinitions" | |||
| [dataSet]="data?.zone" | |||
| > | |||
| </app-search-select> | |||
| <input id="zone" type="hidden" formControlName="zone"/> | |||
| </div> | |||
| <button type="submit" class="btn btn-primary" [disabled]="form.invalid"> | |||
| {{ 'basic.send' | translate }} | |||
| {{ (isEditMode() ? 'basic.save' : 'basic.create') | translate }} | |||
| </button> | |||
| </form> | |||
| </div> | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { LocationFormComponent } from './location-form.component'; | |||
| describe('LocationFormComponent', () => { | |||
| let component: LocationFormComponent; | |||
| let fixture: ComponentFixture<LocationFormComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [LocationFormComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(LocationFormComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,37 @@ | |||
| import { Component } from '@angular/core'; | |||
| import {AbstractDataFormComponent} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| import {LocationJsonld, LocationService, ZoneService} from "@app/core/api/v1"; | |||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | |||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||
| import {locationForm} from "@app/_forms/apiForms"; | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| @Component({ | |||
| selector: 'app-location-form', | |||
| templateUrl: './location-form.component.html' | |||
| }) | |||
| export class LocationFormComponent extends AbstractDataFormComponent<LocationJsonld> { | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| protected zoneColDefinitions: ListColDefinition[]; | |||
| constructor( | |||
| private locationService: LocationService, | |||
| private zoneService: ZoneService | |||
| ) { | |||
| super( | |||
| locationForm, | |||
| (data: LocationJsonld) => locationService.locationsPost(data), | |||
| (id: string | number, data: LocationJsonld) => locationService.locationsIdPatch(id.toString(), data) | |||
| ); | |||
| this.zoneColDefinitions = SearchSelectComponent.getDefaultColDefZones(); | |||
| } | |||
| protected override getInitialData(): LocationJsonld { | |||
| return {} as LocationJsonld; | |||
| } | |||
| getZones: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.zoneService.zonesGetCollection(index, pageSize, term); | |||
| } | |||
| } | |||
| @@ -2,9 +2,9 @@ | |||
| <app-list #listComponent | |||
| [listId]="'locationList'" | |||
| [getDataFunction]="getData" | |||
| [onNavigateToDetailsFunction]="navigateToLocationDetail" | |||
| [getCustomDetailLinkFunction]="getCustomDetailLink" | |||
| [onSortFunction]="onSortChange" | |||
| [listColDefinitions]="listColDefinitions" | |||
| [createDataComponent]="LocationNewComponent" | |||
| [dataFormComponent]="LocationFormComponent" | |||
| ></app-list> | |||
| </div> | |||
| @@ -1,16 +1,13 @@ | |||
| import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | |||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||
| import {ListComponent} from "@app/_components/list/list.component"; | |||
| import {LocationJsonld, LocationService, UserService} from "@app/core/api/v1"; | |||
| import {Router} from "@angular/router"; | |||
| import {LocationJsonld, LocationService} from "@app/core/api/v1"; | |||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | |||
| import {OrderFilter} from "@app/_models/orderFilter"; | |||
| import {FilterBarComponent} from "@app/_components/filter-bar/filter-bar.component"; | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| import {ROUTE_LOCATIONS} from "@app/app-routing.module"; | |||
| import {Sort} from "@angular/material/sort"; | |||
| import {ZoneNewComponent} from "@app/_views/zone/zone-new/zone-new.component"; | |||
| import {LocationNewComponent} from "@app/_views/location/location-new/location-new.component"; | |||
| import {LocationFormComponent} from "@app/_views/location/location-form/location-form.component"; | |||
| @Component({ | |||
| selector: 'app-location-list', | |||
| @@ -20,12 +17,12 @@ import {LocationNewComponent} from "@app/_views/location/location-new/location-n | |||
| export class LocationListComponent implements OnInit, AfterViewInit { | |||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||
| protected readonly LocationNewComponent = LocationNewComponent; | |||
| protected readonly LocationFormComponent = LocationFormComponent; | |||
| protected listColDefinitions!: ListColDefinition[]; | |||
| constructor( | |||
| private locationService: LocationService, | |||
| private router: Router, | |||
| protected appHelperService: AppHelperService, | |||
| ) { | |||
| @@ -91,10 +88,7 @@ export class LocationListComponent implements OnInit, AfterViewInit { | |||
| onSortChange = (sortState: Sort) => { | |||
| } | |||
| navigateToLocationDetail = (element: any) => { | |||
| const location: LocationJsonld = element as LocationJsonld; | |||
| this.router.navigate(['/' + ROUTE_LOCATIONS, this.appHelperService.extractId(location.id)]); | |||
| getCustomDetailLink(element: LocationJsonld) { | |||
| return ROUTE_LOCATIONS + '/' + this.appHelperService.extractId(element?.id); | |||
| } | |||
| } | |||
| @@ -1,66 +0,0 @@ | |||
| import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | |||
| import {AbstractCreateDataComponent} from "@app/_interfaces/AbstractCreateDataComponent"; | |||
| import {LocationJsonld, LocationService, ZoneService} from "@app/core/api/v1"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {locationForm} from "@app/_forms/apiForms"; | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | |||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||
| @Component({ | |||
| selector: 'app-location-new', | |||
| templateUrl: './location-new.component.html', | |||
| styleUrl: './location-new.component.scss' | |||
| }) | |||
| export class LocationNewComponent extends AbstractCreateDataComponent<LocationJsonld> implements OnInit { | |||
| @Input() public override data!: LocationJsonld; | |||
| @Output() public override submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| override form: FormGroup = locationForm; | |||
| protected zoneColDefinitions: ListColDefinition[]; | |||
| constructor( | |||
| private locationService: LocationService, | |||
| private zoneService: ZoneService, | |||
| ) { | |||
| super(); | |||
| this.zoneColDefinitions = SearchSelectComponent.getDefaultColDefZones(); | |||
| } | |||
| override ngOnInit() { | |||
| if (this.data) { | |||
| this.form.patchValue(this.data); | |||
| } | |||
| } | |||
| getInitialData(): LocationJsonld { | |||
| return {} as LocationJsonld; | |||
| } | |||
| getZones: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.zoneService.zonesGetCollection( | |||
| index, | |||
| pageSize, | |||
| term | |||
| ); | |||
| } | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| console.log(this.form); | |||
| console.log(this.form.value as LocationJsonld); | |||
| this.locationService.locationsPost( | |||
| this.form.value as LocationJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| <p>shipping-company-detail works!</p> | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { ShippingCompanyDetailComponent } from './shipping-company-detail.component'; | |||
| describe('ShippingCompanyDetailComponent', () => { | |||
| let component: ShippingCompanyDetailComponent; | |||
| let fixture: ComponentFixture<ShippingCompanyDetailComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [ShippingCompanyDetailComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(ShippingCompanyDetailComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,10 @@ | |||
| import { Component } from '@angular/core'; | |||
| @Component({ | |||
| selector: 'app-shipping-company-detail', | |||
| templateUrl: './shipping-company-detail.component.html', | |||
| styleUrl: './shipping-company-detail.component.scss' | |||
| }) | |||
| export class ShippingCompanyDetailComponent { | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| <h2>{{ (isEditMode() ? 'basic.edit' : 'basic.new') | translate }} {{ 'model.shipping_company' | translate }}</h2> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| <label for="name" class="form-label">{{ 'common.name' | translate }}*:</label> | |||
| <input type="text" | |||
| class="form-control" | |||
| id="name" | |||
| formControlName="name"> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="code" class="form-label">{{ 'common.code' | translate }}*:</label> | |||
| <input type="text" | |||
| class="form-control" | |||
| id="code" | |||
| formControlName="code"> | |||
| </div> | |||
| <button type="submit" | |||
| class="btn btn-primary" | |||
| [disabled]="form.invalid"> | |||
| {{ (isEditMode() ? 'basic.save' : 'basic.create') | translate }} | |||
| </button> | |||
| </form> | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { ShippingCompanyFormComponent } from './shipping-company-form.component'; | |||
| describe('ShippingCompanyFormComponent', () => { | |||
| let component: ShippingCompanyFormComponent; | |||
| let fixture: ComponentFixture<ShippingCompanyFormComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [ShippingCompanyFormComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(ShippingCompanyFormComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,24 @@ | |||
| import { Component } from '@angular/core'; | |||
| import { ShippingCompanyJsonld, ShippingCompanyService } from "@app/core/api/v1"; | |||
| import { shippingCompanyForm } from "@app/_forms/apiForms"; | |||
| import {AbstractDataFormComponent} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| @Component({ | |||
| selector: 'app-shipping-company-form', | |||
| templateUrl: './shipping-company-form.component.html' | |||
| }) | |||
| export class ShippingCompanyFormComponent extends AbstractDataFormComponent<ShippingCompanyJsonld> { | |||
| constructor( | |||
| private shippingCompanyService: ShippingCompanyService | |||
| ) { | |||
| super( | |||
| shippingCompanyForm, | |||
| (data: ShippingCompanyJsonld) => shippingCompanyService.shippingCompaniesPost(data), | |||
| (id: string | number, data: ShippingCompanyJsonld) => shippingCompanyService.shippingCompaniesIdPatch(id.toString(), data) | |||
| ); | |||
| } | |||
| protected override getInitialData(): ShippingCompanyJsonld { | |||
| return {} as ShippingCompanyJsonld; | |||
| } | |||
| } | |||
| @@ -5,6 +5,6 @@ | |||
| [onNavigateToDetailsFunction]="navigateToZoneDetail" | |||
| [onSortFunction]="onSortChange" | |||
| [listColDefinitions]="listColDefinitions" | |||
| [createDataComponent]="ShippingCompanyNewComponent" | |||
| [dataFormComponent]="ShippingCompanyFormComponent" | |||
| ></app-list> | |||
| </div> | |||
| @@ -12,9 +12,8 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||
| import {Sort} from "@angular/material/sort"; | |||
| import {ROUTE_SHIPPING_COMPANIES} from "@app/app-routing.module"; | |||
| import { | |||
| ShippingCompanyNewComponent | |||
| } from "@app/_views/shipping-company/shipping-company-new/shipping-company-new.component"; | |||
| import {ZoneNewComponent} from "@app/_views/zone/zone-new/zone-new.component"; | |||
| ShippingCompanyFormComponent | |||
| } from "@app/_views/shipping-company/shipping-company-form/shipping-company-form.component"; | |||
| @Component({ | |||
| selector: 'app-shipping-company-list', | |||
| @@ -24,7 +23,7 @@ import {ZoneNewComponent} from "@app/_views/zone/zone-new/zone-new.component"; | |||
| export class ShippingCompanyListComponent { | |||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||
| protected readonly ShippingCompanyNewComponent = ShippingCompanyNewComponent; | |||
| protected readonly ShippingCompanyFormComponent = ShippingCompanyFormComponent; | |||
| protected listColDefinitions!: ListColDefinition[]; | |||
| constructor( | |||
| @@ -91,5 +90,4 @@ export class ShippingCompanyListComponent { | |||
| const shippingCompany: ShippingCompanyJsonld = element as ShippingCompanyJsonld; | |||
| this.router.navigate(['/' + ROUTE_SHIPPING_COMPANIES, this.appHelperService.extractId(shippingCompany.id)]); | |||
| } | |||
| protected readonly ZoneNewComponent = ZoneNewComponent; | |||
| } | |||
| @@ -1,23 +0,0 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { ShippingCompanyNewComponent } from './shipping-company-new.component'; | |||
| describe('ShippingCompanyNewComponent', () => { | |||
| let component: ShippingCompanyNewComponent; | |||
| let fixture: ComponentFixture<ShippingCompanyNewComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [ShippingCompanyNewComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(ShippingCompanyNewComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -1,41 +0,0 @@ | |||
| import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | |||
| import {AbstractCreateDataComponent} from "@app/_interfaces/AbstractCreateDataComponent"; | |||
| import {LocationJsonld, ShippingCompanyJsonld, ShippingCompanyService} from "@app/core/api/v1"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {shippingCompanyForm} from "@app/_forms/apiForms"; | |||
| @Component({ | |||
| selector: 'app-shipping-company-new', | |||
| templateUrl: './shipping-company-new.component.html', | |||
| styleUrl: './shipping-company-new.component.scss' | |||
| }) | |||
| export class ShippingCompanyNewComponent extends AbstractCreateDataComponent<ShippingCompanyJsonld> implements OnInit { | |||
| @Input() public override data!: ShippingCompanyJsonld; | |||
| @Output() public override submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| override form: FormGroup = shippingCompanyForm; | |||
| constructor( | |||
| private shippingCompanyService: ShippingCompanyService | |||
| ) { | |||
| super(); | |||
| } | |||
| getInitialData(): ShippingCompanyJsonld { | |||
| return {} as ShippingCompanyJsonld; | |||
| } | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| this.shippingCompanyService.shippingCompaniesPost( | |||
| this.form.value as ShippingCompanyJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| <p>vessel-detail works!</p> | |||
| @@ -0,0 +1,23 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { VesselDetailComponent } from './vessel-detail.component'; | |||
| describe('VesselDetailComponent', () => { | |||
| let component: VesselDetailComponent; | |||
| let fixture: ComponentFixture<VesselDetailComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [VesselDetailComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(VesselDetailComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| it('should create', () => { | |||
| expect(component).toBeTruthy(); | |||
| }); | |||
| }); | |||
| @@ -0,0 +1,10 @@ | |||
| import { Component } from '@angular/core'; | |||
| @Component({ | |||
| selector: 'app-vessel-detail', | |||
| templateUrl: './vessel-detail.component.html', | |||
| styleUrl: './vessel-detail.component.scss' | |||
| }) | |||
| export class VesselDetailComponent { | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| <h2>{{ (isEditMode() ? 'basic.edit' : 'basic.new') | translate }} {{ 'model.vessel' | translate }}</h2> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| <label for="name" class="form-label">{{ 'common.name' | translate }}*:</label> | |||
| <input type="text" | |||
| class="form-control" | |||
| id="name" | |||
| formControlName="name"> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="code" class="form-label">{{ 'common.code' | translate }}*:</label> | |||
| <input type="text" | |||
| class="form-control" | |||
| id="code" | |||
| formControlName="code"> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="company" class="form-label">{{ 'model.shipping_company' | translate }}:</label> | |||
| <app-search-select #shippingCompanySearchSelect | |||
| [formId]="'company'" | |||
| [formLabelLangKey]="'model.shipping_company'" | |||
| [documentForm]="form" | |||
| [getDataFunction]="getShippingCompanies" | |||
| [displayedDataField]="'name'" | |||
| [listColDefinitions]="shippingCompanyColDefinitions"> | |||
| </app-search-select> | |||
| </div> | |||
| <button type="submit" | |||
| class="btn btn-primary" | |||
| [disabled]="form.invalid"> | |||
| {{ (isEditMode() ? 'basic.save' : 'basic.create') | translate }} | |||
| </button> | |||
| </form> | |||
| @@ -1,18 +1,18 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { VesselNewComponent } from './vessel-new.component'; | |||
| import { VesselFormComponent } from './vessel-form.component'; | |||
| describe('VesselNewComponent', () => { | |||
| let component: VesselNewComponent; | |||
| let fixture: ComponentFixture<VesselNewComponent>; | |||
| describe('VesselFormComponent', () => { | |||
| let component: VesselFormComponent; | |||
| let fixture: ComponentFixture<VesselFormComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [VesselNewComponent] | |||
| declarations: [VesselFormComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(VesselNewComponent); | |||
| fixture = TestBed.createComponent(VesselFormComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| @@ -0,0 +1,41 @@ | |||
| import { Component } from '@angular/core'; | |||
| import { VesselJsonld, VesselService, ShippingCompanyService } from "@app/core/api/v1"; | |||
| import { vesselForm } from "@app/_forms/apiForms"; | |||
| import { SearchSelectComponent } from "@app/_components/search-select/search-select.component"; | |||
| import { ListGetDataFunctionType } from "@app/_components/list/list-get-data-function-type"; | |||
| import { ListColDefinition } from "@app/_components/list/list-col-definition"; | |||
| import {AbstractDataFormComponent} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| @Component({ | |||
| selector: 'app-vessel-form', | |||
| templateUrl: './vessel-form.component.html' | |||
| }) | |||
| export class VesselFormComponent extends AbstractDataFormComponent<VesselJsonld> { | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| protected shippingCompanyColDefinitions: ListColDefinition[]; | |||
| constructor( | |||
| private vesselService: VesselService, | |||
| private shippingCompanyService: ShippingCompanyService | |||
| ) { | |||
| super( | |||
| vesselForm, | |||
| (data: VesselJsonld) => vesselService.vesselsPost(data), | |||
| (id: string | number, data: VesselJsonld) => vesselService.vesselsIdPatch(id.toString(), data) | |||
| ); | |||
| this.shippingCompanyColDefinitions = SearchSelectComponent.getDefaultColDefShippingCompanies(); | |||
| } | |||
| protected override getInitialData(): VesselJsonld { | |||
| return {} as VesselJsonld; | |||
| } | |||
| getShippingCompanies: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.shippingCompanyService.shippingCompaniesGetCollection( | |||
| index, | |||
| pageSize, | |||
| term | |||
| ); | |||
| } | |||
| } | |||
| @@ -5,6 +5,6 @@ | |||
| [onNavigateToDetailsFunction]="navigateToVesselDetail" | |||
| [onSortFunction]="onSortChange" | |||
| [listColDefinitions]="listColDefinitions" | |||
| [createDataComponent]="VesselNewComponent" | |||
| [dataFormComponent]="VesselFormComponent" | |||
| ></app-list> | |||
| </div> | |||
| @@ -8,7 +8,7 @@ import {FilterBarComponent} from "@app/_components/filter-bar/filter-bar.compone | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| import {Sort} from "@angular/material/sort"; | |||
| import {ROUTE_VESSELS} from "@app/app-routing.module"; | |||
| import {VesselNewComponent} from "@app/_views/vessel/vessel-new/vessel-new.component"; | |||
| import {VesselFormComponent} from "@app/_views/vessel/vessel-form/vessel-form.component"; | |||
| @Component({ | |||
| selector: 'app-vessel-list', | |||
| @@ -18,7 +18,7 @@ import {VesselNewComponent} from "@app/_views/vessel/vessel-new/vessel-new.compo | |||
| export class VesselListComponent { | |||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||
| protected readonly VesselNewComponent = VesselNewComponent; | |||
| protected readonly VesselFormComponent = VesselFormComponent; | |||
| protected listColDefinitions!: ListColDefinition[]; | |||
| constructor( | |||
| @@ -93,4 +93,5 @@ export class VesselListComponent { | |||
| const vessel: VesselJsonld = element as VesselJsonld; | |||
| this.router.navigate(['/' + ROUTE_VESSELS, this.appHelperService.extractId(vessel.id)]); | |||
| } | |||
| } | |||
| @@ -1,29 +0,0 @@ | |||
| <h2>{{ 'basic.new' | translate }} {{ 'model.vessel' | translate }}</h2> | |||
| <div class="spt-form"> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| <label for="name" class="form-label">{{ 'common.name' | translate }}*:</label> | |||
| <input type="text" class="form-control" id="name" formControlName="name" required/> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="code" class="form-label">{{ 'common.code' | translate }}*:</label> | |||
| <input type="text" class="form-control" id="code" formControlName="code" required/> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="company" class="form-label">{{ 'model.shipping_company' | translate }}:</label> | |||
| <app-search-select #shippingCompanySearchSelect | |||
| [formId]="'company'" | |||
| [formLabelLangKey]="'model.shipping_company'" | |||
| [documentForm]="form" | |||
| [getDataFunction]="getShippingCompanies" | |||
| [displayedDataField]="'name'" | |||
| [listColDefinitions]="shippingCompanyColDefinitions" | |||
| > | |||
| </app-search-select> | |||
| <input id="company" type="hidden" formControlName="company"/> | |||
| </div> | |||
| <button type="submit" class="btn btn-primary" [disabled]="form.invalid"> | |||
| {{ 'basic.send' | translate }} | |||
| </button> | |||
| </form> | |||
| </div> | |||
| @@ -1,66 +0,0 @@ | |||
| import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | |||
| import {AbstractCreateDataComponent} from "@app/_interfaces/AbstractCreateDataComponent"; | |||
| import { | |||
| ShippingCompanyService, | |||
| VesselJsonld, | |||
| VesselService, | |||
| } from "@app/core/api/v1"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {vesselForm} from "@app/_forms/apiForms"; | |||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| @Component({ | |||
| selector: 'app-vessel-new', | |||
| templateUrl: './vessel-new.component.html', | |||
| styleUrl: './vessel-new.component.scss' | |||
| }) | |||
| export class VesselNewComponent extends AbstractCreateDataComponent<VesselJsonld> implements OnInit { | |||
| @Input() public override data!: VesselJsonld; | |||
| @Output() public override submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| override form: FormGroup = vesselForm; | |||
| protected shippingCompanyColDefinitions: ListColDefinition[]; | |||
| constructor( | |||
| private vesselService: VesselService, | |||
| private shippingCompanyService: ShippingCompanyService, | |||
| ) { | |||
| super(); | |||
| this.shippingCompanyColDefinitions = SearchSelectComponent.getDefaultColDefShippingCompanies(); | |||
| } | |||
| override ngOnInit() { | |||
| if (this.data) { | |||
| this.form.patchValue(this.data); | |||
| } | |||
| } | |||
| getInitialData(): VesselJsonld { | |||
| return {} as VesselJsonld; | |||
| } | |||
| getShippingCompanies: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.shippingCompanyService.shippingCompaniesGetCollection( | |||
| index, | |||
| pageSize, | |||
| term | |||
| ); | |||
| } | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| this.vesselService.vesselsPost( | |||
| this.form.value as VesselJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| <p>zone-detail works!</p> | |||
| @@ -1,18 +1,18 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { LocationNewComponent } from './location-new.component'; | |||
| import { ZoneDetailComponent } from './zone-detail.component'; | |||
| describe('LocationNewComponent', () => { | |||
| let component: LocationNewComponent; | |||
| let fixture: ComponentFixture<LocationNewComponent>; | |||
| describe('ZoneDetailComponent', () => { | |||
| let component: ZoneDetailComponent; | |||
| let fixture: ComponentFixture<ZoneDetailComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [LocationNewComponent] | |||
| declarations: [ZoneDetailComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(LocationNewComponent); | |||
| fixture = TestBed.createComponent(ZoneDetailComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| @@ -0,0 +1,59 @@ | |||
| import {Component, OnInit} from '@angular/core'; | |||
| import {ZoneJsonld, ZoneService} from "@app/core/api/v1"; | |||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | |||
| import {TranslateService} from "@ngx-translate/core"; | |||
| import {ActivatedRoute, Router} from "@angular/router"; | |||
| import {ROUTE_LOCATIONS} from "@app/app-routing.module"; | |||
| @Component({ | |||
| selector: 'app-zone-detail', | |||
| templateUrl: './zone-detail.component.html', | |||
| styleUrl: './zone-detail.component.scss' | |||
| }) | |||
| export class ZoneDetailComponent implements OnInit { | |||
| protected zone!: ZoneJsonld; | |||
| constructor( | |||
| private zoneService: ZoneService, | |||
| protected appHelperService: AppHelperService, | |||
| protected translateService: TranslateService, | |||
| private route: ActivatedRoute, | |||
| protected router: Router | |||
| ) { | |||
| } | |||
| ngOnInit() { | |||
| this.route.params.subscribe(params => { | |||
| this.apiGetZoneData(params['id']); | |||
| }); | |||
| } | |||
| apiGetZoneData(locationId: string) | |||
| { | |||
| this.zoneService.zonesIdGet( | |||
| locationId | |||
| ).subscribe( | |||
| data => { | |||
| this.zone = data; | |||
| } | |||
| ) | |||
| } | |||
| apiDeleteZone() | |||
| { | |||
| let confirmMessage = ""; | |||
| this.translateService.get('basic.delete_confirm').subscribe((translation: string) => { | |||
| confirmMessage = translation; | |||
| }); | |||
| if (confirm(confirmMessage)) { | |||
| this.zoneService.zonesIdDelete(this.appHelperService.extractId(this.zone.id!)) | |||
| .subscribe( | |||
| data => { | |||
| this.router.navigate(['/' + ROUTE_LOCATIONS]); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| <h2>{{ 'basic.new' | translate }} {{ 'model.shipping_company' | translate }}</h2> | |||
| <h2>{{ (isEditMode() ? 'basic.edit' : 'basic.new') | translate }} {{ 'model.location' | translate }}</h2> | |||
| <div class="spt-form"> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| @@ -9,7 +9,8 @@ | |||
| <label for="code" class="form-label">{{ 'common.code' | translate }}*:</label> | |||
| <input type="text" class="form-control" id="code" formControlName="code" required/> | |||
| </div> | |||
| <button type="submit" class="btn btn-primary" [disabled]="form.invalid">{{ 'basic.send' | translate }} | |||
| <button type="submit" class="btn btn-primary" [disabled]="form.invalid"> | |||
| {{ (isEditMode() ? 'basic.save' : 'basic.create') | translate }} | |||
| </button> | |||
| </form> | |||
| </div> | |||
| @@ -1,18 +1,18 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
| import { ZoneNewComponent } from './zone-new.component'; | |||
| import { ZoneFormComponent } from './zone-form.component'; | |||
| describe('ZoneNewComponent', () => { | |||
| let component: ZoneNewComponent; | |||
| let fixture: ComponentFixture<ZoneNewComponent>; | |||
| describe('ZoneFormComponent', () => { | |||
| let component: ZoneFormComponent; | |||
| let fixture: ComponentFixture<ZoneFormComponent>; | |||
| beforeEach(async () => { | |||
| await TestBed.configureTestingModule({ | |||
| declarations: [ZoneNewComponent] | |||
| declarations: [ZoneFormComponent] | |||
| }) | |||
| .compileComponents(); | |||
| fixture = TestBed.createComponent(ZoneNewComponent); | |||
| fixture = TestBed.createComponent(ZoneFormComponent); | |||
| component = fixture.componentInstance; | |||
| fixture.detectChanges(); | |||
| }); | |||
| @@ -0,0 +1,29 @@ | |||
| import { Component } from '@angular/core'; | |||
| import {AbstractDataFormComponent} from "@app/_components/_abstract/abstract-data-form-component"; | |||
| import {ZoneJsonld, ZoneService} from "@app/core/api/v1"; | |||
| import {zoneForm} from "@app/_forms/apiForms"; | |||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | |||
| @Component({ | |||
| selector: 'app-zone-form', | |||
| templateUrl: './zone-form.component.html', | |||
| styleUrl: './zone-form.component.scss' | |||
| }) | |||
| export class ZoneFormComponent extends AbstractDataFormComponent<ZoneJsonld> { | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| constructor( | |||
| private zoneService: ZoneService | |||
| ) { | |||
| super( | |||
| zoneForm, | |||
| (data: ZoneJsonld) => zoneService.zonesPost(data), | |||
| (id: string | number, data: ZoneJsonld) => zoneService.zonesIdPatch(id.toString(), data) | |||
| ); | |||
| } | |||
| protected override getInitialData(): ZoneJsonld { | |||
| return {} as ZoneJsonld; | |||
| } | |||
| } | |||
| @@ -5,6 +5,6 @@ | |||
| [onNavigateToDetailsFunction]="navigateToZoneDetail" | |||
| [onSortFunction]="onSortChange" | |||
| [listColDefinitions]="listColDefinitions" | |||
| [createDataComponent]="ZoneNewComponent" | |||
| [dataFormComponent]="ZoneFormComponent" | |||
| ></app-list> | |||
| </div> | |||
| @@ -4,12 +4,11 @@ import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||
| import {ZoneJsonld, ZoneService} from "@app/core/api/v1"; | |||
| import {Router} from "@angular/router"; | |||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | |||
| import {FilterBarComponent} from "@app/_components/filter-bar/filter-bar.component"; | |||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | |||
| import {Sort} from "@angular/material/sort"; | |||
| import {ROUTE_ZONES} from "@app/app-routing.module"; | |||
| import {ZoneNewComponent} from "@app/_views/zone/zone-new/zone-new.component"; | |||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | |||
| import {ZoneFormComponent} from "@app/_views/zone/zone-form/zone-form.component"; | |||
| @Component({ | |||
| selector: 'app-zone-list', | |||
| @@ -19,7 +18,6 @@ import {SearchSelectComponent} from "@app/_components/search-select/search-selec | |||
| export class ZoneListComponent { | |||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||
| protected readonly ZoneNewComponent = ZoneNewComponent; | |||
| protected listColDefinitions!: ListColDefinition[]; | |||
| constructor( | |||
| @@ -60,4 +58,5 @@ export class ZoneListComponent { | |||
| this.router.navigate(['/' + ROUTE_ZONES, this.appHelperService.extractId(zone.id)]); | |||
| } | |||
| protected readonly ZoneFormComponent = ZoneFormComponent; | |||
| } | |||
| @@ -1,11 +0,0 @@ | |||
| <h2>{{ 'basic.new' | translate }} {{ 'model.zone' | translate }}</h2> | |||
| <div class="spt-form"> | |||
| <form [formGroup]="form" (ngSubmit)="onSubmit()"> | |||
| <div class="mb-3"> | |||
| <label for="name" class="form-label">{{ 'common.name' | translate }}*:</label> | |||
| <input type="text" class="form-control" id="name" formControlName="name" required/> | |||
| </div> | |||
| <button type="submit" class="btn btn-primary" [disabled]="form.invalid">{{ 'basic.send' | translate }} | |||
| </button> | |||
| </form> | |||
| </div> | |||
| @@ -1,41 +0,0 @@ | |||
| import {Component, EventEmitter, Input, Output} from '@angular/core'; | |||
| import {ZoneJsonld, ZoneService} from "@app/core/api/v1"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| import {zoneForm} from "@app/_forms/apiForms"; | |||
| import {AbstractCreateDataComponent} from "@app/_interfaces/AbstractCreateDataComponent"; | |||
| @Component({ | |||
| selector: 'app-zone-new', | |||
| templateUrl: './zone-new.component.html', | |||
| styleUrl: './zone-new.component.scss' | |||
| }) | |||
| export class ZoneNewComponent extends AbstractCreateDataComponent<ZoneJsonld>{ | |||
| @Input() public override data!: ZoneJsonld; | |||
| @Output() public override submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| override form: FormGroup = zoneForm; | |||
| constructor( | |||
| private zoneService: ZoneService | |||
| ) { | |||
| super(); | |||
| } | |||
| getInitialData(): ZoneJsonld { | |||
| return {} as ZoneJsonld; | |||
| } | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| this.zoneService.zonesPost( | |||
| this.form.value as ZoneJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| @@ -8,6 +8,12 @@ import {UsersComponent} from "@app/_views/user/users.component"; | |||
| import {TwoColumnComponent} from "@app/_components/layout/two-column/two-column.component"; | |||
| import {DashboardComponent} from "@app/_views/dashboard/dashboard.component"; | |||
| import {BaseDataComponent} from "@app/_views/base-data/base-data.component"; | |||
| import {LocationDetailComponent} from "@app/_views/location/location-detail/location-detail.component"; | |||
| import {ZoneDetailComponent} from "@app/_views/zone/zone-detail/zone-detail.component"; | |||
| import {VesselDetailComponent} from "@app/_views/vessel/vessel-detail/vessel-detail.component"; | |||
| import { | |||
| ShippingCompanyDetailComponent | |||
| } from "@app/_views/shipping-company/shipping-company-detail/shipping-company-detail.component"; | |||
| const accountModule = () => import('@app/_views/account/account.module').then(x => x.AccountModule); | |||
| @@ -43,6 +49,38 @@ const routes: Routes = [ | |||
| {path: '', component: BaseDataComponent}, | |||
| ] | |||
| }, | |||
| { | |||
| path: ROUTE_LOCATIONS, | |||
| component: TwoColumnComponent, | |||
| canActivate: [userGuard], | |||
| children: [ | |||
| {path: ':id', component: LocationDetailComponent}, | |||
| ] | |||
| }, | |||
| { | |||
| path: ROUTE_ZONES, | |||
| component: TwoColumnComponent, | |||
| canActivate: [userGuard], | |||
| children: [ | |||
| {path: ':id', component: ZoneDetailComponent}, | |||
| ] | |||
| }, | |||
| { | |||
| path: ROUTE_VESSELS, | |||
| component: TwoColumnComponent, | |||
| canActivate: [userGuard], | |||
| children: [ | |||
| {path: ':id', component: VesselDetailComponent}, | |||
| ] | |||
| }, | |||
| { | |||
| path: ROUTE_SHIPPING_COMPANIES, | |||
| component: TwoColumnComponent, | |||
| canActivate: [userGuard], | |||
| children: [ | |||
| {path: ':id', component: ShippingCompanyDetailComponent}, | |||
| ] | |||
| }, | |||
| { | |||
| path: ROUTE_PROFILE, | |||
| component: TwoColumnComponent, | |||
| @@ -53,10 +53,14 @@ import { LocationListComponent } from './_views/location/location-list/location- | |||
| import { ZoneListComponent } from './_views/zone/zone-list/zone-list.component'; | |||
| import { VesselListComponent } from './_views/vessel/vessel-list/vessel-list.component'; | |||
| import { ShippingCompanyListComponent } from './_views/shipping-company/shipping-company-list/shipping-company-list.component'; | |||
| import { ZoneNewComponent } from './_views/zone/zone-new/zone-new.component'; | |||
| import { LocationNewComponent } from './_views/location/location-new/location-new.component'; | |||
| import { ShippingCompanyNewComponent } from './_views/shipping-company/shipping-company-new/shipping-company-new.component'; | |||
| import { VesselNewComponent } from './_views/vessel/vessel-new/vessel-new.component'; | |||
| import { LocationDetailComponent } from './_views/location/location-detail/location-detail.component'; | |||
| import { ZoneDetailComponent } from './_views/zone/zone-detail/zone-detail.component'; | |||
| import { VesselDetailComponent } from './_views/vessel/vessel-detail/vessel-detail.component'; | |||
| import { ShippingCompanyDetailComponent } from './_views/shipping-company/shipping-company-detail/shipping-company-detail.component'; | |||
| import { LocationFormComponent } from './_views/location/location-form/location-form.component'; | |||
| import { ZoneFormComponent } from './_views/zone/zone-form/zone-form.component'; | |||
| import { VesselFormComponent } from './_views/vessel/vessel-form/vessel-form.component'; | |||
| import { ShippingCompanyFormComponent } from './_views/shipping-company/shipping-company-form/shipping-company-form.component'; | |||
| registerLocaleData(localeDe, 'de-DE'); | |||
| @@ -132,10 +136,14 @@ export function HttpLoaderFactory(http: HttpClient) { | |||
| ZoneListComponent, | |||
| VesselListComponent, | |||
| ShippingCompanyListComponent, | |||
| ZoneNewComponent, | |||
| LocationNewComponent, | |||
| ShippingCompanyNewComponent, | |||
| VesselNewComponent, | |||
| LocationDetailComponent, | |||
| ZoneDetailComponent, | |||
| VesselDetailComponent, | |||
| ShippingCompanyDetailComponent, | |||
| LocationFormComponent, | |||
| ZoneFormComponent, | |||
| VesselFormComponent, | |||
| ShippingCompanyFormComponent, | |||
| ], | |||
| providers: [ | |||
| {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}, | |||
| @@ -191,6 +191,77 @@ export class LocationService { | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the Location resource. | |||
| * Removes the Location resource. | |||
| * @param id Location identifier | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public locationsIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public locationsIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public locationsIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public locationsIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling locationsIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/locations/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a Location resource. | |||
| * Retrieves a Location resource. | |||
| @@ -191,6 +191,77 @@ export class ShippingCompanyService { | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the ShippingCompany resource. | |||
| * Removes the ShippingCompany resource. | |||
| * @param id ShippingCompany identifier | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public shippingCompaniesIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public shippingCompaniesIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public shippingCompaniesIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public shippingCompaniesIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling shippingCompaniesIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/shipping_companies/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a ShippingCompany resource. | |||
| * Retrieves a ShippingCompany resource. | |||
| @@ -196,6 +196,77 @@ export class UserService { | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the User resource. | |||
| * Removes the User resource. | |||
| * @param id User identifier | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public usersIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public usersIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public usersIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public usersIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling usersIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a User resource. | |||
| * Retrieves a User resource. | |||
| @@ -191,6 +191,77 @@ export class VesselService { | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the Vessel resource. | |||
| * Removes the Vessel resource. | |||
| * @param id Vessel identifier | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public vesselsIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public vesselsIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public vesselsIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public vesselsIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling vesselsIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/vessels/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a Vessel resource. | |||
| * Retrieves a Vessel resource. | |||
| @@ -191,6 +191,77 @@ export class ZoneService { | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the Zone resource. | |||
| * Removes the Zone resource. | |||
| * @param id Zone identifier | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public zonesIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public zonesIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public zonesIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public zonesIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling zonesIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/zones/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a Zone resource. | |||
| * Retrieves a Zone resource. | |||
| @@ -70,7 +70,11 @@ | |||
| "id": "Id", | |||
| "note": "Note", | |||
| "number": "#", | |||
| "send": "Send" | |||
| "send": "Send", | |||
| "edit": "Edit", | |||
| "save": "Save", | |||
| "delete": "Delete", | |||
| "delete_confirm": "Do you really want to delete this dataset? There might be related data, which makes deletion impossible unless the related data will be removed first!" | |||
| }, | |||
| "users": | |||
| { | |||
| @@ -6,6 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; | |||
| use ApiPlatform\Metadata\ApiFilter; | |||
| use ApiPlatform\Metadata\ApiProperty; | |||
| use ApiPlatform\Metadata\ApiResource; | |||
| use ApiPlatform\Metadata\Delete; | |||
| use ApiPlatform\Metadata\Get; | |||
| use ApiPlatform\Metadata\GetCollection; | |||
| use ApiPlatform\Metadata\Patch; | |||
| @@ -34,6 +35,9 @@ use Symfony\Component\PropertyInfo\Type; | |||
| new Patch( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ), | |||
| new Delete( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ) | |||
| ], | |||
| security: 'is_granted("ROLE_USER")', | |||
| provider: EntityToDtoStateProvider::class, | |||
| @@ -6,6 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; | |||
| use ApiPlatform\Metadata\ApiFilter; | |||
| use ApiPlatform\Metadata\ApiProperty; | |||
| use ApiPlatform\Metadata\ApiResource; | |||
| use ApiPlatform\Metadata\Delete; | |||
| use ApiPlatform\Metadata\Get; | |||
| use ApiPlatform\Metadata\GetCollection; | |||
| use ApiPlatform\Metadata\Patch; | |||
| @@ -33,6 +34,9 @@ use Symfony\Component\Validator\Constraints as Assert; | |||
| new Patch( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ), | |||
| new Delete( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ) | |||
| ], | |||
| security: 'is_granted("ROLE_USER")', | |||
| provider: EntityToDtoStateProvider::class, | |||
| @@ -12,6 +12,7 @@ use ApiPlatform\Doctrine\Orm\State\Options; | |||
| use ApiPlatform\Metadata\ApiFilter; | |||
| use ApiPlatform\Metadata\ApiProperty; | |||
| use ApiPlatform\Metadata\ApiResource; | |||
| use ApiPlatform\Metadata\Delete; | |||
| use ApiPlatform\Metadata\Get; | |||
| use ApiPlatform\Metadata\GetCollection; | |||
| use ApiPlatform\Metadata\Patch; | |||
| @@ -40,6 +41,9 @@ use Symfony\Component\Validator\Constraints as Assert; | |||
| new Patch( | |||
| security: 'is_granted("is_granted("EDIT", object)")' | |||
| ), | |||
| new Delete( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ) | |||
| ], | |||
| security: 'is_granted("ROLE_USER")', | |||
| provider: EntityToDtoStateProvider::class, | |||
| @@ -6,6 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; | |||
| use ApiPlatform\Metadata\ApiFilter; | |||
| use ApiPlatform\Metadata\ApiProperty; | |||
| use ApiPlatform\Metadata\ApiResource; | |||
| use ApiPlatform\Metadata\Delete; | |||
| use ApiPlatform\Metadata\Get; | |||
| use ApiPlatform\Metadata\GetCollection; | |||
| use ApiPlatform\Metadata\Patch; | |||
| @@ -34,6 +35,9 @@ use Symfony\Component\PropertyInfo\Type; | |||
| new Patch( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ), | |||
| new Delete( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ) | |||
| ], | |||
| security: 'is_granted("ROLE_USER")', | |||
| provider: EntityToDtoStateProvider::class, | |||
| @@ -6,6 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; | |||
| use ApiPlatform\Metadata\ApiFilter; | |||
| use ApiPlatform\Metadata\ApiProperty; | |||
| use ApiPlatform\Metadata\ApiResource; | |||
| use ApiPlatform\Metadata\Delete; | |||
| use ApiPlatform\Metadata\Get; | |||
| use ApiPlatform\Metadata\GetCollection; | |||
| use ApiPlatform\Metadata\Patch; | |||
| @@ -33,6 +34,9 @@ use Symfony\Component\Validator\Constraints as Assert; | |||
| new Patch( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ), | |||
| new Delete( | |||
| security: 'is_granted("ROLE_ADMIN")' | |||
| ) | |||
| ], | |||
| security: 'is_granted("ROLE_USER")', | |||
| provider: EntityToDtoStateProvider::class, | |||
| @@ -32,7 +32,6 @@ class LocationApiToEntityMapper implements MapperInterface | |||
| return $entity; | |||
| } | |||
| // For new locations, we need the zone | |||
| if (!$dto->zone) { | |||
| throw new \Exception('Zone is required for new locations'); | |||
| } | |||