<?php

/*
 * PuzzleApp
 * Webemyos
 * Jérôme Oliva
 * GNU Licence
 */

namespace Apps\Booking\Module\DialogAdminBooking;

use Core\Control\Button\Button;
use Core\Controller\Controller;
use Core\View\View;

use Apps\Booking\Widget\BookingCaracteristiqueForm\BookingCaracteristiqueForm;
use Apps\Booking\Entity\BookingCaracteristique;

use Apps\Booking\Widget\BookingEditReservationForm\BookingEditReservationForm;
use Apps\Booking\Entity\BookingReservation;

/*
 * 
 */
 class DialogAdminBookingController extends Controller
 {
    /**
     * Constructeur
     */
    function _construct($core="")
    {
          $this->Core = $core;
    }

    /**
     * Create
     */
    function Create()
    {
    }

    /**
     * Init
     */
    function Init()
    {
    }

    /**
     * Render
     */
    function Show($all=true)
    {
         return $this->Index();
    }
    
    /*
    * Get the home page
    */
   function Index()
   {
       $view = new View(__DIR__."/View/index.tpl", $this->Core);
       return $view->Render();
   }

   /***
     * Add a caractéristique
     */
    function AddCaracteristique($caracteristiqueId){
     
        $caracteristique = new BookingCaracteristique($this->Core);
 
        if($caracteristiqueId != ""){
            $caracteristique->GetById($caracteristiqueId);
        }
    
       $data["Id"] = $caracteristiqueId;
       $caracteristiqueForm = new BookingCaracteristiqueForm($this->Core, $data);
       $caracteristiqueForm->Load($caracteristique);
     
       return $caracteristiqueForm->Render();
    }

    /***
     * Edit a reservation
     */
    function EditReservation($reservationId){

        $reservation = new BookingReservation($this->Core);
        $reservation->GetById($reservationId);
     
        $reservationForm = new BookingEditReservationForm($this->Core, $reservation);
     
      //  $reservationForm->Load($reservation);
        return $reservationForm->Render();
    }


          
          /*action*/
 }?>