Transform rename button to full edit functionality

- Replace rename modal with comprehensive edit modal supporting name, MAC, and IP changes
- Add edit_computer() method with full validation (MAC format, duplicates)
- Create new /api/edit endpoint accepting all computer attributes
- Update frontend JavaScript for multi-field editing with client-side validation
- Rename functions from openRenameModal/performRename to openEditModal/performEdit
- Pre-populate edit form with current values and validate MAC address format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-07 00:10:21 +03:00
parent 86931a091e
commit 072553953e
3 changed files with 139 additions and 37 deletions

View File

@@ -100,26 +100,30 @@
</div>
</div>
<!-- Modal pentru redenumirea calculatoarelor -->
<div id="renameModal" class="modal">
<!-- Modal pentru editarea calculatoarelor -->
<div id="editModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h2>Redenumește Calculator</h2>
<span class="close" onclick="closeRenameModal()">&times;</span>
<h2>Editează Calculator</h2>
<span class="close" onclick="closeEditModal()">&times;</span>
</div>
<div class="modal-body">
<div class="form-group">
<label for="currentName">Nume Actual:</label>
<input type="text" id="currentName" readonly>
<label for="editName">Nume Calculator:</label>
<input type="text" id="editName" placeholder="ex: PC Birou">
</div>
<div class="form-group">
<label for="newName">Nume Nou:</label>
<input type="text" id="newName" placeholder="Introdu noul nume">
<label for="editMac">Adresa MAC:</label>
<input type="text" id="editMac" placeholder="ex: 00:11:22:33:44:55">
</div>
<div class="form-group">
<label for="editIp">IP (opțional):</label>
<input type="text" id="editIp" placeholder="ex: 192.168.1.100">
</div>
</div>
<div class="form-actions">
<button type="button" onclick="closeRenameModal()">Anulează</button>
<button type="button" onclick="performRename()">Redenumește</button>
<button type="button" onclick="closeEditModal()">Anulează</button>
<button type="button" onclick="performEdit()">Salvează</button>
</div>
</div>
</div>