<div class="panel-viewer-wrapper">

    <div class="panel-viewer-title">
        <i class="fa fa-info-circle"></i>
        {{'label.general-information.title' | translate}}
    </div>

    <form [formGroup]="form">
        <div class="panel-viewer-body">
            <div class="row pt-3 pb-4">
                <div class="col-6 mat-elevation-z3">
                    <div class="row">
                        <div class="col-6">
                            <div class="row">
                                <div class="form-group col-xl-6">
                                    <xdf-select name="originId" label="reserva-form.originId" [values]="listAirport"
                                        [required]="true" placeholder="reserva-form.originId.placeholder"
                                        [formGroup]="form" [options]="{sourceValue: 'id', sourceLabel: 'airportName'}">
                                    </xdf-select>
                                </div>
                                <div class="form-group col-xl-6">
                                    <xdf-select name="destinationId" label="reserva-form.destinationId"
                                        [values]="listAirport" [required]="true"
                                        placeholder="reserva-form.destinationId.placeholder" [formGroup]="form"
                                        [options]="{sourceValue: 'id', sourceLabel: 'airportName'}">
                                    </xdf-select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xl-6">
                                    <xdf-datepicker name="departureDate" label="departureDate"
                                        placeholder="vuelo-form.departureDate.placeholder" [formGroup]="form"
                                        [required]="true">
                                    </xdf-datepicker>
                                </div>
                                <div class="form-group col-xl-6">
                                    <xdf-datepicker name="arrivalDate" label="arrivalDate"
                                        placeholder="vuelo-form.arrivalDate.placeholder" [formGroup]="form"
                                        [required]="true">
                                    </xdf-datepicker>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xl-6">
                                    <xdf-input name="departureTime" label="departureTime" type="time"
                                        placeholder="vuelo-form.departureTime.placeholder"
                                        [formGroup]="form"></xdf-input>
                                </div>
                                <div class="form-group col-xl-6">
                                    <xdf-input name="arrivalTime" label="arrivalTime" type="time"
                                        placeholder="vuelo-form.arrivalTime.placeholder" [formGroup]="form"
                                        [required]="true"></xdf-input>
                                </div>
                            </div>
                            <div class="row">
                                <button mat-stroked-button (click)="addTable()" class="pull-right">
                                    <span class="pr-1">Guardar</span>
                                    <i class="fa fa-chevron-right"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-3">
                    <table class="crud-table table table-striped">
                        <thead>
                            <tr>
                                <th>Aereopuerto Origen
                                </th>
                                <th>Aereopuerto Destino
                                </th>
                                <th>Fecha Salida
                                </th>
                                <th>Fecha LLegada
                                </th>
                                <th>Hora Salida
                                </th>
                                <th>Hora LLegada
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr *ngFor="let item of dataSource">
                                <td>{{ item?.originId}}</td>
                                <td>{{ item?.destinationId}}</td>
                                <td>{{ item?.departureDate}}</td>
                                <td>{{ item?.arrivalDate}}</td>
                                <td>{{ item?.departureTime}}</td>
                                <td>{{ item?.arrivalTime}}</td>
                                <td><button (click)="editItem(item)" *ngIf="flag" type="button"
                                        class="btn btn-outline-primary btn-sm pull-right"><i
                                            class="fa fa-file"></i><span
                                            class="visible-md-inline visible-lg-inline visible-xl-inline">
                                            Editar
                                        </span></button><button type="button" class="btn btn-delete pull-right"
                                        (click)="deleteItem(item)"><span class="fa fa-trash"></span></button></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="footer-bar">
                <div class="row">
                    <div class="col-12">
                        <button mat-stroked-button (click)="next()" class="pull-right">
                            <span class="pr-1">{{'btn.next' | translate}}</span>
                            <i class="fa fa-chevron-right"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>

</div>