Commit d0e0a43c authored by RenanMontenegro3's avatar RenanMontenegro3

feat:"adicção do campo calado_max"

parent 36615b5b
...@@ -39,19 +39,22 @@ ...@@ -39,19 +39,22 @@
</mat-form-field> </mat-form-field>
<mat-form-field class="field small" appearance="outline"> <mat-form-field class="field small" appearance="outline">
<mat-label>Boca (m)</mat-label> <mat-label>Boca (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="boca"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="boca">
<mat-error *ngIf="empForm.get('boca')?.invalid">{{ getErrorMessage('boca') }}</mat-error> <mat-error *ngIf="empForm.get('boca')?.invalid">{{ getErrorMessage('boca') }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Calado de Entrada</mat-label> <mat-label>Calado de Entrada</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="calado_entrada"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="calado_entrada">
<mat-error *ngIf="empForm.get('calado_entrada')?.invalid">{{ getErrorMessage('calado_entrada') }}</mat-error> <mat-error *ngIf="empForm.get('calado_entrada')?.invalid">{{ getErrorMessage('calado_entrada') }}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Calado de Saída</mat-label> <mat-label>Calado de Saída</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="calado_saida"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="calado_saida">
<mat-error *ngIf="empForm.get('calado_saida')?.invalid">{{ getErrorMessage('calado_saida') }}</mat-error> <mat-error *ngIf="empForm.get('calado_saida')?.invalid">{{ getErrorMessage('calado_saida') }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
...@@ -63,56 +66,46 @@ ...@@ -63,56 +66,46 @@
</mat-form-field> </mat-form-field>
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Pontal (m)</mat-label> <mat-label>Pontal (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="pontal"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="pontal">
<mat-error *ngIf="empForm.get('pontal')?.invalid">{{ getErrorMessage('pontal') }}</mat-error> <mat-error *ngIf="empForm.get('pontal')?.invalid">{{ getErrorMessage('pontal') }}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="field small" appearance="outline"> <mat-form-field class="field small" appearance="outline" *ngIf="selectedCategoriaNome === 'Granel Líquido'">
<mat-label>Ponte Mfold (m)</mat-label> <mat-label>Ponte Mfold (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="ponte_mfold"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="ponte_mfold">
<mat-error *ngIf="empForm.get('ponte_mfold')?.invalid">{{ getErrorMessage('ponte_mfold') }}</mat-error> <mat-error *ngIf="empForm.get('ponte_mfold')?.invalid">{{ getErrorMessage('ponte_mfold') }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="field large" appearance="outline"> <mat-form-field class="field large" appearance="outline" *ngIf="selectedCategoriaNome === 'Granel Líquido'">
<mat-label>Mfold Quilha (m)</mat-label> <mat-label>Mfold Quilha (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="mfold_quilha"> <input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }"
formControlName="mfold_quilha">
<mat-error *ngIf="empForm.get('mfold_quilha')?.invalid">{{ getErrorMessage('mfold_quilha') }}</mat-error> <mat-error *ngIf="empForm.get('mfold_quilha')?.invalid">{{ getErrorMessage('mfold_quilha') }}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Categoria</mat-label> <mat-label>Categoria</mat-label>
<mat-select formControlName="categoria"> <mat-select formControlName="categoria" (selectionChange)="onCategoriaChange($event.value)">
<mat-option *ngFor="let cat of categoria" [value]="cat.id"> <mat-option *ngFor="let cat of categoria" [value]="cat.id">
{{ cat.nome }} {{ cat.nome }}
</mat-option> </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="empForm.get('categoria')?.invalid">{{ getErrorMessage('categoria') }}</mat-error> <mat-error *ngIf="empForm.get('categoria')?.invalid">{{ getErrorMessage('categoria') }}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="field small" appearance="outline"> <mat-form-field class="field small" appearance="outline">
<mat-label>Flag</mat-label> <mat-label>Flag</mat-label>
<mat-select formControlName="flag"> <mat-select formControlName="flag">
<mat-select-trigger> <mat-select-trigger>
<img <img *ngIf="selectedCountry" [src]="selectedCountry.flagUrl" width="20" height="15"
*ngIf="selectedCountry" alt="{{ selectedCountry.name }} flag" style="margin-right: 8px" />
[src]="selectedCountry.flagUrl"
width="20"
height="15"
alt="{{ selectedCountry.name }} flag"
style="margin-right: 8px"
/>
{{ selectedCountry?.name }} {{ selectedCountry?.name }}
</mat-select-trigger> </mat-select-trigger>
<mat-option <mat-option *ngFor="let country of countries" [value]="country.id"
*ngFor="let country of countries" (onSelectionChange)="onCountrySelected(country)">
[value]="country.id" <img [src]="country.flagUrl" width="20" height="15" alt="{{ country.name }} flag"
(onSelectionChange)="onCountrySelected(country)" style="margin-right: 8px" />
>
<img
[src]="country.flagUrl"
width="20"
height="15"
alt="{{ country.name }} flag"
style="margin-right: 8px"
/>
{{ country.name }} {{ country.name }}
</mat-option> </mat-option>
</mat-select> </mat-select>
...@@ -121,7 +114,7 @@ ...@@ -121,7 +114,7 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="field full-width" appearance="outline"> <mat-form-field class="field full-width" appearance="outline">
<mat-label>Observação</mat-label> <mat-label>Observação</mat-label>
...@@ -129,7 +122,7 @@ ...@@ -129,7 +122,7 @@
<mat-error *ngIf="empForm.get('obs')?.invalid">{{ getErrorMessage('obs') }}</mat-error> <mat-error *ngIf="empForm.get('obs')?.invalid">{{ getErrorMessage('obs') }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<!-- Sexta Linha: Status --> <!-- Sexta Linha: Status -->
<div class="row"> <div class="row">
<mat-form-field class="field large" appearance="outline"> <mat-form-field class="field large" appearance="outline">
...@@ -152,13 +145,7 @@ ...@@ -152,13 +145,7 @@
</mat-form-field> </mat-form-field>
<div class="row file-upload-container"> <div class="row file-upload-container">
<mat-label style="color:cadetblue">Adicione o documente Q88 da embarcação</mat-label> <mat-label style="color:cadetblue">Adicione o documente Q88 da embarcação</mat-label>
<input <input type="file" class="file-input" (change)="onFileSelected($event)" #fileUpload style="display: none" />
type="file"
class="file-input"
(change)="onFileSelected($event)"
#fileUpload
style="display: none"
/>
<div class="file-upload-content"> <div class="file-upload-content">
<div class="file-info"> <div class="file-info">
...@@ -166,13 +153,7 @@ ...@@ -166,13 +153,7 @@
</div> </div>
<div class="upload-button-wrapper"> <div class="upload-button-wrapper">
<button <button mat-mini-fab color="primary" class="upload-btn" (click)="fileUpload.click()" type="button">
mat-mini-fab
color="primary"
class="upload-btn"
(click)="fileUpload.click()"
type="button"
>
<mat-icon>attach_file</mat-icon> <mat-icon>attach_file</mat-icon>
</button> </button>
</div> </div>
...@@ -180,23 +161,17 @@ ...@@ -180,23 +161,17 @@
<div class="uploaded-image-container" *ngIf="imageUrl"> <div class="uploaded-image-container" *ngIf="imageUrl">
<img [src]="imageUrl" alt="Uploaded Image" class="uploaded-image" /> <img [src]="imageUrl" alt="Uploaded Image" class="uploaded-image" />
<button <button mat-mini-fab color="warn" class="remove-image-btn" (click)="removeImage()" type="button">
mat-mini-fab
color="warn"
class="remove-image-btn"
(click)="removeImage()"
type="button"
>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Ações do Diálogo --> <!-- Ações do Diálogo -->
<div mat-dialog-actions class="action"> <div mat-dialog-actions class="action">
<button mat-raised-button type="button" color="warn" [mat-dialog-close]="false">Cancelar</button> <button mat-raised-button type="button" color="warn" [mat-dialog-close]="false">Cancelar</button>
<button mat-raised-button color="primary" type="submit">Salvar</button> <button mat-raised-button color="primary" type="submit">Salvar</button>
</div> </div>
</form> </form>
\ No newline at end of file
...@@ -85,9 +85,26 @@ export class AceiteEditComponent implements OnInit { ...@@ -85,9 +85,26 @@ export class AceiteEditComponent implements OnInit {
calado_saida: ['', Validators.required], calado_saida: ['', Validators.required],
restricoes: [''] restricoes: ['']
}); });
this.empForm.get('categoria')?.valueChanges.subscribe(catId => {
const cat = this.categoria.find((c: any) => c.id === catId);
if (cat && cat.nome === 'Granel Líquido') {
this.empForm.get('mfold_quilha')?.setValidators([Validators.required]);
this.empForm.get('ponte_mfold')?.setValidators([Validators.required]);
} else {
this.empForm.get('mfold_quilha')?.clearValidators();
this.empForm.get('ponte_mfold')?.clearValidators();
}
this.empForm.get('mfold_quilha')?.updateValueAndValidity();
});
} }
selectedCategoriaNome: string = '';
onCategoriaChange(catId: any) {
const cat = this.categoria.find((c: any) => c.id === catId);
this.selectedCategoriaNome = cat ? cat.nome : '';
}
countries = [ countries = [
{ id: 1, name: 'Afeganistão', flagUrl: 'https://flagcdn.com/w20/af.png' }, { id: 1, name: 'Afeganistão', flagUrl: 'https://flagcdn.com/w20/af.png' },
...@@ -484,12 +501,12 @@ export class AceiteEditComponent implements OnInit { ...@@ -484,12 +501,12 @@ export class AceiteEditComponent implements OnInit {
if (input.files && input.files.length > 0) { if (input.files && input.files.length > 0) {
const file = input.files[0]; const file = input.files[0];
const allowedTypes = ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']; const allowedTypes = ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
if (!allowedTypes.includes(file.type)) { if (!allowedTypes.includes(file.type)) {
this.toastService.error('Apenas arquivos PDF ou Word são permitidos.'); this.toastService.error('Apenas arquivos PDF ou Word são permitidos.');
return; return;
} }
this.selectedFile = file; this.selectedFile = file;
this.fileName = file.name; this.fileName = file.name;
const reader = new FileReader(); const reader = new FileReader();
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
</div> </div>
--> -->
<!--
<div class="row"> <div class="row">
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
...@@ -77,6 +78,8 @@ ...@@ -77,6 +78,8 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
-->
</div>
<div mat-dialog-actions class="action"> <div mat-dialog-actions class="action">
<button mat-raised-button type="button" color="warn" [mat-dialog-close]="false"> <button mat-raised-button type="button" color="warn" [mat-dialog-close]="false">
Cancelar Cancelar
......
...@@ -56,6 +56,18 @@ ...@@ -56,6 +56,18 @@
<p class="field full-width" appearance="outline"> <p class="field full-width" appearance="outline">
O gerente está analisando a solicitação para verificar as especificações. O gerente está analisando a solicitação para verificar as especificações.
</p> </p>
<p *ngIf="data.bercosSelecionados?.length > 0 " class="field full-width" appearance="outline">
<strong>Preferências de Berços do Usuário:</strong>
<span *ngIf="data.bercosSelecionados?.length > 0; else semPreferencias">
<span *ngFor="let berco of data.bercosSelecionados; let last = last">
{{ berco.nome || berco }}
<span *ngIf="!last">, </span>
</span>
</span>
<ng-template #semPreferencias>
Nenhuma preferência informada.
</ng-template>
</p>
</div> </div>
<div *ngSwitchCase="'Y'"> <div *ngSwitchCase="'Y'">
<p class="field full-width" appearance="outline"> <p class="field full-width" appearance="outline">
......
...@@ -45,6 +45,15 @@ ...@@ -45,6 +45,15 @@
}}</mat-error> }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row">
<mat-form-field class="field medium" appearance="outline">
<mat-label>Calado Máximo</mat-label>
<input matInput type="text" formControlName="calado_maximo" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }">
<mat-error *ngIf="empForm.get('calado_maximo')?.invalid">
{{ getErrorMessage('calado_maximo') }}
</mat-error>
</mat-form-field>
</div>
<div class="row"> <div class="row">
<mat-form-field class="field large" appearance="outline"> <mat-form-field class="field large" appearance="outline">
<mat-label>DWT</mat-label> <mat-label>DWT</mat-label>
......
...@@ -71,6 +71,8 @@ export class NavioAddComponent implements OnInit { ...@@ -71,6 +71,8 @@ export class NavioAddComponent implements OnInit {
mfold_quilha: ['', Validators.required], mfold_quilha: ['', Validators.required],
categoria: ['', Validators.required], categoria: ['', Validators.required],
flag: ['', Validators.required], flag: ['', Validators.required],
calado_maximo: ['', Validators.required],
obs: [''], obs: [''],
}); });
this.empForm.get('categoria')?.valueChanges.subscribe(catId => { this.empForm.get('categoria')?.valueChanges.subscribe(catId => {
...@@ -446,13 +448,13 @@ bercosDisponiveis: any[] = []; ...@@ -446,13 +448,13 @@ bercosDisponiveis: any[] = [];
ngOnInit(): void { ngOnInit(): void {
this._bercoService.getBercosListSemPaginacao().subscribe({ this._bercoService.getBercosListSemPaginacao().subscribe({
next: (res) => { next: (res) => {
this.bercosDisponiveis = Array.isArray(res) ? res : []; this.bercosDisponiveis = Array.isArray(res) ? res : [];
}, },
error: () => { error: () => {
this.bercosDisponiveis = []; this.bercosDisponiveis = [];
} }
}); });
if (this.data) { if (this.data) {
this.empForm.patchValue(this.data.empForm); this.empForm.patchValue(this.data.empForm);
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
}}</mat-error> }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<!--
<div class="row"> <div class="row">
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Data de Início</mat-label> <mat-label>Data de Início</mat-label>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
<input matInput type="date" formControlName="dataFim" /> <input matInput type="date" formControlName="dataFim" />
</mat-form-field> </mat-form-field>
</div> </div>
-->
<!-- <!--
<mat-form-field class="field medium" appearance="outline"> <mat-form-field class="field medium" appearance="outline">
<mat-label>Categoria</mat-label> <mat-label>Categoria</mat-label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment