From 289d89851b97677e6306470b678328f3f90fc619 Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Mon, 4 Sep 2023 09:05:48 +0200 Subject: [PATCH 1/4] falta botones exportar, etc --- .../Tarifas/Tarifasenviosprecios.php | 11 ++- .../Tarifas/TarifaEnvioPrecioEntity.php | 2 + .../Tarifas/TarifaEnvioZonaEntity.php | 1 + ci4/app/Language/en/TarifasEnviosPrecios.php | 7 ++ ci4/app/Language/en/TarifasEnviosZonas.php | 7 ++ ci4/app/Language/es/TarifasEnviosPrecios.php | 8 +- ci4/app/Language/es/TarifasEnviosZonas.php | 7 ++ .../Models/Tarifas/TarifaEnvioPrecioModel.php | 28 +++++-- .../Models/Tarifas/TarifaEnvioZonaModel.php | 24 ++++-- .../tarifas/envios/_tarifaEnvioFormItems.php | 17 +++-- .../tarifas/envios/viewTarifaEnvioForm.php | 76 +++++++------------ 11 files changed, 112 insertions(+), 76 deletions(-) diff --git a/ci4/app/Controllers/Tarifas/Tarifasenviosprecios.php b/ci4/app/Controllers/Tarifas/Tarifasenviosprecios.php index 6284a4a4..0f88a868 100644 --- a/ci4/app/Controllers/Tarifas/Tarifasenviosprecios.php +++ b/ci4/app/Controllers/Tarifas/Tarifasenviosprecios.php @@ -253,7 +253,7 @@ class Tarifasenviosprecios extends \App\Controllers\GoBaseResourceController { ->validator('Validate::numeric', array( 'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal')) ), - Field::inst('zona_envio_id'), + Field::inst('tarifa_envio_id'), Field::inst('proveedor_id'), Field::inst('user_created_id'), Field::inst('created_at'), @@ -272,7 +272,7 @@ class Tarifasenviosprecios extends \App\Controllers\GoBaseResourceController { $process_data['peso_max'] = $data['data'][$pkey]['peso_max']; $process_data['proveedor_id'] = $data['data'][$pkey]['proveedor_id']; $process_data['tipo_envio'] = $data['data'][$pkey]['tipo_envio']; - $response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['zona_envio_id']); + $response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_envio_id']); // No se pueden duplicar valores al crear o al editar if (!empty($response)) { return $response; @@ -333,14 +333,14 @@ class Tarifasenviosprecios extends \App\Controllers\GoBaseResourceController { $order = TarifaEnvioPrecioModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; - $zona_envio_id = $reqData['zona_envio_id'] ?? -1; + $tarifa_envio_id = $reqData['tarifa_envio_id'] ?? -1; - $resourceData = $this->model->getResource($search, $zona_envio_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $resourceData = $this->model->getResource($search, $tarifa_envio_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); return $this->respond(Collection::datatable( $resourceData, $this->model->getResource()->countAllResults(), - $this->model->getResource($search, $zona_envio_id)->countAllResults() + $this->model->getResource($search, $tarifa_envio_id)->countAllResults() )); } else { return $this->failUnauthorized('Invalid request', 403); @@ -427,7 +427,6 @@ class Tarifasenviosprecios extends \App\Controllers\GoBaseResourceController { protected function getTipoEnvioOptions() { $tipoEnvioOptions = [ '' => lang('Basic.global.pleaseSelect'), - 'a domicilio' => 'a domicilio', 'cajas' => 'cajas', 'palets' => 'palets', ]; diff --git a/ci4/app/Entities/Tarifas/TarifaEnvioPrecioEntity.php b/ci4/app/Entities/Tarifas/TarifaEnvioPrecioEntity.php index 2b52b4ca..097d70bf 100644 --- a/ci4/app/Entities/Tarifas/TarifaEnvioPrecioEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEnvioPrecioEntity.php @@ -14,6 +14,7 @@ class TarifaEnvioPrecioEntity extends \CodeIgniter\Entity\Entity "peso_max" => null, "precio" => null, "precio_adicional" => 0, + "margen" => 0, "user_created_id" => 0, "user_updated_id" => 0, "is_deleted" => 0, @@ -27,6 +28,7 @@ class TarifaEnvioPrecioEntity extends \CodeIgniter\Entity\Entity "peso_max" => "float", "precio" => "float", "precio_adicional" => "float", + "margen" => "float", "user_created_id" => "int", "user_updated_id" => "int", "is_deleted" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaEnvioZonaEntity.php b/ci4/app/Entities/Tarifas/TarifaEnvioZonaEntity.php index 85907228..3de29e0b 100644 --- a/ci4/app/Entities/Tarifas/TarifaEnvioZonaEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEnvioZonaEntity.php @@ -8,6 +8,7 @@ class TarifaEnvioZonaEntity extends \CodeIgniter\Entity\Entity protected $attributes = [ "id" => null, "tarifa_envio_id" => null, + "nombre" => "", "cp_inicial" => null, "cp_final" => null, "importe_fijo" => 0, diff --git a/ci4/app/Language/en/TarifasEnviosPrecios.php b/ci4/app/Language/en/TarifasEnviosPrecios.php index e58a12c2..626e62cc 100644 --- a/ci4/app/Language/en/TarifasEnviosPrecios.php +++ b/ci4/app/Language/en/TarifasEnviosPrecios.php @@ -15,6 +15,7 @@ return [ 'pesoMin' => 'Min Weight', 'precio' => 'Price', 'precioAdicional' => 'Additional Price', + 'margen' => 'Margin', 'proveedorId' => 'Provider', 'tarifaEnvioId' => 'Shipping Rate', 'tarifaEnvioPrecio' => 'Weight and Cost', @@ -52,6 +53,12 @@ return [ ], + 'margen' => [ + 'decimal' => 'The field must contain a decimal number.', + 'required' => 'The field is required.', + + ], + 'tipo_envio' => [ 'in_list' => 'The field must be one of the are included in the list.', 'required' => 'The field is required.', diff --git a/ci4/app/Language/en/TarifasEnviosZonas.php b/ci4/app/Language/en/TarifasEnviosZonas.php index 137ae7cd..6966ba4c 100644 --- a/ci4/app/Language/en/TarifasEnviosZonas.php +++ b/ci4/app/Language/en/TarifasEnviosZonas.php @@ -3,6 +3,7 @@ return [ + 'nombre' => 'Name', 'cpFinal' => 'Final Postcode', 'cpInicial' => 'Initial Postcode', 'createdAt' => 'Created At', @@ -20,6 +21,12 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdatedId' => 'User Updated ID', 'validation' => [ + 'nombre' => [ + 'max_length' => 'The field cannot exceed 50 characters in length.', + 'required' => 'The field is required.', + + ], + 'cp_final' => [ 'max_length' => 'The field cannot exceed 10 characters in length.', 'required' => 'The field is required.', diff --git a/ci4/app/Language/es/TarifasEnviosPrecios.php b/ci4/app/Language/es/TarifasEnviosPrecios.php index c2af4492..737b6951 100644 --- a/ci4/app/Language/es/TarifasEnviosPrecios.php +++ b/ci4/app/Language/es/TarifasEnviosPrecios.php @@ -3,7 +3,6 @@ return [ - 'aDomicilio' => 'A domicilio', 'cajas' => 'Cajas', 'createdAt' => 'Created At', 'deletedAt' => 'Deleted At', @@ -15,6 +14,7 @@ return [ 'pesoMin' => 'Peso Min', 'precio' => 'Precio peso mín.', 'precioAdicional' => 'Precio Kg Adicional', + 'margen' => 'Margen', 'proveedorId' => 'Proveedor', 'tarifaEnvioId' => 'Tarifa Envío', 'tarifaEnvioPrecio' => 'Peso y Precio', @@ -52,6 +52,12 @@ return [ ], + 'margen' => [ + 'decimal' => 'El campo debe contener un número decimal.', + 'required' => 'El campo es obligatorio.', + + ], + 'tipo_envio' => [ 'in_list' => 'El campo debe ser uno de la lista.', 'required' => 'El campo es obligatorio.', diff --git a/ci4/app/Language/es/TarifasEnviosZonas.php b/ci4/app/Language/es/TarifasEnviosZonas.php index 9421c1df..02df8c01 100644 --- a/ci4/app/Language/es/TarifasEnviosZonas.php +++ b/ci4/app/Language/es/TarifasEnviosZonas.php @@ -3,6 +3,7 @@ return [ + 'nombre' => 'Nombre', 'cpFinal' => 'CP Final', 'cpInicial' => 'CP Inicial', 'createdAt' => 'Created At', @@ -20,6 +21,12 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdatedId' => 'User Updated ID', 'validation' => [ + 'nombre' => [ + 'max_length' => 'El campo no puede exceder 50 caracteres en longitud.', + 'required' => 'El campo es obligatorio.', + + ], + 'cp_final' => [ 'max_length' => 'El campo no puede exceder 10 caracteres en longitud.', 'required' => 'El campo es obligatorio.', diff --git a/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php b/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php index b7cb9f50..8d76bbd4 100644 --- a/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php +++ b/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php @@ -18,7 +18,8 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel 2 => "t1.peso_min", 3 => "t1.peso_max", 4 => "t1.precio", - 5 => "t1.precio_adicional" + 5 => "t1.precio_adicional", + 5 => "t1.margen" ]; protected $allowedFields = [ @@ -29,6 +30,7 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel "peso_max", "precio", "precio_adicional", + "margen", "deleted_at", "is_deleted", ]; @@ -60,9 +62,13 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel "label" => "TarifasEnviosPrecios.precioAdicional", "rules" => "required|decimal", ], + "margen" => [ + "label" => "TarifasEnviosPrecios.margen", + "rules" => "required|decimal", + ], "tipo_envio" => [ "label" => "TarifasEnviosPrecios.tipoEnvio", - "rules" => "required|in_list[a domicilio,cajas,palets]", + "rules" => "required|in_list[cajas,palets]", ], ]; @@ -83,6 +89,10 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel "decimal" => "TarifasEnviosPrecios.validation.precio_adicional.decimal", "required" => "TarifasEnviosPrecios.validation.precio_adicional.required", ], + "margen" => [ + "decimal" => "TarifasEnviosPrecios.margen.margen.decimal", + "required" => "TarifasEnviosPrecios.margen.margen.required", + ], "tipo_envio" => [ "in_list" => "TarifasEnviosPrecios.validation.tipo_envio.in_list", "required" => "TarifasEnviosPrecios.validation.tipo_envio.required", @@ -116,17 +126,17 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel * * @return \CodeIgniter\Database\BaseBuilder */ - public function getResource(string $search = "", $zona_envio_id = -1) + public function getResource(string $search = "", $tarifa_envio_id = -1) { $builder = $this->db ->table($this->table . " t1") ->select( "t1.id AS id, t1.tipo_envio AS tipo_envio, t1.peso_min AS peso_min, t1.peso_max AS peso_max, t1.precio AS precio, - t1.precio_adicional AS precio_adicional, t2.id AS tarifa_envio, t3.id AS proveedor_id, t3.nombre AS proveedor" + t1.precio_adicional AS precio_adicional, t1.margen AS margen, t2.id AS tarifa_envio, t3.id AS proveedor_id, t3.nombre AS proveedor" ); - $builder->join("tarifas_envios_zonas t2", "t1.zona_envio_id = t2.id", "left"); + $builder->join("tarifas_envios_zonas t2", "t1.tarifa_envio_id = t2.id", "left"); $builder->join("lg_proveedores t3", "t1.proveedor_id = t3.id", "left"); - $builder->where("t1.zona_envio_id", $zona_envio_id); + $builder->where("t1.tarifa_envio_id", $tarifa_envio_id); //JJO $builder->where("t1.is_deleted", 0); @@ -140,12 +150,14 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel ->orLike("t1.peso_max", $search) ->orLike("t1.precio", $search) ->orLike("t1.precio_adicional", $search) + ->orLike("t1.margen", $search) ->orLike("t3.nombre", $search) ->orLike("t1.tipo_envio", $search) ->orLike("t1.peso_min", $search) ->orLike("t1.peso_max", $search) ->orLike("t1.precio", $search) ->orLike("t1.precio_adicional", $search) + ->orLike("t1.margen", $search) ->orLike("t3.nombre", $search) ->groupEnd(); } @@ -163,7 +175,7 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel ->table($this->table) ->select("id, proveedor_id, tipo_envio, peso_min, peso_max") ->where("is_deleted", 0) - ->where("zona_envio_id", $zona_id) + ->where("tarifa_envio_id", $zona_id) ->get()->getResultObject(); @@ -190,7 +202,7 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel ->table($this->table) ->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'), 'is_deleted' => $delete_flag]) - ->where('zona_envio_id',$zona_id) + ->where('tarifa_envio_id',$zona_id) ->update(); return $builder; diff --git a/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php b/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php index f6c8e6d4..e2da9b9b 100644 --- a/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php +++ b/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php @@ -13,12 +13,13 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel protected $useAutoIncrement = true; const SORTABLE = [ - 0 => "t1.cp_inicial", - 1 => "t1.cp_final", - 2 => "t1.importe_fijo", + 0 => "t1.nombre", + 1 => "t1.cp_inicial", + 2 => "t1.cp_final", + 3 => "t1.importe_fijo", ]; - protected $allowedFields = ["tarifa_envio_id", "cp_inicial", "cp_final", "importe_fijo", "is_deleted", "deleted_at"]; + protected $allowedFields = ["tarifa_envio_id", "nombre", "cp_inicial", "cp_final", "importe_fijo", "is_deleted", "deleted_at"]; protected $returnType = "App\Entities\Tarifas\TarifaEnvioZonaEntity"; protected $useTimestamps = true; @@ -31,6 +32,11 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel public static $labelField = "tarifa_envio_id"; protected $validationRules = [ + "nombre" => [ + "label" => "TarifasEnviosZonas.nombre", + "rules" => "trim|required|max_length[50]", + ], + "cp_final" => [ "label" => "TarifasEnviosZonas.cpFinal", "rules" => "trim|required|max_length[10]", @@ -46,6 +52,10 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel ]; protected $validationMessages = [ + "nombre" => [ + "max_length" => "TarifasEnviosZonas.validation.nombre.max_length", + "required" => "TarifasEnviosZonas.validation.nombre.required", + ], "cp_final" => [ "max_length" => "TarifasEnviosZonas.validation.cp_final.max_length", "required" => "TarifasEnviosZonas.validation.cp_final.required", @@ -93,7 +103,7 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "t1.id as id, t1.cp_inicial AS cp_inicial, t1.cp_final AS cp_final, t1.importe_fijo AS importe_fijo, t2.id AS tarifa_envio" + "t1.id as id, t1.nombre AS nombre, t1.cp_inicial AS cp_inicial, t1.cp_final AS cp_final, t1.importe_fijo AS importe_fijo, t2.id AS tarifa_envio" ); $builder->join("lg_tarifas_envios t2", "t1.tarifa_envio_id = t2.id", "left"); $builder->where("t1.tarifa_envio_id", $tarifa_envio_id); @@ -105,9 +115,11 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel ? $builder : $builder ->groupStart() - ->like("t1.cp_inicial", $search) + ->like("t1.nombre", $search) + ->orLike("t1.cp_inicial", $search) ->orLike("t1.cp_final", $search) ->orLike("t1.importe_fijo", $search) + ->orLike("t1.nombre", $search) ->orLike("t1.cp_inicial", $search) ->orLike("t1.cp_final", $search) ->orLike("t1.importe_fijo", $search) diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/_tarifaEnvioFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/_tarifaEnvioFormItems.php index 3950f782..a8bcbd97 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/_tarifaEnvioFormItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/_tarifaEnvioFormItems.php @@ -1,8 +1,16 @@
+ +
+ + +
+
-
- - -
-
\ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index b9d57ef6..08cca8cc 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -45,6 +45,7 @@ + @@ -81,6 +82,7 @@ + @@ -138,9 +140,7 @@ } }); - var selected_zona_id = -1; - - + $(document).on('click', '.btn-remove', function(e) { const dataId = $(this).attr('data-id'); const row = $(this).closest('tr'); @@ -174,6 +174,8 @@ table : "#tableOfZonas", idSrc: 'id', fields: [ { + name: "nombre" + }, { name: "cp_inicial" }, { name: "cp_final" @@ -224,14 +226,20 @@ autoWidth: true, responsive: true, lengthMenu: [ 5, 10, 25], - order: [[ 0, "asc" ], [ 1, "asc" ]], + order: [[ 0, "asc" ]], pageLength: 10, lengthChange: true, searching: false, - paging: true, - select: true, + paging: true, info: false, - dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + "dom": 'lfBrtip', + "buttons": [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], ajax : $.fn.dataTable.pipeline( { url: '', data: { @@ -242,6 +250,7 @@ async: true, }), columns: [ + { 'data': 'nombre' }, { 'data': 'cp_inicial' }, { 'data': 'cp_final' }, { 'data': 'importe_fijo' }, @@ -256,7 +265,7 @@ searchable: false, targets: [lastColNr] }, - {"orderData": [ 0, 1 ], "targets": 0 }, + {"orderData": [ 0], "targets": 0 }, ], language: { @@ -309,22 +318,6 @@ }); } - - theTable.on( 'select', function ( e, dt, type, indexes ) { - if ( type === 'row' ) { - selected_zona_id = parseInt(theTable.rows( indexes ).data().pluck( 'id' )[0]); - theTable2.clearPipeline(); - theTable2.draw(); - } - } ); - - theTable.on( 'deselect', function ( e, dt, type, indexes ) { - if ( theTable.rows( '.selected' ).count() == 0 ) { - selected_zona_id = -1; - theTable2.clearPipeline(); - theTable2.draw(); - } - } ); endSection() ?> @@ -357,9 +350,12 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; }, { name: "precio" }, { - name: "precio_adicional" + name: "precio_adicional", + def: 0 }, { - "name": "zona_envio_id", + name: "margen" + }, { + "name": "tarifa_envio_id", "type": "hidden" }, { "name": "deleted_at", @@ -377,11 +373,11 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; editor2.on( 'preSubmit', function ( e, d, type ) { if ( type === 'create'){ - d.data[0]['zona_envio_id'] = selected_zona_id; + d.data[0]['tarifa_envio_id'] = id; } else if(type === 'edit' ) { for (v in d.data){ - d.data[v]['zona_envio_id'] = selected_zona_id; + d.data[v]['tarifa_envio_id'] = id; } } }); @@ -390,7 +386,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; editor2.dependent('proveedor_id', function (val, data, callback, e ) { var supplier = suppliersList.find(o => o.value === val); - values = [{label:'', value: "a domicilio"}]; + values = []; if(supplier.options != null) { @@ -424,7 +420,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; autoWidth: true, responsive: true, lengthMenu: [ 5, 10, 25, 50, 100], - order: [[ 0, "asc" ], [ 1, "asc" ]], + order: [ 0, "asc" ], pageLength: 25, lengthChange: true, searching: false, @@ -434,7 +430,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; ajax : $.fn.dataTable.pipeline( { url: '', data: function ( d ) { - d.zona_envio_id = selected_zona_id; + d.tarifa_envio_id = id; }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, @@ -448,9 +444,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; }, }, { 'data': 'tipo_envio', "render": function ( data, type, row, meta ) { - if(data=='a domicilio') - return ''; - else if (data=='cajas') + if (data=='cajas') return ''; else if (data=='palets') return ''; @@ -460,6 +454,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; { 'data': 'peso_max' }, { 'data': 'precio' }, { 'data': 'precio_adicional' }, + { 'data': 'margen' }, { data: actionBtns, className: 'row-edit dt-center' @@ -486,19 +481,6 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; submitHtml: '' }, - action: function ( e, dt, node, config ) { - if(selected_zona_id == -1){ - popErrorAlert(""); - } - else{ - formOptions= { - submitTrigger: -1, - submitHtml: '' - - }; - editor2.inlineCreate(config.position, formOptions); - } - }, } ], } ); From 5b4126f4605cf93f556b30ddaa22da6b7f457458 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Mon, 4 Sep 2023 13:16:25 +0200 Subject: [PATCH 2/4] Temporal Nacho --- .idea/deployment.xml | 9 +++++- .idea/webServers.xml | 7 +++++ .../tarifas/envios/viewTarifaEnvioForm.php | 29 +++++++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 0bdb7590..5fb78f02 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,6 +1,6 @@ - + diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index 08cca8cc..7ab050dd 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -232,7 +232,7 @@ searching: false, paging: true, info: false, - "dom": 'lfBrtip', + "dom": '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', "buttons": [ 'copy', 'csv', 'excel', 'print', { extend: 'pdfHtml5', @@ -426,7 +426,8 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; searching: false, paging: true, info: false, - dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + //dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + "dom": 'lfBrtip', ajax : $.fn.dataTable.pipeline( { url: '', data: function ( d ) { @@ -472,19 +473,37 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; language: { url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, - buttons: [ { + /*buttons: [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + }, + ],*/ + } ); + + new $.fn.dataTable.Buttons( theTable2, { + + name: 'new', className: 'btn btn-primary float-end me-sm-3 me-1', extend: "createInline", editor: editor2, formOptions: { submitTrigger: -1, submitHtml: '' - + }, - } ], + } ); + theTable2.buttons( 'new', null ).container().appendTo( + //theTable2.table().container() + '#panel' + ); + + + // Activate an inline edit on click of a table cell $('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) { From 1cce675f796d8c10e6fc904708cfb9ed8e17dd0f Mon Sep 17 00:00:00 2001 From: imnavajas Date: Tue, 5 Sep 2023 15:28:53 +0200 Subject: [PATCH 3/4] Encontrado como hacerlo --- .../tarifas/envios/viewTarifaEnvioForm.php | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index 7ab050dd..06a07216 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -18,10 +18,10 @@
" - /> + class="btn btn-primary float-start me-sm-3 me-1" + name="save" + value="" + /> "btn btn-secondary float-start",]) ?>
@@ -72,7 +72,7 @@
- +
@@ -423,11 +423,11 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; order: [ 0, "asc" ], pageLength: 25, lengthChange: true, - searching: false, + searching: true, paging: true, info: false, - //dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', - "dom": 'lfBrtip', + dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + //dom: 'lBfrtip', ajax : $.fn.dataTable.pipeline( { url: '', data: function ( d ) { @@ -471,40 +471,41 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; ], language: { - url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" + url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json", }, - /*buttons: [ - 'copy', 'csv', 'excel', 'print', { - extend: 'pdfHtml5', - orientation: 'landscape', - pageSize: 'A4' - }, - ],*/ - } ); + buttons: [ 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + }], - new $.fn.dataTable.Buttons( theTable2, { + initComplete: function () { - name: 'new', - className: 'btn btn-primary float-end me-sm-3 me-1', - extend: "createInline", - editor: editor2, - formOptions: { - submitTrigger: -1, - submitHtml: '' + new $.fn.dataTable.Buttons(theTable2, { + name: 'test2', + buttons: [{ + className: 'btn btn-primary float-end me-sm-3 me-1', + extend: "createInline", + editor: editor2, + formOptions: { + submitTrigger: -1, + submitHtml: '' - }, + } + }] + }); + + theTable2.buttons('test2', null) + .container() + .insertBefore('.dataTables_length'); + } } ); - theTable2.buttons( 'new', null ).container().appendTo( - //theTable2.table().container() - '#panel' - ); - // Activate an inline edit on click of a table cell $('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) { editor2.inline( From 9b1f2aee803979db7579e0d038c3b4c68111704c Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Tue, 5 Sep 2023 21:02:36 +0200 Subject: [PATCH 4/4] Solucionado el boton nuevo --- .../tarifas/envios/viewTarifaEnvioForm.php | 50 ++++++++++--------- httpdocs/themes/vuexy/css/sk-datatables.css | 3 +- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index 06a07216..3ef37d3b 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -1,7 +1,9 @@ include("themes/_commonPartialsBs/datatables") ?> include("themes/_commonPartialsBs/select2bs5") ?> include("themes/_commonPartialsBs/sweetalert") ?> +include('themes/_commonPartialsBs/_confirm2delete') ?> extend('themes/backend/vuexy/main/defaultlayout') ?> + section("content") ?>
@@ -9,24 +11,22 @@

-
+ -
- - getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> - -
-
- " - /> - "btn btn-secondary float-start",]) ?> -
+ + getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> + +
+ " + /> + "btn btn-secondary float-start",]) ?> +
-
+
@@ -426,8 +426,8 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; searching: true, paging: true, info: false, - dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', - //dom: 'lBfrtip', + //dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + dom: 'Brtip', ajax : $.fn.dataTable.pipeline( { url: '', data: function ( d ) { @@ -482,9 +482,9 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; initComplete: function () { new $.fn.dataTable.Buttons(theTable2, { - name: 'test2', + name: 'btn_new', buttons: [{ - className: 'btn btn-primary float-end me-sm-3 me-1', + className: 'btn btn-primary float-end', extend: "createInline", editor: editor2, formOptions: { @@ -495,12 +495,14 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; }] }); - theTable2.buttons('test2', null) - .container() - .insertBefore('.dataTables_length'); - } - + var $newbtncontainer = $("
"); + $("#tableOfPrecios_wrapper").prepend($newbtncontainer); + + theTable2.buttons('btn_new', null) + .container() + .appendTo($newbtncontainer); + } } ); diff --git a/httpdocs/themes/vuexy/css/sk-datatables.css b/httpdocs/themes/vuexy/css/sk-datatables.css index 6f1342e2..37e8b118 100644 --- a/httpdocs/themes/vuexy/css/sk-datatables.css +++ b/httpdocs/themes/vuexy/css/sk-datatables.css @@ -12,4 +12,5 @@ table.dataTable > tbody > tr.selected > * { table.dataTable.table-hover > tbody > tr.selected:hover > * { box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.65); -} \ No newline at end of file +} +