Daniel преди 1 година
родител
ревизия
f8b9e70e0d
променени са 8 файла, в които са добавени 18 реда и са изтрити 13 реда
  1. +1
    -1
      angular/openapi.json
  2. +0
    -2
      angular/openapi.yaml
  3. +2
    -2
      angular/src/app/_forms/apiForms.ts
  4. +10
    -2
      angular/src/app/_views/user-trip/user-trip-form/user-trip-form.component.ts
  5. +1
    -1
      angular/src/app/core/api/v1/model/userTrip.ts
  6. +1
    -1
      angular/src/app/core/api/v1/model/userTripJsonld.ts
  7. +1
    -2
      httpdocs/src/ApiResource/UserTripApi.php
  8. +2
    -2
      httpdocs/src/Mapper/UserTripEntityToApiMapper.php

+ 1
- 1
angular/openapi.json
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 0
- 2
angular/openapi.yaml Целия файл

@@ -2836,7 +2836,6 @@ components:
required:
- trip
- user
- completed
UserTrip.jsonld:
type: object
description: ''
@@ -2901,7 +2900,6 @@ components:
required:
- trip
- user
- completed
UserTripEvent:
type: object
description: ''


+ 2
- 2
angular/src/app/_forms/apiForms.ts Целия файл

@@ -140,7 +140,7 @@ export const userTripForm = new FormGroup({
trip: new FormControl(null, [Validators.required]),
user: new FormControl(null, [Validators.required]),
captainName: new FormControl(null, []),
completed: new FormControl(null, [Validators.required]),
completed: new FormControl(null, []),
signature: new FormControl(null, []),
signatureUrl: new FormControl(null, []),
completedDate: new FormControl(null, []),
@@ -152,7 +152,7 @@ export const userTripJsonldForm = new FormGroup({
trip: new FormControl(null, [Validators.required]),
user: new FormControl(null, [Validators.required]),
captainName: new FormControl(null, []),
completed: new FormControl(null, [Validators.required]),
completed: new FormControl(null, []),
signature: new FormControl(null, []),
signatureUrl: new FormControl(null, []),
completedDate: new FormControl(null, []),


+ 10
- 2
angular/src/app/_views/user-trip/user-trip-form/user-trip-form.component.ts Целия файл

@@ -74,7 +74,6 @@ export class UserTripFormComponent extends AbstractDataFormComponent<UserTripJso
}

override onSubmit(): void {
//if (!this.form.valid) return;
if (!this.form.valid) {
console.log('Form is invalid:', this.form.errors);
Object.keys(this.form.controls).forEach(key => {
@@ -88,12 +87,19 @@ export class UserTripFormComponent extends AbstractDataFormComponent<UserTripJso

// Wenn keine Datei ausgewählt wurde, rufe direkt die Elternmethode auf
if (!this.selectedFile) {
// Wenn keine Datei ausgewählt wurde und keine vorhandene Signature existiert,
// setzen wir sie auf undefined (nicht null)
const currentValue = this.form.get('signature')?.value;
if (currentValue === null) {
this.form.patchValue({
signature: undefined
});
}
super.onSubmit();
return;
}

// 1. Handle file upload if a file is selected
// Blob direkt verwenden, keine FormData erforderlich
this.mediaObjectService.mediaObjectsPost(this.selectedFile).subscribe({
next: (mediaObject) => {
// 2. Update the form data with the new mediaObject
@@ -101,6 +107,8 @@ export class UserTripFormComponent extends AbstractDataFormComponent<UserTripJso
signature: mediaObject
});

console.log('Form after file upload:', this.form.value);

// 3. Call the parent method to handle the standard save process
super.onSubmit();
},


+ 1
- 1
angular/src/app/core/api/v1/model/userTrip.ts Целия файл

@@ -22,7 +22,7 @@ export interface UserTrip {
trip: Trip;
user: User;
captainName?: string | null;
completed: boolean;
completed?: boolean;
signature?: MediaObject;
readonly signatureUrl?: string | null;
completedDate?: string | null;


+ 1
- 1
angular/src/app/core/api/v1/model/userTripJsonld.ts Целия файл

@@ -26,7 +26,7 @@ export interface UserTripJsonld {
trip: TripJsonld;
user: UserJsonld;
captainName?: string | null;
completed: boolean;
completed?: boolean;
signature?: MediaObjectJsonld;
readonly signatureUrl?: string | null;
completedDate?: string | null;


+ 1
- 2
httpdocs/src/ApiResource/UserTripApi.php Целия файл

@@ -95,8 +95,7 @@ class UserTripApi

public ?string $captainName = null;

#[Assert\NotBlank]
public bool $completed;
public bool $completed = false;

/**
* @var MediaObjectApi


+ 2
- 2
httpdocs/src/Mapper/UserTripEntityToApiMapper.php Целия файл

@@ -54,9 +54,9 @@ class UserTripEntityToApiMapper implements MapperInterface
MicroMapperInterface::MAX_DEPTH => 1,
]);

$dto->signatureUrl = null;
$dto->signature = null;
if ($entity->getSignature() !== null) {
$dto->signatureUrl = $this->microMapper->map($entity->getSignature(), MediaObjectApi::class, [
$dto->signature = $this->microMapper->map($entity->getSignature(), MediaObjectApi::class, [
MicroMapperInterface::MAX_DEPTH => 1,
]);
}


Зареждане…
Отказ
Запис