<?php
namespace WpBookingEventAdmin\app\controllers;
use WpBookingEvent\Factory;
use WpBookingEvent\Mvc\Controller\Controller;
use WpBookingEvent\Mvc\Controller\ControllerForm as ControllerFormAlias;
use WpBookingEvent\Mvc\Model\Model;
use WpBookingEvent\Utilities\Utility;

defined('_WPBOOKINGEVENT_EXEC') or die;
class CalendarController extends ControllerFormAlias
{
    public $view="calendar";
    public function get_order_by_employee_id(){
        $input=Factory::getInput();
        $employee_id=$input->getInt('id',0);
        if(isset($employee_id)) {
            $modelCalendar = Model::getInstance('calendar');
            $order = $modelCalendar->getListOrderByEmployeeId($employee_id);
            return $order;
        }
    }
    public function get_order_by_customer_id(){
        $input=Factory::getInput();
        $customer_id=$input->getInt('id',0);
        if(isset($customer_id)) {
            $modelCalendar = Model::getInstance('calendar');
            $order = $modelCalendar->getListOrderByCustomerId($customer_id);
            return $order;
        }
    }
    public function save_schedule_event(){
        $input=Factory::getInput();
        $modelOrder = Model::getInstance('calendar');
        $data=$input->getData();
        $response=new \stdClass();
        $response->result="success";
        $response->data=$data;
        $newevent=$modelOrder->save_recurring_event($data);
        return $newevent;
    }
    public function delete($id = 0)
    {
        $input=Factory::getInput();
        $data=$input->getData();
        $order_id=$data['order_id'];
        $modelCustomer= Model::getInstance('customer');
        $customer=$modelCustomer->delete_customer($data);
        if(!$id)
        {
            $id=$order_id;
        }
        $model=$this->getModel();
        $model->delete($id);
        return true;
    }


}
