<?php include __DIR__ . '/../includes/header.php'; ensure_can_manage_master_data(); if (is_post()) { $data = ['company_name'=>trim($_POST['company_name'] ?? ''),'company_ruc'=>trim($_POST['company_ruc'] ?? ''),'company_phone'=>trim($_POST['company_phone'] ?? ''),'company_email'=>trim($_POST['company_email'] ?? ''),'company_address'=>trim($_POST['company_address'] ?? ''),'company_logo'=>trim($_POST['company_logo'] ?? 'assets/img/logo.png'),'company_city'=>trim($_POST['company_city'] ?? ''),'payroll_note'=>trim($_POST['payroll_note'] ?? '')]; $stmt = db()->prepare("REPLACE INTO company_settings (setting_key, setting_value, updated_at) VALUES (?, ?, NOW())"); foreach ($data as $key => $value) { $stmt->execute([$key, $value]); } audit_log('update', 'company_settings', null, 'Actualización de datos de empresa'); set_flash('success', 'Datos de empresa actualizados.'); redirect('settings/index.php'); } ?>
<div class="form-wrap"><div class="d-flex justify-content-between align-items-center mb-3"><div><h4 class="mb-0">Datos de la empresa</h4><div class="text-muted small">Configuración editable para demo comercial y recibos.</div></div></div><form method="post" class="row g-3"><div class="col-md-6"><label class="form-label">Nombre comercial</label><input name="company_name" class="form-control" value="<?= e(setting('company_name', 'HM Servicios Informáticos')) ?>" required></div><div class="col-md-3"><label class="form-label">RUC</label><input name="company_ruc" class="form-control" value="<?= e(setting('company_ruc')) ?>"></div><div class="col-md-3"><label class="form-label">Teléfono</label><input name="company_phone" class="form-control" value="<?= e(setting('company_phone')) ?>"></div><div class="col-md-4"><label class="form-label">Correo</label><input name="company_email" type="email" class="form-control" value="<?= e(setting('company_email')) ?>"></div><div class="col-md-8"><label class="form-label">Dirección</label><input name="company_address" class="form-control" value="<?= e(setting('company_address')) ?>"></div><div class="col-md-4"><label class="form-label">Ciudad</label><input name="company_city" class="form-control" value="<?= e(setting('company_city')) ?>"></div><div class="col-md-8"><label class="form-label">Nota pie de recibo</label><input name="payroll_note" class="form-control" value="<?= e(setting('payroll_note','Documento generado por el sistema.')) ?>"></div><div class="col-md-12"><label class="form-label">Ruta logo</label><input name="company_logo" class="form-control" value="<?= e(setting('company_logo', 'assets/img/logo.png')) ?>"><div class="form-text">Podés dejar <code>assets/img/logo.png</code> o cambiar a otra imagen dentro del sistema.</div></div><div class="col-12"><button class="btn btn-primary">Guardar cambios</button></div></form></div>
<?php include __DIR__ . '/../includes/footer.php'; ?>
