"primeng": "^5.2.7"
@angular/compiler": "^5.0.0"
html
Code: Select all
<p-table [value]="dias" [responsive]="true">
<ng-template pTemplate="header" let-columns>
<tr>
<th class="col-codigo" scope="col">Aberto?</th>
<th class="col-codigo" scope="col">Código</th>
<th scope="col">Dia Semana</th>
<th scope="col">Hora Abertura</th>
<th scope="col">Hora Fechamento</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-dia>
<tr>
<td>
<p-checkbox [(ngModel)]="dia.opt_Funcionamento" [value]="dia.opt_Funcionamento"
binary="false" name="funcionamento" (onclick)="!dia.opt_Funcionamento"></p-checkbox>
</td>
<td scope="row">
{{dia.cd_Funcionamento}}
</td>
<td scope="row">
{{dia.dia}}
</td>
<td pEditableColumn scope="row">
<p-cellEditor>
<ng-template pTemplate="input">
<p-calendar [(ngModel)]="dia.hr_Abertura" [timeOnly]="true" name="horaAbertura" [showSeconds]="true" dataType="string"></p-calendar>
</ng-template>
<ng-template pTemplate="output">
{{dia.hr_Abertura}}
</ng-template>
</p-cellEditor>
</td>
<td pEditableColumn scope="row">
<p-cellEditor>
<ng-template pTemplate="input">
<p-calendar [(ngModel)]="dia.hr_Fechamento" [timeOnly]="true" name="horaFechamento" [showSeconds]="true" dataType="string"></p-calendar>
</ng-template>
<ng-template pTemplate="output">
{{dia.hr_Fechamento}}
</ng-template>
</p-cellEditor>
</td>
</tr>
</ng-template>
</p-table>
Code: Select all
export class FuncionamentoEstabelecimentoCadastroComponent {
@Input () displayValue: string;
funcionamentoEstabelecimento = new FuncionamentoEstabelecimento();
dias: FuncionamentoEstabelecimento[];
aberto = false; // TEST
diaSelecionado: FuncionamentoEstabelecimento; // TEST
constructor(
...
) { }
ngOnInit() {
this.tituloPagina.setTitle('Dias de funcionamento do estabelecimento');
const codigoFuncionamento = this.rota.snapshot.params['codigo'];
this.carregaDiasFuncionamento();
}
carregaDiasFuncionamento() {
this.funcionamentoService.carregaDiasFuncionamento()
.then(funcionamentoDados => {
this.dias = funcionamentoDados;
})
.catch(erro => this.errorHandler.handle(erro));
}
Code: Select all
export class FuncionamentoEstabelecimento {
cd_Funcionamento: number;
dia: string;
opt_Funcionamento = false;
hr_Abertura: Time;
hr_Fechamento: Time;
}