mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Realizados arreglos para corregir bugs existentes (clientes y buscador de presupuestos
This commit is contained in:
@ -370,8 +370,8 @@ $routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], fu
|
||||
$routes->post('datatable', 'Clienteprecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||
$routes->post('datatable_editor', 'Clienteprecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||
});
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Clienteplantillaprecios::index', ['as' => 'clienteplantillapreciosList']);
|
||||
@ -512,6 +512,7 @@ $routes->group('clientecontactos', ['namespace' => 'App\Controllers\Clientes'],
|
||||
$routes->post('(:num)/edit', 'Clientecontactos::edit/$1', ['as' => 'updateClienteContactos']);
|
||||
$routes->post('datatable', 'Clientecontactos::datatable', ['as' => 'dataTableOfClienteContactos']);
|
||||
$routes->post('datatable_editor', 'Clientecontactos::datatable_editor', ['as' => 'editorOfClienteContactos']);
|
||||
$routes->get('delete/(:num)', 'Clientecontactos::delete/$1', ['as' => 'deleteClienteContactos']);
|
||||
$routes->post('allmenuitems', 'Clientecontactos::allItemsSelect', ['as' => 'select2ItemsOfClienteContactos']);
|
||||
$routes->post('menuitems', 'Clientecontactos::menuItems', ['as' => 'menuItemsOfClienteContactos']);
|
||||
});
|
||||
|
||||
@ -60,7 +60,6 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
@ -24,6 +24,11 @@ return [
|
||||
'libroCosidoTapaDura' => "Cosido Tapa Dura",
|
||||
'libroFresadoTapaBlanda' => "Fresado Tapa Blanda",
|
||||
'libroFresadoTapaDura' => "Fresado Tapa Dura",
|
||||
'libroEspiralTapaDura' => "Espiral Tapa Dura",
|
||||
'libroEspiralTapaBlanda' => "Espiral Tapa Blanda",
|
||||
'libroWireoTapaDura' => "Wire-o Tapa Dura",
|
||||
'libroWireoTapaBlanda' => "Wire-o Tapa Blanda",
|
||||
'libroGrapado' => "Grapado",
|
||||
|
||||
'datosPresupuesto' => 'Datos generales del presupuesto',
|
||||
'datosLibro' => 'Datos del libro',
|
||||
|
||||
@ -564,7 +564,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||
<div class="tab-pane fade" id="tarifascliente" role="tabpanel">
|
||||
<?= view("themes/backend/vuexy/form/clientes/cliente/convert2templateModal") ?>
|
||||
@ -610,7 +609,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="contactos" role="tabpanel">
|
||||
<table id="tableOfClienteContactos"
|
||||
class="table table-striped table-hover" style="width: 100%;">
|
||||
@ -629,7 +627,6 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="domicilio-entrega" role="tabpanel">
|
||||
<?= view("themes/backend/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
|
||||
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable" style="width: 100%;">
|
||||
@ -673,27 +670,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php /* A implementar en el controller
|
||||
<div class="mb-3">
|
||||
<label for="limiteCreditoUserId" class="form-label">
|
||||
<?= lang('Clientes.limiteCreditoUserId') ?>*
|
||||
</label>
|
||||
<input type="number" id="limiteCreditoUserId" name="limite_credito_user_id" required placeholder="1"
|
||||
maxLength="10" class="form-control"
|
||||
value="<?= old('limite_credito_user_id', $clienteEntity->limite_credito_user_id) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="limiteCreditoChangeAt" class="form-label">
|
||||
<?= lang('Clientes.limiteCreditoChangeAt') ?>*
|
||||
</label>
|
||||
<input type="text" id="limiteCreditoChangeAt" name="limite_credito_change_at" required
|
||||
placeholder="2017-02-13 12:38:03" maxLength="20" class="form-control"
|
||||
value="<?= old('limite_credito_change_at', $clienteEntity->limite_credito_change_at) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
*/ ?>
|
||||
|
||||
|
||||
|
||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||
@ -701,6 +677,12 @@
|
||||
/****************************************
|
||||
Funcionamiento general
|
||||
*****************************************/
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
let id = -1;
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
|
||||
$(document).on('click', '.btn-remove', function(e) {
|
||||
|
||||
@ -718,18 +700,21 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/****************************************
|
||||
Contactos
|
||||
*****************************************/
|
||||
|
||||
const lastColNr = $('#tableOfClienteContactos').find("tr:first th").length - 1;
|
||||
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-deleted mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<span class="cancel"></span>
|
||||
`;
|
||||
};
|
||||
@ -779,7 +764,6 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
@ -803,33 +787,27 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$('#tableOfClienteContactos').on( 'click', 'tbody span.remove', function (e) {
|
||||
$(document).on('click', '.btn-deleted', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
editor
|
||||
.create( false )
|
||||
.edit( this.parentNode, false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
|
||||
}
|
||||
});
|
||||
$(document).on('click', '.btn-remove', function(e) {
|
||||
const dataId = $(this).attr('data-id');
|
||||
const row = $(this).closest('tr');
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/clientecontactos/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle');
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
var theTable = $('#tableOfClienteContactos').DataTable( {
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
$('#saveForm').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#soporteId').select2({
|
||||
|
||||
@ -121,6 +121,11 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) {
|
||||
selector.append('<option value="libroCosidoTapaDura"><?= lang('Presupuestos.libroCosidoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroFresadoTapaBlanda"><?= lang('Presupuestos.libroFresadoTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroFresadoTapaDura"><?= lang('Presupuestos.libroFresadoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroEspiralTapaDura"><?= lang('Presupuestos.libroEspiralTapaDura') ?></option>');
|
||||
selector.append('<option value="libroEspiralTapaBlanda"><?= lang('Presupuestos.libroEspiralTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroWireoTapaDura"><?= lang('Presupuestos.libroWireoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroWireoTapaBlanda"><?= lang('Presupuestos.libroWireoTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroGrapado"><?= lang('Presupuestos.libroGrapado') ?></option>');
|
||||
|
||||
selector.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
@ -207,6 +212,27 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
||||
return '<?= lang('Presupuestos.libroFresadoTapaDura') ?>';
|
||||
break;
|
||||
|
||||
|
||||
case "libroEspiralTapaDura":
|
||||
return '<?= lang('Presupuestos.libroEspiralTapaDura') ?>';
|
||||
break;
|
||||
|
||||
case "libroEspiralTapaBlanda":
|
||||
return '<?= lang('Presupuestos.libroEspiralTapaBlanda') ?>';
|
||||
break;
|
||||
|
||||
case "libroWireoTapaDura":
|
||||
return '<?= lang('Presupuestos.libroWireoTapaDura') ?>';
|
||||
break;
|
||||
|
||||
case "libroWireoTapaBlanda":
|
||||
return '<?= lang('Presupuestos.libroWireoTapaBlanda') ?>';
|
||||
break;
|
||||
|
||||
case "libroGrapado":
|
||||
return '<?= lang('Presupuestos.libroGrapado') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return data; // Debug
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user