user roles
This commit is contained in:
@@ -219,6 +219,14 @@
|
||||
<label for="position" class="form-label">Position</label>
|
||||
<input type="text" class="form-control" id="position" name="position">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<select class="form-select" id="role" name="role" required>
|
||||
<option value="user">Standard User</option>
|
||||
<option value="manager">Manager</option>
|
||||
<option value="admin">Administrator</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="status" class="form-label">Status</label>
|
||||
<select class="form-select" id="status" name="status">
|
||||
@@ -267,6 +275,14 @@
|
||||
<label for="edit-position" class="form-label">Position</label>
|
||||
<input type="text" class="form-control" id="edit-position" name="position">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="edit-role" class="form-label">Role</label>
|
||||
<select class="form-select" id="edit-role" name="role" required>
|
||||
<option value="user">Standard User</option>
|
||||
<option value="manager">Manager</option>
|
||||
<option value="admin">Administrator</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="edit-status" class="form-label">Status</label>
|
||||
<select class="form-select" id="edit-status" name="status">
|
||||
@@ -682,6 +698,7 @@ async function addContact(event) {
|
||||
}
|
||||
|
||||
const formData = new FormData(event.target);
|
||||
|
||||
const response = await fetch(`{{ instance.main_url }}/api/admin/contacts`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -695,7 +712,8 @@ async function addContact(event) {
|
||||
phone: formData.get('phone'),
|
||||
company: formData.get('company'),
|
||||
position: formData.get('position'),
|
||||
status: formData.get('status')
|
||||
role: formData.get('role'),
|
||||
is_active: formData.get('status') === 'active'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -756,6 +774,7 @@ async function editContact(id) {
|
||||
document.getElementById('edit-phone').value = contact.phone || '';
|
||||
document.getElementById('edit-company').value = contact.company || '';
|
||||
document.getElementById('edit-position').value = contact.position || '';
|
||||
document.getElementById('edit-role').value = contact.role;
|
||||
document.getElementById('edit-status').value = contact.is_active ? 'active' : 'inactive';
|
||||
|
||||
// Show modal
|
||||
@@ -804,7 +823,8 @@ async function updateContact(event) {
|
||||
phone: formData.get('phone'),
|
||||
company: formData.get('company'),
|
||||
position: formData.get('position'),
|
||||
status: formData.get('status') === 'active'
|
||||
role: formData.get('role'),
|
||||
is_active: formData.get('status') === 'active'
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user