feat(non-loanable-devices): implement non-loanable device management

- Add non_loanable_devices table to database schema
- Add web interface routes: /non_loanable_devices, /add_non_loanable_device, /edit_non_loanable_device, /delete_non_loanable_device
- Add CLI menu options 8-10 for non-loanable device management
- Add templates for non-loanable device CRUD operations
- Update README.md with new feature documentation
- Update REQUIREMENTS.md marking non-loanable devices as implemented
- Add gestiontablets.sh script

Implements: #porDefinir Registrar nuevos dispositivos no prestables
This commit is contained in:
ijuanes 2026-06-09 23:54:38 +01:00
parent ac73e5dc93
commit d3d1fb1b32
10 changed files with 417 additions and 6 deletions

View file

@ -0,0 +1,63 @@
{% extends "base.html" %}
{% block content %}
<h2>Add Non-Loanable Device</h2>
<p>Add a device that will be tracked in inventory but cannot be loaned to users (e.g., projectors, monitors, etc.)</p>
<form method="POST" action="/add_non_loanable_device">
<div class="form-group">
<label for="device_type">Device Type:</label>
<select id="device_type" name="device_type" required>
<option value="">Select device type...</option>
<option value="projector">Projector</option>
<option value="monitor">Monitor</option>
<option value="laptop">Laptop (non-loanable)</option>
<option value="printer">Printer</option>
<option value="camera">Camera</option>
<option value="audio">Audio Equipment</option>
<option value="network">Network Equipment</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="brand">Brand:</label>
<input type="text" id="brand" name="brand" required>
</div>
<div class="form-group">
<label for="model">Model:</label>
<input type="text" id="model" name="model" required>
</div>
<div class="form-group">
<label for="serial_number">Serial Number:</label>
<input type="text" id="serial_number" name="serial_number" required>
</div>
<div class="form-group">
<label for="location">Location:</label>
<input type="text" id="location" name="location">
</div>
<div class="form-group">
<label for="purchase_date">Purchase Date:</label>
<input type="date" id="purchase_date" name="purchase_date">
</div>
<div class="form-group">
<label for="purchase_cost">Purchase Cost:</label>
<input type="number" id="purchase_cost" name="purchase_cost" step="0.01">
</div>
<div class="form-group">
<label for="notes">Notes:</label>
<textarea id="notes" name="notes"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn">Add Device</button>
<a href="/non_loanable_devices" class="btn">Cancel</a>
</div>
</form>
{% endblock %}

View file

@ -144,6 +144,7 @@
<a href="/loan_tablet">Loan Tablet</a>
<a href="/history">Loan History</a>
<a href="/user_loans">User Loans</a>
<a href="/non_loanable_devices">Non-Loanable Devices</a>
<a href="/project_management">Project Management</a>
</div>

View file

@ -0,0 +1,71 @@
{% extends "base.html" %}
{% block content %}
<h2>Edit Non-Loanable Device</h2>
<form method="POST" action="/edit_non_loanable_device/{{ device.id }}">
<div class="form-group">
<label for="device_type">Device Type:</label>
<select id="device_type" name="device_type" required>
<option value="projector" {% if device.device_type == 'projector' %}selected{% endif %}>Projector</option>
<option value="monitor" {% if device.device_type == 'monitor' %}selected{% endif %}>Monitor</option>
<option value="laptop" {% if device.device_type == 'laptop' %}selected{% endif %}>Laptop (non-loanable)</option>
<option value="printer" {% if device.device_type == 'printer' %}selected{% endif %}>Printer</option>
<option value="camera" {% if device.device_type == 'camera' %}selected{% endif %}>Camera</option>
<option value="audio" {% if device.device_type == 'audio' %}selected{% endif %}>Audio Equipment</option>
<option value="network" {% if device.device_type == 'network' %}selected{% endif %}>Network Equipment</option>
<option value="other" {% if device.device_type == 'other' %}selected{% endif %}>Other</option>
</select>
</div>
<div class="form-group">
<label for="brand">Brand:</label>
<input type="text" id="brand" name="brand" value="{{ device.brand }}" required>
</div>
<div class="form-group">
<label for="model">Model:</label>
<input type="text" id="model" name="model" value="{{ device.model }}" required>
</div>
<div class="form-group">
<label for="serial_number">Serial Number:</label>
<input type="text" id="serial_number" name="serial_number" value="{{ device.serial_number }}" required>
</div>
<div class="form-group">
<label for="location">Location:</label>
<input type="text" id="location" name="location" value="{{ device.location or '' }}">
</div>
<div class="form-group">
<label for="status">Status:</label>
<select id="status" name="status" required>
<option value="available" {% if device.status == 'available' %}selected{% endif %}>Available</option>
<option value="in_use" {% if device.status == 'in_use' %}selected{% endif %}>In Use</option>
<option value="maintenance" {% if device.status == 'maintenance' %}selected{% endif %}>Maintenance</option>
<option value="retired" {% if device.status == 'retired' %}selected{% endif %}>Retired</option>
</select>
</div>
<div class="form-group">
<label for="purchase_date">Purchase Date:</label>
<input type="date" id="purchase_date" name="purchase_date" value="{{ device.purchase_date or '' }}">
</div>
<div class="form-group">
<label for="purchase_cost">Purchase Cost:</label>
<input type="number" id="purchase_cost" name="purchase_cost" step="0.01" value="{{ device.purchase_cost or '' }}">
</div>
<div class="form-group">
<label for="notes">Notes:</label>
<textarea id="notes" name="notes">{{ device.notes or '' }}</textarea>
</div>
<div class="form-group">
<button type="submit" class="btn">Update Device</button>
<a href="/non_loanable_devices" class="btn">Cancel</a>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block content %}
<div class="section">
<h2>Non-Loanable Devices Inventory</h2>
<p>These devices are tracked in inventory but cannot be loaned to users.</p>
<a href="/add_non_loanable_device" class="btn">Add Non-Loanable Device</a>
{% if devices %}
<table>
<thead>
<tr>
<th>Type</th>
<th>Brand</th>
<th>Model</th>
<th>Serial Number</th>
<th>Location</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for device in devices %}
<tr>
<td>{{ device.device_type }}</td>
<td>{{ device.brand }}</td>
<td>{{ device.model }}</td>
<td>{{ device.serial_number }}</td>
<td>{{ device.location or '-' }}</td>
<td>{{ device.status }}</td>
<td>
<a href="/edit_non_loanable_device/{{ device.id }}" class="btn">Edit</a>
<a href="/delete_non_loanable_device/{{ device.id }}" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this device?')">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No non-loanable devices registered.</p>
{% endif %}
</div>
{% endblock %}