<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_CategoryController")) {
    /**
     * Class WpBookingPro_CategoryController
     */
    class WpBookingPro_CategoryController extends woobooking_controller
    {
        /**
         * @param array $data
         * @return array|bool|mixed
         */
        public function save($data = array())
        {
            return parent::save($data); // TODO: Change the autogenerated stub
        }

        /**
         * @return mixed
         * @throws Exception
         */
        public function ajax_add_new_category()
        {
            return self::view("category.form");
        }

        /**
         * @return mixed
         * @throws Exception
         */
        public function ajax_get_item()
        {
            return self::view("category.form");
        }

        /**
         * @return bool
         * @throws Exception
         */
        public function ajax_delete()
        {
            $categoryModel = WoobookingModel::getInstance('category');
            $input = Factory::getInput();
            $list_delete_category_id = $input->get('list_delete_category_id', array(), 'array');
            foreach ($list_delete_category_id as $category_id) {
                $categoryModel->delete($category_id);
            }
            return true;
        }
    }
}
?>