<div class="ng-card mb-0 mt-20">
    <div class="ng-cardHead">
        <div class="ng-cardLabel">
            <h3 class="ng-cardTitle">Room</h3>
        </div>
        <button [routerLink]="['/Services/Hotel/HotelManage/HotelAddRoom/'+ Extranet_Hotel_Id]" class="btn btn-primary">
            Add Room </button>
    </div>
    <div class="ng-searchBody">
        <div class="row">
            <div class="col-lg-3">
                <div class="formControlWrapper">
                    <label class="formLabel">Room Name</label>
                    <input class="formInput" type="text" [(ngModel)]="Room_Name" />
                </div>
            </div>
            <div class="col-lg-3">
                <div class="formControlWrapper">
                    <label class="formLabel">Room View</label>
                    <ng-select #Roomview class="is-invalid" placeholder="Select" [(ngModel)]="Room_View">
                        <ng-template ng-header-tmp>
                            <div class="temp_mobileBack">
                                <div class="temp_mobileHead">
                                    <div class="temp_mobileTitle">
                                        <h4>Room View</h4>
                                    </div>
                                    <button matRipple (click)="Roomview.close()" class="temp_mobileBackButton">
                                        <i class="material-icons"> close </i>
                                    </button>
                                </div>
                            </div>
                        </ng-template>
                        <ng-option value="">Select</ng-option>
                        <ng-option *ngFor="let data of AllRoomView"
                            [value]="data.extranet_room_view_id">{{data.room_view_name}}</ng-option>
                    </ng-select>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="formControlWrapper">
                    <label class="formLabel">Extrabed Supported</label>
                    <ng-select #ExtraBed class="is-invalid" placeholder="Select" [(ngModel)]="Extra_bed">
                        <ng-template ng-header-tmp>
                            <div class="temp_mobileBack">
                                <div class="temp_mobileHead">
                                    <div class="temp_mobileTitle">
                                        <h4>Extrabed Supported</h4>
                                    </div>
                                    <button matRipple (click)="ExtraBed.close()" class="temp_mobileBackButton">
                                        <i class="material-icons"> close </i>
                                    </button>
                                </div>
                            </div>
                        </ng-template>
                        <ng-option value="">Select</ng-option>
                        <ng-option value="1">Yes</ng-option>
                        <ng-option value="2">No</ng-option>
                    </ng-select>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="formControlWrapper">
                    <label class="formLabel">Free Child Allowed</label>
                    <ng-select #FreeChild class="is-invalid" placeholder="Select" [(ngModel)]="Free_Child">
                        <ng-template ng-header-tmp>
                            <div class="temp_mobileBack">
                                <div class="temp_mobileHead">
                                    <div class="temp_mobileTitle">
                                        <h4>Free Child Allowed</h4>
                                    </div>
                                    <button matRipple (click)="FreeChild.close()" class="temp_mobileBackButton">
                                        <i class="material-icons"> close </i>
                                    </button>
                                </div>
                            </div>
                        </ng-template>
                        <ng-option value="">Select</ng-option>
                        <ng-option value="1">Yes</ng-option>
                        <ng-option value="2">No</ng-option>
                    </ng-select>
                </div>
            </div>
        </div>
        <!-- <div class="app-mainGrid6 mb-10 mt-20">
           <div>
            <mat-checkbox [(ngModel)]="Extra_bed">Extrabed Supported</mat-checkbox>
           </div>
           <div>
            <mat-checkbox [(ngModel)]="Free_Child">Free Child Allowed</mat-checkbox>
           </div>
        </div> -->
    </div>
    <div class="ng-searchFooter">
        <button type="button" (click)="Reset()" class="btn btn-secondary mr-10 ResetBtn">Reset</button>
        <button type="button" (click)="Search()" class="btn btn-primary SearchBtn">Search</button>
    </div>
</div>
<div class="dataTable actionButtonSticky custom-shadow">
    <p-table #dt [resizableColumns]="true" [columns]="cols" [value]="Result" [rowsPerPageOptions]="[10, 25, 50, 100]"
        styleClass="p-datatable-gridlines" [rows]="10" 
        responsiveLayout="scroll" [paginator]="true" [rowHover]="true" dataKey="id" [globalFilterFields]="[
    'room_name',
    'room_view',
    'max_occupancy_type',
    'max_adult_occupancy',
    'max_child_occupancy',
    'max_child_age',
    'max_total_occupancy',
    'is_extra_bed_supported',
    'is_free_child',
    'extranet_room_id',
    'Custom_created_on',
    'updated_by',
    'status',
    'Custom_updated_on',
    'created_by',
]" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
        <ng-template pTemplate="caption">
            <p-toolbar *ngIf="Result && Result.length > 0">
                <ng-template pTemplate="left"  *ngIf="_commonService.MenuTabList.Rooms.Download">
                    <button type="button" pButton class="btn-secondary mr-10" pTooltip="CSV" tooltipPosition="bottom"
                        (click)="dt.exportCSV()">CSV</button>
                    <button type="button" pButton class="btn-secondary mr-10" pTooltip="XLS" tooltipPosition="bottom"
                        (click)="_commonService.exportExcel(Result,cols,'Hotel Rooms')">Excel</button>
                    <button type="button" pButton class="btn-secondary mr-10" pTooltip="PDF" tooltipPosition="bottom"
                        (click)="_commonService.exportPdf(Result,cols,'Hotel Rooms')">PDF</button>
                </ng-template>
                <ng-template pTemplate="right">
                    <div class="p-d-flex p-ai-center">
                        <span class="p-input-icon-left">
                            <i class="pi pi-search"></i>
                            <input pInputText type="search" #searchInp
                                (input)="dt.filterGlobal(searchInp.value, 'contains')" placeholder="Search" />
                        </span>
                    </div>
                </ng-template>
            </p-toolbar>
        </ng-template>
        <ng-template pTemplate="header">
            <tr>
                <th pSortableColumn="status">
                    Status
                    <p-sortIcon field="status" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="room_name">
                    Room Name
                    <p-sortIcon field="room_name" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="room_view">
                    Room View
                    <p-sortIcon field="room_view" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="max_occupancy_type">
                    Max Occupancy Type
                    <p-sortIcon field="max_occupancy_type" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="max_adult_occupancy">
                    Max Adult Occupancy
                    <p-sortIcon field="max_adult_occupancy" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="max_child_occupancy">
                    Max Child Occupancy
                    <p-sortIcon field="max_child_occupancy" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="max_child_age">
                    Max Child Age
                    <p-sortIcon field="max_child_age" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="max_total_occupancy">
                    Max Total Occupancy
                    <p-sortIcon field="max_total_occupancy" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="is_extra_bed_supported">
                    Extrabed Supported
                    <p-sortIcon field="is_extra_bed_supported" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="is_free_child">
                    Free Child Allowed
                    <p-sortIcon field="is_free_child" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="extranet_room_id">
                    Room Id
                    <p-sortIcon field="extranet_room_id" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="created_by">
                    Created By
                    <p-sortIcon field="created_by" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="created_on">
                    Created On
                    <p-sortIcon field="created_on" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="updated_by">
                    Updated By
                    <p-sortIcon field="updated_by" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="updated_on">
                    Updated On
                    <p-sortIcon field="updated_on" class="p-sort-icon"></p-sortIcon>
                </th>
                <th pSortableColumn="hotel_name">Action</th>
            </tr>
        </ng-template>
        <ng-template pTemplate="body" let-data>
            <tr>
                <td>
                    <span class="status"
                        [ngClass]="{'status-success':data.is_active,'status-failed':data.is_active == false}">
                        {{data.status}}
                    </span>
                </td>
                <td>{{data.room_name}}</td>
                <td>{{data.room_view}}</td>
                <td>{{data.max_occupancy_type}}</td>
                <td>{{data.max_adult_occupancy}}</td>
                <td>{{data.max_child_occupancy}}</td>
                <td>{{data.max_child_age}}</td>
                <td>{{data.max_total_occupancy}}</td>
                <td>{{data.is_extra_bed_supported}}</td>
                <td>{{data.is_free_child}}</td>
                <td>{{data.extranet_room_id}}</td>
                <td>{{data.created_by}}</td>
                <td>{{data.Custom_created_on}}</td>
                <td>{{data.updated_by}}</td>
                <td>{{data.Custom_updated_on}}</td>
                <td>
                    <button mat-icon-button [matMenuTriggerFor]="menu">
                        <span class="material-icons"> more_horiz </span>
                    </button>
                    <mat-menu #menu="matMenu">
                        <button mat-menu-item (click)="Edit(data.extranet_room_id)">
                            <span class="flex-center">
                                <span> Edit </span>
                            </span>
                        </button>
                        <button mat-menu-item *ngIf="_commonService.MenuTabList.Rooms.IsActive"
                        (click)="updateStatus(data.extranet_room_id,data.is_active)">
                            <span class="flex-center">
                                <span> {{ !data.is_active ? 'Active' : 'Deactive'}}</span>
                            </span>
                        </button>
                        <button mat-menu-item (click)="Clone(data.extranet_room_id)">
                            <span class="flex-center">
                                <span> Clone Room </span>
                            </span>
                        </button>
                    </mat-menu>
                </td>
            </tr>
        </ng-template>
        <ng-template pTemplate="emptymessage">
            <tr *ngIf="Result === null || Result" class="resultNotFound">
                <td> No data found </td>
            </tr>
        </ng-template>
    </p-table>
</div>