Dirección y Clave de proveedor

This commit is contained in:
2025-05-22 08:06:56 -06:00
parent 65989cc05a
commit f3a7f5497f
4 changed files with 68 additions and 66 deletions

2
.env
View File

@@ -1,4 +1,4 @@
DB_HOST=localhost
DB_HOST=DESKTOP-22T88B6
DB_DATABASE=Importaciones_HC
DB_USERNAME=sa
DB_PASSWORD=Soluciones01

View File

@@ -130,12 +130,27 @@ function ajax_lista()
if ($status === 200 && ($json = json_decode($resp, true)) && is_array($json)) {
foreach ($json as $p) {
$clave = htmlspecialchars($p['Clave'] ?? '', ENT_QUOTES);
// Construir dirección
$direccion = trim(implode(', ', array_filter([
$p['Calles'] ?? '',
'Num. Ext: ' . ($p['NumExt'] ?? ''),
'Num. Int: ' . ($p['NumInt'] ?? ''),
$p['Colonia'] ?? '',
$p['Municipio'] ?? '',
$p['Ciudad'] ?? '',
'C.P. ' . ($p['CodigoPostal'] ?? ''),
$p['EntidadFederativa'] ?? '',
$p['Pais'] ?? ''
])));
$dataList[] = [
$clave,
htmlspecialchars($p['Nombre'] ?? '', ENT_QUOTES),
htmlspecialchars($p['RFC'] ?? '', ENT_QUOTES),
htmlspecialchars($p['Ciudad'] ?? '', ENT_QUOTES),
htmlspecialchars($p['Telefono']?? '', ENT_QUOTES),
htmlspecialchars($direccion ?? '', ENT_QUOTES),
// Acciones
"<a href=\"/IMPORTADORES/proveedores/editar?clave=" . rawurlencode($clave) . "\" class=\"btn btn-sm btn-primary\">✏️</a>
<button class=\"btn btn-sm btn-danger\" onclick=\"confirmDelete('{$clave}')\">🗑️</button>"
@@ -149,7 +164,6 @@ function ajax_lista()
echo json_encode(['data' => $dataList]);
}
/**
* GET /IMPORTADORES/proveedores/eliminar
* Llama a DELETE /api/proveedores/:clave y redirige
@@ -193,7 +207,6 @@ function crear()
include __DIR__ . '/../../views/proveedores/crear.php';
}
/**
* POST /IMPORTADORES/proveedores/guardar
* Procesa el alta de un nuevo proveedor contra la API WinSAAI.
@@ -268,4 +281,3 @@ function guardar()
exit;
}
}

View File

@@ -64,8 +64,6 @@ function getApiToken(): ?string
return null;
}
/**
* Listado de solicitudes de importación (facturas) del importador logueado
*/
@@ -146,7 +144,6 @@ function crear() {
$unidades_medida[] = $r;
}
include __DIR__ . '/../../views/solicitud_importacion/crear.php';
}
@@ -214,7 +211,6 @@ function guardar() {
foto_solicitud_url, status, proveedor_clave)
OUTPUT INSERTED.id_solicitud
VALUES(?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
;
$stmt = sqlsrv_query($conn, $sql, $params, ['Scrollable' => SQLSRV_CURSOR_KEYSET]);
if ($stmt === false) {
@@ -228,8 +224,6 @@ if (!$new || empty($new['id_solicitud'])) {
$id_solicitud = (int)$new['id_solicitud'];
// Partidas
if(!empty($_POST['partidas'])&&is_array($_POST['partidas'])){
@@ -271,7 +265,6 @@ if(!empty($_POST['partidas'])&&is_array($_POST['partidas'])){
}
}
header('Location: /IMPORTADORES/solicitud_importacion/lista?created=ok');
exit;
}
@@ -393,9 +386,11 @@ function ajax_proveedores()
$out = ['results' => []];
if ($status === 200 && ($json = json_decode($resp, true)) && is_array($json)) {
foreach ($json as $p) {
$clave = $p['Clave'] ?? '';
$nombre = $p['Nombre'] ?? '';
$out['results'][] = [
'id' => $p['Clave'] ?? '',
'text' => $p['Nombre'] ?? ''
'id' => $clave,
'text' => "[$clave] - $nombre"
];
}
}
@@ -405,10 +400,6 @@ function ajax_proveedores()
exit;
}
function ajax_lista()
{
// 1) Fijamos el header JSON
@@ -465,7 +456,6 @@ function ajax_lista()
echo json_encode(['data' => $dataList]);
}
function update_status() {
header('Content-Type: application/json; charset=utf-8');
@@ -490,5 +480,3 @@ function update_status() {
echo json_encode(['success'=>true]);
exit;
}

View File

@@ -100,6 +100,7 @@
<th>RFC</th>
<th>Ciudad</th>
<th>Teléfono</th>
<th>Dirección</th>
<th>Acciones</th>
</tr>
</thead>
@@ -147,7 +148,8 @@
{ data: 2 },
{ data: 3 },
{ data: 4, className: 'text-center' },
{ data: 5, className: 'text-center' }
{ data: 5},
{ data: 6, className: 'text-center' }
],
language: {
processing: '<div class="spinner-border text-primary" role="status"><span class="visually-hidden">Cargando...</span></div>',