feat(pos): configuracion funcional — sucursales, empleados, tema

Replace hardcoded demo data in the config page with real API calls.
Branches and employees now load from /pos/api/config/* endpoints,
with create modals for both. Business data tab reads tenant_config
(read-only). Theme selector was already working and is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 02:15:24 +00:00
parent f85e53cee8
commit cc2336ca06
3 changed files with 546 additions and 156 deletions

View File

@@ -126,6 +126,29 @@ def create_employee():
return jsonify({'id': emp_id, 'message': 'Employee created'}), 201
@config_bp.route('/business', methods=['GET'])
@require_auth()
def get_business():
"""Read-only tenant business info from tenant_config."""
conn = get_tenant_conn(g.tenant_id)
cur = conn.cursor()
cur.execute("SELECT key, value FROM tenant_config WHERE key LIKE 'tenant_%'")
cfg = {}
for row in cur.fetchall():
cfg[row[0]] = row[1]
cur.close()
conn.close()
return jsonify({
'razon_social': cfg.get('tenant_razon_social', ''),
'nombre': cfg.get('tenant_nombre', cfg.get('tenant_razon_social', '')),
'rfc': cfg.get('tenant_rfc', ''),
'regimen_fiscal': cfg.get('tenant_regimen_fiscal', ''),
'direccion': cfg.get('tenant_direccion', ''),
'telefono': cfg.get('tenant_telefono', ''),
'email': cfg.get('tenant_email', ''),
})
@config_bp.route('/theme', methods=['GET'])
@require_auth()
def get_theme():