Commit 36615b5b authored by RenanMontenegro3's avatar RenanMontenegro3

feat:"alteração no tipo de array para berços selecionados"

parent 8472f529
......@@ -109,15 +109,15 @@
</mat-error>
</mat-form-field>
</div>
<div class="row">
<mat-form-field class="field small" appearance="outline" *ngIf="selectedCategoriaNome === 'Granel Líquido'">
<div class="row">
<mat-form-field class="field small" appearance="outline" *ngIf="selectedCategoriaNome === 'Granel Líquido'">
<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>
<div class="row">
<mat-form-field class="field full-width" appearance="outline">
<mat-label>Observação</mat-label>
......@@ -153,13 +153,14 @@
<mat-form-field class="field full-width" appearance="outline">
<mat-label>Berços</mat-label>
<mat-select formControlName="bercosSelecionados" multiple>
<mat-option *ngFor="let berco of bercosDisponiveis" [value]="berco.nome">
<mat-option *ngFor="let berco of bercosDisponiveis" [value]="+berco.nome">
Berço {{ berco.nome }}
</mat-option>
</mat-select>
<mat-hint>Selecione um ou mais berços</mat-hint>
</mat-form-field>
</div>
</div>
......
......@@ -80,7 +80,7 @@ export class AceiteAddComponent implements OnInit {
obs: [data ? data.obs : ''],
calado_entrada: ['', Validators.required],
calado_saida: ['', Validators.required],
bercosSelecionados: ['']
bercosSelecionados: []
,
});
this.empForm.get('categoria')?.valueChanges.subscribe(catId => {
......
......@@ -6,7 +6,7 @@ import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
import { MatDialogModule } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../../../environments/.env';
@Component({
selector: 'app-visualizacao-aceite',
standalone: true,
......@@ -41,25 +41,28 @@ export class VisualizacaoAceiteComponent implements OnInit {
}
return null;
}
downloadNavioFunction() {
this.httpClient.get('http://localhost:8080/api/download-file', {
params: { filename: this.data.path },
responseType: 'blob' // Adiciona 'blob' para lidar com arquivos binários
}).subscribe({
next: (response) => {
// Criação de um URL temporário para o arquivo
const blob = new Blob([response]);
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = this.data.path || 'download'; // Define o nome do arquivo
link.click();
// Libera o objeto URL após o download
window.URL.revokeObjectURL(link.href);
console.log('Download iniciado:', this.data.path);
},
error: (error) => {
console.error('Erro ao baixar o arquivo:', error);
}
});
this.httpClient
.get(`${environment.API_URL}/api/download-file`, {
params: { filename: this.data.path },
responseType: 'blob', // Adiciona 'blob' para lidar com arquivos binários
})
.subscribe({
next: (response) => {
// Criação de um URL temporário para o arquivo
const blob = new Blob([response]);
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = this.data.path || 'download'; // Define o nome do arquivo
link.click();
// Libera o objeto URL após o download
window.URL.revokeObjectURL(link.href);
console.log('Download iniciado:', this.data.path);
},
error: (error) => {
console.error('Erro ao baixar o arquivo:', error);
},
});
}}
......@@ -10,7 +10,7 @@ import { MatGridList } from '@angular/material/grid-list';
import { HttpClient } from '@angular/common/http';
import { HttpClientModule } from '@angular/common/http';
import { NavioService } from '../../../services/navio.service';
import { environment } from '../../../../environments/.env';
@Component({
selector: 'app-visualizacao-navio',
standalone: true,
......@@ -380,7 +380,8 @@ export class VisualizacaoNavioComponent implements OnInit {
},
];
downloadNavioFunction() {
this.httpClient.get('http://localhost:8080/api/download-file', {
this.httpClient
.get(`${environment.API_URL}/api/download-file`, {
params: { filename: this.data.path },
responseType: 'blob' // Adiciona 'blob' para lidar com arquivos binários
}).subscribe({
......@@ -391,7 +392,7 @@ export class VisualizacaoNavioComponent implements OnInit {
link.href = window.URL.createObjectURL(blob);
link.download = this.data.path || 'download'; // Define o nome do arquivo
link.click();
// Libera o objeto URL após o download
window.URL.revokeObjectURL(link.href);
console.log('Download iniciado:', this.data.path);
......@@ -402,26 +403,26 @@ export class VisualizacaoNavioComponent implements OnInit {
});
}
}
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