1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<div mat-dialog-title>
<h1>Editar Aceite</h1>
</div>
<form [formGroup]="empForm" (ngSubmit)="onFormSubmit()">
<div mat-dialog-content class="content">
<div class="row">
<mat-form-field class="field full-width" appearance="outline">
<mat-label>IMO</mat-label>
<input matInput type="number" (keydown)="preventNegative($event)" min="0" formControlName="imo">
<mat-error>
<ng-container *ngIf="empForm.get('imo')?.invalid">
<ng-container *ngIf="getErrorMessage('imo') === 'Esse imo não existe'">
{{ getErrorMessage('imo') }}, se desejar soliciatar a criação de um novo navio,
<a (click)="exibirFormNavio()" style="text-decoration: underline">clique aqui!</a>
</ng-container>
<ng-container *ngIf="getErrorMessage('imo') !== 'Esse imo não existe'">
{{ getErrorMessage('imo') }}
</ng-container>
</ng-container>
</mat-error>
</mat-form-field>
<mat-form-field class="field full-width" appearance="outline">
<mat-label>MMSI</mat-label>
<input matInput type="text" formControlName="mmsi" (keydown)="preventNegative($event)">
<mat-error *ngIf="empForm.get('mmsi')?.invalid">{{ getErrorMessage('mmsi') }}</mat-error>
</mat-form-field>
</div>
<div class="row">
<mat-form-field class="field large" appearance="outline">
<mat-label>Nome</mat-label>
<input matInput type="text" formControlName="nome">
<mat-error *ngIf="empForm.get('nome')?.invalid">{{ getErrorMessage('nome') }}</mat-error>
</mat-form-field>
<mat-form-field class="field medium" appearance="outline">
<mat-label>LOA (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="loa">
<mat-error *ngIf="empForm.get('loa')?.invalid">{{ getErrorMessage('loa') }}</mat-error>
</mat-form-field>
<mat-form-field class="field small" appearance="outline">
<mat-label>Boca (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="boca">
<mat-error *ngIf="empForm.get('boca')?.invalid">{{ getErrorMessage('boca') }}</mat-error>
</mat-form-field>
</div>
<div class="row">
<mat-form-field class="field medium" appearance="outline">
<mat-label>Calado de Entrada</mat-label>
<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-form-field>
<mat-form-field class="field medium" appearance="outline">
<mat-label>Calado de Saída</mat-label>
<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-form-field>
</div>
<div class="row">
<mat-form-field class="field large" appearance="outline">
<mat-label>DWT (Atual)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="dwt">
<mat-error *ngIf="empForm.get('dwt')?.invalid">{{ getErrorMessage('dwt') }}</mat-error>
</mat-form-field>
<mat-form-field class="field medium" appearance="outline">
<mat-label>Pontal (m)</mat-label>
<input matInput type="text" [currencyMask]="{ prefix: '', thousands: '.', decimal: ',' }" formControlName="pontal">
<mat-error *ngIf="empForm.get('pontal')?.invalid">{{ getErrorMessage('pontal') }}</mat-error>
</mat-form-field>
<mat-form-field class="field small" appearance="outline">
<mat-label>Ponte Mfold (m)</mat-label>
<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-form-field>
</div>
<div class="row">
<mat-form-field class="field large" appearance="outline">
<mat-label>Mfold Quilha (m)</mat-label>
<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-form-field>
<mat-form-field class="field medium" appearance="outline">
<mat-label>Categoria</mat-label>
<mat-select formControlName="categoria">
<mat-option *ngFor="let cat of categoria" [value]="cat.id">
{{ cat.nome }}
</mat-option>
</mat-select>
<mat-error *ngIf="empForm.get('categoria')?.invalid">{{ getErrorMessage('categoria') }}</mat-error>
</mat-form-field>
<mat-form-field class="field small" appearance="outline">
<mat-label>Flag</mat-label>
<mat-select formControlName="flag">
<mat-select-trigger>
<img
*ngIf="selectedCountry"
[src]="selectedCountry.flagUrl"
width="20"
height="15"
alt="{{ selectedCountry.name }} flag"
style="margin-right: 8px"
/>
{{ selectedCountry?.name }}
</mat-select-trigger>
<mat-option
*ngFor="let country of countries"
[value]="country.id"
(onSelectionChange)="onCountrySelected(country)"
>
<img
[src]="country.flagUrl"
width="20"
height="15"
alt="{{ country.name }} flag"
style="margin-right: 8px"
/>
{{ country.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="empForm.get('flag')?.invalid">
{{ getErrorMessage("flag") }}
</mat-error>
</mat-form-field>
</div>
<div class="row">
<mat-form-field class="field full-width" appearance="outline">
<mat-label>Observação</mat-label>
<input matInput type="text" formControlName="obs">
<mat-error *ngIf="empForm.get('obs')?.invalid">{{ getErrorMessage('obs') }}</mat-error>
</mat-form-field>
</div>
<!-- Sexta Linha: Status -->
<div class="row">
<mat-form-field class="field large" appearance="outline">
<mat-label>Status</mat-label>
<mat-select formControlName="status" (selectionChange)="onStatusChange($event.value)">
<mat-option value="Y">Aceito</mat-option>
<mat-option value="NE">Negado</mat-option>
<mat-option value="N">Em Processamento</mat-option>
</mat-select>
<mat-error *ngIf="empForm.get('status')?.invalid">{{ getErrorMessage('status') }}</mat-error>
</mat-form-field>
</div>
<div *ngIf="empForm.get('status')?.value === 'Y' || empForm.get('status')?.value === 'NE'" class="field large">
<mat-form-field class="field large" appearance="outline">
<mat-label>Comentários sobre o aceite:</mat-label>
<input matInput type="text" formControlName="restricoes">
<mat-error *ngIf="empForm.get('restricoes')?.invalid">
{{ getErrorMessage('restricoes') }}
</mat-error>
</mat-form-field>
<div class="row file-upload-container">
<mat-label style="color:cadetblue">Adicione o documente Q88 da embarcação</mat-label>
<input
type="file"
class="file-input"
(change)="onFileSelected($event)"
#fileUpload
style="display: none"
/>
<div class="file-upload-content">
<div class="file-info">
<span>{{ fileName || "No file uploaded yet." }}</span>
</div>
<div class="upload-button-wrapper">
<button
mat-mini-fab
color="primary"
class="upload-btn"
(click)="fileUpload.click()"
type="button"
>
<mat-icon>attach_file</mat-icon>
</button>
</div>
</div>
<div class="uploaded-image-container" *ngIf="imageUrl">
<img [src]="imageUrl" alt="Uploaded Image" class="uploaded-image" />
<button
mat-mini-fab
color="warn"
class="remove-image-btn"
(click)="removeImage()"
type="button"
>
<mat-icon>close</mat-icon>
</button>
</div>
</div>
</div>
</div>
<!-- Ações do Diálogo -->
<div mat-dialog-actions class="action">
<button mat-raised-button type="button" color="warn" [mat-dialog-close]="false">Cancelar</button>
<button mat-raised-button color="primary" type="submit">Salvar</button>
</div>
</form>