mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'add/nullableEnClientes' into 'main'
añadido el fichero de nullable para la tabla clientes See merge request jjimenez/safekat!387
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class ModifyNullableComercialSoporte extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
66
httpdocs/assets/js/safekat/pages/cliente/cliente.js
Normal file
66
httpdocs/assets/js/safekat/pages/cliente/cliente.js
Normal file
@ -0,0 +1,66 @@
|
||||
import ClassSelect from '../../components/select2.js';
|
||||
|
||||
class Cliente {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.csrf_token = this.getToken();
|
||||
this.csrf_hash = $('#clienteForm').find('input[name="' + this.csrf_token + '"]').val();
|
||||
|
||||
this.pais = new ClassSelect($("#paisId"), '/paises/menuitems2', "Seleccione un país", {[this.csrf_token]: this.csrf_hash});
|
||||
this.soporte = new ClassSelect($("#soporteId"), '/users/getMenuComerciales', "Seleccione un usuario", {[this.csrf_token]: this.csrf_hash});
|
||||
this.comercial = new ClassSelect($("#comercialId"), '/users/getMenuComerciales', "Seleccione un usuario", {[this.csrf_token]: this.csrf_hash});
|
||||
this.formaPago = new ClassSelect($("#formaPagoId"), '/formas-pago/menuitems', "Seleccione una forma de pago", {[this.csrf_token]: this.csrf_hash});
|
||||
this.provincia = new ClassSelect($("#provinciaId"), '/provincias/menuitems2', "Seleccione una provincia", {[this.csrf_token]: this.csrf_hash});
|
||||
this.comunidadAutonoma = new ClassSelect($("#comunidadAutonomaId"), '/comunidades-autonomas/menuitems2', "Seleccione una comunidad autónoma", {[this.csrf_token]: this.csrf_hash});
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
// Fuerza el foco en el campo de búsqueda de select2
|
||||
$(document).on('select2:open', () => {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
this.pais.init();
|
||||
this.soporte.init();
|
||||
this.comercial.init();
|
||||
this.formaPago.init();
|
||||
this.provincia.init();
|
||||
this.comunidadAutonoma.init();
|
||||
|
||||
$(document).keypress(function (e) {
|
||||
var key = e.which;
|
||||
if (key == 13) // the enter key code
|
||||
{
|
||||
e.preventDefault()
|
||||
if ($('#addressForm').hasClass('show')) {
|
||||
$("#saveAdd").click();
|
||||
}
|
||||
else if ($('#convert2Template').hasClass('show')) {
|
||||
$("#saveTemplate").click();
|
||||
}
|
||||
else {
|
||||
$('#saveForm').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getToken(){
|
||||
|
||||
const scriptUrl = new URL(import.meta.url);
|
||||
const params = new URLSearchParams(scriptUrl.search);
|
||||
|
||||
const paramsObject = Object.fromEntries(params.entries());
|
||||
return paramsObject.token;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
new Cliente().init();
|
||||
});
|
||||
Reference in New Issue
Block a user