<!DOCTYPE html>
<html lang="en">
{{ template "head" . }}
<body>

<div class="container-fluid">
    {{ $devs := .Devices }}
    {{ $device := .Device }}
    {{ $rgbModes := .Device.RGBModes }}
    {{ $controllers := .Device.Controllers }}
    {{ $deviceProfile := .Device.DeviceProfile }}
    <input type="hidden" id="deviceId" name="deviceId" value="{{ $device.Serial }}">
    <div class="row">
        <!-- Sidebar -->
        {{ template "sidebar" . }}

        <!-- Main -->
        <main class="main-content p-4">
            <!-- Temperature bar -->
            {{ if .Dashboard.TemperatureBar }}
            {{ template "temperature-bar" . }}
            {{ end }}

            <!-- Cluster -->
            <div class="row g-4 mb-4 align-items-start">
                <div class="col-md-2">
                    <div class="card system-card text-center">
                        <div class="card-header">
                            {{ .Device.Product }}
                        </div>
                        <div class="card-body">
                            <div class="settings-list">
                                <!-- Brightness -->
                                <div class="settings-row">
                                    <span class="settings-label text-ellipsis">{{ .Lang "txtBrightness" }}</span>
                                    <div class="system-slider no-padding-top">
                                        <label for="brightnessSlider">
                                            <input type="range" id="brightnessSlider" name="brightnessSlider" min="0" max="100" value="{{ $deviceProfile.BrightnessSlider }}" step="1">
                                        </label>
                                        <div class="slider-value" id="brightnessSliderValue">{{ $deviceProfile.BrightnessSlider }} %</div>
                                    </div>
                                </div>

                                <!-- RGB Profile -->
                                <div class="settings-row">
                                    <span class="settings-label text-ellipsis">{{ .Lang "txtRgb" }}</span>
                                    <label for="clusterRgbProfile">
                                        <select id="clusterRgbProfile" class="form-select system-select compact auto-width clusterRgbProfile" name="clusterRgbProfile">
                                            <option value="">None</option>
                                            {{ range $key, $mode := $rgbModes }}
                                            {{ if eq $mode $device.DeviceProfile.RGBProfile }}
                                            <option value="0;{{ $mode }}" selected>{{ $mode }}</option>
                                            {{ else }}
                                            <option value="0;{{ $mode }}">{{ $mode }}</option>
                                            {{ end }}
                                            {{ end }}
                                        </select>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-10">
                    <div class="card system-card text-center">
                        <div class="card-body">
                            <table class="dataTable text-sm" id="table" style="width: 100%;">
                                <thead>
                                <tr>
                                    <th>{{ .Lang "txtDevice" }}</th>
                                    <th>{{ .Lang "txtDeviceSerial" }}</th>
                                    <th>{{ .Lang "txtRgb" }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                {{ range $key, $value := $device.Controllers }}
                                <tr>
                                    <td>{{ $value.Product }}</td>
                                    <td>{{ $value.Serial }}</td>
                                    <td>{{ $device.DeviceProfile.RGBProfile }}</td>
                                </tr>
                                {{ end }}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
</div>
<script src="/static/js/cluster.js"></script>
<script src="/static/js/sidebar.js"></script>
{{ if .Dashboard.TemperatureBar }}
<script src="/static/js/temperature-bar.js"></script>
{{ end }}
</body>
</html>
