Newer
Older
HoteleriaAdmin / src / app / bookings / bookings-components / list / list.component.ts
import { Component, OnInit } from '@angular/core';
import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap';
interface Room {
  id?: number;
  name: string;
  description: string;
  active: boolean;
  price: number;
  discount: number;
  photo: string;
  hotel_id: number;
  type_room_id: number;
}
@Component({
  selector: 'app-list',
  templateUrl: './list.component.html',
  styleUrls: ['./list.component.css']
})
export class ListComponent implements OnInit {
  closeResult = '';
  listaHab: Room[];
  constructor(private modalService: NgbModal) { }

  ngOnInit(): void {
    this.listRoom();
  }
  open(content) {
    this.modalService.open(content, {ariaLabelledBy: 'modal-basic-title'}).result.then((result) => {
      this.closeResult = `Closed with: ${result}`;
    }, (reason) => {
      this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
    });
  }

  private getDismissReason(reason: any): string {
    if (reason === ModalDismissReasons.ESC) {
      return 'by pressing ESC';
    } else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
      return 'by clicking on a backdrop';
    } else {
      return `with: ${reason}`;
    }
  }
  listRoom() {
    const rooms: Room[] = [
      {
        id: 1,
        name: 'suite',
        description:
          'Lorem Ipsum is simply dummy text of the printing and typesetting industry. ',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/suite.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
      {
        id: 2,
        name: 'Habitacion con vista al mar',
        description:
          'Consta de dos camas y una vista increible',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/vista la mar.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
      {
        id: 3,
        name: 'Habitacion privada doble',
        description:
          'Con closet y cama doble ',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/privada doble.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
      {
        id: 4,
        name: 'Suite Privada',
        description:
          'suite privada',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/suite privada.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
      {
        id: 5,
        name: 'Habitacion Doble',
        description:
          'Cama doble',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/habitacion doble.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
      {
        id: 6,
        name: 'Habitacion sencilla',
        description:
          'Cama sencilla ',
        active: true,
        price: 12456,
        discount: 3456,
        photo: 'assets/images/room/habitacion sencilla.jpg',
        hotel_id: 1,
        type_room_id: 2,
      },
    ];
    this.listaHab = rooms;
  }

}