fix(config): agrega roles Taller y Mecanico en creacion de empleados
- Agrega opciones workshop y mechanic al select de rol en config.html - Actualiza ROLE_LABELS y ROLE_BADGE en config.js - Valida roles mechanic y workshop en config_bp.py con permisos por defecto - Añade clases CSS badge--orange y badge--teal Tests: 35 passed
This commit is contained in:
@@ -200,7 +200,7 @@ def create_employee():
|
||||
nxt_name = PLANS[nxt]['name'] if nxt else 'Enterprise'
|
||||
return jsonify({'error': f'Plan limit reached ({limit} employees). Upgrade to {nxt_name}.'}), 403
|
||||
|
||||
valid_roles = ['admin', 'cashier', 'warehouse', 'accountant', 'workshop']
|
||||
valid_roles = ['admin', 'cashier', 'warehouse', 'accountant', 'workshop', 'mechanic']
|
||||
if data['role'] not in valid_roles:
|
||||
return jsonify({'error': f'role must be one of: {", ".join(valid_roles)}'}), 400
|
||||
|
||||
@@ -239,6 +239,8 @@ def create_employee():
|
||||
'fleet.view'],
|
||||
'workshop': ['workshop.view', 'workshop.edit', 'workshop.add_items', 'customers.view',
|
||||
'fleet.view'],
|
||||
'mechanic': ['workshop.view', 'workshop.edit', 'workshop.add_items', 'customers.view',
|
||||
'fleet.view'],
|
||||
}
|
||||
|
||||
for perm in role_permissions.get(data['role'], []):
|
||||
|
||||
@@ -1186,6 +1186,8 @@
|
||||
.badge--green { background: rgba(34,197,94,0.15); color: var(--color-success); }
|
||||
.badge--yellow { background: rgba(234,179,8,0.15); color: #eab308; }
|
||||
.badge--purple { background: rgba(168,85,247,0.15); color: #a855f7; }
|
||||
.badge--orange { background: rgba(249,115,22,0.15); color: #f97316; }
|
||||
.badge--teal { background: rgba(20,184,166,0.15); color: #14b8a6; }
|
||||
|
||||
/* Toast notification */
|
||||
.cfg-toast {
|
||||
|
||||
@@ -106,7 +106,9 @@ const Config = (() => {
|
||||
admin: 'Admin',
|
||||
cashier: 'Cajero',
|
||||
warehouse: 'Almacenista',
|
||||
accountant: 'Contador'
|
||||
accountant: 'Contador',
|
||||
workshop: 'Taller',
|
||||
mechanic: 'Mecanico'
|
||||
};
|
||||
|
||||
var ROLE_BADGE = {
|
||||
@@ -114,7 +116,9 @@ const Config = (() => {
|
||||
admin: 'badge--blue',
|
||||
cashier: 'badge--green',
|
||||
warehouse: 'badge--yellow',
|
||||
accountant: 'badge--purple'
|
||||
accountant: 'badge--purple',
|
||||
workshop: 'badge--orange',
|
||||
mechanic: 'badge--teal'
|
||||
};
|
||||
|
||||
function roleBadge(role) {
|
||||
|
||||
@@ -896,6 +896,8 @@
|
||||
<option value="cashier">Cajero</option>
|
||||
<option value="warehouse">Almacenista</option>
|
||||
<option value="accountant">Contador</option>
|
||||
<option value="workshop">Taller</option>
|
||||
<option value="mechanic">Mecanico</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user