<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_AppointmentController")) {
    /**
     * Class WpBookingPro_AppointmentController
     */
    class WpBookingPro_AppointmentController extends woobooking_controller
    {
        /**
         * @var string
         */
        public $view = "appointment";
        /**
         * @var string
         */
        public $table_name = "order";

        /**
         * @return mixed
         * @throws Exception
         */
        public function get_employee_by_id()
        {
            return self::view("appointment.list");
        }

        /**
         * @return mixed
         * @throws Exception
         */
        public function ajax_edit_order_detail()
        {
            return self::view("appointment.order_detail");
        }

        /**
         * @return mixed
         * @throws Exception
         */
        public function ajax_change_order_status()
        {
            $input = Factory::getInput();
            $order_id = $input->getInt('order_id', 0);
            $order_status_id = $input->getInt('order_status_id', 0);
            $modelOrder = WoobookingModel::getInstance('order');
            $order = $modelOrder->change_order_status($order_id, $order_status_id);
            return $order;
        }
        public function ajax_delete()
        {
            $input = Factory::getInput();
            $modelEvent = WoobookingModel::getInstance('appointment');
            $list_delete_order_id = $input->get('list_delete_order_id', array(), 'array');
            foreach ($list_delete_order_id as $order_id) {
                $modelEvent->delete($order_id);
            }
            return true;
        }
    }
}

?>