<?php

require_once PLUGIN_DIR_PATH . 'admin/device.class.php';
require_once PLUGIN_DIR_PATH . 'admin/room.class.php';
require_once PLUGIN_DIR_PATH . 'admin/TypeStatus.class.php';
require_once PLUGIN_DIR_PATH . 'admin/provide.class.php';
require_once PLUGIN_DIR_PATH . 'admin/accessories.class.php';
require_once PLUGIN_DIR_PATH . 'admin/DeviceStatus.class.php';
require_once PLUGIN_DIR_PATH . 'admin/AccessoriesDevice.class.php';
$args = ['fields' => ['display_name', 'id']];
$list_user = get_users($args);
$devicestatus = new DeviceStatus();
$type_status = new TypeStatus();
$accessories = new Accessories();
$device = new Device();
$data = $devicestatus->getTable($where = "", $orderField = "matttb", $groupByField = "", Global_Define::KC_MANAGEMENT_ORDER . ' LIMIT ' . $devicestatus->num_item);
$num_page = $devicestatus->CountPage();
$list_type_status = $type_status->getTable($where = "", $orderField = "loaitinhtrang", $groupByField = "", '');
$list_accessories = $accessories->getTable($where = "", $orderField = "malk", $groupByField = "", '');
$list_device = $device->getTable($where = "", $orderField = "matb", $groupByField = "");
?>
<div id="wpbody" role="main">
	<div id="wpbody-content" aria-label="Nội dung chính" tabindex="0" style="overflow: hidden;">
			<div class="wrap">
				<h1><?php 
_e('Quản lý thiết bị phòng thực hành', KC_DOMAIN);
?>
</h1>
				<div id="welcome-panel" class="welcome-panel">
					<input type="hidden" id="welcomepanelnonce" name="welcomepanelnonce" value="d0b9b07e0f">        <a class="welcome-panel-close" href="http://manager.dev/wp-admin/?welcome=0">Hủy</a>
						<div class="welcome-panel-content">
 public static function DeviceStatus($type, $data)
 {
     require_once 'DeviceStatus.class.php';
     $class = new DeviceStatus();
     $class->filter = ManagementFunction::getPostVariable('filter');
     $status = false;
     $class->setData($data);
     switch ($type) {
         case 'add':
             $status = $class->add();
             break;
         case 'update':
             $status = $class->update();
             break;
         case 'delete':
             $status = $class->delete();
             break;
         case 'getsingle':
             $status = $class->getsingle();
             break;
         case 'getpage':
             $status = $class->getpage();
             break;
         case 'search':
             $status = $class->search();
             break;
         case 'getdeviceaccessories':
             $status = $class->getdeviceaccessories();
             break;
         case 'print':
             $status = $class->print_data();
             break;
         default:
             break;
     }
     if ($status) {
         wp_send_json_success($status);
     } else {
         wp_send_json_error($class->error);
     }
 }