<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会议室和设备选择</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <div class="container mt-5">
        <h1 class="mb-4">选择会议室和设备</h1>

        <form id="region-form" class="mb-4">
            <div class="mb-3">
                <label for="company_id" class="form-label">选择公司:</label>
                <select class="form-select" id="company_id" name="company_id" required>
                    <option value="" disabled selected>请选择公司</option>
                    {% for company_id in company_ids %}
                    <option value="{{ company_id }}">{{ company_id }}</option>
                    {% endfor %}
                </select>
            </div>
            <button type="button" class="btn btn-primary" onclick="getRegions()">获取会议室</button>
        </form>

        <div id="regions-container" class="mb-4">
            <label for="regions" class="form-label">选择会议室:</label>
            <select id="regions" class="form-select" multiple size="10"></select>
            <button type="button" class="btn btn-primary mt-2" onclick="getDevices()">获取设备</button>
        </div>

        <div id="devices-container">
            <label for="devices" class="form-label">选择设备:</label>
            <select id="devices" class="form-select" multiple size="10"></select>
        </div>

        <div class="mt-4">
            <button type="button" class="btn btn-success" onclick="togglePower(true)">会议室开启电源</button>
            <button type="button" class="btn btn-danger" onclick="togglePower(false)">会议室关闭电源</button>
            <button type="button" class="btn btn-success" onclick="toggleStatus(true)">会议室在线</button>
            <button type="button" class="btn btn-danger" onclick="toggleStatus(false)">会议室离线</button>
        </div>
    </div>

    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>
