diff --git a/ci4/app/Models/Pedidos/PedidoLineaModel.php b/ci4/app/Models/Pedidos/PedidoLineaModel.php
index d7eb4699..06f4f29c 100644
--- a/ci4/app/Models/Pedidos/PedidoLineaModel.php
+++ b/ci4/app/Models/Pedidos/PedidoLineaModel.php
@@ -14,12 +14,20 @@ class PedidoLineaModel extends \App\Models\BaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
- 0 => "t1.id",
- 1 => "t1.estado",
- 2 => "t1.total_precio",
- 3 => "t1.total_tirada",
+ 0 => "t2.id",
+ 1 => "t2.updated_at",
+ 2 => "t2.fecha_entrega_real",
+ 3 => "t4.nombre",
+ 4 => "CONCAT(t5.first_name, ' ', t5.last_name)",
+ 5 => "t3.titulo",
+ 6 => "t6.nombre",
+ 7 => "t3.inc_rei",
+ 8 => "t3.paginas",
+ 9 => "t3.tirada",
+ 10 => "t3.total_aceptado",
+ 11 => "t2.estado"
];
-
+
protected $allowedFields = [
"pedido_id",
"presupuesto_id",
@@ -40,7 +48,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
public static $labelField = "id";
- public function getResource(string $search = "", $estado="")
+ public function getResource($search = [], $estado="")
{
$builder = $this->db
->table($this->table . " t1")
@@ -67,14 +75,22 @@ class PedidoLineaModel extends \App\Models\BaseModel
}
}
- // Falta implementar la busqueda por grupos
- return empty($search)
- ? $builder
- : $builder
- ->groupStart()
- ->like("t1.id", $search)
- ->orLike("t1.id", $search)
- ->groupEnd();
+ if (empty($search))
+ return $builder;
+ else {
+ $builder->groupStart();
+ foreach ($search as $col_search) {
+ if ($col_search[0] != 1 && $col_search[0] != 2)
+ $builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
+ else {
+ $dates = explode(" ", $col_search[2]);
+ $builder->where(self::SORTABLE[$col_search[0]] . ">=", $dates[0]);
+ $builder->where(self::SORTABLE[$col_search[0]] . "<=", $dates[1]);
+ }
+ }
+ $builder->groupEnd();
+ return $builder;
+ }
}
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
index c172c254..032d9f8b 100644
--- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
+++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
@@ -17,7 +17,7 @@
| = lang('Pedidos.id') ?> |
= lang('Pedidos.fecha') ?> |
- = lang('Pedidos.fecha_entrega') ?> |
+ = lang('Pedidos.fecha_entrega') ?> |
= lang('Pedidos.cliente') ?> |
= lang('Pedidos.comercial') ?> |
= lang('Pedidos.titulo') ?> |
@@ -27,7 +27,7 @@
= lang('Pedidos.tiradas') ?> |
= lang('Pedidos.total_presupuesto') ?> |
= lang('Pedidos.estado') ?> |
- = lang('Basic.global.Action') ?> |
+ = lang('Basic.global.Action') ?> |
@@ -62,9 +62,10 @@ $('#tableOfPedidos thead tr').clone(true).appendTo('#tableOfPedidos thead');
$('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
if (!$(this).hasClass("noFilter")) {
var title = $(this).text();
- if(i==1){
- $(this).html('');
- var bsRangePickerRange = $('#bs-rangepicker-range')
+ if(i==1 || i==2){
+ name = 'bs-rangepicker-range_' + i;
+ $(this).html('');
+ var bsRangePickerRange = $('#' + name);
bsRangePickerRange.daterangepicker({
ranges: {
'= lang('datePicker.hoy') ?>': [moment(), moment()],
@@ -106,6 +107,27 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
});
}
+ else if (i == 11) {
+ // Agregar un selector en la tercera columna
+ $(this).html('');
+
+ // Agregar opciones al selector
+ var selector = $('select', this);
+
+ selector.append(''); // Opción vacía
+ selector.append('');
+ selector.append('');
+ selector.append('');
+ selector.append('');
+ selector.append('');
+
+ selector.on('change', function () {
+ var val = $.fn.dataTable.util.escapeRegex(
+ $(this).val()
+ );
+ theTable.column(i).search(val).draw();
+ });
+ }
else{
$(this).html('');
@@ -212,15 +234,9 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
});
theTable.on( 'draw.dt', function () {
- //const boolCols = [];
- const dateCols = [1];
+ const dateCols = [1,2];
const priceCols = [10];
- /*for (let coln of boolCols) {
- theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
- cell.innerHTML = cell.innerHTML == '1' ? '' : '';
- });
- }*/
-
+
for (let coln of dateCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
const datestr = cell.innerHTML;