<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-datepicker name="fromDate" label="fromDate"
                                        placeholder="vuelo-form.fromDate.placeholder" [formGroup]="form"
                                        [required]="true">
                                    </xdf-datepicker>
                                </div>
                                <div class="form-group col-xl-6">
                                    <xdf-datepicker name="toDate" label="toDate"
                                        placeholder="vuelo-form.toDate.placeholder" [formGroup]="form"
                                        [required]="true">
                                    </xdf-datepicker>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xl-6">
                                    <xdf-input name="amount" label="amount" type="number"
                                        placeholder="vuelo-form.amount.placeholder" [formGroup]="form"></xdf-input>
                                </div>
                                <xdf-select name="airline" label="vuelo-form.airline" [values]="airline"
                                    [required]="true" placeholder="vuelo-form.airline.placeholder" [formGroup]="form"
                                    [options]="{sourceValue: 'name', sourceLabel: 'name'}">
                                </xdf-select>
                            </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>De: (Fecha)
                                </th>
                                <th>A: (Fecha)
                                </th>
                                <th>Costo
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr *ngFor="let item of dataSource">
                                <td>{{ item?.fromDate}}</td>
                                <td>{{ item?.toDate}}</td>
                                <td>{{ item?.amount}}</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)="save()" class="pull-right">
                            <span class="pr-1">Guardar</span>
                            <i class="fa fa-chevron-right"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>

</div>