subir cambios antes de update

This commit is contained in:
jaimejimenezortega
2024-05-07 17:55:10 +02:00
parent 5ef1360565
commit 8009d34955
8 changed files with 109 additions and 11 deletions

View File

@ -536,6 +536,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'tablaPresupuestosCliente']);
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
});
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);

View File

@ -608,11 +608,12 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
public function presupuesto()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$error =(object)[
'interior' => "",
'cubierta' => "",
@ -931,6 +932,7 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
'guardas' => $guardas,
'serviciosDefecto' => $servDefecto,
'servicios_automaticos' => $serviciosAutomaticos,
$csrfTokenName => $newTokenHash
];
@ -940,16 +942,33 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
}
}
public function getDireccionesCliente(){
if ($this->request->isAJAX()) {
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$reqData = $this->request->getPost();
$cliente_id = $reqData['id'] ?? 0;
$model = model('App\Models\Clientes\ClienteDireccionesModel');
$data = $model->getMenuDirecciones($cliente_id);
array_unshift($data, ['id' => 0, 'text' => 'Agregar nueva dirección']);
return $this->respond([
'menu'=>$data,
$csrfTokenName => $newTokenHash
]);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
/***********************
*
* Funciones auxiliares
*
**********************/
**********************/
protected function calcular_lomo($lineas, $lomo_inicial){
$lomo = $lomo_inicial;
foreach ($lineas as $linea) {

View File

@ -189,6 +189,7 @@ class LoginAuthFilter implements FilterInterface
'cast',
'getGramaje',
'presupuesto',
'getDireccionesCliente'
];
}

View File

@ -30,4 +30,11 @@
</div>
</div>
</div>
<?= $this->section("additionalInlineJs") ?>
window.routes_direcciones = {
direcciones: "<?= route_to('getDirecciones') ?>",
}
<?= $this->endSection() ?>

View File

@ -1,3 +1,30 @@
function initDirecciones() {
data = {
id: $('#clienteId').val()
},
data = Object.assign(data, window.token_ajax)
$.ajax({
url: window.routes_direcciones.direcciones,
type: 'POST',
data: data,
success: function(response) {
$("#direcciones").empty();
$.each(response.menu, function(key, value) {
$('#direcciones')
.append($('<option>', { value : key })
.text(value));
});
$('#direcciones').val();
},
error: function() {
$("#direcciones").empty();
},
});
}
function initTiradasDirecciones() {
const _this = this
@ -61,6 +88,13 @@ function updateTiradasDireccionesCheck(el) {
}
}
$('#direcciones').on('change', function() {
if( $('#direcciones').val() == 0 ) {
console.log("Nueva direccion")
}
})
$('#insertarDireccion').on('click', function() {
//if( ('#direcciones').val() > 0 ) {

View File

@ -208,6 +208,7 @@
}
}).on('core.form.valid', function () {
validationStepper.next();
initDirecciones();
initTiradasDirecciones();
});

View File

@ -10,11 +10,10 @@
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^8.1",
"php": "^8.2",
"codeigniter4/framework": "^4.0",
"codeigniter4/shield": "^1.0",
"dompdf/dompdf": "^2.0",
//"phpoffice/phpspreadsheet": "^1.18"
"dompdf/dompdf": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.9",

View File

@ -438322,3 +438322,39 @@ Stack trace:
[71] [Step Debug] ERR: Could not connect to debugging client. Tried: 10.5.0.1:9003 (from REMOTE_ADDR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port).
[71] Log closed at 2024-05-06 19:49:12.627128
[22] Log opened at 2024-05-07 15:47:13.581991
[22] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.22'
[22] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[22] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[22] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[22] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 10.5.0.1:9003.
[22] [Step Debug] WARN: Creating socket for '10.5.0.1:9003', poll success, but error: Operation now in progress (29).
[22] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9003.
[22] [Step Debug] WARN: Creating socket for 'host.docker.internal:9003', getaddrinfo: Invalid argument.
[22] [Step Debug] ERR: Could not connect to debugging client. Tried: 10.5.0.1:9003 (from REMOTE_ADDR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port).
[22] Log closed at 2024-05-07 15:47:13.646557
[22] Log opened at 2024-05-07 15:47:13.889324
[22] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.22'
[22] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[22] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[22] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[22] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 10.5.0.1:9003.
[22] [Step Debug] WARN: Creating socket for '10.5.0.1:9003', poll success, but error: Operation now in progress (29).
[22] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9003.
[22] [Step Debug] WARN: Creating socket for 'host.docker.internal:9003', getaddrinfo: Invalid argument.
[22] [Step Debug] ERR: Could not connect to debugging client. Tried: 10.5.0.1:9003 (from REMOTE_ADDR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port).
[22] Log closed at 2024-05-07 15:47:13.948692
[23] Log opened at 2024-05-07 15:47:45.788281
[23] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.23'
[23] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[23] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[23] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[23] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 10.5.0.1:9003.
[23] [Step Debug] WARN: Creating socket for '10.5.0.1:9003', poll success, but error: Operation now in progress (29).
[23] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9003.
[23] [Step Debug] WARN: Creating socket for 'host.docker.internal:9003', getaddrinfo: Invalid argument.
[23] [Step Debug] ERR: Could not connect to debugging client. Tried: 10.5.0.1:9003 (from REMOTE_ADDR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port).
[23] Log closed at 2024-05-07 15:47:45.851339