Files
Server_Monitorizare_v2/templates/wmt/device_form.html

101 lines
4.6 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}{% if device %}Edit Device{% else %}New Device{% endif %} WMT {{ app_name }}{% endblock %}
{% block page_title %}{% if device %}Edit Device{% else %}New Device{% endif %}{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-7">
<div class="card">
<div class="card-header">
<i class="fas fa-desktop me-2"></i>
{% if device %}
Edit: <code>{{ device.mac_address }}</code>
{% else %}
Register New WMT Device
{% endif %}
</div>
<div class="card-body">
<form method="post">
<div class="mb-3">
<label class="form-label fw-semibold">MAC Address <span class="text-danger">*</span>
<small class="text-muted fw-normal">(unique identifier, e.g. b8:27:eb:aa:bb:cc)</small>
</label>
{% if device %}
<input type="text" class="form-control" value="{{ device.mac_address }}" readonly disabled>
<small class="text-muted">MAC cannot be changed after registration.</small>
{% else %}
<input type="text" name="mac_address" class="form-control"
placeholder="b8:27:eb:aa:bb:cc" required
pattern="^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$">
{% endif %}
</div>
<div class="mb-3">
<label class="form-label fw-semibold">Work Place
<small class="text-muted fw-normal">(table / workstation identifier)</small>
</label>
<input type="text" name="device_name" class="form-control"
value="{{ device.device_name or '' if device else '' }}"
placeholder="Masa-01">
</div>
<div class="row g-3 mb-3">
<div class="col-md-6">
<label class="form-label fw-semibold">Hostname</label>
<input type="text" name="hostname" class="form-control"
value="{{ device.hostname or '' if device else '' }}"
placeholder="rpi-masa01">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">IP Address</label>
<input type="text" name="device_ip" class="form-control"
value="{{ device.device_ip or '' if device else '' }}"
placeholder="192.168.1.100">
</div>
</div>
<div class="mb-4">
<label class="form-label fw-semibold">Notes</label>
<textarea name="notes" class="form-control" rows="2">{{ device.notes or '' if device else '' }}</textarea>
</div>
<div class="mb-4">
<label class="form-label fw-semibold">Card Presence
<small class="text-muted fw-normal">(enable = RFID card reader present; disable = no card reader)</small>
</label>
<select name="card_presence" class="form-select">
<option value="enable" {% if not device or device.card_presence != 'disable' %}selected{% endif %}>enable</option>
<option value="disable" {% if device and device.card_presence == 'disable' %}selected{% endif %}>disable</option>
</select>
</div>
{% if device %}
<div class="alert alert-light border small mb-4">
<strong>Last seen:</strong>
{{ device.last_seen | local_dt('%Y-%m-%d %H:%M:%S') if device.last_seen else 'Never' }}<br>
<strong>Config updated:</strong>
{{ device.config_updated_at | local_dt('%Y-%m-%d %H:%M:%S') if device.config_updated_at else '—' }}<br>
<strong>Info reviewed at:</strong>
<span class="{% if device.info_reviewed_at and device.info_reviewed_at.year > 1970 %}text-success{% else %}text-muted{% endif %}">
{{ device.info_reviewed_at | local_dt('%Y-%m-%d %H:%M:%S') if (device.info_reviewed_at and device.info_reviewed_at.year > 1970) else 'Never reviewed' }}
</span>
<br><small class="text-muted">Updated automatically when you save this form, accept or reject a device request.</small>
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-1"></i> {% if device %}Save Changes{% else %}Register Device{% endif %}
</button>
<a href="{{ url_for('wmt_web.devices') }}" class="btn btn-outline-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}