瀏覽代碼

trips and trip locations

master
Daniel 1 年之前
父節點
當前提交
78f321a129
共有 100 個文件被更改,包括 2683 次插入2128 次删除
  1. +1
    -1
      angular/openapi.json
  2. +368
    -532
      angular/openapi.yaml
  3. +6
    -0
      angular/src/app/_components/_abstract/abstract-data-form-component.ts
  4. +2
    -2
      angular/src/app/_components/datetime-picker/datetime-picker.component.ts
  5. +2
    -2
      angular/src/app/_components/layout/two-column/two-column.component.html
  6. +70
    -0
      angular/src/app/_components/search-select/search-select.component.ts
  7. +25
    -40
      angular/src/app/_forms/apiForms.ts
  8. +3
    -2
      angular/src/app/_helpers/jwt.interceptor.ts
  9. +25
    -1
      angular/src/app/_views/location/location-form/location-form.component.html
  10. +2
    -0
      angular/src/app/_views/location/location-form/location-form.component.ts
  11. +24
    -0
      angular/src/app/_views/location/location-list/location-list.component.ts
  12. +99
    -0
      angular/src/app/_views/trip/trip-detail/trip-detail.component.html
  13. +0
    -0
      angular/src/app/_views/trip/trip-detail/trip-detail.component.scss
  14. +23
    -0
      angular/src/app/_views/trip/trip-detail/trip-detail.component.spec.ts
  15. +218
    -0
      angular/src/app/_views/trip/trip-detail/trip-detail.component.ts
  16. +93
    -0
      angular/src/app/_views/trip/trip-form/trip-form.component.html
  17. +0
    -0
      angular/src/app/_views/trip/trip-form/trip-form.component.scss
  18. +23
    -0
      angular/src/app/_views/trip/trip-form/trip-form.component.spec.ts
  19. +64
    -0
      angular/src/app/_views/trip/trip-form/trip-form.component.ts
  20. +8
    -0
      angular/src/app/_views/trip/trip-list/trip-list.component.html
  21. +0
    -0
      angular/src/app/_views/trip/trip-list/trip-list.component.scss
  22. +23
    -0
      angular/src/app/_views/trip/trip-list/trip-list.component.spec.ts
  23. +127
    -0
      angular/src/app/_views/trip/trip-list/trip-list.component.ts
  24. +6
    -1
      angular/src/app/_views/trip/trip.component.html
  25. +2
    -35
      angular/src/app/_views/vessel/vessel-list/vessel-list.component.ts
  26. +18
    -0
      angular/src/app/app-routing.module.ts
  27. +2
    -1
      angular/src/app/app.component.ts
  28. +8
    -0
      angular/src/app/app.module.ts
  29. +8
    -14
      angular/src/app/core/api/v1/.openapi-generator/FILES
  30. +3
    -5
      angular/src/app/core/api/v1/api/api.ts
  31. +264
    -0
      angular/src/app/core/api/v1/api/event.service.ts
  32. +90
    -4
      angular/src/app/core/api/v1/api/trip.service.ts
  33. +97
    -4
      angular/src/app/core/api/v1/api/tripLocation.service.ts
  34. +0
    -419
      angular/src/app/core/api/v1/api/userTripLocation.service.ts
  35. +0
    -419
      angular/src/app/core/api/v1/api/userTripWorkLog.service.ts
  36. +23
    -0
      angular/src/app/core/api/v1/model/apiEventsGetCollection200Response.ts
  37. +3
    -3
      angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseSearch.ts
  38. +1
    -1
      angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseSearchMappingInner.ts
  39. +1
    -1
      angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseView.ts
  40. +4
    -4
      angular/src/app/core/api/v1/model/apiLocationsGetCollection200Response.ts
  41. +4
    -4
      angular/src/app/core/api/v1/model/apiMediaObjectsGetCollection200Response.ts
  42. +4
    -4
      angular/src/app/core/api/v1/model/apiShippingCompaniesGetCollection200Response.ts
  43. +4
    -4
      angular/src/app/core/api/v1/model/apiTripLocationsGetCollection200Response.ts
  44. +4
    -4
      angular/src/app/core/api/v1/model/apiTripsGetCollection200Response.ts
  45. +0
    -23
      angular/src/app/core/api/v1/model/apiUserTripLocationsGetCollection200Response.ts
  46. +0
    -23
      angular/src/app/core/api/v1/model/apiUserTripWorkLogsGetCollection200Response.ts
  47. +4
    -4
      angular/src/app/core/api/v1/model/apiUserTripsGetCollection200Response.ts
  48. +4
    -4
      angular/src/app/core/api/v1/model/apiUsersGetCollection200Response.ts
  49. +4
    -4
      angular/src/app/core/api/v1/model/apiVesselsGetCollection200Response.ts
  50. +4
    -4
      angular/src/app/core/api/v1/model/apiZonesGetCollection200Response.ts
  51. +9
    -4
      angular/src/app/core/api/v1/model/eventJsonld.ts
  52. +3
    -3
      angular/src/app/core/api/v1/model/eventJsonldContext.ts
  53. +3
    -3
      angular/src/app/core/api/v1/model/eventJsonldContextOneOf.ts
  54. +3
    -0
      angular/src/app/core/api/v1/model/location.ts
  55. +5
    -2
      angular/src/app/core/api/v1/model/locationJsonld.ts
  56. +2
    -2
      angular/src/app/core/api/v1/model/mediaObjectJsonld.ts
  57. +7
    -11
      angular/src/app/core/api/v1/model/models.ts
  58. +2
    -2
      angular/src/app/core/api/v1/model/shippingCompanyJsonld.ts
  59. +8
    -4
      angular/src/app/core/api/v1/model/trip.ts
  60. +8
    -6
      angular/src/app/core/api/v1/model/tripJsonld.ts
  61. +5
    -2
      angular/src/app/core/api/v1/model/tripLocation.ts
  62. +5
    -4
      angular/src/app/core/api/v1/model/tripLocationJsonld.ts
  63. +1
    -1
      angular/src/app/core/api/v1/model/user.ts
  64. +3
    -3
      angular/src/app/core/api/v1/model/userJsonld.ts
  65. +2
    -2
      angular/src/app/core/api/v1/model/userTripJsonld.ts
  66. +0
    -30
      angular/src/app/core/api/v1/model/userTripLocationJsonld.ts
  67. +0
    -26
      angular/src/app/core/api/v1/model/userTripWorkLog.ts
  68. +0
    -32
      angular/src/app/core/api/v1/model/userTripWorkLogJsonld.ts
  69. +2
    -2
      angular/src/app/core/api/v1/model/vesselJsonld.ts
  70. +2
    -2
      angular/src/app/core/api/v1/model/zoneJsonld.ts
  71. +18
    -6
      angular/src/assets/i18n/en.json
  72. +1
    -1
      httpdocs/config/packages/api_platform.yaml
  73. +31
    -0
      httpdocs/migrations/Version20250228112455.php
  74. +31
    -0
      httpdocs/migrations/Version20250228113640.php
  75. +53
    -0
      httpdocs/migrations/Version20250303144554.php
  76. +31
    -0
      httpdocs/migrations/Version20250303152548.php
  77. +31
    -0
      httpdocs/migrations/Version20250304114315.php
  78. +33
    -0
      httpdocs/migrations/Version20250304115016.php
  79. +31
    -0
      httpdocs/migrations/Version20250304122802.php
  80. +31
    -0
      httpdocs/migrations/Version20250304124329.php
  81. +56
    -0
      httpdocs/src/ApiResource/EventApi.php
  82. +6
    -0
      httpdocs/src/ApiResource/LocationApi.php
  83. +25
    -8
      httpdocs/src/ApiResource/TripApi.php
  84. +19
    -4
      httpdocs/src/ApiResource/TripLocationApi.php
  85. +3
    -0
      httpdocs/src/ApiResource/UserApi.php
  86. +12
    -9
      httpdocs/src/ApiResource/UserTripEventApi.php
  87. +0
    -103
      httpdocs/src/ApiResource/UserTripWorkLogApi.php
  88. +116
    -0
      httpdocs/src/Command/Import/CreateEventsCommand.php
  89. +89
    -0
      httpdocs/src/Entity/Event.php
  90. +33
    -22
      httpdocs/src/Entity/Location.php
  91. +19
    -9
      httpdocs/src/Entity/Trip.php
  92. +13
    -0
      httpdocs/src/Entity/TripLocation.php
  93. +13
    -0
      httpdocs/src/Entity/User.php
  94. +7
    -54
      httpdocs/src/Entity/UserTrip.php
  95. +96
    -0
      httpdocs/src/Entity/UserTripEvent.php
  96. +0
    -83
      httpdocs/src/Entity/UserTripLocation.php
  97. +0
    -119
      httpdocs/src/Entity/UserTripWorkLog.php
  98. +41
    -0
      httpdocs/src/Mapper/EventEntityToApiMapper.php
  99. +3
    -0
      httpdocs/src/Mapper/LocationApiToEntityMapper.php
  100. +3
    -0
      httpdocs/src/Mapper/LocationEntityToApiMapper.php

+ 1
- 1
angular/openapi.json
文件差異過大導致無法顯示
查看文件


+ 368
- 532
angular/openapi.yaml
文件差異過大導致無法顯示
查看文件


+ 6
- 0
angular/src/app/_components/_abstract/abstract-data-form-component.ts 查看文件

@@ -100,6 +100,12 @@ export abstract class AbstractDataFormComponent<T extends { [key: string]: any }
});
}

onDateChange(newDate: any, fieldName: string) {
if (typeof newDate === 'string' || newDate === null) {
this.form.patchValue({ [fieldName]: newDate });
}
}

isEditMode(): boolean {
return this.mode === FormMode.Edit;
}

+ 2
- 2
angular/src/app/_components/datetime-picker/datetime-picker.component.ts 查看文件

@@ -60,10 +60,10 @@ export class DatetimePickerComponent implements OnInit {
// Format the date to match the loaded format
const formattedDate = dateTime.toLocaleString('sv-SE', { timeZone: 'Europe/Berlin' }).replace(' ', 'T') + '+02:00';

console.log('Emitting datetime:', formattedDate);
//console.log('Emitting datetime:', formattedDate);
this.dateTimeChange.emit(formattedDate);
} else {
console.log('Emitting null datetime');
//console.log('Emitting null datetime');
this.dateTimeChange.emit(null);
}
}


+ 2
- 2
angular/src/app/_components/layout/two-column/two-column.component.html 查看文件

@@ -19,14 +19,14 @@
<li class="nav-item mb-3">
<a class="card" routerLink="/trips" routerLinkActive="active">
<div class="card-body position-relative" data-cat="dashboard">
<h3 class="position-absolute m-0">{{'trips.view' | translate}}</h3>
<h3 class="position-absolute m-0">{{'trip.view' | translate}}</h3>
</div>
</a>
</li>
<li class="nav-item mb-3">
<a class="card" routerLink="/user-trips" routerLinkActive="active">
<div class="card-body position-relative" data-cat="dashboard">
<h3 class="position-absolute m-0">{{'user_trips.view' | translate}}</h3>
<h3 class="position-absolute m-0">{{'user_trip.view' | translate}}</h3>
</div>
</a>
</li>


+ 70
- 0
angular/src/app/_components/search-select/search-select.component.ts 查看文件

@@ -47,6 +47,8 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
if (this.dataSet !== undefined) {
this.searchBoxFilled = true;
}
// Add this line to create a deep copy of the listColDefinitions
this.listColDefinitions = JSON.parse(JSON.stringify(this.listColDefinitions));
}

ngAfterViewInit(): void {
@@ -95,6 +97,36 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
return this.listComponent.getPageSize();
}

public static getDefaultColDefLocations(subResource?: string): ListColDefinition[] {
return [
{
name: 'name',
text: 'common.name',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'code',
text: 'common.code',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'code',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'zone',
text: 'model.zone',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'zone',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
];
}

public static getDefaultColDefZones(subResource?: string): ListColDefinition[] {
return [
{
@@ -144,4 +176,42 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
} as ListColDefinition,
];
}

public static getDefaultColDefVessels(subResource?: string): ListColDefinition[] {
return [
{
name: 'name',
text: 'common.name',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'code',
text: 'common.code',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'code',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'shippingCompanyName',
text: 'model.shipping_company',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'company',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'createdAt',
text: 'common.created_at',
type: ListComponent.COLUMN_TYPE_DATE,
field: 'createdAt',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_DATE,
} as ListColDefinition,
];
}
}

+ 25
- 40
angular/src/app/_forms/apiForms.ts 查看文件

@@ -1,10 +1,22 @@
import { FormGroup, FormControl, Validators } from '@angular/forms';

export const eventJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
name: new FormControl(null, []),
identifier: new FormControl(null, []),
sequence: new FormControl(null, []),
mandatory: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

export const locationForm = new FormGroup({
dbId: new FormControl(null, []),
zone: new FormControl(null, []),
name: new FormControl(null, [Validators.required]),
code: new FormControl(null, [Validators.required]),
isZone: new FormControl(null, []),
isPlace: new FormControl(null, []),
isPort: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

@@ -13,6 +25,9 @@ export const locationJsonldForm = new FormGroup({
zone: new FormControl(null, []),
name: new FormControl(null, [Validators.required]),
code: new FormControl(null, [Validators.required]),
isZone: new FormControl(null, []),
isPlace: new FormControl(null, []),
isPort: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

@@ -40,24 +55,28 @@ export const shippingCompanyJsonldForm = new FormGroup({
export const tripForm = new FormGroup({
dbId: new FormControl(null, []),
vessel: new FormControl(null, []),
pilotReference: new FormControl(null, [Validators.required]),
pilotageReference: new FormControl(null, []),
customerReference: new FormControl(null, []),
captainName: new FormControl(null, []),
startLocation: new FormControl(null, []),
endLocation: new FormControl(null, []),
startDate: new FormControl(null, [Validators.required]),
endDate: new FormControl(null, [Validators.required]),
note: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

export const tripJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
vessel: new FormControl(null, []),
pilotReference: new FormControl(null, [Validators.required]),
pilotageReference: new FormControl(null, []),
customerReference: new FormControl(null, []),
captainName: new FormControl(null, []),
startLocation: new FormControl(null, []),
endLocation: new FormControl(null, []),
startDate: new FormControl(null, [Validators.required]),
endDate: new FormControl(null, [Validators.required]),
note: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

@@ -65,6 +84,7 @@ export const tripLocationForm = new FormGroup({
dbId: new FormControl(null, []),
trip: new FormControl(null, []),
location: new FormControl(null, []),
isArrival: new FormControl(null, []),
date: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});
@@ -73,6 +93,7 @@ export const tripLocationJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
trip: new FormControl(null, []),
location: new FormControl(null, []),
isArrival: new FormControl(null, []),
date: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});
@@ -81,6 +102,7 @@ export const userForm = new FormGroup({
dbId: new FormControl(null, []),
email: new FormControl(null, [Validators.required, Validators.email]),
firstName: new FormControl(null, [Validators.required]),
referenceId: new FormControl(null, [Validators.required]),
lastName: new FormControl(null, [Validators.required]),
image: new FormControl(null, []),
imageUrl: new FormControl(null, []),
@@ -88,7 +110,6 @@ export const userForm = new FormGroup({
password: new FormControl(null, []),
active: new FormControl(null, []),
roles: new FormControl(null, []),
token: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

@@ -96,6 +117,7 @@ export const userJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
email: new FormControl(null, [Validators.required, Validators.email]),
firstName: new FormControl(null, [Validators.required]),
referenceId: new FormControl(null, [Validators.required]),
lastName: new FormControl(null, [Validators.required]),
image: new FormControl(null, []),
imageUrl: new FormControl(null, []),
@@ -103,7 +125,6 @@ export const userJsonldForm = new FormGroup({
password: new FormControl(null, []),
active: new FormControl(null, []),
roles: new FormControl(null, []),
token: new FormControl(null, []),
createdAt: new FormControl(null, [])
});

@@ -127,42 +148,6 @@ export const userTripJsonldForm = new FormGroup({
createdAt: new FormControl(null, [])
});

export const userTripLocationForm = new FormGroup({
dbId: new FormControl(null, []),
userTrip: new FormControl(null, []),
location: new FormControl(null, []),
plannedDate: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});

export const userTripLocationJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
userTrip: new FormControl(null, []),
location: new FormControl(null, []),
plannedDate: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});

export const userTripWorkLogForm = new FormGroup({
dbId: new FormControl(null, []),
userTrip: new FormControl(null, []),
startLocation: new FormControl(null, []),
endLocation: new FormControl(null, []),
startDate: new FormControl(null, [Validators.required]),
endDate: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});

export const userTripWorkLogJsonldForm = new FormGroup({
dbId: new FormControl(null, []),
userTrip: new FormControl(null, []),
startLocation: new FormControl(null, []),
endLocation: new FormControl(null, []),
startDate: new FormControl(null, [Validators.required]),
endDate: new FormControl(null, [Validators.required]),
createdAt: new FormControl(null, [])
});

export const vesselForm = new FormGroup({
dbId: new FormControl(null, []),
name: new FormControl(null, [Validators.required]),


+ 3
- 2
angular/src/app/_helpers/jwt.interceptor.ts 查看文件

@@ -12,12 +12,13 @@ export class JwtInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// add auth header with jwt if user is logged in and request is to the api url
const user = this.accountService.userValue;
const isLoggedIn = user && user.token;
const token = localStorage.getItem('token');
const isLoggedIn = user && token;
const isApiUrl = request.url.startsWith(environment.apiUrl);
if (isLoggedIn && isApiUrl) {
request = request.clone({
setHeaders: {
Authorization: `Bearer ${user.token}`
Authorization: `Bearer ${token}`
}
});
}


+ 25
- 1
angular/src/app/_views/location/location-form/location-form.component.html 查看文件

@@ -3,7 +3,7 @@
<h2>{{ (isEditMode() ? 'basic.edit' : 'basic.new') | translate }} {{ 'model.location' | translate }}</h2>
</div>
<div class="spt-form">
<form [formGroup]="form" (ngSubmit)="onSubmit()">
<form [formGroup]="locationForm" (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/>
@@ -27,6 +27,30 @@
<input id="zone" type="hidden" formControlName="zone"/>
</div>

<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3 switch-widget">
<p class="form-label">{{ 'location.is_zone' | translate }}:</p>
<label class="switch">
<input type="checkbox" formControlName="isZone">
<span class="slider round"></span>
</label>
</div>

<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3 switch-widget">
<p class="form-label">{{ 'location.is_place' | translate }}:</p>
<label class="switch">
<input type="checkbox" formControlName="isPlace">
<span class="slider round"></span>
</label>
</div>

<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3 switch-widget">
<p class="form-label">{{ 'location.is_port' | translate }}:</p>
<label class="switch">
<input type="checkbox" formControlName="isPort">
<span class="slider round"></span>
</label>
</div>

<div class="flex gap-2">
<button type="submit" class="btn btn-primary" [disabled]="form.invalid">
{{ 'basic.save' | translate }}


+ 2
- 0
angular/src/app/_views/location/location-form/location-form.component.ts 查看文件

@@ -16,6 +16,7 @@ import { ROUTE_BASE_DATA } from "@app/app-routing.module";
export class LocationFormComponent extends AbstractDataFormComponent<LocationJsonld> {
protected readonly SearchSelectComponent = SearchSelectComponent;
protected zoneColDefinitions: ListColDefinition[];
protected readonly locationForm = locationForm;

constructor(
private locationService: LocationService,
@@ -39,4 +40,5 @@ export class LocationFormComponent extends AbstractDataFormComponent<LocationJso
getZones: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => {
return this.zoneService.zonesGetCollection(index, pageSize, term);
}

}

+ 24
- 0
angular/src/app/_views/location/location-list/location-list.component.ts 查看文件

@@ -52,6 +52,30 @@ export class LocationListComponent implements OnInit, AfterViewInit {
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'is_zone',
text: 'location.is_zone',
type: ListComponent.COLUMN_TYPE_BOOLEAN,
field: 'isZone',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_BOOLEAN,
} as ListColDefinition,
{
name: 'is_place',
text: 'location.is_place',
type: ListComponent.COLUMN_TYPE_BOOLEAN,
field: 'isPlace',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_BOOLEAN,
} as ListColDefinition,
{
name: 'is_port',
text: 'location.is_port',
type: ListComponent.COLUMN_TYPE_BOOLEAN,
field: 'isPort',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_BOOLEAN,
} as ListColDefinition,
{
name: 'createdAt',
text: 'common.created_at',


+ 99
- 0
angular/src/app/_views/trip/trip-detail/trip-detail.component.html 查看文件

@@ -0,0 +1,99 @@
@if (trip) {
<div class="spt-container">
<div class="spt-headline d-flex justify-content-between align-items-start">
<h2>{{ ('basic.edit') | translate }} {{ 'model.trip' | translate }}</h2>
</div>
</div>
<mat-tab-group>
<mat-tab label="{{ 'trip.view_single' | translate }}">
<app-trip-form
[data]="trip"
[mode]="FormMode.Edit"
[id]="appHelperService.extractId(trip.id!)"
(submit)="onFormUpdate($event)"
></app-trip-form>
</mat-tab>
<mat-tab label="{{ 'trip.itinerary' | translate }}">
<div class="container-fluid p-4 bg-dark text-white">
<h4 class="mb-4">trip.locations</h4>

<div *ngFor="let tripLocation of tripLocations; let i = index" class="mb-4">
<div class="row">
<div class="col-12 col-md-4 mb-3">
<label [for]="'location_' + i" class="form-label">Location*:</label>
<app-search-select
[formId]="'location'"
[formLabelLangKey]="'model.location'"
[documentForm]="locationForms[i]"
[getDataFunction]="getLocations"
[displayedDataField]="'name'"
[listColDefinitions]="locationColDefinitions"
[dataSet]="tripLocation.location"
>
</app-search-select>
<input [id]="'location_' + i" type="hidden" formControlName="location"/>
</div>

<div class="col-12 col-md-2 mb-3">
<label class="form-label">trip.date (Date):</label>
<div>
<input
type="date"
class="form-control"
[value]="formatDateForInput(tripLocation.date)"
(change)="onDateInputChange($event, i)"
/>
</div>
</div>

<div class="col-12 col-md-2 mb-3">
<label class="form-label">trip.date (Time):</label>
<div>
<input
type="time"
class="form-control"
[value]="formatTimeForInput(tripLocation.date)"
(change)="onTimeInputChange($event, i)"
/>
</div>
</div>

<div class="col-12 col-md-2 mb-3 d-flex align-items-end">
<div class="form-check">
<input
class="form-check-input"
type="checkbox"
[id]="'isArrival_' + i"
[checked]="tripLocation.isArrival"
(change)="onIsArrivalChange($event, i)"
>
<label class="form-check-label text-white" [for]="'isArrival_' + i">
trip.is_arrival
</label>
</div>
</div>

<div class="col-12 col-md-2 mb-3 d-flex align-items-end">
<button type="button" class="btn btn-danger" (click)="removeTripLocation(i)">
basic.remove
</button>
</div>
</div>
</div>

<div class="my-3">
<button type="button" class="btn btn-primary" (click)="addNewTripLocation()">
basic.add
</button>
</div>

<div class="mt-4">
<button type="button" class="btn btn-success" (click)="saveAllTripLocations()">
Save
</button>
</div>
</div>
</mat-tab>
</mat-tab-group>

}

+ 0
- 0
angular/src/app/_views/trip/trip-detail/trip-detail.component.scss 查看文件


+ 23
- 0
angular/src/app/_views/trip/trip-detail/trip-detail.component.spec.ts 查看文件

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TripDetailComponent } from './trip-detail.component';

describe('TripDetailComponent', () => {
let component: TripDetailComponent;
let fixture: ComponentFixture<TripDetailComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TripDetailComponent]
})
.compileComponents();
fixture = TestBed.createComponent(TripDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 218
- 0
angular/src/app/_views/trip/trip-detail/trip-detail.component.ts 查看文件

@@ -0,0 +1,218 @@
import { Component, OnInit, ViewChild, AfterViewInit, QueryList, ViewChildren } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { TripJsonld, TripLocationJsonld, TripLocationService, TripService, LocationService, LocationJsonld } from "@app/core/api/v1";
import { AppHelperService } from "@app/_helpers/app-helper.service";
import { ActivatedRoute } from "@angular/router";
import { FormMode, FormSubmitEvent } from "@app/_components/_abstract/abstract-data-form-component";
import { ModalStatus } from "@app/_helpers/modal.states";
import { Observable } from 'rxjs';
import { ListColDefinition } from '@app/_components/list/list-col-definition';
import { SearchSelectComponent } from '@app/_components/search-select/search-select.component';
import { ListComponent } from '@app/_components/list/list.component';

@Component({
selector: 'app-trip-detail',
templateUrl: './trip-detail.component.html',
styleUrl: './trip-detail.component.scss'
})
export class TripDetailComponent implements OnInit, AfterViewInit {
protected trip!: TripJsonld;
protected readonly FormMode = FormMode;
protected tripLocations: TripLocationJsonld[] = [];
protected locationForms: FormGroup[] = [];
protected locationColDefinitions: ListColDefinition[] = SearchSelectComponent.getDefaultColDefLocations();

@ViewChildren(SearchSelectComponent) searchSelects!: QueryList<SearchSelectComponent>;

constructor(
private tripService: TripService,
private tripLocationService: TripLocationService,
private locationService: LocationService,
protected appHelperService: AppHelperService,
private route: ActivatedRoute,
private fb: FormBuilder
) {}

ngOnInit() {
this.route.params.subscribe(params => {
this.tripService.tripsIdGet(params['id']).subscribe(
data => {
this.trip = data;
this.loadTripLocations();
}
);
});
}

ngAfterViewInit() {
// Reinitialize search selects when they change
this.searchSelects.changes.subscribe(components => {
components.forEach((component: SearchSelectComponent) => {
// Force search selects to initialize
if (component.dataSet) {
component.ngAfterViewInit();
}
});
});
}

loadTripLocations() {
this.tripLocationService.tripLocationsGetCollection(
1,
200,
this.trip !== undefined ? this.trip.id : undefined,
).subscribe(
data => {
this.tripLocations = data.member;
// Create a form for each trip location
this.locationForms = [];
this.tripLocations.forEach(() => {
this.locationForms.push(this.createLocationForm());
});
}
);
}

createLocationForm(): FormGroup {
return this.fb.group({
location: [null]
});
}

getLocations = (page: number, pageSize: number, term?: string): Observable<any> => {
return this.locationService.locationsGetCollection(page, pageSize, undefined, term);
}

onFormUpdate(event: FormSubmitEvent<TripJsonld>) {
if (event.status === ModalStatus.Submitted && event.data) {
this.trip = event.data;
}
}

formatDateForInput(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return date.toISOString().split('T')[0];
}

formatTimeForInput(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return date.toTimeString().slice(0, 5);
}

onDateInputChange(event: Event, index: number) {
const input = event.target as HTMLInputElement;
const currentDate = new Date(this.tripLocations[index].date || new Date());
const [year, month, day] = input.value.split('-').map(Number);

currentDate.setFullYear(year, month - 1, day);
this.tripLocations[index].date = currentDate.toISOString();
}

onTimeInputChange(event: Event, index: number) {
const input = event.target as HTMLInputElement;
const currentDate = new Date(this.tripLocations[index].date || new Date());
const [hours, minutes] = input.value.split(':').map(Number);

currentDate.setHours(hours, minutes);
this.tripLocations[index].date = currentDate.toISOString();
}

onIsArrivalChange(event: Event, index: number) {
const checkbox = event.target as HTMLInputElement;
this.tripLocations[index].isArrival = checkbox.checked;
}

addNewTripLocation() {
// Create a new empty trip location
const newTripLocation: TripLocationJsonld = {
trip: {
'id': this.trip.id // Ensure we send the trip ID in the correct format
} as TripJsonld,
date: new Date().toISOString(),
isArrival: false
};

this.tripLocations.push(newTripLocation);
this.locationForms.push(this.createLocationForm());

// Force update in the next event loop to properly initialize the search-select
setTimeout(() => {
if (this.searchSelects) {
const lastSelect = this.searchSelects.last;
if (lastSelect) {
lastSelect.ngAfterViewInit();
}
}
});
}

removeTripLocation(index: number) {
const tripLocationId = this.tripLocations[index].id;

if (tripLocationId) {
// If it exists on the server, delete it
this.tripLocationService.tripLocationsIdDelete(this.appHelperService.extractId(tripLocationId)).subscribe(
() => {
this.tripLocations.splice(index, 1);
this.locationForms.splice(index, 1);
}
);
} else {
// If it's only local, just remove it from the array
this.tripLocations.splice(index, 1);
this.locationForms.splice(index, 1);
}
}

saveAllTripLocations() {
// First update the location objects in our tripLocations array
this.tripLocations.forEach((tripLocation, index) => {
const locationFormValue = this.locationForms[index].get('location')?.value;

// Ensure we have a location
if (locationFormValue) {
// If just an ID was set, create a proper location object
if (typeof locationFormValue === 'string') {
tripLocation.location = {
'id': locationFormValue
} as LocationJsonld;
}
} else {
// If no location is set, show an error
return;
}
});

// Filter out trip locations that have no location set
const validTripLocations = this.tripLocations.filter(tl => tl.location);

if (validTripLocations.length === 0) {
return;
}

// Save all trip locations
const savePromises = validTripLocations.map(tripLocation => {
if (tripLocation.id) {
// Update existing
return this.tripLocationService.tripLocationsIdPatch(
this.appHelperService.extractId(tripLocation.id),
tripLocation
).toPromise();
} else {
// Create new
return this.tripLocationService.tripLocationsPost(tripLocation).toPromise();
}
});

Promise.all(savePromises)
.then(() => {
// Reload trip locations to get updated data
this.loadTripLocations();
})
.catch(error => {
console.error('Error saving trip locations:', error);
});
}
}

+ 93
- 0
angular/src/app/_views/trip/trip-form/trip-form.component.html 查看文件

@@ -0,0 +1,93 @@
<div class="spt-container">
@if (!isEditMode()) {
<div class="spt-headline d-flex justify-content-between align-items-start">
<h2>{{ ('basic.new') | translate }} {{ 'model.trip' | translate }}</h2>
</div>
}
<div class="spt-form">
<form [formGroup]="tripForm" (ngSubmit)="onSubmit()">
<div class="mb-3">
<label for="vessel" class="form-label">{{ 'trip.vessel' | translate }}*:</label>
<app-search-select #vesselSearchSelect
[formId]="'vessel'"
[formLabelLangKey]="'model.vessel'"
[documentForm]="form"
[getDataFunction]="getVessels"
[displayedDataField]="'name'"
[listColDefinitions]="vesselColDefinitions"
[dataSet]="data?.vessel"
>
</app-search-select>
<input id="vessel" type="hidden" formControlName="vessel" required/>
</div>
<div class="mb-3">
<label for="startLocation" class="form-label">{{ 'trip.start_location' | translate }}*:</label>
<app-search-select #startLocationSearchSelect
[formId]="'startLocation'"
[formLabelLangKey]="'model.location'"
[documentForm]="form"
[getDataFunction]="getLocations"
[displayedDataField]="'name'"
[listColDefinitions]="locationColDefinitions"
[dataSet]="data?.startLocation"
>
</app-search-select>
<input id="startLocation" type="hidden" formControlName="startLocation" required/>
</div>
<div class="mb-3">
<label for="endLocation" class="form-label">{{ 'trip.end_location' | translate }}*:</label>
<app-search-select #endLocationSearchSelect
[formId]="'endLocation'"
[formLabelLangKey]="'model.location'"
[documentForm]="form"
[getDataFunction]="getLocations"
[displayedDataField]="'name'"
[listColDefinitions]="locationColDefinitions"
[dataSet]="data?.endLocation"
>
</app-search-select>
<input id="endLocation" type="hidden" formControlName="endLocation" required/>
</div>

<div class="mb-3">
<label for="customerReference" class="form-label">{{ 'trip.customer_reference' | translate }}:</label>
<input type="text" class="form-control" id="customerReference" formControlName="customerReference"/>
</div>

<div class="mb-3">
<label for="captainName" class="form-label">{{ 'trip.captain_name' | translate }}:</label>
<input type="text" class="form-control" id="captainName" formControlName="captainName"/>
</div>

<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3">
<app-datetime-picker
[label]="'trip.start_date' | translate"
[inputId]="'startDate'"
[initialValue]="tripForm.get('startDate')?.value ?? null"
(dateTimeChange)="onDateChange($event, 'startDate')"
></app-datetime-picker>
</div>

<div class="col-12 col-sm-6 col-md-4 col-lg-3 mb-3">
<app-datetime-picker
[label]="'trip.end_date' | translate"
[inputId]="'startDate'"
[initialValue]="tripForm.get('endDate')?.value ?? null"
(dateTimeChange)="onDateChange($event, 'endDate')"
></app-datetime-picker>
</div>

<div class="flex gap-2">
<button type="submit" class="btn btn-primary" [disabled]="form.invalid">
{{ 'basic.save' | translate }}
</button>

@if (isEditMode()) {
<button type="button" class="ms-3 btn btn-primary" (click)="onDelete()">
{{ 'basic.delete' | translate }} {{ 'model.trip' | translate }}
</button>
}
</div>
</form>
</div>
</div>

+ 0
- 0
angular/src/app/_views/trip/trip-form/trip-form.component.scss 查看文件


+ 23
- 0
angular/src/app/_views/trip/trip-form/trip-form.component.spec.ts 查看文件

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TripFormComponent } from './trip-form.component';

describe('TripFormComponent', () => {
let component: TripFormComponent;
let fixture: ComponentFixture<TripFormComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TripFormComponent]
})
.compileComponents();
fixture = TestBed.createComponent(TripFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 64
- 0
angular/src/app/_views/trip/trip-form/trip-form.component.ts 查看文件

@@ -0,0 +1,64 @@
import { Component } from '@angular/core';
import {
AbstractDataFormComponent, DeleteFunction,
SaveFunction,
UpdateFunction
} from "@app/_components/_abstract/abstract-data-form-component";
import {
LocationJsonld, LocationService,
ShippingCompanyService,
TripJsonld,
TripService,
VesselJsonld,
VesselService
} from "@app/core/api/v1";
import {SearchSelectComponent} from "@app/_components/search-select/search-select.component";
import {tripForm, vesselForm} from "@app/_forms/apiForms";
import {FormGroup} from "@angular/forms";
import {TranslateService} from "@ngx-translate/core";
import {Router} from "@angular/router";
import {ROUTE_BASE_DATA} from "@app/app-routing.module";
import {ListColDefinition} from "@app/_components/list/list-col-definition";
import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type";

@Component({
selector: 'app-trip-form',
templateUrl: './trip-form.component.html',
styleUrl: './trip-form.component.scss'
})
export class TripFormComponent extends AbstractDataFormComponent<TripJsonld> {

protected readonly SearchSelectComponent = SearchSelectComponent;
protected vesselColDefinitions: ListColDefinition[];
protected locationColDefinitions: ListColDefinition[];
protected readonly tripForm = tripForm;

constructor(
private tripService: TripService,
private vesselService: VesselService,
private locationService: LocationService,
translateService: TranslateService,
router: Router
) {
super(
tripForm,
(data: TripJsonld) => this.tripService.tripsPost(data),
(id: string | number, data: TripJsonld) => this.tripService.tripsIdPatch(id.toString(), data),
(id: string | number) => this.tripService.tripsIdDelete(id.toString()),
translateService,
router
);

this.redirectAfterDelete = '/' + ROUTE_BASE_DATA;
this.vesselColDefinitions = SearchSelectComponent.getDefaultColDefVessels();
this.locationColDefinitions = SearchSelectComponent.getDefaultColDefLocations();
}

getVessels: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => {
return this.vesselService.vesselsGetCollection(index, pageSize, term);
}

getLocations: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => {
return this.locationService.locationsGetCollection(index, pageSize, term);
}
}

+ 8
- 0
angular/src/app/_views/trip/trip-list/trip-list.component.html 查看文件

@@ -0,0 +1,8 @@
<div class="spt-container">
<app-list #listComponent
[listId]="'tripList'"
[getDataFunction]="getData"
[listColDefinitions]="listColDefinitions"
[dataFormComponent]="tripFormComponent"
></app-list>
</div>

+ 0
- 0
angular/src/app/_views/trip/trip-list/trip-list.component.scss 查看文件


+ 23
- 0
angular/src/app/_views/trip/trip-list/trip-list.component.spec.ts 查看文件

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TripListComponent } from './trip-list.component';

describe('TripListComponent', () => {
let component: TripListComponent;
let fixture: ComponentFixture<TripListComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TripListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(TripListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 127
- 0
angular/src/app/_views/trip/trip-list/trip-list.component.ts 查看文件

@@ -0,0 +1,127 @@
import {Component, ViewChild} from '@angular/core';
import {ListComponent} from "@app/_components/list/list.component";
import {ListColDefinition} from "@app/_components/list/list-col-definition";
import {TripFormComponent} from "@app/_views/trip/trip-form/trip-form.component";
import {TripService} from "@app/core/api/v1";
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";

@Component({
selector: 'app-trip-list',
templateUrl: './trip-list.component.html',
styleUrl: './trip-list.component.scss'
})
export class TripListComponent {

@ViewChild("listComponent", {static: false}) listComponent!: ListComponent;

protected readonly tripFormComponent = TripFormComponent;
protected listColDefinitions!: ListColDefinition[];

constructor(
private tripService: TripService,
protected appHelperService: AppHelperService,
) {
this.listColDefinitions = [
{
name: 'pilotageReference',
text: 'trip.pilot_reference',
type: ListComponent.COLUMN_TYPE_TEXT_BOLD,
field: 'pilotageReference',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'customerReference',
text: 'trip.customer_reference',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'customerReference',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'vessel',
text: 'trip.vessel',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'vessel',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'captainName',
text: 'trip.captain_name',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'captainName',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'startLocation',
text: 'trip.start_location',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'startLocation',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'endLocation',
text: 'trip.end_location',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'endLocation',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'startDate',
text: 'trip.start_date',
type: ListComponent.COLUMN_TYPE_DATE,
field: 'startDate',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_DATE,
} as ListColDefinition,
{
name: 'endDate',
text: 'trip.end_date',
type: ListComponent.COLUMN_TYPE_DATE,
field: 'endDate',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_DATE,
} as ListColDefinition,
{
name: 'createdAt',
text: 'common.created_at',
type: ListComponent.COLUMN_TYPE_DATE,
field: 'createdAt',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_DATE,
} as ListColDefinition,
];
}

ngOnInit() {

}

ngAfterViewInit(): void {
this.listComponent.getData();
}

getData: ListGetDataFunctionType = (
index: number,
pageSize: number,
term?: string,
) => {
return this.tripService.tripsGetCollection(
index,
pageSize,
term ? Number(term) : undefined,
this.listComponent.getFilterJsonString(),
this.listComponent.getSortingJsonString()
);
}

}

+ 6
- 1
angular/src/app/_views/trip/trip.component.html 查看文件

@@ -1 +1,6 @@
<p>trip works!</p>
<div class="spt-container">
<div class="spt-headline d-flex justify-content-between align-items-start">
<h2>{{ 'trip.view' | translate }}</h2>
</div>
<app-trip-list></app-trip-list>
</div>

+ 2
- 35
angular/src/app/_views/vessel/vessel-list/vessel-list.component.ts 查看文件

@@ -9,6 +9,7 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct
import {Sort} from "@angular/material/sort";
import {ROUTE_VESSELS, ROUTE_ZONES} from "@app/app-routing.module";
import {VesselFormComponent} from "@app/_views/vessel/vessel-form/vessel-form.component";
import {SearchSelectComponent} from "@app/_components/search-select/search-select.component";

@Component({
selector: 'app-vessel-list',
@@ -27,41 +28,7 @@ export class VesselListComponent {
protected appHelperService: AppHelperService,
) {

this.listColDefinitions = [
{
name: 'name',
text: 'common.name',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'code',
text: 'common.code',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'code',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'shippingCompanyName',
text: 'model.shipping_company',
type: ListComponent.COLUMN_TYPE_TEXT,
subResource: 'company',
field: 'name',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_TEXT,
} as ListColDefinition,
{
name: 'createdAt',
text: 'common.created_at',
type: ListComponent.COLUMN_TYPE_DATE,
field: 'createdAt',
sortable: true,
filterType: FilterBarComponent.FILTER_TYPE_DATE,
} as ListColDefinition,
];
this.listColDefinitions = SearchSelectComponent.getDefaultColDefVessels();
}

ngOnInit() {


+ 18
- 0
angular/src/app/app-routing.module.ts 查看文件

@@ -14,6 +14,8 @@ import {VesselDetailComponent} from "@app/_views/vessel/vessel-detail/vessel-det
import {
ShippingCompanyDetailComponent
} from "@app/_views/shipping-company/shipping-company-detail/shipping-company-detail.component";
import {TripComponent} from "@app/_views/trip/trip.component";
import {TripDetailComponent} from "@app/_views/trip/trip-detail/trip-detail.component";

const accountModule = () => import('@app/_views/account/account.module').then(x => x.AccountModule);

@@ -57,6 +59,22 @@ const routes: Routes = [
{path: ':id', component: LocationDetailComponent},
]
},
{
path: ROUTE_TRIPS,
component: TwoColumnComponent,
canActivate: [userGuard],
children: [
{path: '', component: TripComponent},
]
},
{
path: ROUTE_TRIPS,
component: TwoColumnComponent,
canActivate: [userGuard],
children: [
{path: ':id', component: TripDetailComponent},
]
},
{
path: ROUTE_ZONES,
component: TwoColumnComponent,


+ 2
- 1
angular/src/app/app.component.ts 查看文件

@@ -55,7 +55,8 @@ export class AppComponent implements OnInit {
// TODO: Hilfsfunktion - entfernen
copyTokenToClipboard() {
const el = document.createElement('textarea');
el.value = this.user?.token || "";
const token = localStorage.getItem('token');
el.value = token || "";
document.body.appendChild(el);
el.select();
document.execCommand('copy');


+ 8
- 0
angular/src/app/app.module.ts 查看文件

@@ -61,6 +61,10 @@ import { LocationFormComponent } from './_views/location/location-form/location-
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';
import { TripListComponent } from './_views/trip/trip-list/trip-list.component';
import { TripDetailComponent } from './_views/trip/trip-detail/trip-detail.component';
import { TripFormComponent } from './_views/trip/trip-form/trip-form.component';
import {DatetimePickerComponent} from "@app/_components/datetime-picker/datetime-picker.component";

registerLocaleData(localeDe, 'de-DE');

@@ -119,6 +123,7 @@ export function HttpLoaderFactory(http: HttpClient) {
ProfileComponent,
SearchInputComponent,
PagingComponent,
DatetimePickerComponent,
UsersComponent,
UserDetailComponent,
UserListComponent,
@@ -147,6 +152,9 @@ export function HttpLoaderFactory(http: HttpClient) {
ZoneFormComponent,
VesselFormComponent,
ShippingCompanyFormComponent,
TripListComponent,
TripDetailComponent,
TripFormComponent,
],
providers: [
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},


+ 8
- 14
angular/src/app/core/api/v1/.openapi-generator/FILES 查看文件

@@ -1,9 +1,9 @@
.gitignore
.openapi-generator-ignore
README.md
api.module.ts
api/api.ts
api/auth.service.ts
api/event.service.ts
api/location.service.ts
api/mediaObject.service.ts
api/shippingCompany.service.ts
@@ -11,34 +11,32 @@ api/trip.service.ts
api/tripLocation.service.ts
api/user.service.ts
api/userTrip.service.ts
api/userTripLocation.service.ts
api/userTripWorkLog.service.ts
api/vessel.service.ts
api/zone.service.ts
configuration.ts
encoder.ts
git_push.sh
index.ts
model/apiEventsGetCollection200Response.ts
model/apiEventsGetCollection200ResponseSearch.ts
model/apiEventsGetCollection200ResponseSearchMappingInner.ts
model/apiEventsGetCollection200ResponseView.ts
model/apiLocationsGetCollection200Response.ts
model/apiLocationsGetCollection200ResponseSearch.ts
model/apiLocationsGetCollection200ResponseSearchMappingInner.ts
model/apiLocationsGetCollection200ResponseView.ts
model/apiMediaObjectsGetCollection200Response.ts
model/apiShippingCompaniesGetCollection200Response.ts
model/apiTripLocationsGetCollection200Response.ts
model/apiTripsGetCollection200Response.ts
model/apiUserTripLocationsGetCollection200Response.ts
model/apiUserTripWorkLogsGetCollection200Response.ts
model/apiUserTripsGetCollection200Response.ts
model/apiUsersGetCollection200Response.ts
model/apiVesselsGetCollection200Response.ts
model/apiZonesGetCollection200Response.ts
model/authResponse.ts
model/credentials.ts
model/eventJsonld.ts
model/eventJsonldContext.ts
model/eventJsonldContextOneOf.ts
model/location.ts
model/locationJsonld.ts
model/locationJsonldContext.ts
model/locationJsonldContextOneOf.ts
model/mediaObjectJsonld.ts
model/models.ts
model/shippingCompany.ts
@@ -51,10 +49,6 @@ model/user.ts
model/userJsonld.ts
model/userTrip.ts
model/userTripJsonld.ts
model/userTripLocation.ts
model/userTripLocationJsonld.ts
model/userTripWorkLog.ts
model/userTripWorkLogJsonld.ts
model/vessel.ts
model/vesselJsonld.ts
model/zone.ts


+ 3
- 5
angular/src/app/core/api/v1/api/api.ts 查看文件

@@ -1,5 +1,7 @@
export * from './auth.service';
import { AuthService } from './auth.service';
export * from './event.service';
import { EventService } from './event.service';
export * from './location.service';
import { LocationService } from './location.service';
export * from './mediaObject.service';
@@ -14,12 +16,8 @@ export * from './user.service';
import { UserService } from './user.service';
export * from './userTrip.service';
import { UserTripService } from './userTrip.service';
export * from './userTripLocation.service';
import { UserTripLocationService } from './userTripLocation.service';
export * from './userTripWorkLog.service';
import { UserTripWorkLogService } from './userTripWorkLog.service';
export * from './vessel.service';
import { VesselService } from './vessel.service';
export * from './zone.service';
import { ZoneService } from './zone.service';
export const APIS = [AuthService, LocationService, MediaObjectService, ShippingCompanyService, TripService, TripLocationService, UserService, UserTripService, UserTripLocationService, UserTripWorkLogService, VesselService, ZoneService];
export const APIS = [AuthService, EventService, LocationService, MediaObjectService, ShippingCompanyService, TripService, TripLocationService, UserService, UserTripService, VesselService, ZoneService];

+ 264
- 0
angular/src/app/core/api/v1/api/event.service.ts 查看文件

@@ -0,0 +1,264 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';

// @ts-ignore
import { ApiEventsGetCollection200Response } from '../model/apiEventsGetCollection200Response';
// @ts-ignore
import { EventJsonld } from '../model/eventJsonld';

// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';



@Injectable({
providedIn: 'root'
})
export class EventService {

protected basePath = 'http://localhost';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
public encoder: HttpParameterCodec;

constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
}
if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) {
basePath = basePath[0];
}

if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}


// @ts-ignore
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}

private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
if (value == null) {
return httpParams;
}

if (typeof value === "object") {
if (Array.isArray(value)) {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
} else {
throw Error("key may not be null if value is Date");
}
} else {
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
httpParams, value[k], key != null ? `${key}.${k}` : k));
}
} else if (key != null) {
httpParams = httpParams.append(key, value);
} else {
throw Error("key may not be null if value is not object or array");
}
return httpParams;
}

/**
* Retrieves the collection of Event resources.
* Retrieves the collection of Event resources.
* @param page The collection page number
* @param itemsPerPage The number of items per page
* @param name
* @param customJsonFilter
* @param customJsonOrder
* @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 eventsGetCollection(page?: number, itemsPerPage?: number, name?: string, customJsonFilter?: string, customJsonOrder?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiEventsGetCollection200Response>;
public eventsGetCollection(page?: number, itemsPerPage?: number, name?: string, customJsonFilter?: string, customJsonOrder?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiEventsGetCollection200Response>>;
public eventsGetCollection(page?: number, itemsPerPage?: number, name?: string, customJsonFilter?: string, customJsonOrder?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiEventsGetCollection200Response>>;
public eventsGetCollection(page?: number, itemsPerPage?: number, name?: string, customJsonFilter?: string, customJsonOrder?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
}
if (itemsPerPage !== undefined && itemsPerPage !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>itemsPerPage, 'itemsPerPage');
}
if (name !== undefined && name !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>name, 'name');
}
if (customJsonFilter !== undefined && customJsonFilter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonFilter, 'custom_json_filter');
}
if (customJsonOrder !== undefined && customJsonOrder !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonOrder, 'custom_json_order');
}

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[] = [
'application/ld+json'
];
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/events`;
return this.httpClient.request<ApiEventsGetCollection200Response>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Retrieves a Event resource.
* Retrieves a Event resource.
* @param id Event 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 eventsIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<EventJsonld>;
public eventsIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<EventJsonld>>;
public eventsIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<EventJsonld>>;
public eventsIdGet(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling eventsIdGet.');
}

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[] = [
'application/ld+json'
];
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/events/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<EventJsonld>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

}

+ 90
- 4
angular/src/app/core/api/v1/api/trip.service.ts 查看文件

@@ -100,13 +100,16 @@ export class TripService {
* Retrieves the collection of Trip resources.
* @param page The collection page number
* @param itemsPerPage The number of items per page
* @param id
* @param customJsonFilter
* @param customJsonOrder
* @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 tripsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiTripsGetCollection200Response>;
public tripsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiTripsGetCollection200Response>>;
public tripsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiTripsGetCollection200Response>>;
public tripsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public tripsGetCollection(page?: number, itemsPerPage?: number, id?: number, customJsonFilter?: string, customJsonOrder?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiTripsGetCollection200Response>;
public tripsGetCollection(page?: number, itemsPerPage?: number, id?: number, customJsonFilter?: string, customJsonOrder?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiTripsGetCollection200Response>>;
public tripsGetCollection(page?: number, itemsPerPage?: number, id?: number, customJsonFilter?: string, customJsonOrder?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiTripsGetCollection200Response>>;
public tripsGetCollection(page?: number, itemsPerPage?: number, id?: number, customJsonFilter?: string, customJsonOrder?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
@@ -117,6 +120,18 @@ export class TripService {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>itemsPerPage, 'itemsPerPage');
}
if (id !== undefined && id !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>id, 'id');
}
if (customJsonFilter !== undefined && customJsonFilter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonFilter, 'custom_json_filter');
}
if (customJsonOrder !== undefined && customJsonOrder !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonOrder, 'custom_json_order');
}

let localVarHeaders = this.defaultHeaders;

@@ -176,6 +191,77 @@ export class TripService {
);
}

/**
* Removes the Trip resource.
* Removes the Trip resource.
* @param id Trip 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 tripsIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>;
public tripsIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
public tripsIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
public tripsIdDelete(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 tripsIdDelete.');
}

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/trips/${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 Trip resource.
* Retrieves a Trip resource.


+ 97
- 4
angular/src/app/core/api/v1/api/tripLocation.service.ts 查看文件

@@ -100,13 +100,17 @@ export class TripLocationService {
* Retrieves the collection of TripLocation resources.
* @param page The collection page number
* @param itemsPerPage The number of items per page
* @param trip
* @param trip2
* @param customJsonFilter
* @param customJsonOrder
* @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 tripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiTripLocationsGetCollection200Response>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiTripLocationsGetCollection200Response>>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiTripLocationsGetCollection200Response>>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, trip?: string, trip2?: Array<string>, customJsonFilter?: string, customJsonOrder?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiTripLocationsGetCollection200Response>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, trip?: string, trip2?: Array<string>, customJsonFilter?: string, customJsonOrder?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiTripLocationsGetCollection200Response>>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, trip?: string, trip2?: Array<string>, customJsonFilter?: string, customJsonOrder?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiTripLocationsGetCollection200Response>>;
public tripLocationsGetCollection(page?: number, itemsPerPage?: number, trip?: string, trip2?: Array<string>, customJsonFilter?: string, customJsonOrder?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
@@ -117,6 +121,24 @@ export class TripLocationService {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>itemsPerPage, 'itemsPerPage');
}
if (trip !== undefined && trip !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>trip, 'trip');
}
if (trip2) {
trip2.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'trip[]');
})
}
if (customJsonFilter !== undefined && customJsonFilter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonFilter, 'custom_json_filter');
}
if (customJsonOrder !== undefined && customJsonOrder !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>customJsonOrder, 'custom_json_order');
}

let localVarHeaders = this.defaultHeaders;

@@ -176,6 +198,77 @@ export class TripLocationService {
);
}

/**
* Removes the TripLocation resource.
* Removes the TripLocation resource.
* @param id TripLocation 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 tripLocationsIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>;
public tripLocationsIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
public tripLocationsIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
public tripLocationsIdDelete(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 tripLocationsIdDelete.');
}

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/trip_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 TripLocation resource.
* Retrieves a TripLocation resource.


+ 0
- 419
angular/src/app/core/api/v1/api/userTripLocation.service.ts 查看文件

@@ -1,419 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';

// @ts-ignore
import { ApiUserTripLocationsGetCollection200Response } from '../model/apiUserTripLocationsGetCollection200Response';
// @ts-ignore
import { UserTripLocation } from '../model/userTripLocation';
// @ts-ignore
import { UserTripLocationJsonld } from '../model/userTripLocationJsonld';

// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';



@Injectable({
providedIn: 'root'
})
export class UserTripLocationService {

protected basePath = 'http://localhost';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
public encoder: HttpParameterCodec;

constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
}
if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) {
basePath = basePath[0];
}

if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}


// @ts-ignore
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}

private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
if (value == null) {
return httpParams;
}

if (typeof value === "object") {
if (Array.isArray(value)) {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
} else {
throw Error("key may not be null if value is Date");
}
} else {
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
httpParams, value[k], key != null ? `${key}.${k}` : k));
}
} else if (key != null) {
httpParams = httpParams.append(key, value);
} else {
throw Error("key may not be null if value is not object or array");
}
return httpParams;
}

/**
* Retrieves the collection of UserTripLocation resources.
* Retrieves the collection of UserTripLocation resources.
* @param page The collection page number
* @param itemsPerPage The number of items per page
* @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 userTripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiUserTripLocationsGetCollection200Response>;
public userTripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiUserTripLocationsGetCollection200Response>>;
public userTripLocationsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiUserTripLocationsGetCollection200Response>>;
public userTripLocationsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
}
if (itemsPerPage !== undefined && itemsPerPage !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>itemsPerPage, 'itemsPerPage');
}

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[] = [
'application/ld+json'
];
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/user_trip_locations`;
return this.httpClient.request<ApiUserTripLocationsGetCollection200Response>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Retrieves a UserTripLocation resource.
* Retrieves a UserTripLocation resource.
* @param id UserTripLocation 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 userTripLocationsIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripLocationJsonld>;
public userTripLocationsIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripLocationJsonld>>;
public userTripLocationsIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripLocationJsonld>>;
public userTripLocationsIdGet(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling userTripLocationsIdGet.');
}

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[] = [
'application/ld+json'
];
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/user_trip_locations/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<UserTripLocationJsonld>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Updates the UserTripLocation resource.
* Updates the UserTripLocation resource.
* @param id UserTripLocation identifier
* @param userTripLocation The updated UserTripLocation resource
* @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 userTripLocationsIdPatch(id: string, userTripLocation: UserTripLocation, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripLocationJsonld>;
public userTripLocationsIdPatch(id: string, userTripLocation: UserTripLocation, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripLocationJsonld>>;
public userTripLocationsIdPatch(id: string, userTripLocation: UserTripLocation, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripLocationJsonld>>;
public userTripLocationsIdPatch(id: string, userTripLocation: UserTripLocation, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling userTripLocationsIdPatch.');
}
if (userTripLocation === null || userTripLocation === undefined) {
throw new Error('Required parameter userTripLocation was null or undefined when calling userTripLocationsIdPatch.');
}

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[] = [
'application/ld+json'
];
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;
}


// to determine the Content-Type header
const consumes: string[] = [
'application/merge-patch+json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}

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/user_trip_locations/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<UserTripLocationJsonld>('patch', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: userTripLocation,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Creates a UserTripLocation resource.
* Creates a UserTripLocation resource.
* @param userTripLocationJsonld The new UserTripLocation resource
* @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 userTripLocationsPost(userTripLocationJsonld: UserTripLocationJsonld, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripLocationJsonld>;
public userTripLocationsPost(userTripLocationJsonld: UserTripLocationJsonld, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripLocationJsonld>>;
public userTripLocationsPost(userTripLocationJsonld: UserTripLocationJsonld, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripLocationJsonld>>;
public userTripLocationsPost(userTripLocationJsonld: UserTripLocationJsonld, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (userTripLocationJsonld === null || userTripLocationJsonld === undefined) {
throw new Error('Required parameter userTripLocationJsonld was null or undefined when calling userTripLocationsPost.');
}

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[] = [
'application/ld+json'
];
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;
}


// to determine the Content-Type header
const consumes: string[] = [
'application/ld+json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}

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/user_trip_locations`;
return this.httpClient.request<UserTripLocationJsonld>('post', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: userTripLocationJsonld,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

}

+ 0
- 419
angular/src/app/core/api/v1/api/userTripWorkLog.service.ts 查看文件

@@ -1,419 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';

// @ts-ignore
import { ApiUserTripWorkLogsGetCollection200Response } from '../model/apiUserTripWorkLogsGetCollection200Response';
// @ts-ignore
import { UserTripWorkLog } from '../model/userTripWorkLog';
// @ts-ignore
import { UserTripWorkLogJsonld } from '../model/userTripWorkLogJsonld';

// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';



@Injectable({
providedIn: 'root'
})
export class UserTripWorkLogService {

protected basePath = 'http://localhost';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
public encoder: HttpParameterCodec;

constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
}
if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) {
basePath = basePath[0];
}

if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}


// @ts-ignore
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}

private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
if (value == null) {
return httpParams;
}

if (typeof value === "object") {
if (Array.isArray(value)) {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
} else {
throw Error("key may not be null if value is Date");
}
} else {
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
httpParams, value[k], key != null ? `${key}.${k}` : k));
}
} else if (key != null) {
httpParams = httpParams.append(key, value);
} else {
throw Error("key may not be null if value is not object or array");
}
return httpParams;
}

/**
* Retrieves the collection of UserTripWorkLog resources.
* Retrieves the collection of UserTripWorkLog resources.
* @param page The collection page number
* @param itemsPerPage The number of items per page
* @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 userTripWorkLogsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiUserTripWorkLogsGetCollection200Response>;
public userTripWorkLogsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiUserTripWorkLogsGetCollection200Response>>;
public userTripWorkLogsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiUserTripWorkLogsGetCollection200Response>>;
public userTripWorkLogsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
}
if (itemsPerPage !== undefined && itemsPerPage !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>itemsPerPage, 'itemsPerPage');
}

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[] = [
'application/ld+json'
];
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/user_trip_work_logs`;
return this.httpClient.request<ApiUserTripWorkLogsGetCollection200Response>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Retrieves a UserTripWorkLog resource.
* Retrieves a UserTripWorkLog resource.
* @param id UserTripWorkLog 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 userTripWorkLogsIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripWorkLogJsonld>;
public userTripWorkLogsIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripWorkLogJsonld>>;
public userTripWorkLogsIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripWorkLogJsonld>>;
public userTripWorkLogsIdGet(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling userTripWorkLogsIdGet.');
}

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[] = [
'application/ld+json'
];
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/user_trip_work_logs/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<UserTripWorkLogJsonld>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Updates the UserTripWorkLog resource.
* Updates the UserTripWorkLog resource.
* @param id UserTripWorkLog identifier
* @param userTripWorkLog The updated UserTripWorkLog resource
* @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 userTripWorkLogsIdPatch(id: string, userTripWorkLog: UserTripWorkLog, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripWorkLogJsonld>;
public userTripWorkLogsIdPatch(id: string, userTripWorkLog: UserTripWorkLog, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripWorkLogJsonld>>;
public userTripWorkLogsIdPatch(id: string, userTripWorkLog: UserTripWorkLog, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripWorkLogJsonld>>;
public userTripWorkLogsIdPatch(id: string, userTripWorkLog: UserTripWorkLog, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling userTripWorkLogsIdPatch.');
}
if (userTripWorkLog === null || userTripWorkLog === undefined) {
throw new Error('Required parameter userTripWorkLog was null or undefined when calling userTripWorkLogsIdPatch.');
}

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[] = [
'application/ld+json'
];
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;
}


// to determine the Content-Type header
const consumes: string[] = [
'application/merge-patch+json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}

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/user_trip_work_logs/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<UserTripWorkLogJsonld>('patch', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: userTripWorkLog,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

/**
* Creates a UserTripWorkLog resource.
* Creates a UserTripWorkLog resource.
* @param userTripWorkLogJsonld The new UserTripWorkLog resource
* @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 userTripWorkLogsPost(userTripWorkLogJsonld: UserTripWorkLogJsonld, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<UserTripWorkLogJsonld>;
public userTripWorkLogsPost(userTripWorkLogJsonld: UserTripWorkLogJsonld, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserTripWorkLogJsonld>>;
public userTripWorkLogsPost(userTripWorkLogJsonld: UserTripWorkLogJsonld, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserTripWorkLogJsonld>>;
public userTripWorkLogsPost(userTripWorkLogJsonld: UserTripWorkLogJsonld, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (userTripWorkLogJsonld === null || userTripWorkLogJsonld === undefined) {
throw new Error('Required parameter userTripWorkLogJsonld was null or undefined when calling userTripWorkLogsPost.');
}

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[] = [
'application/ld+json'
];
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;
}


// to determine the Content-Type header
const consumes: string[] = [
'application/ld+json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}

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/user_trip_work_logs`;
return this.httpClient.request<UserTripWorkLogJsonld>('post', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: userTripWorkLogJsonld,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);
}

}

+ 23
- 0
angular/src/app/core/api/v1/model/apiEventsGetCollection200Response.ts 查看文件

@@ -0,0 +1,23 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { EventJsonld } from './eventJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiEventsGetCollection200Response {
member: Array<EventJsonld>;
totalItems?: number;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


angular/src/app/core/api/v1/model/apiLocationsGetCollection200ResponseSearch.ts → angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseSearch.ts 查看文件

@@ -9,13 +9,13 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearchMappingInner } from './apiLocationsGetCollection200ResponseSearchMappingInner';
import { ApiEventsGetCollection200ResponseSearchMappingInner } from './apiEventsGetCollection200ResponseSearchMappingInner';


export interface ApiLocationsGetCollection200ResponseSearch {
export interface ApiEventsGetCollection200ResponseSearch {
type?: string;
template?: string;
variableRepresentation?: string;
mapping?: Array<ApiLocationsGetCollection200ResponseSearchMappingInner>;
mapping?: Array<ApiEventsGetCollection200ResponseSearchMappingInner>;
}


angular/src/app/core/api/v1/model/apiLocationsGetCollection200ResponseSearchMappingInner.ts → angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseSearchMappingInner.ts 查看文件

@@ -11,7 +11,7 @@
*/


export interface ApiLocationsGetCollection200ResponseSearchMappingInner {
export interface ApiEventsGetCollection200ResponseSearchMappingInner {
type?: string;
variable?: string;
property?: string | null;

angular/src/app/core/api/v1/model/apiLocationsGetCollection200ResponseView.ts → angular/src/app/core/api/v1/model/apiEventsGetCollection200ResponseView.ts 查看文件

@@ -11,7 +11,7 @@
*/


export interface ApiLocationsGetCollection200ResponseView {
export interface ApiEventsGetCollection200ResponseView {
id?: string;
type?: string;
first?: string;

+ 4
- 4
angular/src/app/core/api/v1/model/apiLocationsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';
import { LocationJsonld } from './locationJsonld';


export interface ApiLocationsGetCollection200Response {
member: Array<LocationJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiMediaObjectsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { MediaObjectJsonld } from './mediaObjectJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiMediaObjectsGetCollection200Response {
member: Array<MediaObjectJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiShippingCompaniesGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { ShippingCompanyJsonld } from './shippingCompanyJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiShippingCompaniesGetCollection200Response {
member: Array<ShippingCompanyJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiTripLocationsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { TripLocationJsonld } from './tripLocationJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiTripLocationsGetCollection200Response {
member: Array<TripLocationJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiTripsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { TripJsonld } from './tripJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiTripsGetCollection200Response {
member: Array<TripJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 0
- 23
angular/src/app/core/api/v1/model/apiUserTripLocationsGetCollection200Response.ts 查看文件

@@ -1,23 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { UserTripLocationJsonld } from './userTripLocationJsonld';


export interface ApiUserTripLocationsGetCollection200Response {
member: Array<UserTripLocationJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
}


+ 0
- 23
angular/src/app/core/api/v1/model/apiUserTripWorkLogsGetCollection200Response.ts 查看文件

@@ -1,23 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { UserTripWorkLogJsonld } from './userTripWorkLogJsonld';


export interface ApiUserTripWorkLogsGetCollection200Response {
member: Array<UserTripWorkLogJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiUserTripsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { UserTripJsonld } from './userTripJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiUserTripsGetCollection200Response {
member: Array<UserTripJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiUsersGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { UserJsonld } from './userJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiUsersGetCollection200Response {
member: Array<UserJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiVesselsGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { VesselJsonld } from './vesselJsonld';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';


export interface ApiVesselsGetCollection200Response {
member: Array<VesselJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


+ 4
- 4
angular/src/app/core/api/v1/model/apiZonesGetCollection200Response.ts 查看文件

@@ -9,15 +9,15 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiLocationsGetCollection200ResponseSearch } from './apiLocationsGetCollection200ResponseSearch';
import { ApiLocationsGetCollection200ResponseView } from './apiLocationsGetCollection200ResponseView';
import { ApiEventsGetCollection200ResponseSearch } from './apiEventsGetCollection200ResponseSearch';
import { ApiEventsGetCollection200ResponseView } from './apiEventsGetCollection200ResponseView';
import { ZoneJsonld } from './zoneJsonld';


export interface ApiZonesGetCollection200Response {
member: Array<ZoneJsonld>;
totalItems?: number;
view?: ApiLocationsGetCollection200ResponseView;
search?: ApiLocationsGetCollection200ResponseSearch;
view?: ApiEventsGetCollection200ResponseView;
search?: ApiEventsGetCollection200ResponseSearch;
}


angular/src/app/core/api/v1/model/userTripLocation.ts → angular/src/app/core/api/v1/model/eventJsonld.ts 查看文件

@@ -9,16 +9,21 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface UserTripLocation {
export interface EventJsonld {
readonly id?: string;
readonly type?: string;
context?: EventJsonldContext;
readonly dbId?: number | null;
readonly userTrip?: string;
readonly location?: string;
plannedDate: string;
name?: string;
identifier?: string;
sequence?: number;
mandatory?: boolean;
readonly createdAt?: string | null;
}


angular/src/app/core/api/v1/model/locationJsonldContext.ts → angular/src/app/core/api/v1/model/eventJsonldContext.ts 查看文件

@@ -9,12 +9,12 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContextOneOf } from './locationJsonldContextOneOf';
import { EventJsonldContextOneOf } from './eventJsonldContextOneOf';


/**
* @type LocationJsonldContext
* @type EventJsonldContext
* @export
*/
export type LocationJsonldContext = LocationJsonldContextOneOf | string;
export type EventJsonldContext = EventJsonldContextOneOf | string;


angular/src/app/core/api/v1/model/locationJsonldContextOneOf.ts → angular/src/app/core/api/v1/model/eventJsonldContextOneOf.ts 查看文件

@@ -11,14 +11,14 @@
*/


export interface LocationJsonldContextOneOf {
export interface EventJsonldContextOneOf {
[key: string]: any | any;


vocab: string;
hydra: LocationJsonldContextOneOf.HydraEnum;
hydra: EventJsonldContextOneOf.HydraEnum;
}
export namespace LocationJsonldContextOneOf {
export namespace EventJsonldContextOneOf {
export type HydraEnum = 'http://www.w3.org/ns/hydra/core#';
export const HydraEnum = {
HttpWwwW3OrgNsHydraCore: 'http://www.w3.org/ns/hydra/core#' as HydraEnum

+ 3
- 0
angular/src/app/core/api/v1/model/location.ts 查看文件

@@ -20,6 +20,9 @@ export interface Location {
zone?: Zone;
name: string;
code: string;
isZone?: boolean;
isPlace?: boolean;
isPort?: boolean;
readonly createdAt?: string | null;
}


+ 5
- 2
angular/src/app/core/api/v1/model/locationJsonld.ts 查看文件

@@ -9,7 +9,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';
import { ZoneJsonld } from './zoneJsonld';


@@ -17,13 +17,16 @@ import { ZoneJsonld } from './zoneJsonld';
*
*/
export interface LocationJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
zone?: ZoneJsonld;
name: string;
code: string;
isZone?: boolean;
isPlace?: boolean;
isPort?: boolean;
readonly createdAt?: string | null;
}


+ 2
- 2
angular/src/app/core/api/v1/model/mediaObjectJsonld.ts 查看文件

@@ -9,14 +9,14 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface MediaObjectJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;


+ 7
- 11
angular/src/app/core/api/v1/model/models.ts 查看文件

@@ -1,23 +1,23 @@
export * from './apiEventsGetCollection200Response';
export * from './apiEventsGetCollection200ResponseSearch';
export * from './apiEventsGetCollection200ResponseSearchMappingInner';
export * from './apiEventsGetCollection200ResponseView';
export * from './apiLocationsGetCollection200Response';
export * from './apiLocationsGetCollection200ResponseSearch';
export * from './apiLocationsGetCollection200ResponseSearchMappingInner';
export * from './apiLocationsGetCollection200ResponseView';
export * from './apiMediaObjectsGetCollection200Response';
export * from './apiShippingCompaniesGetCollection200Response';
export * from './apiTripLocationsGetCollection200Response';
export * from './apiTripsGetCollection200Response';
export * from './apiUserTripLocationsGetCollection200Response';
export * from './apiUserTripWorkLogsGetCollection200Response';
export * from './apiUserTripsGetCollection200Response';
export * from './apiUsersGetCollection200Response';
export * from './apiVesselsGetCollection200Response';
export * from './apiZonesGetCollection200Response';
export * from './authResponse';
export * from './credentials';
export * from './eventJsonld';
export * from './eventJsonldContext';
export * from './eventJsonldContextOneOf';
export * from './location';
export * from './locationJsonld';
export * from './locationJsonldContext';
export * from './locationJsonldContextOneOf';
export * from './mediaObjectJsonld';
export * from './shippingCompany';
export * from './shippingCompanyJsonld';
@@ -29,10 +29,6 @@ export * from './user';
export * from './userJsonld';
export * from './userTrip';
export * from './userTripJsonld';
export * from './userTripLocation';
export * from './userTripLocationJsonld';
export * from './userTripWorkLog';
export * from './userTripWorkLogJsonld';
export * from './vessel';
export * from './vesselJsonld';
export * from './zone';


+ 2
- 2
angular/src/app/core/api/v1/model/shippingCompanyJsonld.ts 查看文件

@@ -9,14 +9,14 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface ShippingCompanyJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;


+ 8
- 4
angular/src/app/core/api/v1/model/trip.ts 查看文件

@@ -9,6 +9,8 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Vessel } from './vessel';
import { Location } from './location';


/**
@@ -16,13 +18,15 @@
*/
export interface Trip {
readonly dbId?: number | null;
readonly vessel?: string;
pilotReference: string;
vessel?: Vessel;
readonly pilotageReference?: string | null;
customerReference?: string | null;
captainName?: string | null;
readonly startLocation?: string;
readonly endLocation?: string;
startLocation?: Location;
endLocation?: Location;
startDate: string;
endDate: string;
note?: string | null;
readonly createdAt?: string | null;
}


+ 8
- 6
angular/src/app/core/api/v1/model/tripJsonld.ts 查看文件

@@ -10,25 +10,27 @@
* Do not edit the class manually.
*/
import { VesselJsonld } from './vesselJsonld';
import { EventJsonldContext } from './eventJsonldContext';
import { LocationJsonld } from './locationJsonld';
import { LocationJsonldContext } from './locationJsonldContext';


/**
*
*/
export interface TripJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
readonly vessel?: VesselJsonld;
pilotReference: string;
vessel?: VesselJsonld;
readonly pilotageReference?: string | null;
customerReference?: string | null;
captainName?: string | null;
readonly startLocation?: LocationJsonld;
readonly endLocation?: LocationJsonld;
startLocation?: LocationJsonld;
endLocation?: LocationJsonld;
startDate: string;
endDate: string;
note?: string | null;
readonly createdAt?: string | null;
}


+ 5
- 2
angular/src/app/core/api/v1/model/tripLocation.ts 查看文件

@@ -9,6 +9,8 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Trip } from './trip';
import { Location } from './location';


/**
@@ -16,8 +18,9 @@
*/
export interface TripLocation {
readonly dbId?: number | null;
readonly trip?: string;
readonly location?: string;
trip?: Trip;
location?: Location;
isArrival?: boolean;
date: string;
readonly createdAt?: string | null;
}


+ 5
- 4
angular/src/app/core/api/v1/model/tripLocationJsonld.ts 查看文件

@@ -10,20 +10,21 @@
* Do not edit the class manually.
*/
import { TripJsonld } from './tripJsonld';
import { EventJsonldContext } from './eventJsonldContext';
import { LocationJsonld } from './locationJsonld';
import { LocationJsonldContext } from './locationJsonldContext';


/**
*
*/
export interface TripLocationJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
readonly trip?: TripJsonld;
readonly location?: LocationJsonld;
trip?: TripJsonld;
location?: LocationJsonld;
isArrival?: boolean;
date: string;
readonly createdAt?: string | null;
}


+ 1
- 1
angular/src/app/core/api/v1/model/user.ts 查看文件

@@ -18,6 +18,7 @@ export interface User {
readonly dbId?: number | null;
email: string;
firstName: string;
referenceId: string;
lastName: string;
image?: string | null;
readonly imageUrl?: string | null;
@@ -28,7 +29,6 @@ export interface User {
password?: string;
active?: boolean;
roles?: Array<string>;
readonly token?: string | null;
readonly createdAt?: string | null;
}


+ 3
- 3
angular/src/app/core/api/v1/model/userJsonld.ts 查看文件

@@ -9,19 +9,20 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface UserJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
email: string;
firstName: string;
referenceId: string;
lastName: string;
image?: string | null;
readonly imageUrl?: string | null;
@@ -32,7 +33,6 @@ export interface UserJsonld {
password?: string;
active?: boolean;
roles?: Array<string>;
readonly token?: string | null;
readonly createdAt?: string | null;
}


+ 2
- 2
angular/src/app/core/api/v1/model/userTripJsonld.ts 查看文件

@@ -11,14 +11,14 @@
*/
import { TripJsonld } from './tripJsonld';
import { UserJsonld } from './userJsonld';
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface UserTripJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;


+ 0
- 30
angular/src/app/core/api/v1/model/userTripLocationJsonld.ts 查看文件

@@ -1,30 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { UserTripJsonld } from './userTripJsonld';
import { LocationJsonld } from './locationJsonld';
import { LocationJsonldContext } from './locationJsonldContext';


/**
*
*/
export interface UserTripLocationJsonld {
context?: LocationJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
readonly userTrip?: UserTripJsonld;
readonly location?: LocationJsonld;
plannedDate: string;
readonly createdAt?: string | null;
}


+ 0
- 26
angular/src/app/core/api/v1/model/userTripWorkLog.ts 查看文件

@@ -1,26 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


/**
*
*/
export interface UserTripWorkLog {
readonly dbId?: number | null;
readonly userTrip?: string;
readonly startLocation?: string;
readonly endLocation?: string;
startDate: string;
endDate: string;
readonly createdAt?: string | null;
}


+ 0
- 32
angular/src/app/core/api/v1/model/userTripWorkLogJsonld.ts 查看文件

@@ -1,32 +0,0 @@
/**
* Imaq Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { UserTripJsonld } from './userTripJsonld';
import { LocationJsonld } from './locationJsonld';
import { LocationJsonldContext } from './locationJsonldContext';


/**
*
*/
export interface UserTripWorkLogJsonld {
context?: LocationJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;
readonly userTrip?: UserTripJsonld;
readonly startLocation?: LocationJsonld;
readonly endLocation?: LocationJsonld;
startDate: string;
endDate: string;
readonly createdAt?: string | null;
}


+ 2
- 2
angular/src/app/core/api/v1/model/vesselJsonld.ts 查看文件

@@ -10,14 +10,14 @@
* Do not edit the class manually.
*/
import { ShippingCompanyJsonld } from './shippingCompanyJsonld';
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface VesselJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;


+ 2
- 2
angular/src/app/core/api/v1/model/zoneJsonld.ts 查看文件

@@ -9,14 +9,14 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { LocationJsonldContext } from './locationJsonldContext';
import { EventJsonldContext } from './eventJsonldContext';


/**
*
*/
export interface ZoneJsonld {
context?: LocationJsonldContext;
context?: EventJsonldContext;
readonly id?: string;
readonly type?: string;
readonly dbId?: number | null;


+ 18
- 6
angular/src/assets/i18n/en.json 查看文件

@@ -15,11 +15,21 @@
"code": "Code",
"created_at": "Created at"
},
"trips":
"trip":
{
"view": "Trips"
"view": "Trips",
"view_single": "Trip",
"pilot_reference": "Pilotage reference",
"customer_reference": "Customer reference",
"captain_name": "Captain name",
"vessel": "Vessel",
"start_location": "Start location",
"end_location": "End location",
"start_date": "Start date",
"end_date": "End date",
"itinerary": "Itinerary"
},
"user_trips":
"user_trip":
{
"view": "User Trips"
},
@@ -35,12 +45,14 @@
"location": "Location",
"zone": "Zone",
"vessel": "Vessel",
"shipping_company": "Shipping Company"
"shipping_company": "Shipping Company",
"trip": "Trip"
},
"location":
{

"is_zone": "Is zone",
"is_place": "Is place",
"is_port": "Is port"
},
"zone":
{


+ 1
- 1
httpdocs/config/packages/api_platform.yaml 查看文件

@@ -15,7 +15,7 @@ api_platform:
standard_put: true
pagination_client_items_per_page: true
pagination_items_per_page: 50
pagination_maximum_items_per_page: 100
pagination_maximum_items_per_page: 200

swagger:
api_keys:


+ 31
- 0
httpdocs/migrations/Version20250228112455.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250228112455 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE location ADD is_area TINYINT(1) NOT NULL, ADD is_place TINYINT(1) NOT NULL, ADD is_port TINYINT(1) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE location DROP is_area, DROP is_place, DROP is_port');
}
}

+ 31
- 0
httpdocs/migrations/Version20250228113640.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250228113640 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE location CHANGE is_area is_zone TINYINT(1) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE location CHANGE is_zone is_area TINYINT(1) NOT NULL');
}
}

+ 53
- 0
httpdocs/migrations/Version20250303144554.php 查看文件

@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250303144554 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE event (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, identifier VARCHAR(255) NOT NULL, `order` INT UNSIGNED NOT NULL, mandatory TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_3BAE0AA75E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_trip_event (id INT AUTO_INCREMENT NOT NULL, user_trip_id INT NOT NULL, event_id INT NOT NULL, date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_46824C08FDB13004 (user_trip_id), INDEX IDX_46824C0871F7E88B (event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE user_trip_event ADD CONSTRAINT FK_46824C08FDB13004 FOREIGN KEY (user_trip_id) REFERENCES user_trip (id)');
$this->addSql('ALTER TABLE user_trip_event ADD CONSTRAINT FK_46824C0871F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('ALTER TABLE user_trip_location DROP FOREIGN KEY FK_1841178B64D218E');
$this->addSql('ALTER TABLE user_trip_location DROP FOREIGN KEY FK_1841178BFDB13004');
$this->addSql('ALTER TABLE user_trip_work_log DROP FOREIGN KEY FK_B38EA119FDB13004');
$this->addSql('ALTER TABLE user_trip_work_log DROP FOREIGN KEY FK_B38EA1195C3A313A');
$this->addSql('ALTER TABLE user_trip_work_log DROP FOREIGN KEY FK_B38EA119C43C7F1');
$this->addSql('DROP TABLE user_trip_location');
$this->addSql('DROP TABLE user_trip_work_log');
$this->addSql('ALTER TABLE trip_location ADD is_arrival TINYINT(1) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE user_trip_location (id INT AUTO_INCREMENT NOT NULL, user_trip_id INT NOT NULL, location_id INT NOT NULL, planned_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_1841178BFDB13004 (user_trip_id), INDEX IDX_1841178B64D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE user_trip_work_log (id INT AUTO_INCREMENT NOT NULL, user_trip_id INT NOT NULL, start_location_id INT NOT NULL, end_location_id INT NOT NULL, start_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_B38EA119C43C7F1 (end_location_id), INDEX IDX_B38EA119FDB13004 (user_trip_id), INDEX IDX_B38EA1195C3A313A (start_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE user_trip_location ADD CONSTRAINT FK_1841178B64D218E FOREIGN KEY (location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE user_trip_location ADD CONSTRAINT FK_1841178BFDB13004 FOREIGN KEY (user_trip_id) REFERENCES user_trip (id)');
$this->addSql('ALTER TABLE user_trip_work_log ADD CONSTRAINT FK_B38EA119FDB13004 FOREIGN KEY (user_trip_id) REFERENCES user_trip (id)');
$this->addSql('ALTER TABLE user_trip_work_log ADD CONSTRAINT FK_B38EA1195C3A313A FOREIGN KEY (start_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE user_trip_work_log ADD CONSTRAINT FK_B38EA119C43C7F1 FOREIGN KEY (end_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE user_trip_event DROP FOREIGN KEY FK_46824C08FDB13004');
$this->addSql('ALTER TABLE user_trip_event DROP FOREIGN KEY FK_46824C0871F7E88B');
$this->addSql('DROP TABLE event');
$this->addSql('DROP TABLE user_trip_event');
$this->addSql('ALTER TABLE trip_location DROP is_arrival');
}
}

+ 31
- 0
httpdocs/migrations/Version20250303152548.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250303152548 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE event CHANGE `order` sequence INT UNSIGNED NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE event CHANGE sequence `order` INT UNSIGNED NOT NULL');
}
}

+ 31
- 0
httpdocs/migrations/Version20250304114315.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250304114315 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user_trip_event ADD note LONGTEXT DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user_trip_event DROP note');
}
}

+ 33
- 0
httpdocs/migrations/Version20250304115016.php 查看文件

@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250304115016 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_7656F53B69AF50E7 ON trip');
$this->addSql('ALTER TABLE trip DROP pilotage_reference');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip ADD pilotage_reference VARCHAR(255) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_7656F53B69AF50E7 ON trip (pilotage_reference)');
}
}

+ 31
- 0
httpdocs/migrations/Version20250304122802.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250304122802 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip CHANGE cruise_reference cruise_reference VARCHAR(255) DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip CHANGE cruise_reference cruise_reference VARCHAR(255) NOT NULL');
}
}

+ 31
- 0
httpdocs/migrations/Version20250304124329.php 查看文件

@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250304124329 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip CHANGE cruise_reference customer_reference VARCHAR(255) DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip CHANGE customer_reference cruise_reference VARCHAR(255) DEFAULT NULL');
}
}

+ 56
- 0
httpdocs/src/ApiResource/EventApi.php 查看文件

@@ -0,0 +1,56 @@
<?php

namespace App\ApiResource;

use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Doctrine\Orm\State\Options;
use App\Entity\Event;
use App\Filter\CustomJsonFilter;
use App\Filter\CustomJsonOrderFilter;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;

#[ApiResource(
shortName: 'Event',
operations: [
new Get(
security: 'is_granted("ROLE_USER")'
),
new GetCollection(
security: 'is_granted("ROLE_USER")'
),
],
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: Event::class),
)]
#[ApiFilter(SearchFilter::class, properties: [
'name' => 'ipartial',
])]
#[ApiFilter(CustomJsonFilter::class)]
#[ApiFilter(CustomJsonOrderFilter::class)]
class EventApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
public ?int $id = null;

#[ApiProperty(writable: false)]
public ?int $dbId = null;

public string $name;

public string $identifier;

public int $sequence;

public bool $mandatory;

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;
}

+ 6
- 0
httpdocs/src/ApiResource/LocationApi.php 查看文件

@@ -79,6 +79,12 @@ class LocationApi
#[Assert\NotBlank]
public string $code;

public bool $isZone;

public bool $isPlace;

public bool $isPort;

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;
}

+ 25
- 8
httpdocs/src/ApiResource/TripApi.php 查看文件

@@ -2,14 +2,19 @@

namespace App\ApiResource;

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;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Doctrine\Orm\State\Options;
use App\Entity\Trip;
use App\Filter\CustomJsonFilter;
use App\Filter\CustomJsonOrderFilter;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;
use Symfony\Component\Validator\Constraints as Assert;
@@ -30,12 +35,20 @@ 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,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: Trip::class),
)]
#[ApiFilter(SearchFilter::class, properties: [
'id' => 'ipartial',
])]
#[ApiFilter(CustomJsonFilter::class)]
#[ApiFilter(CustomJsonOrderFilter::class)]
class TripApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
@@ -48,9 +61,9 @@ class TripApi
* @var VesselApi
*/
#[ApiProperty(
writable: false,
writable: true,
readableLink: true,
writableLink: false,
writableLink: true,
builtinTypes: [
new Type(
'object',
@@ -60,8 +73,10 @@ class TripApi
)]
public ?VesselApi $vessel = null;

#[Assert\NotBlank]
public string $pilotReference;
#[ApiProperty(writable: false)]
public ?string $pilotageReference = null;

public ?string $customerReference = null;

public ?string $captainName = null;

@@ -69,9 +84,9 @@ class TripApi
* @var LocationApi
*/
#[ApiProperty(
writable: false,
writable: true,
readableLink: true,
writableLink: false,
writableLink: true,
builtinTypes: [
new Type(
'object',
@@ -85,9 +100,9 @@ class TripApi
* @var LocationApi
*/
#[ApiProperty(
writable: false,
writable: true,
readableLink: true,
writableLink: false,
writableLink: true,
builtinTypes: [
new Type(
'object',
@@ -103,6 +118,8 @@ class TripApi
#[Assert\NotBlank]
public \DateTimeImmutable $endDate;

public ?string $note;

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;
}

+ 19
- 4
httpdocs/src/ApiResource/TripLocationApi.php 查看文件

@@ -2,14 +2,19 @@

namespace App\ApiResource;

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;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Doctrine\Orm\State\Options;
use App\Entity\TripLocation;
use App\Filter\CustomJsonFilter;
use App\Filter\CustomJsonOrderFilter;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;
use Symfony\Component\Validator\Constraints as Assert;
@@ -30,12 +35,20 @@ use Symfony\Component\PropertyInfo\Type;
new Patch(
security: 'is_granted("ROLE_ADMIN")'
),
new Delete(
security: 'is_granted("ROLE_ADMIN")'
)
],
order: ['date' => 'ASC'],
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: TripLocation::class),
)]

#[ApiFilter(SearchFilter::class, properties: ['trip' => 'exact'])]
#[ApiFilter(CustomJsonFilter::class)]
#[ApiFilter(CustomJsonOrderFilter::class)]
class TripLocationApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
@@ -48,9 +61,9 @@ class TripLocationApi
* @var TripApi
*/
#[ApiProperty(
writable: false,
writable: true,
readableLink: true,
writableLink: false,
writableLink: true,
builtinTypes: [
new Type(
'object',
@@ -64,9 +77,9 @@ class TripLocationApi
* @var LocationApi
*/
#[ApiProperty(
writable: false,
writable: true,
readableLink: true,
writableLink: false,
writableLink: true,
builtinTypes: [
new Type(
'object',
@@ -76,6 +89,8 @@ class TripLocationApi
)]
public ?LocationApi $location = null;

public bool $isArrival;

#[Assert\NotBlank]
public \DateTimeImmutable $date;



+ 3
- 0
httpdocs/src/ApiResource/UserApi.php 查看文件

@@ -69,6 +69,9 @@ class UserApi
#[Assert\NotBlank]
public string $firstName;

#[Assert\NotBlank]
public string $referenceId;

#[Assert\NotBlank]
public string $lastName;



httpdocs/src/ApiResource/UserTripLocationApi.php → httpdocs/src/ApiResource/UserTripEventApi.php 查看文件

@@ -9,14 +9,15 @@ use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Doctrine\Orm\State\Options;
use App\Entity\UserTripLocation;
use App\Entity\UserTrip;
use App\Entity\UserTripEvent;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\PropertyInfo\Type;

#[ApiResource(
shortName: 'UserTripLocation',
shortName: 'UserTrip',
operations: [
new Get(
security: 'is_granted("ROLE_USER")'
@@ -34,9 +35,9 @@ use Symfony\Component\PropertyInfo\Type;
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: UserTripLocation::class),
stateOptions: new Options(entityClass: UserTripEvent::class),
)]
class UserTripLocationApi
class UserTripEventApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
public ?int $id = null;
@@ -54,14 +55,14 @@ class UserTripLocationApi
builtinTypes: [
new Type(
'object',
class: UserTripApi::class,
class: UserTrip::class,
)
]
)]
public ?UserTripApi $userTrip = null;

/**
* @var LocationApi
* @var EventApi
*/
#[ApiProperty(
writable: false,
@@ -70,14 +71,16 @@ class UserTripLocationApi
builtinTypes: [
new Type(
'object',
class: LocationApi::class,
class: EventApi::class,
)
]
)]
public ?LocationApi $location = null;
public ?EventApi $event = null;

#[Assert\NotBlank]
public \DateTimeImmutable $plannedDate;
public \DateTimeImmutable $date;

public ?string $note;

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;

+ 0
- 103
httpdocs/src/ApiResource/UserTripWorkLogApi.php 查看文件

@@ -1,103 +0,0 @@
<?php

namespace App\ApiResource;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Doctrine\Orm\State\Options;
use App\Entity\UserTripWorkLog;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\PropertyInfo\Type;

#[ApiResource(
shortName: 'UserTripWorkLog',
operations: [
new Get(
security: 'is_granted("ROLE_USER")'
),
new GetCollection(
security: 'is_granted("ROLE_USER")'
),
new Post(
security: 'is_granted("ROLE_ADMIN")'
),
new Patch(
security: 'is_granted("ROLE_ADMIN")'
),
],
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: UserTripWorkLog::class),
)]
class UserTripWorkLogApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
public ?int $id = null;

#[ApiProperty(writable: false)]
public ?int $dbId = null;

/**
* @var UserTripApi
*/
#[ApiProperty(
writable: false,
readableLink: true,
writableLink: false,
builtinTypes: [
new Type(
'object',
class: UserTripApi::class,
)
]
)]
public ?UserTripApi $userTrip = null;

/**
* @var LocationApi
*/
#[ApiProperty(
writable: false,
readableLink: true,
writableLink: false,
builtinTypes: [
new Type(
'object',
class: LocationApi::class,
)
]
)]
public ?LocationApi $startLocation = null;

/**
* @var LocationApi
*/
#[ApiProperty(
writable: false,
readableLink: true,
writableLink: false,
builtinTypes: [
new Type(
'object',
class: LocationApi::class,
)
]
)]
public ?LocationApi $endLocation = null;

#[Assert\NotBlank]
public \DateTimeImmutable $startDate;

#[Assert\NotBlank]
public \DateTimeImmutable $endDate;

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;
}

+ 116
- 0
httpdocs/src/Command/Import/CreateEventsCommand.php 查看文件

@@ -0,0 +1,116 @@
<?php

declare(strict_types=1);

namespace App\Command\Import;

use App\Entity\Event;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'app:create-events',
description: 'Creates events'
)]
class CreateEventsCommand extends Command
{

public function __construct(
private readonly EntityManagerInterface $entityManager
) {
parent::__construct();
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$event = new Event();
$event->setName('EEZ In');
$event->setIdentifier('eez');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('EEZ Out');
$event->setIdentifier('eez');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Watch Start');
$event->setIdentifier('watch');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Watch Stop');
$event->setIdentifier('watch');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('3nm In');
$event->setIdentifier('3nm');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('3nm Out');
$event->setIdentifier('3nm');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Arrival to port');
$event->setIdentifier('port');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Departure from port');
$event->setIdentifier('port');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Anchor Start');
$event->setIdentifier('anchor');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Anchor Stop');
$event->setIdentifier('anchor');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Drifting Start');
$event->setIdentifier('drifting');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Drifting Stop');
$event->setIdentifier('drifting');
$event->setSequence(2);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Port canceled');
$event->setIdentifier('port_canceled');
$event->setSequence(1);
$this->entityManager->persist($event);

$event = new Event();
$event->setName('Port amended');
$event->setIdentifier('port_amended');
$event->setSequence(1);
$this->entityManager->persist($event);

$this->entityManager->flush();
return Command::SUCCESS;
}
}

+ 89
- 0
httpdocs/src/Entity/Event.php 查看文件

@@ -0,0 +1,89 @@
<?php

declare(strict_types=1);

namespace App\Entity;

use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'event')]
class Event
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;

#[ORM\Column(length: 255, unique: true)]
private string $name;

#[ORM\Column(length: 255)]
private string $identifier;

#[ORM\Column(type: 'integer', options: ["unsigned" => true])]
private ?int $sequence = null;

#[ORM\Column(nullable: false)]
private bool $mandatory = true;

#[ORM\Column]
private DateTimeImmutable $createdAt;

public function __construct()
{
$this->createdAt = new DateTimeImmutable();
}

public function getId(): ?int
{
return $this->id;
}

public function getName(): string
{
return $this->name;
}

public function setName(string $name): void
{
$this->name = $name;
}

public function getIdentifier(): string
{
return $this->identifier;
}

public function setIdentifier(string $identifier): void
{
$this->identifier = $identifier;
}

public function getSequence(): ?int
{
return $this->sequence;
}

public function setSequence(?int $sequence): void
{
$this->sequence = $sequence;
}

public function isMandatory(): bool
{
return $this->mandatory;
}

public function setMandatory(bool $mandatory): void
{
$this->mandatory = $mandatory;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}

}

+ 33
- 22
httpdocs/src/Entity/Location.php 查看文件

@@ -28,21 +28,21 @@ class Location
#[ORM\Column(length: 255)]
private string $name;

#[ORM\Column(nullable: false)]
private bool $isZone = false;

#[ORM\Column(nullable: false)]
private bool $isPlace = false;

#[ORM\Column(nullable: false)]
private bool $isPort = false;

#[ORM\Column]
private DateTimeImmutable $createdAt;

#[ORM\OneToMany(targetEntity: TripLocation::class, mappedBy: 'location')]
private Collection $tripLocations;

#[ORM\OneToMany(targetEntity: UserTripLocation::class, mappedBy: 'location')]
private Collection $userTripLocations;

#[ORM\OneToMany(targetEntity: UserTripWorkLog::class, mappedBy: 'startLocation')]
private Collection $startWorkLogs;

#[ORM\OneToMany(targetEntity: UserTripWorkLog::class, mappedBy: 'endLocation')]
private Collection $endWorkLogs;

public function __construct(Zone $zone, string $name, string $code)
{
$this->zone = $zone;
@@ -50,9 +50,6 @@ class Location
$this->code = $code;
$this->createdAt = new DateTimeImmutable();
$this->tripLocations = new ArrayCollection();
$this->userTripLocations = new ArrayCollection();
$this->startWorkLogs = new ArrayCollection();
$this->endWorkLogs = new ArrayCollection();
}

public function getId(): ?int
@@ -92,29 +89,43 @@ class Location
$this->code = $code;
}

public function getCreatedAt(): DateTimeImmutable
public function isZone(): bool
{
return $this->createdAt;
return $this->isZone;
}

public function getTripLocations(): Collection
public function setIsZone(bool $isZone): void
{
return $this->tripLocations;
$this->isZone = $isZone;
}

public function isPlace(): bool
{
return $this->isPlace;
}

public function getUserTripLocations(): Collection
public function setIsPlace(bool $isPlace): void
{
return $this->userTripLocations;
$this->isPlace = $isPlace;
}

public function getStartWorkLogs(): Collection
public function isPort(): bool
{
return $this->startWorkLogs;
return $this->isPort;
}

public function getEndWorkLogs(): Collection
public function setIsPort(bool $isPort): void
{
return $this->endWorkLogs;
$this->isPort = $isPort;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}

public function getTripLocations(): Collection
{
return $this->tripLocations;
}
}

+ 19
- 9
httpdocs/src/Entity/Trip.php 查看文件

@@ -22,8 +22,8 @@ class Trip
#[ORM\JoinColumn(nullable: false)]
private Vessel $vessel;

#[ORM\Column(length: 255)]
private string $pilotReference;
#[ORM\Column(length: 255, nullable: true)]
private ?string $customerReference = null;

#[ORM\Column(length: 255, nullable: true)]
private ?string $captainName = null;
@@ -42,6 +42,9 @@ class Trip
#[ORM\Column]
private DateTimeImmutable $endDate;

#[ORM\Column(type: "text", nullable: true)]
protected ?string $note;

#[ORM\Column]
private DateTimeImmutable $createdAt;

@@ -53,14 +56,12 @@ class Trip

public function __construct(
Vessel $vessel,
string $pilotageReference,
Location $startLocation,
Location $endLocation,
DateTimeImmutable $startDate,
DateTimeImmutable $endDate
) {
$this->vessel = $vessel;
$this->pilotReference = $pilotageReference;
$this->startLocation = $startLocation;
$this->endLocation = $endLocation;
$this->startDate = $startDate;
@@ -86,15 +87,14 @@ class Trip
return $this;
}

public function getPilotReference(): string
public function getCustomerReference(): ?string
{
return $this->pilotReference;
return $this->customerReference;
}

public function setPilotReference(string $pilotReference): self
public function setCustomerReference(?string $customerReference): void
{
$this->pilotReference = $pilotReference;
return $this;
$this->customerReference = $customerReference;
}

public function getCaptainName(): ?string
@@ -152,6 +152,16 @@ class Trip
return $this;
}

public function getNote(): ?string
{
return $this->note;
}

public function setNote(?string $note): void
{
$this->note = $note;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;


+ 13
- 0
httpdocs/src/Entity/TripLocation.php 查看文件

@@ -24,6 +24,9 @@ class TripLocation
#[ORM\JoinColumn(nullable: false)]
private Location $location;

#[ORM\Column(nullable: false)]
private bool $isArrival = true;

#[ORM\Column]
private DateTimeImmutable $date;

@@ -76,6 +79,16 @@ class TripLocation
return $this;
}

public function isArrival(): bool
{
return $this->isArrival;
}

public function setIsArrival(bool $isArrival): void
{
$this->isArrival = $isArrival;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;


+ 13
- 0
httpdocs/src/Entity/User.php 查看文件

@@ -22,6 +22,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(length: 180, unique: true)]
private ?string $email = null;

#[ORM\Column(length: 255)]
private ?string $referenceId = null;

#[ORM\Column(length: 255)]
private ?string $firstName = null;

@@ -70,6 +73,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}

public function getReferenceId(): ?string
{
return $this->referenceId;
}

public function setReferenceId(?string $referenceId): void
{
$this->referenceId = $referenceId;
}

/**
* A visual identifier that represents this user.
*


+ 7
- 54
httpdocs/src/Entity/UserTrip.php 查看文件

@@ -38,11 +38,8 @@ class UserTrip
#[ORM\Column]
private DateTimeImmutable $createdAt;

#[ORM\OneToMany(targetEntity: UserTripLocation::class, mappedBy: 'userTrip')]
private Collection $tripLocations;

#[ORM\OneToMany(targetEntity: UserTripWorkLog::class, mappedBy: 'userTrip')]
private Collection $workLogs;
#[ORM\OneToMany(targetEntity: UserTripEvent::class, mappedBy: 'userTrip')]
private Collection $userTripEvents;

public function __construct(
Trip $trip,
@@ -57,8 +54,7 @@ class UserTrip
$this->startDate = $startDate;
$this->endDate = $endDate;
$this->createdAt = new DateTimeImmutable();
$this->tripLocations = new ArrayCollection();
$this->workLogs = new ArrayCollection();
$this->userTripEvents = new ArrayCollection();
}

public function getId(): ?int
@@ -121,56 +117,13 @@ class UserTrip
return $this;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}

public function getTripLocations(): Collection
{
return $this->tripLocations;
}

public function addTripLocation(UserTripLocation $tripLocation): self
{
if (!$this->tripLocations->contains($tripLocation)) {
$this->tripLocations->add($tripLocation);
$tripLocation->setUserTrip($this);
}
return $this;
}

public function removeTripLocation(UserTripLocation $tripLocation): self
{
if ($this->tripLocations->removeElement($tripLocation)) {
if ($tripLocation->getUserTrip() === $this) {
$tripLocation->setUserTrip(null);
}
}
return $this;
}

public function getWorkLogs(): Collection
{
return $this->workLogs;
}

public function addWorkLog(UserTripWorkLog $workLog): self
public function getUserTripEvents(): Collection
{
if (!$this->workLogs->contains($workLog)) {
$this->workLogs->add($workLog);
$workLog->setUserTrip($this);
}
return $this;
return $this->userTripEvents;
}

public function removeWorkLog(UserTripWorkLog $workLog): self
public function getCreatedAt(): DateTimeImmutable
{
if ($this->workLogs->removeElement($workLog)) {
if ($workLog->getUserTrip() === $this) {
$workLog->setUserTrip(null);
}
}
return $this;
return $this->createdAt;
}
}

+ 96
- 0
httpdocs/src/Entity/UserTripEvent.php 查看文件

@@ -0,0 +1,96 @@
<?php

declare(strict_types=1);

namespace App\Entity;

use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'user_trip_event')]
class UserTripEvent
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;

#[ORM\ManyToOne(targetEntity: UserTrip::class, inversedBy: 'userTripEvents')]
#[ORM\JoinColumn(nullable: false)]
private UserTrip $userTrip;

#[ORM\ManyToOne(targetEntity: Event::class)]
#[ORM\JoinColumn(nullable: false)]
private Event $event;

#[ORM\Column(nullable: false)]
private DateTimeImmutable $date;

#[ORM\Column(type: "text", nullable: true)]
protected ?string $note;

#[ORM\Column]
private DateTimeImmutable $createdAt;

public function __construct(
UserTrip $userTrip,
Event $event,
DateTimeImmutable $date
) {
$this->userTrip = $userTrip;
$this->event = $event;
$this->date = $date;
$this->createdAt = new DateTimeImmutable();
}

public function getId(): ?int
{
return $this->id;
}

public function getUserTrip(): UserTrip
{
return $this->userTrip;
}

public function setUserTrip(UserTrip $userTrip): void
{
$this->userTrip = $userTrip;
}

public function getEvent(): Event
{
return $this->event;
}

public function setEvent(Event $event): void
{
$this->event = $event;
}

public function getDate(): DateTimeImmutable
{
return $this->date;
}

public function setDate(DateTimeImmutable $date): void
{
$this->date = $date;
}

public function getNote(): ?string
{
return $this->note;
}

public function setNote(?string $note): void
{
$this->note = $note;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
}

+ 0
- 83
httpdocs/src/Entity/UserTripLocation.php 查看文件

@@ -1,83 +0,0 @@
<?php

declare(strict_types=1);

namespace App\Entity;

use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'user_trip_location')]
class UserTripLocation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;

#[ORM\ManyToOne(targetEntity: UserTrip::class, inversedBy: 'tripLocations')]
#[ORM\JoinColumn(nullable: false)]
private UserTrip $userTrip;

#[ORM\ManyToOne(targetEntity: Location::class, inversedBy: 'userTripLocations')]
#[ORM\JoinColumn(nullable: false)]
private Location $location;

#[ORM\Column]
private DateTimeImmutable $plannedDate;

#[ORM\Column]
private DateTimeImmutable $createdAt;

public function __construct(UserTrip $userTrip, Location $location, DateTimeImmutable $plannedDate)
{
$this->userTrip = $userTrip;
$this->location = $location;
$this->plannedDate = $plannedDate;
$this->createdAt = new DateTimeImmutable();
}

public function getId(): ?int
{
return $this->id;
}

public function getUserTrip(): UserTrip
{
return $this->userTrip;
}

public function setUserTrip(UserTrip $userTrip): self
{
$this->userTrip = $userTrip;
return $this;
}

public function getLocation(): Location
{
return $this->location;
}

public function setLocation(Location $location): self
{
$this->location = $location;
return $this;
}

public function getPlannedDate(): DateTimeImmutable
{
return $this->plannedDate;
}

public function setPlannedDate(DateTimeImmutable $plannedDate): self
{
$this->plannedDate = $plannedDate;
return $this;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
}

+ 0
- 119
httpdocs/src/Entity/UserTripWorkLog.php 查看文件

@@ -1,119 +0,0 @@
<?php

declare(strict_types=1);

namespace App\Entity;

use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'user_trip_work_log')]
class UserTripWorkLog
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;

#[ORM\ManyToOne(targetEntity: UserTrip::class, inversedBy: 'workLogs')]
#[ORM\JoinColumn(nullable: false)]
private UserTrip $userTrip;

#[ORM\ManyToOne(targetEntity: Location::class, inversedBy: 'startWorkLogs')]
#[ORM\JoinColumn(name: 'start_location_id', nullable: false)]
private Location $startLocation;

#[ORM\ManyToOne(targetEntity: Location::class, inversedBy: 'endWorkLogs')]
#[ORM\JoinColumn(name: 'end_location_id', nullable: false)]
private Location $endLocation;

#[ORM\Column]
private DateTimeImmutable $startDate;

#[ORM\Column]
private DateTimeImmutable $endDate;

#[ORM\Column]
private DateTimeImmutable $createdAt;

public function __construct(
UserTrip $userTrip,
Location $startLocation,
Location $endLocation,
DateTimeImmutable $startDate,
DateTimeImmutable $endDate
) {
$this->userTrip = $userTrip;
$this->startLocation = $startLocation;
$this->endLocation = $endLocation;
$this->startDate = $startDate;
$this->endDate = $endDate;
$this->createdAt = new DateTimeImmutable();
}

public function getId(): ?int
{
return $this->id;
}

public function getUserTrip(): UserTrip
{
return $this->userTrip;
}

public function setUserTrip(UserTrip $userTrip): self
{
$this->userTrip = $userTrip;
return $this;
}

public function getStartLocation(): Location
{
return $this->startLocation;
}

public function setStartLocation(Location $startLocation): self
{
$this->startLocation = $startLocation;
return $this;
}

public function getEndLocation(): Location
{
return $this->endLocation;
}

public function setEndLocation(Location $endLocation): self
{
$this->endLocation = $endLocation;
return $this;
}

public function getStartDate(): DateTimeImmutable
{
return $this->startDate;
}

public function setStartDate(DateTimeImmutable $startDate): self
{
$this->startDate = $startDate;
return $this;
}

public function getEndDate(): DateTimeImmutable
{
return $this->endDate;
}

public function setEndDate(DateTimeImmutable $endDate): self
{
$this->endDate = $endDate;
return $this;
}

public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
}

+ 41
- 0
httpdocs/src/Mapper/EventEntityToApiMapper.php 查看文件

@@ -0,0 +1,41 @@
<?php

namespace App\Mapper;

use App\ApiResource\EventApi;
use App\ApiResource\ZoneApi;
use App\Entity\Event;
use Symfonycasts\MicroMapper\AsMapper;
use Symfonycasts\MicroMapper\MapperInterface;

#[AsMapper(from: Event::class, to: EventApi::class)]
class EventEntityToApiMapper implements MapperInterface
{
public function load(object $from, string $toClass, array $context): object
{
$entity = $from;
assert($entity instanceof Event);

$dto = new EventApi();
$dto->id = $entity->getId();

return $dto;
}

public function populate(object $from, object $to, array $context): object
{
$entity = $from;
$dto = $to;
assert($entity instanceof Event);
assert($dto instanceof EventApi);

$dto->dbId = $entity->getId();
$dto->name = $entity->getName();
$dto->identifier = $entity->getIdentifier();
$dto->sequence = $entity->getSequence();
$dto->mandatory = $entity->isMandatory();
$dto->createdAt = $entity->getCreatedAt();

return $dto;
}
}

+ 3
- 0
httpdocs/src/Mapper/LocationApiToEntityMapper.php 查看文件

@@ -53,6 +53,9 @@ class LocationApiToEntityMapper implements MapperInterface

$entity->setName($dto->name);
$entity->setCode($dto->code);
$entity->setIsZone($dto->isZone);
$entity->setIsPlace($dto->isPlace);
$entity->setIsPort($dto->isPort);

if ($dto->zone) {
$zone = $this->zoneRepository->find($dto->zone->id);


+ 3
- 0
httpdocs/src/Mapper/LocationEntityToApiMapper.php 查看文件

@@ -38,6 +38,9 @@ class LocationEntityToApiMapper implements MapperInterface
$dto->dbId = $entity->getId();
$dto->name = $entity->getName();
$dto->code = $entity->getCode();
$dto->isZone = $entity->isZone();
$dto->isPlace = $entity->isPlace();
$dto->isPort = $entity->isPort();
$dto->createdAt = $entity->getCreatedAt();

$dto->zone = $this->microMapper->map($entity->getZone(), ZoneApi::class, [


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存