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: required:
- trip - trip
- user - user
- completed
UserTrip.jsonld: UserTrip.jsonld:
type: object type: object
description: '' description: ''
@@ -2901,7 +2900,6 @@ components:
required: required:
- trip - trip
- user - user
- completed
UserTripEvent: UserTripEvent:
type: object type: object
description: '' description: ''


+ 2
- 2
angular/src/app/_forms/apiForms.ts Прегледај датотеку

@@ -140,7 +140,7 @@ export const userTripForm = new FormGroup({
trip: new FormControl(null, [Validators.required]), trip: new FormControl(null, [Validators.required]),
user: new FormControl(null, [Validators.required]), user: new FormControl(null, [Validators.required]),
captainName: new FormControl(null, []), captainName: new FormControl(null, []),
completed: new FormControl(null, [Validators.required]),
completed: new FormControl(null, []),
signature: new FormControl(null, []), signature: new FormControl(null, []),
signatureUrl: new FormControl(null, []), signatureUrl: new FormControl(null, []),
completedDate: new FormControl(null, []), completedDate: new FormControl(null, []),
@@ -152,7 +152,7 @@ export const userTripJsonldForm = new FormGroup({
trip: new FormControl(null, [Validators.required]), trip: new FormControl(null, [Validators.required]),
user: new FormControl(null, [Validators.required]), user: new FormControl(null, [Validators.required]),
captainName: new FormControl(null, []), captainName: new FormControl(null, []),
completed: new FormControl(null, [Validators.required]),
completed: new FormControl(null, []),
signature: new FormControl(null, []), signature: new FormControl(null, []),
signatureUrl: new FormControl(null, []), signatureUrl: new FormControl(null, []),
completedDate: 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 { override onSubmit(): void {
//if (!this.form.valid) return;
if (!this.form.valid) { if (!this.form.valid) {
console.log('Form is invalid:', this.form.errors); console.log('Form is invalid:', this.form.errors);
Object.keys(this.form.controls).forEach(key => { 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 // Wenn keine Datei ausgewählt wurde, rufe direkt die Elternmethode auf
if (!this.selectedFile) { 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(); super.onSubmit();
return; return;
} }


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


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

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


+ 1
- 1
angular/src/app/core/api/v1/model/userTrip.ts Прегледај датотеку

@@ -22,7 +22,7 @@ export interface UserTrip {
trip: Trip; trip: Trip;
user: User; user: User;
captainName?: string | null; captainName?: string | null;
completed: boolean;
completed?: boolean;
signature?: MediaObject; signature?: MediaObject;
readonly signatureUrl?: string | null; readonly signatureUrl?: string | null;
completedDate?: 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; trip: TripJsonld;
user: UserJsonld; user: UserJsonld;
captainName?: string | null; captainName?: string | null;
completed: boolean;
completed?: boolean;
signature?: MediaObjectJsonld; signature?: MediaObjectJsonld;
readonly signatureUrl?: string | null; readonly signatureUrl?: string | null;
completedDate?: string | null; completedDate?: string | null;


+ 1
- 2
httpdocs/src/ApiResource/UserTripApi.php Прегледај датотеку

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


public ?string $captainName = null; public ?string $captainName = null;


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


/** /**
* @var MediaObjectApi * @var MediaObjectApi


+ 2
- 2
httpdocs/src/Mapper/UserTripEntityToApiMapper.php Прегледај датотеку

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


$dto->signatureUrl = null;
$dto->signature = null;
if ($entity->getSignature() !== 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, MicroMapperInterface::MAX_DEPTH => 1,
]); ]);
} }


Loading…
Откажи
Сачувај