diff --git a/ci4/app/Controllers/Pedidos/Pedido.php b/ci4/app/Controllers/Pedidos/Pedido.php
index 25bc2f5a..f8d45fc3 100755
--- a/ci4/app/Controllers/Pedidos/Pedido.php
+++ b/ci4/app/Controllers/Pedidos/Pedido.php
@@ -132,17 +132,15 @@ class Pedido extends \App\Controllers\BaseResourceController
private function obtenerDatosFormulario(&$pedidoEntity){
- $pedidoLineaModel = model('\App\Models\Pedidos\PedidoLineaModel');
- $clienteModel = model('\App\Models\Clientes\ClienteModel');
- $presupuestoModel = model('\App\Models\Presupuestos\PresupuestoModel');
+ $datos = $this->model->obtenerDatosForm($pedidoEntity->id);
- $linea = $pedidoLineaModel->where('pedido_id', $pedidoEntity->id)->first();
- // los clientes son los mismos para todas las lineas de un mismo presupuesto
- $presupuesto = $presupuestoModel->find($linea->presupuesto_id);
- $cliente = $clienteModel->find($presupuesto->cliente_id);
+ $pedidoEntity->estadoText = lang('Pedidos.' . $pedidoEntity->estado);
- $pedidoEntity->cliente = $cliente->nombre;
- $pedidoEntity->cliente_id = $cliente->id;
+ if(count($datos) > 0){
+ $pedidoEntity->cliente = $datos[0]->cliente;
+ $pedidoEntity->cliente_id = $datos[0]->cliente_id;
+ $pedidoEntity->comercial = $datos[0]->comercial;
+ }
}
}
\ No newline at end of file
diff --git a/ci4/app/Language/en/Pedidos.php b/ci4/app/Language/en/Pedidos.php
index 4551b2da..99ae4950 100644
--- a/ci4/app/Language/en/Pedidos.php
+++ b/ci4/app/Language/en/Pedidos.php
@@ -21,7 +21,21 @@ return [
'finalizado' => 'Finished',
'enviado' => 'Sent',
'cancelado' => 'Cancelled',
+
+ 'datosPedido' => 'Order Details',
+ 'totales' => 'Totales',
+ 'total_precio' => 'Total price',
+ "total_tirada" => 'Total print',
+
+ 'fechas' => "Dates",
+ 'fecha_entrega_real' => 'Actual Delivery Date',
+ 'fecha_impresion' => 'Printing Date',
+ 'fecha_encuadernado' => 'Binding Date',
+ 'fecha_entrega_externo' => 'External Delivery Date',
+
+ 'lineas' => 'Lines',
+
'moduleTitle' => 'Orders',
'pedido' => 'Order',
'pedidos' => 'Orders',
diff --git a/ci4/app/Language/es/Pedidos.php b/ci4/app/Language/es/Pedidos.php
index 021cb159..08c27abe 100644
--- a/ci4/app/Language/es/Pedidos.php
+++ b/ci4/app/Language/es/Pedidos.php
@@ -21,6 +21,20 @@ return [
'enviado' => 'Enviado',
'cancelado' => 'Cancelado',
+ 'datosPedido' => 'Datos del pedido',
+
+ 'totales' => 'Totales',
+ 'total_precio' => 'Total precio',
+ "total_tirada" => 'Total tirada',
+
+ 'fechas' => "Fechas",
+ 'fecha_entrega_real' => "Fecha entrega real",
+ 'fecha_impresion' => "Fecha impresion",
+ 'fecha_encuadernado' => "Fecha encuadernado",
+ 'fecha_entrega_externo' => "Fecha entrega externo",
+
+ 'lineas' => 'Líneas pedido',
+
'moduleTitle' => 'Pedidos',
'pedido' => 'Pedido',
'pedidos' => 'Pedidos',
diff --git a/ci4/app/Models/Pedidos/PedidoModel.php b/ci4/app/Models/Pedidos/PedidoModel.php
index 6b0336eb..4018529c 100644
--- a/ci4/app/Models/Pedidos/PedidoModel.php
+++ b/ci4/app/Models/Pedidos/PedidoModel.php
@@ -53,4 +53,18 @@ class PedidoModel extends \App\Models\BaseModel
public static $labelField = "id";
+ public function obtenerDatosForm($pedido_id){
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t4.id AS cliente_id, t4.nombre AS cliente, CONCAT(t5.first_name, ' ', t5.last_name) AS comercial");
+
+ $builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left");
+ $builder->join("presupuestos t3", "t2.presupuesto_id = t3.id", "left");
+ $builder->join("clientes t4", "t4.id = t3.cliente_id", "left");
+ $builder->join("users t5", "t5.id = t4.comercial_id", "left");
+
+
+ return $builder->get()->getResultObject();
+ }
}
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php
index 7beeb0e0..19dac6f8 100644
--- a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php
+++ b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php
@@ -1,8 +1,9 @@
-
\ No newline at end of file
+
+
+
+=$this->section('additionalInlineJs') ?>
+
+$("#fecha_entrega_real").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_impresion").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_encuadernado").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_entrega_externo").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+=$this->endSection() ?>
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php
new file mode 100644
index 00000000..132fdfb5
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+ | =lang('Presupuestos.id')?> |
+ = lang('Presupuestos.created_at') ?> |
+ = lang('Presupuestos.tipoPresupuesto') ?> |
+ = lang('Clientes.cliente') ?> |
+ = lang('Presupuestos.comercial') ?> |
+ = lang('Presupuestos.titulo') ?> |
+ = lang('Paises.pais') ?> |
+ = lang('Presupuestos.incRei') ?> |
+ = lang('Presupuestos.paginas') ?> |
+ = lang('Presupuestos.tirada') ?> |
+ = lang('Presupuestos.totalPresupuesto') ?> |
+ = lang('Presupuestos.presupuestoEstado') ?> |
+ = lang('Basic.global.Action') ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+=$this->section('additionalInlineJs') ?>
+
+$("#fecha_entrega_real").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_impresion").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_encuadernado").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+$("#fecha_entrega_externo").flatpickr({
+ dateFormat: "d/m/Y",
+ locale: {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
+ longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
+ },
+ months: {
+ shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
+ longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ },
+ },
+});
+
+=$this->endSection() ?>
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php
index e9384afe..b65da3c8 100644
--- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php
+++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php
@@ -16,6 +16,7 @@
= view("themes/_commonPartialsBs/_alertBoxes") ?>
= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
+ = view("themes/vuexy/form/pedidos/_lineasItems") ?>
= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
@@ -24,4 +25,14 @@
-= $this->endSection() ?>
\ No newline at end of file
+= $this->endSection() ?>
+
+
+=$this->section('css') ?>
+ ">
+=$this->endSection() ?>
+
+= $this->section('additionalExternalJs') ?>
+
+=$this->endSection() ?>
+