diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index fec21e00..fc20b6e0 100755
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -479,6 +479,7 @@ $routes->resource('ClienteContactos', ['namespace' => 'App\Controllers\Clientes'
$routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
+ $routes->get('delete/(:num)', 'Clientedirecciones::delete/$1', ['as' => 'deleteClientedirecciones']);
$routes->post('datatable', 'Clientedirecciones::datatable', ['as' => 'dataTableOfClienteDirecciones']);
$routes->post('datatable_editor', 'Clientedirecciones::datatable_editor', ['as' => 'editorOfClienteDirecciones']);
});
@@ -523,6 +524,10 @@ $routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presu
$routes->post('edit/(:num)', 'Presupuestopreimpresiones::edit/$1', ['as' => 'updatePresupuestopreimpresiones']);
});
+$routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
+ $routes->post('datatable', 'Presupuestodirecciones::datatable', ['as' => 'dataTableOfPresupuestoDirecciones']);
+});
+
$routes->group('printpresupuestos', ['namespace' => 'App\Controllers\Pdf'], function ($routes) {
$routes->get('', 'PrintPresupuestos::index', ['as' => 'viewPresupuesto']);
$routes->get('generar', 'PrintPresupuestos::generar', ['as' => 'presupuestoToPdf']);
diff --git a/ci4/app/Controllers/Clientes/Clientedirecciones.php b/ci4/app/Controllers/Clientes/Clientedirecciones.php
index 8480d36c..30483e31 100755
--- a/ci4/app/Controllers/Clientes/Clientedirecciones.php
+++ b/ci4/app/Controllers/Clientes/Clientedirecciones.php
@@ -22,11 +22,7 @@ class Clientedirecciones extends \App\Controllers\GoBaseResourceController
protected static $controllerSlug = 'clientedirecciones';
- public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
- $this->soft_delete = false;
-
- $this->viewData = ['usingServerSideDataTable' => true]; // JJO
- }
+
public function datatable()
diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
index c8c55f09..7288f0fe 100755
--- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
+++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
@@ -7,6 +7,7 @@ use App\Entities\Configuracion\Maquina;
use App\Models\Collection;
use App\Entities\Presupuestos\PresupuestoEntity;
+use App\Models\Presupuestos\PresupuestoDireccionesModel;
use App\Models\Configuracion\PapelGenericoModel;
use App\Models\Presupuestos\PresupuestoModel;
@@ -288,6 +289,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['serviciosManipuladoList'] = (new PresupuestoManipuladosModel())->getResource($id)->get()->getResultObject();
$this->viewData['serviciosPreimpresionList'] = (new PresupuestoPreimpresionesModel())->getResource($id)->get()->getResultObject();
+ // Direciones presupuesto
+ $this->viewData['presupuestoDirecciones'] = (new PresupuestoDireccionesModel())->getResource("",$id)->get()->getResultObject();
+
$this->viewData['POD'] = $this->getPOD();
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
diff --git a/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php b/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php
new file mode 100644
index 00000000..ca2ba25e
--- /dev/null
+++ b/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php
@@ -0,0 +1,70 @@
+request->isAJAX()) {
+ $reqData = $this->request->getPost();
+ if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
+ $errstr = 'No data available in response to this specific request.';
+ $response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
+ return $response;
+ }
+ $start = $reqData['start'] ?? 0;
+ $length = 30;
+ $search = $reqData['search']['value'];
+ $requestedOrder = $reqData['order']['0']['column'] ?? 1;
+ $order = PresupuestoDireccionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
+ $dir = $reqData['order']['0']['dir'] ?? 'asc';
+
+ $id_P = $reqData['presupuesto_id'] ?? -1;
+
+
+ $resourceData = $this->model->getResource($search, $id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
+
+
+ return $this->respond(Collection::datatable(
+ $resourceData,
+ $this->model->getResource()->countAllResults(),
+ $this->model->getResource("", $id_P)->countAllResults()
+ ));
+ } else {
+ return $this->failUnauthorized('Invalid request', 403);
+ }
+ }
+
+
+}
diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php
index 14df24b7..d321fca4 100755
--- a/ci4/app/Controllers/Test.php
+++ b/ci4/app/Controllers/Test.php
@@ -17,9 +17,9 @@ class Test extends BaseController
public function index()
{
- $model = model('App\Models\Clientes\ClienteDireccionesModel');
+ $model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
echo '
';
- var_dump($model->getResource("", 1420)->get()->getResultArray());
+ var_dump($model->getResource("", 8)->get()->getResultObject());
echo '';
}
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php
index ef60ab28..33e5386a 100755
--- a/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php
@@ -15,11 +15,12 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity
"direccion" => null,
"pais_id" => null,
"ccaa_id" => null,
- "provincia_id" => null,
- "municipio_id" => null,
+ "provincia" => null,
+ "municipio" => null,
"cp" => null,
"telefono" => null,
"precio" => null,
+ "margen" => null,
];
protected $casts = [
"presupuesto_id" => "int",
@@ -27,9 +28,9 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity
"peso" => "float",
"pais_id" => "int",
"ccaa_id" => "int",
- "provincia_id" => "int",
- "municipio_id" => "int",
"cp" => "int",
"precio" => "float",
+ "margen" => "float",
];
}
+
diff --git a/ci4/app/Language/en/PresupuestosDirecciones.php b/ci4/app/Language/en/PresupuestosDirecciones.php
new file mode 100644
index 00000000..638fe79c
--- /dev/null
+++ b/ci4/app/Language/en/PresupuestosDirecciones.php
@@ -0,0 +1,27 @@
+ 'New address',
+ 'alias' => 'Alias',
+ 'att' => 'Attn.',
+ 'email' => 'Email',
+ 'direccion' => 'Address',
+ 'cp' => 'Zip Code',
+ 'municipio' => 'Town',
+ 'provincia' => 'City',
+ 'ccaa' => 'Region',
+ 'pais' => 'Country',
+ 'telefono' => 'Phone',
+ 'peso' => 'Weight',
+ 'cantidad' => 'Quantity',
+ 'precio' => 'Price',
+ 'validation' => [
+ 'max_length' => 'Max. length ',
+ 'required' => 'Field required'
+ 'valid_email' => 'The email is not valid',
+
+ ],
+
+ 'selectPais' => 'Select a country',
+
+];
diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php
index dc4b3a0b..bdf91661 100755
--- a/ci4/app/Language/es/Presupuestos.php
+++ b/ci4/app/Language/es/Presupuestos.php
@@ -180,6 +180,8 @@ return [
// Envios
'envios' => 'Envios',
+ 'recogerEnTaller' => 'Recoger en taller',
+
'cantidad' => 'Cantidad',
@@ -335,7 +337,7 @@ return [
'presupuesto' => 'Presupuesto',
'presupuestoList' => 'Presupuesto List',
'presupuestos' => 'Presupuestos',
- 'recogerEnTaller' => 'Recoger EN Taller',
+
'referenciaCliente' => 'Referencia Cliente',
'responsable' => 'Responsable',
'serieId' => 'Serie ID',
diff --git a/ci4/app/Language/es/PresupuestosDirecciones.php b/ci4/app/Language/es/PresupuestosDirecciones.php
new file mode 100644
index 00000000..49414413
--- /dev/null
+++ b/ci4/app/Language/es/PresupuestosDirecciones.php
@@ -0,0 +1,30 @@
+ 'Añadir nueva dirección',
+ 'alias' => 'Alias',
+ 'att' => 'Att.',
+ 'email' => 'Email',
+ 'direccion' => 'Direccion',
+ 'cp' => 'CP',
+ 'municipio' => 'Ciudad',
+ 'provincia' => 'Provincia',
+ 'ccaa' => 'CCAA',
+ 'pais' => 'País',
+ 'telefono' => 'Teléfono',
+ 'peso' => 'Peso',
+ 'cantidad' => 'Cantidad',
+ 'precio' => 'Precio',
+ 'validation' => [
+ 'max_length' => 'Max. valor caracteres alcanzado',
+ 'required' => 'Campo obligatorio',
+ 'valid_email' => 'El email introducido no es válido',
+ ],
+
+
+ 'selectPais' => 'Seleccione País',
+ 'selectCcaa' => 'Seleccione CCAA',
+ 'selectProvincia' => 'Seleccione Provincia',
+ 'selectMunicipio' => 'Seleccione Municipio',
+];
diff --git a/ci4/app/Models/Clientes/ClienteDireccionesModel.php b/ci4/app/Models/Clientes/ClienteDireccionesModel.php
index 50a4b90e..9e69d002 100755
--- a/ci4/app/Models/Clientes/ClienteDireccionesModel.php
+++ b/ci4/app/Models/Clientes/ClienteDireccionesModel.php
@@ -19,10 +19,11 @@ class ClienteDireccionesModel extends \App\Models\GoBaseModel
2 => "t1.email",
3 => "t1.direccion",
4 => "t1.cp",
- 5 => "t5.municipio_nombre",
- 6 => "t4.nombre",
- 7 => "t3.nombre",
- 8 => "t1.telefono",
+ 5 => "t1.municipio",
+ 6 => "t1.provincia",
+ 7 => "t4.nombre",
+ 8 => "t3.nombre",
+ 9 => "t1.telefono",
];
protected $allowedFields = [
diff --git a/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php
new file mode 100644
index 00000000..2c89671c
--- /dev/null
+++ b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php
@@ -0,0 +1,89 @@
+ "t1.cantidad",
+ 1 => "t1.att",
+ 2 => "t1.email",
+ 3 => "t1.direccion",
+ 4 => "t1.cp",
+ 5 => "t1.municipio",
+ 6 => "t1.provincia",
+ 7 => "t2.nombre",
+ 8 => "t1.telefono",
+ ];
+
+ protected $allowedFields = [
+ "presupuesto_id",
+ "cantidad",
+ "peso",
+ "att",
+ "email",
+ "direccion",
+ "pais_id",
+ "ccaa_id",
+ "provincia",
+ "municipio",
+ "cp",
+ "telefono",
+ 'precio',
+ 'margen',
+ ];
+
+ protected $returnType = "App\Entities\Clientes\ClienteDireccionesEntity";
+
+ public static $labelField = "id";
+
+
+
+ /**
+ * Get resource data.
+ *
+ * @param string $search
+ *
+ * @return \CodeIgniter\Database\BaseBuilder
+ */
+ public function getResource(string $search = "", $presupuesto_id = -1)
+ {
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.id AS id, t1.presupuesto_id AS presupuesto_id, t1.att AS att,
+ t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t2.nombre AS pais,
+ t1.ccaa_id AS ccaa_id, t3.nombre AS ccaa_nombre,
+ t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono,
+ t1.cantidad AS cantidad, t1.precio AS precio, t1.margen AS margen"
+ );
+
+ $builder->where('t1.presupuesto_id', $presupuesto_id);
+ $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
+ $builder->join("lg_comunidades_autonomas t3", "t1.ccaa_id = t3.id", "left");
+
+ return empty($search)
+ ? $builder
+ : $builder
+ ->groupStart()
+ ->like("t1.att", $search)
+ ->orLike("t1.email", $search)
+ ->orLike("t1.direccion", $search)
+ ->orLike("t2.nombre", $search)
+ ->orLike("t3.nombre", $search)
+ ->orLike("t1.municipio", $search)
+ ->orLike("t1.provincia", $search)
+ ->orLike("t1.cp", $search)
+ ->orLike("t1.telefono", $search)
+ ->groupEnd();
+ }
+}
diff --git a/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php
index 7b6c4186..b824c23c 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php
@@ -967,7 +967,7 @@ var tableDirecciones = $('#tableOfDireccionesEnvio').DataTable( {
processing: true,
autoWidth: true,
responsive: true,
- order: [[ 0, "asc" ], [ 1, "asc" ]],
+ order: [0, "asc" ],
pageLength: 10,
lengthChange: false,
searching: false,
@@ -1060,7 +1060,7 @@ $(document).on('click', '.btn-delete-add', function(e) {
function delete_direccion_envio(dataId){
$.ajax({
- url: `/clientedirecciones/delete/${dataId}`,
+ url: `/clientes/clientedirecciones/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php
index a07f6d9f..5f4bec37 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php
@@ -1,39 +1,50 @@
-
+
-
-
-
-
- | = lang('Presupuestos.cantidad') ?> |
- = lang('Presupuestos.peso') ?> |
- = lang('Presupuestos.att') ?> |
- = lang('Presupuestos.email') ?> |
- = lang('Presupuestos.direccion') ?> |
- = lang('Presupuestos.paisiD') ?> |
- = lang('Presupuestos.ccaa') ?> |
- = lang('Presupuestos.provincia') ?> |
- = lang('Presupuestos.municipio') ?> |
- = lang('Presupuestos.cp') ?> |
- = lang('Presupuestos.telefono') ?> |
- = lang('Presupuestos.precio') ?> |
- |
- = lang('Basic.global.Action') ?> |
-
-
-
-
-
-
-
-
+
+
+
+
+
+ | = lang('PresupuestosDirecciones.cantidad') ?> |
+ = lang('PresupuestosDirecciones.peso') ?> |
+ = lang('PresupuestosDirecciones.att') ?> |
+ = lang('PresupuestosDirecciones.email') ?> |
+ = lang('PresupuestosDirecciones.direccion') ?> |
+ = lang('PresupuestosDirecciones.cp') ?> |
+ = lang('PresupuestosDirecciones.municipio') ?> |
+ = lang('PresupuestosDirecciones.provincia') ?> |
+ = lang('PresupuestosDirecciones.ccaa') ?> |
+ = lang('PresupuestosDirecciones.pais') ?> |
+ = lang('PresupuestosDirecciones.telefono') ?> |
+ = lang('PresupuestosDirecciones.precio') ?> |
+ |
+ = lang('Basic.global.Action') ?> |
+
+
+
+
+
+
+
+
+ recoger_en_taller == true ? 'checked' : ''; ?> >
+
+
+
+
+
+
+
+
+
@@ -43,9 +54,10 @@
= $this->section("additionalInlineJs") ?>
+
const lastColNr = $('#tableOfDireccionesEnvio').find("tr:first th").length - 1;
-const actionBtns = function(data) {
+const actionBtns_direcciones = function(data) {
return `
@@ -54,20 +66,20 @@ const actionBtns = function(data) {
};
var tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
- draw:4,
+ draw:5,
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
- order: [[ 0, "asc" ], [ 1, "asc" ]],
- pageLength: 10,
+ order: [[ 0, "asc" ]],
+ pageLength: 20,
lengthChange: false,
searching: false,
- paging: true,
+ paging: false,
info: false,
- dom: '<"mt-4"><"float-end"B><"float-start"l>
<"mt-4 mb-3"p>',
+
ajax : $.fn.dataTable.pipeline( {
- url: '= route_to('dataTableOfPresupuestosenvios') ?>',
+ url: '= route_to('dataTableOfPresupuestoDirecciones') ?>',
data: function ( d ) {
d.presupuesto_id = id;
},
@@ -81,16 +93,16 @@ var tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
{ 'data': 'att' },
{ 'data': 'email' },
{ 'data': 'direccion' },
- { 'data': 'paisId' },
- { 'data': 'ccaaId' },
- { 'data': 'provinciaId' },
- { 'data': 'municipioId' },
{ 'data': 'cp' },
+ { 'data': 'municipio' },
+ { 'data': 'provincia' },
+ { 'data': 'ccaaId' },
+ { 'data': 'paisId' },
{ 'data': 'telefono' },
{ 'data': 'precio' },
{ 'data': 'margen' },
{
- data: actionBtns,
+ data: actionBtns_direcciones,
className: 'row-edit dt-center'
}
],
@@ -100,34 +112,12 @@ var tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
searchable: false,
targets: [lastColNr]
},
- {"orderData": [ 0, 1 ], "targets": 0 },
+ {"orderData": [ 0], "targets": 0 },
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/= config('Basics')->i18n ?>.json"
},
- /*buttons: [ {
- className: 'btn btn-primary float-end me-sm-3 me-1',
- extend: "createInline",
- editor: editor3,
- formOptions: {
- submitTrigger: -1,
- submitHtml: ''
-
- },
- action: function ( e, dt, node, config ) {
- if(selected_tirada_id == -1){
- popErrorAlert("= lang('TarifaEncuadernacionLineas.validation.error_seleccion_tiradas') ?>");
- }
- else{
- formOptions= {
- submitTrigger: -1,
- submitHtml: ''
-
- };
- editor3.inlineCreate(config.position, formOptions);
- }
- },
- } ]*/
+
} );
= $this->endSection() ?>
\ No newline at end of file