mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
feat tarifa maquinas
This commit is contained in:
@ -37,15 +37,47 @@ $routes->group('settings', ['namespace' => 'App\Controllers\Sistema'], function
|
||||
/* Rutas para tarifas */
|
||||
$routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
|
||||
/* Maquinas */
|
||||
$routes->group('maquinas', ['namespace' => 'App\Controllers\Tarifas\Maquinas'], function ($routes) {
|
||||
|
||||
$routes->post('acabado','TarifaMaquinas::add_tarifa_acabado_maquina_with_tarea');
|
||||
$routes->post('manipulado','TarifaMaquinas::add_tarifa_manipulado_maquina_with_tarea');
|
||||
$routes->post('preimpresion','TarifaMaquinas::add_tarifa_preimpresion_maquina_with_tarea');
|
||||
$routes->post('encuadernacion','TarifaMaquinas::add_tarifa_encuadernacion_maquina_with_tarea');
|
||||
$routes->post('extra','TarifaMaquinas::add_tarifa_extra_maquina_with_tarea');
|
||||
|
||||
$routes->delete('acabado/(:num)','TarifaMaquinas::delete_tarifa_acabado_maquina_with_tarea/$1');
|
||||
$routes->delete('manipulado/(:num)','TarifaMaquinas::delete_tarifa_manipulado_maquina_with_tarea/$1');
|
||||
$routes->delete('preimpresion/(:num)','TarifaMaquinas::delete_tarifa_preimpresion_maquina_with_tarea/$1');
|
||||
$routes->delete('encuadernacion/(:num)','TarifaMaquinas::delete_tarifa_encuadernacion_maquina_with_tarea/$1');
|
||||
$routes->delete('extra/(:num)','TarifaMaquinas::delete_tarifa_extra_maquina_with_tarea/$1');
|
||||
|
||||
$routes->get('acabado/select','TarifaMaquinas::get_select_maquina_acabado');
|
||||
$routes->get('manipulado/select','TarifaMaquinas::get_select_maquina_manipulado');
|
||||
$routes->get('impresion/select','TarifaMaquinas::get_select_maquina_impresion');
|
||||
$routes->get('tareas/select','TarifaMaquinas::get_select_maquina_tareas');
|
||||
|
||||
|
||||
|
||||
$routes->get('acabado/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_acabado_maquina/$1');
|
||||
$routes->get('manipulado/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_manipulado_maquina/$1');
|
||||
$routes->get('preimpresion/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_preimpresion_maquina/$1');
|
||||
$routes->get('encuadernacion/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_encuadernacion_maquina/$1');
|
||||
$routes->get('extra/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_extra_maquina/$1');
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
/* Cliente */
|
||||
$routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
|
||||
|
||||
$routes->get('', 'TarifaAcabados::index', ['as' => 'tarifaAcabadoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);
|
||||
$routes->get('select','TarifaAcabados::show_select',["as" => "showSelectTarifaAcabado"]);
|
||||
$routes->get('select', 'TarifaAcabados::show_select', ["as" => "showSelectTarifaAcabado"]);
|
||||
$routes->group('lineas', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
$routes->post('datatable', 'TarifaAcabadosLineas::datatable', ['as' => 'tarifaAcabadoLineasDT']);
|
||||
$routes->post('datatable_editor', 'TarifaAcabadosLineas::datatable_editor', ['as' => 'tarifaAcabadoLineasDTE']);
|
||||
@ -77,7 +109,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
|
||||
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
||||
@ -168,8 +200,7 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->post('datatable', 'Tarifasmanipulado::datatable', ['as' => 'dataTableOfTarifasManipulado']);
|
||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
||||
$routes->get('select','Tarifasmanipulado::show_select',["as" => "showSelectTarifaManipulado"]);
|
||||
|
||||
$routes->get('select', 'Tarifasmanipulado::show_select', ["as" => "showSelectTarifaManipulado"]);
|
||||
});
|
||||
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -663,7 +694,6 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
|
||||
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
||||
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
|
||||
$routes->get('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
||||
|
||||
});
|
||||
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -795,11 +825,9 @@ $routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($r
|
||||
|
||||
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
|
||||
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
|
||||
|
||||
|
||||
});
|
||||
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
|
||||
|
||||
$routes->get('direct/(:num)', 'ChatController::get_chat_direct_view/$1', ['as' => 'getChatDirectView']);
|
||||
$routes->get('presupuesto/(:num)', 'ChatController::get_chat_presupuesto_view/$1', ['as' => 'getChatPresupuestoView']);
|
||||
$routes->get('pedido/(:num)', 'ChatController::get_chat_pedido_view/$1', ['as' => 'getChatPedidoView']);
|
||||
@ -807,7 +835,7 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
|
||||
$routes->get('direct/conversation/(:num)', 'ChatController::get_chat_direct/$1', ['as' => 'getChatDirect']);
|
||||
$routes->get('direct/users/select/(:num)', 'ChatController::get_chat_direct_select_users/$1', ['as' => 'getChatDirectSelectUsers']);
|
||||
|
||||
|
||||
$routes->get('direct/client/users/select/presupuesto/(:num)', 'ChatController::get_presupuesto_client_users/$1/$2', ['as' => 'getPresupuestoClientUsers']);
|
||||
$routes->get('direct/client/users/select/pedido/(:num)', 'ChatController::get_pedido_client_users/$1/$2', ['as' => 'getPedidoClientUsers']);
|
||||
$routes->get('direct/client/users/select/factura/(:num)', 'ChatController::get_factura_client_users/$1/$2', ['as' => 'getFacturaClientUsers']);
|
||||
@ -856,8 +884,6 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
$routes->get('edit/(:num)', 'Ordentrabajo::edit/$1', ['as' => 'viewOrdenTrabajoEdit']);
|
||||
$routes->get('summary/(:num)', 'Ordentrabajo::get_orden_trabajo_summary/$1', ['as' => 'getOrdenTrabajoSumary']);
|
||||
$routes->get('datatable', 'Ordentrabajo::datatable', ['as' => 'datatableOrdenTrabajo']);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
/*
|
||||
@ -898,4 +924,4 @@ $routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' =
|
||||
*/
|
||||
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
|
||||
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@ namespace Config;
|
||||
use App\Services\FTPService;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Services\ProductionService;
|
||||
use App\Services\TarifaMaquinaService;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
*
|
||||
@ -33,4 +35,7 @@ class Services extends BaseService
|
||||
public static function production(){
|
||||
return new ProductionService();
|
||||
}
|
||||
public static function tarifa_maquina(){
|
||||
return new TarifaMaquinaService();
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,5 +43,84 @@ class Validation extends BaseConfig
|
||||
// Rules
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**========================================================================
|
||||
* TARIFA MAQUINA ACABADO
|
||||
*========================================================================**/
|
||||
public array $tarifa_maquina_acabado =
|
||||
[
|
||||
"tarifa_acabado_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_manipulado =
|
||||
[
|
||||
"tarifa_manipulado_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_preimpresion =
|
||||
[
|
||||
"tarifa_preimpresion_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_encuadernacion =
|
||||
[
|
||||
"tarifa_encuadernacion_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_extra =
|
||||
[
|
||||
"tarifa_extra_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
204
ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php
Normal file
204
ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Tarifas\Maquinas;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Configuracion\MaquinaTareaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaManipuladoMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaEncuadernacionMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaPreimpresionMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaExtraMaquinaModel;
|
||||
|
||||
use App\Services\TarifaMaquinaService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
class TarifaMaquinas extends BaseController
|
||||
{
|
||||
protected $format = 'json';
|
||||
protected array $viewData = [];
|
||||
protected MaquinaModel $maquinaModel;
|
||||
protected MaquinaTareaModel $maquinaTareaModel;
|
||||
protected TarifaMaquinaService $tarifaMaquinaService;
|
||||
protected $validation;
|
||||
protected static $controllerSlug = "tarifa-maquinas";
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
$this->maquinaModel = model(MaquinaModel::class);
|
||||
$this->maquinaTareaModel = model(MaquinaTareaModel::class);
|
||||
$this->tarifaMaquinaService = service("tarifa_maquina");
|
||||
$this->validation = service("validation");
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
/**========================================================================
|
||||
* CREATE
|
||||
*========================================================================**/
|
||||
|
||||
public function add_tarifa_acabado_maquina_with_tarea()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "tarifa_maquina_acabado");
|
||||
if ($validated) {
|
||||
$r = $this->tarifaMaquinaService->attachAcabadoToMaquina(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $r]);
|
||||
} else {
|
||||
return $this->response->setJSON($this->validation->getErrors())->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function add_tarifa_manipulado_maquina_with_tarea()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "tarifa_maquina_manipulado");
|
||||
if ($validated) {
|
||||
$r = $this->tarifaMaquinaService->attachManipuladoToMaquina(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $r]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function add_tarifa_preimpresion_maquina_with_tarea()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "tarifa_maquina_preimpresion");
|
||||
if ($validated) {
|
||||
|
||||
$r = $this->tarifaMaquinaService->attachPreimpresionToMaquina(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $r]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function add_tarifa_encuadernacion_maquina_with_tarea()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "tarifa_maquina_encuadernacion");
|
||||
if ($validated) {
|
||||
|
||||
$r = $this->tarifaMaquinaService->attachEncuadernacionToMaquina(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $r]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function add_tarifa_extra_maquina_with_tarea()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "tarifa_maquina_encuadernacion");
|
||||
if ($validated) {
|
||||
$r = $this->tarifaMaquinaService->attachExtraToMaquina(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $r]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
/**========================================================================
|
||||
* DELETES
|
||||
*========================================================================**/
|
||||
public function delete_tarifa_acabado_maquina_with_tarea($tarifa_acabado_maquina_id)
|
||||
{
|
||||
$m = model(TarifaAcabadoMaquinaModel::class);
|
||||
$r = $m->delete($tarifa_acabado_maquina_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true, "data" => $r]);
|
||||
|
||||
}
|
||||
public function delete_tarifa_manipulado_maquina_with_tarea($tarifa_manipulado_maquina_id)
|
||||
{
|
||||
$m = model(TarifaManipuladoMaquinaModel::class);
|
||||
$r = $m->delete($tarifa_manipulado_maquina_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true, "data" => $r]);
|
||||
|
||||
}
|
||||
public function delete_tarifa_encuadernacion_maquina_with_tarea($tarifa_encuadernacion_maquina_id)
|
||||
{
|
||||
$m = model(TarifaEncuadernacionMaquinaModel::class);
|
||||
$r = $m->delete($tarifa_encuadernacion_maquina_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true, "data" => $r]);
|
||||
|
||||
}
|
||||
public function delete_tarifa_preimpresion_maquina_with_tarea($tarifa_preimpresion_maquina_id)
|
||||
{
|
||||
$m = model(TarifaPreimpresionMaquinaModel::class);
|
||||
$r = $m->delete($tarifa_preimpresion_maquina_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true, "data" => $r]);
|
||||
|
||||
}
|
||||
public function delete_tarifa_extra_maquina_with_tarea($tarifa_extra_maquina_id)
|
||||
{
|
||||
$m = model(TarifaExtraMaquinaModel::class);
|
||||
$r = $m->delete($tarifa_extra_maquina_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true, "data" => $r]);
|
||||
|
||||
}
|
||||
|
||||
/**========================================================================
|
||||
* SELECTS
|
||||
*========================================================================**/
|
||||
public function get_select_maquina_acabado()
|
||||
{
|
||||
$r = $this->maquinaModel->getSelectQuery(q: $this->request->getGet("q"), type: 'acabado');
|
||||
return $this->response->setJSON($r);
|
||||
}
|
||||
public function get_select_maquina_impresion()
|
||||
{
|
||||
$r = $this->maquinaModel->getSelectQuery(q: $this->request->getGet("q"), type: 'impresion');
|
||||
return $this->response->setJSON($r);
|
||||
}
|
||||
public function get_select_maquina_manipulado()
|
||||
{
|
||||
$r = $this->maquinaModel->getSelectQuery(q: $this->request->getGet("q"), type: 'manipulado');
|
||||
return $this->response->setJSON($r);
|
||||
}
|
||||
public function get_select_maquina_tareas()
|
||||
{
|
||||
$r = $this->maquinaTareaModel->getSelectQuery(q: $this->request->getGet("q"));
|
||||
return $this->response->setJSON($r);
|
||||
}
|
||||
/**========================================================================
|
||||
* DATATABLES
|
||||
*========================================================================**/
|
||||
public function get_datatable_tarifa_acabado_maquina(int $tarifa_acabado_id)
|
||||
{
|
||||
$m = model(TarifaAcabadoMaquinaModel::class);
|
||||
$q = $m->queryDatatable($tarifa_acabado_id);
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_datatable_tarifa_manipulado_maquina(int $tarifa_manipulado_id)
|
||||
{
|
||||
$m = model(TarifaManipuladoMaquinaModel::class);
|
||||
$q = $m->queryDatatable($tarifa_manipulado_id);
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_datatable_tarifa_preimpresion_maquina(int $tarifa_preimpresion_id)
|
||||
{
|
||||
$m = model(TarifaPreimpresionMaquinaModel::class);
|
||||
$q = $m->queryDatatable($tarifa_preimpresion_id);
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_datatable_tarifa_encuadernacion_maquina(int $tarifa_encuadernacion_id)
|
||||
{
|
||||
$m = model(TarifaEncuadernacionMaquinaModel::class);
|
||||
$q = $m->queryDatatable($tarifa_encuadernacion_id);
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_datatable_tarifa_extra_maquina(int $tarifa_extra_id)
|
||||
{
|
||||
$m = model(TarifaExtraMaquinaModel::class);
|
||||
$q = $m->queryDatatable($tarifa_extra_id);
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
46
ci4/app/Database/Seeds/MaquinaTareaSeeder.php
Normal file
46
ci4/app/Database/Seeds/MaquinaTareaSeeder.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use App\Models\Configuracion\MaquinaTareaModel;
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class MaquinaTareaSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
$data = [
|
||||
[
|
||||
"name" => "Grapar",
|
||||
"description" => "Grapar (acabado)"
|
||||
],
|
||||
[
|
||||
"name" => "Preparación en guillotina",
|
||||
"description" => "Guillotina (manipulado)"
|
||||
],
|
||||
[
|
||||
"name" => "Espiral",
|
||||
"description" => "Perforadora Wire-o/Espiral (manipulado)"
|
||||
],
|
||||
[
|
||||
"name" => "Plegar",
|
||||
"description" => "Plegadora-Grapadora (manipulado)"
|
||||
],
|
||||
[
|
||||
"name" => "Coser",
|
||||
"description" => "Cosedora hilo (manipulado)"
|
||||
],
|
||||
[
|
||||
"name" => "Cubrir",
|
||||
"description" => "Encuadernadora cola caliente (manipulado)"
|
||||
],
|
||||
[
|
||||
"name" => "Corte",
|
||||
"description" => "Manipulado"
|
||||
],
|
||||
];
|
||||
$m = model(MaquinaTareaModel::class);
|
||||
$m->insertBatch($data);
|
||||
}
|
||||
}
|
||||
@ -42,6 +42,7 @@ return [
|
||||
'userUpdatedId' => 'User Updated ID',
|
||||
'velocidad' => 'Velocidad',
|
||||
'velocidadCorte' => 'Velocidad Corte',
|
||||
'maquina_tarea' => 'Máquina tarea',
|
||||
'validation' => [
|
||||
'alto_menor_alto_impresion' => 'El campo \'Alto impresión\' debe ser menor que \'Alto\'',
|
||||
'ancho_menor_ancho_impresion' => '\'Ancho Impresión\' debe ser menor que \'Ancho\'',
|
||||
|
||||
@ -375,4 +375,24 @@ class MaquinaModel extends \App\Models\BaseModel
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Query for select2
|
||||
*
|
||||
* @param string|null $q Query param from select2 ajax request
|
||||
* @param string|null $type Tipo de maquina impresion,manipulado,acabado
|
||||
* @return array
|
||||
*/
|
||||
public function getSelectQuery(?string $q = null, ?string $type = null) : array
|
||||
{
|
||||
$query = $this->builder()->select(["id","nombre","tipo as description"])
|
||||
->where("deleted_at",null);
|
||||
if($q){
|
||||
$query->like("nombre",$q);
|
||||
}
|
||||
if($type){
|
||||
$query->where("tipo",$type);
|
||||
}
|
||||
return $query->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TareaMaquinaEntity;
|
||||
use CodeIgniter\Model;
|
||||
@ -14,7 +14,7 @@ class MaquinaTareaModel extends Model
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"name",
|
||||
"description",
|
||||
];
|
||||
|
||||
@ -47,4 +47,22 @@ class MaquinaTareaModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
/**
|
||||
* Query for select2
|
||||
*
|
||||
* @param string|null $q Query param from select2 ajax request
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public function getSelectQuery(?string $q = null) : array
|
||||
{
|
||||
$query = $this->builder()->select(["id","name","description"])
|
||||
->where("deleted_at",null);
|
||||
if($q){
|
||||
$query->like("nombre",$q);
|
||||
}
|
||||
|
||||
return $query->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TarifaAcabadoMaquinaEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TarifaAcabadoMaquinaModel extends Model
|
||||
@ -48,4 +49,27 @@ class TarifaAcabadoMaquinaModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
/**
|
||||
* Query for datatable
|
||||
*
|
||||
* @param integer|null $tarifa_acabado_id
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function queryDatatable(?int $tarifa_acabado_id = null) : BaseBuilder
|
||||
{
|
||||
$query = $this->builder()->select(
|
||||
[
|
||||
"tarifa_acabado_maquinas.id",
|
||||
"lg_maquinas.nombre as maquinaNombre",
|
||||
"maquina_tareas.name as tareaNombre"
|
||||
]
|
||||
)->join("lg_maquinas","lg_maquinas.id = tarifa_acabado_maquinas.maquina_id","left")
|
||||
->join("maquina_tareas","maquina_tareas.id = tarifa_acabado_maquinas.maquina_tarea_id","left")
|
||||
->where("tarifa_acabado_maquinas.deleted_at",null);
|
||||
if ($tarifa_acabado_id)
|
||||
$query->where("tarifa_acabado_maquinas.tarifa_acabado_id", $tarifa_acabado_id);
|
||||
return $query;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Tarifas\Maquinas;
|
||||
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TarifaEncuadernacionMaquinaEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TarifaEncuadernacionMaquinaModel extends Model
|
||||
@ -48,4 +50,26 @@ class TarifaEncuadernacionMaquinaModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
/**
|
||||
* Query for datatable
|
||||
*
|
||||
* @param integer|null $tarifa_encuadernacion_id
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function queryDatatable(?int $tarifa_encuadernacion_id = null): BaseBuilder
|
||||
{
|
||||
$query = $this->builder()->select(
|
||||
[
|
||||
"tarifa_encuadernacion_maquinas.id",
|
||||
"lg_maquinas.nombre as maquinaNombre",
|
||||
"maquina_tareas.name as tareaNombre"
|
||||
]
|
||||
)->join("lg_maquinas", "lg_maquinas.id = tarifa_encuadernacion_maquinas.maquina_id", "left")
|
||||
->join("maquina_tareas", "maquina_tareas.id = tarifa_encuadernacion_maquinas.maquina_tarea_id", "left")
|
||||
->where("tarifa_encuadernacion_maquinas.deleted_at",null);
|
||||
|
||||
if ($tarifa_encuadernacion_id)
|
||||
$query->where("tarifa_encuadernacion_maquinas.id", $tarifa_encuadernacion_id);
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Tarifas\Maquinas;
|
||||
|
||||
use App\Database\Migrations\TarifaExtraMaquinaTable;
|
||||
use App\Entities\Tarifas\Maquinas\TarifaPreimpresionMaquinaEntity;
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TarifaExtraMaquinaEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TarifaExtraMaquinaEntity extends Model
|
||||
class TarifaExtraMaquinaModel extends Model
|
||||
{
|
||||
protected $table = 'tarifa_acabado_maquinas';
|
||||
protected $primaryKey = 'id';
|
||||
@ -49,4 +50,27 @@ class TarifaExtraMaquinaEntity extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
/**
|
||||
* Query for datatable
|
||||
*
|
||||
* @param integer|null $tarifa_extra_id
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function queryDatatable(?int $tarifa_extra_id = null): BaseBuilder
|
||||
{
|
||||
$query = $this->builder()->select(
|
||||
[
|
||||
"tarifa_extra_maquinas.id",
|
||||
"lg_maquinas.nombre as maquinaNombre",
|
||||
"maquina_tareas.name as tareaNombre"
|
||||
]
|
||||
)->join("lg_maquinas", "lg_maquinas.id = tarifa_extra_maquinas.maquina_id", "left")
|
||||
->join("maquina_tareas", "maquina_tareas.id = tarifa_extra_maquinas.maquina_tarea_id", "left")
|
||||
->where("tarifa_extra_maquinas.deleted_at",null);
|
||||
|
||||
if ($tarifa_extra_id)
|
||||
$query->where("tarifa_extra_maquinas.id", $tarifa_extra_id);
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Tarifas\Maquinas;
|
||||
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TarifaManipuladoMaquinaEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TarifaManipuladoMaquinaModel extends Model
|
||||
@ -48,4 +50,26 @@ class TarifaManipuladoMaquinaModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
/**
|
||||
* Query for datatable
|
||||
*
|
||||
* @param integer|null $tarifa_manipulado_id
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function queryDatatable(?int $tarifa_manipulado_id = null): BaseBuilder
|
||||
{
|
||||
$query = $this->builder()->select(
|
||||
[
|
||||
"tarifa_manipulado_maquinas.id",
|
||||
"lg_maquinas.nombre as maquinaNombre",
|
||||
"maquina_tareas.name as tareaNombre"
|
||||
]
|
||||
)->join("lg_maquinas", "lg_maquinas.id = tarifa_manipulado_maquinas.maquina_id", "left")
|
||||
->join("maquina_tareas", "maquina_tareas.id = tarifa_manipulado_maquinas.maquina_tarea_id", "left")
|
||||
->where("tarifa_manipulado_maquinas.deleted_at",null);
|
||||
if ($tarifa_manipulado_id)
|
||||
$query->where("tarifa_manipulado_maquinas.id", $tarifa_manipulado_id);
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App\Models\Tarifas\Maquinas;
|
||||
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\TarifaPreimpresionMaquinaEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TarifaPreimpresionMaquinaModel extends Model
|
||||
@ -48,4 +50,27 @@ class TarifaPreimpresionMaquinaModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
/**
|
||||
* Query for datatable
|
||||
*
|
||||
* @param integer|null $tarifa_preimpresion_id
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function queryDatatable(?int $tarifa_preimpresion_id = null): BaseBuilder
|
||||
{
|
||||
$query = $this->builder()->select(
|
||||
[
|
||||
"tarifa_preimpresion_maquinas.id",
|
||||
"lg_maquinas.nombre as maquinaNombre",
|
||||
"maquina_tareas.name as tareaNombre"
|
||||
]
|
||||
)->join("lg_maquinas", "lg_maquinas.id = tarifa_preimpresion_maquinas.maquina_id", "left")
|
||||
->join("maquina_tareas", "maquina_tareas.id = tarifa_preimpresion_maquinas.maquina_tarea_id", "left")
|
||||
->where("tarifa_preimpresion_maquinas.deleted_at", null);
|
||||
|
||||
if ($tarifa_preimpresion_id)
|
||||
$query->where("tarifa_preimpresion_maquinas.id", $tarifa_preimpresion_id);
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
class MessageService extends BaseService
|
||||
{
|
||||
public static function get_chat_title_from_presupuesto(int $presuesto_id,?string $department_name = null) : string
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
58
ci4/app/Services/TarifaMaquinaService.php
Normal file
58
ci4/app/Services/TarifaMaquinaService.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Configuracion\MaquinaTareaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaManipuladoMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaEncuadernacionMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaPreimpresionMaquinaModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaExtraMaquinaModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
|
||||
/**
|
||||
* Clase con las funcionalidades necesarias trabajar con tarifas maquinas
|
||||
*/
|
||||
|
||||
class TarifaMaquinaService extends BaseService
|
||||
{
|
||||
protected TarifaAcabadoMaquinaModel $tarifaAcabadoMaquina;
|
||||
protected TarifaManipuladoMaquinaModel $tarifaManipuladoMaquina;
|
||||
protected TarifaPreimpresionMaquinaModel $tarifaPreimpresionMaquina;
|
||||
protected TarifaEncuadernacionMaquinaModel $tarifaEncuadernacionMaquina;
|
||||
protected TarifaExtraMaquinaModel $tarifaExtraMaquina;
|
||||
protected MaquinaTareaModel $maquinaTarea;
|
||||
|
||||
public function __construct() {
|
||||
$this->tarifaAcabadoMaquina = model(TarifaAcabadoMaquinaModel::class);
|
||||
$this->tarifaManipuladoMaquina = model(TarifaManipuladoMaquinaModel::class);
|
||||
$this->tarifaEncuadernacionMaquina = model(TarifaEncuadernacionMaquinaModel::class);
|
||||
$this->tarifaPreimpresionMaquina = model(TarifaPreimpresionMaquinaModel::class);
|
||||
$this->tarifaExtraMaquina = model(TarifaExtraMaquinaModel::class);
|
||||
|
||||
}
|
||||
|
||||
public function attachAcabadoToMaquina(int $tarifa_acabado_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
|
||||
{
|
||||
return $this->tarifaAcabadoMaquina->insert(["tarifa_acabado_id" => $tarifa_acabado_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
|
||||
}
|
||||
public function attachManipuladoToMaquina(int $tarifa_manipulado_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
|
||||
{
|
||||
return $this->tarifaManipuladoMaquina->insert(["tarifa_manipulado_id" => $tarifa_manipulado_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
|
||||
}
|
||||
public function attachPreimpresionToMaquina(int $tarifa_preimpresion_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
|
||||
{
|
||||
return $this->tarifaPreimpresionMaquina->insert(["tarifa_preimpresion_id" => $tarifa_preimpresion_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
|
||||
}
|
||||
public function attachEncuadernacionToMaquina(int $tarifa_encuadernacion_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
|
||||
{
|
||||
return $this->tarifaEncuadernacionMaquina->insert(["tarifa_encuadernacion_id" => $tarifa_encuadernacion_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
|
||||
}
|
||||
public function attachExtraToMaquina(int $tarifa_extra_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
|
||||
{
|
||||
return $this->tarifaExtraMaquina->insert(["tarifa_extra_id" => $tarifa_extra_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<div class="p-2" id="<?= $id ?>" data-id="<?= $tarifaId ?>">
|
||||
<form action="" id="tarifa-maquina" class="needs-validation" novalidate>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-5 col-xs-12 mb-2">
|
||||
<label for="select-tarifa-maquina">Máquina asociada</label>
|
||||
<select id="select-tarifa-maquina" class="select2 form-select" data-allow-clear="true"></select>
|
||||
</div>
|
||||
<div class="col-md-5 col-xs-12 mb-2">
|
||||
<label for="select-maquina-tarea">Tarea asociada</label>
|
||||
<select id="select-maquina-tarea" class="select2 form-select" data-allow-clear="true"></select>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-12 mb-2" id="container-new-tarifa-maquina">
|
||||
<br />
|
||||
<button type="button" class="btn btn-md btn-primary w-100 text-truncate" id="btn-new-tarifa-maquina"><?= lang("App.notification_btn_add") ?></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<table id="table-tarifa-maquinas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Maquinas.maquinas') ?></th>
|
||||
<th><?= lang('Maquinas.maquina_tarea') ?></th>
|
||||
<th>Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -51,7 +51,7 @@
|
||||
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.margen') ?></th>
|
||||
<th class="noFilter" style="min-width:100px"></th>
|
||||
<th class="noFilter" ></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -62,11 +62,27 @@
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
|
||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||
<h3>Tarifa máquinas</h3>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||
<div class="accordion-body">
|
||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas",["id" => "tarifa_maquina_component","tarifaId" => $tarifaacabadoEntity->id ]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/acabado/index.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||
|
||||
@ -124,14 +124,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||
<h3>Tarifa máquinas</h3>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||
<div class="accordion-body">
|
||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas",["id" => "tarifa_maquina_component","tarifaId" => $tarifaEncuadernacionEntity->id ]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||
<?php endif; ?>
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/encuadernacion/index.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para general -->
|
||||
<!------------------------------------------->
|
||||
|
||||
@ -62,8 +62,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||
<h3>Tarifa máquinas</h3>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||
<div class="accordion-body">
|
||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas",["id" => "tarifa_maquina_component","tarifaId" => $tarifaManipuladoEntity->id ]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
</div><!--//.row -->
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/manipulado/index.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
@ -15,11 +15,10 @@
|
||||
<?= view("themes/vuexy/form/tarifas/preimpresion/_tarifapreimpresionFormItems") ?>
|
||||
<div class="pt-4">
|
||||
<input
|
||||
type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>" />
|
||||
<?= anchor(route_to("tarifapreimpresionList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>
|
||||
|
||||
</div><!-- /.card-footer -->
|
||||
@ -27,4 +26,21 @@
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||
<h3>Tarifa máquinas</h3>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||
<div class="accordion-body">
|
||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifapreimpresionEntity->id]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/preimpresion/index.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
30
httpdocs/assets/js/safekat/components/forms/formClass.js
Normal file
30
httpdocs/assets/js/safekat/components/forms/formClass.js
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
|
||||
class FormClass
|
||||
{
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.formData = null
|
||||
}
|
||||
|
||||
validateField()
|
||||
{
|
||||
|
||||
}
|
||||
setAsValid(field)
|
||||
{
|
||||
}
|
||||
setAsInvalid(field){}
|
||||
addSuccessFeedback(field){}
|
||||
addErrorFeedback(field){}
|
||||
getFormData() {
|
||||
let data = {}
|
||||
this.item.serializeArray().forEach((e) => {
|
||||
data[e.name] = e.value
|
||||
}
|
||||
)
|
||||
this.formData = data
|
||||
return this.formData
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquinaAcabado = new TarifaMaquina($("#tarifa_maquina_component"),"acabado");
|
||||
tarifaMaquinaAcabado.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"encuadernacion");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"extra");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"manipulado");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"preimpresion");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
94
httpdocs/assets/js/safekat/pages/tarifas/tarifaMaquina.js
Normal file
94
httpdocs/assets/js/safekat/pages/tarifas/tarifaMaquina.js
Normal file
@ -0,0 +1,94 @@
|
||||
import ClassSelect from "../../components/select2.js";
|
||||
import Ajax from "../../components/ajax.js";
|
||||
class TarifaMaquina {
|
||||
constructor(domItem, type = "acabado") {
|
||||
this.item = domItem
|
||||
this.type = type
|
||||
this.tarifaId = this.item.data("id")
|
||||
this.btnNewTarifaMaquina = this.item.find("#btn-new-tarifa-maquina")
|
||||
this.selectTarifaMaquina = new ClassSelect(this.item.find("#select-tarifa-maquina"), `/tarifas/maquinas/${this.type}/select`, "Seleccione una maquina", true);
|
||||
this.selectMaquinaTarea = new ClassSelect(this.item.find("#select-maquina-tarea"), `/tarifas/maquinas/tareas/select`, "Seleccione una tarea", true);
|
||||
this.datatableItem = this.item.find("#table-tarifa-maquinas")
|
||||
this.datatableColumns = [
|
||||
{ data: 'maquinaNombre', searchable: false, sortable: false },
|
||||
{ data: 'tareaNombre', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false,
|
||||
render: (d, t) => {
|
||||
return `<div class="btn-group btn-group-xs">
|
||||
<a type="button" class="btn btn-xs tarifa-maquina-btn-delete" data-id="${d}"><i class="ti ti-trash ti-sm mx-2"></i></a>
|
||||
</div>`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
init() {
|
||||
// this.btnNewTarifaMaquina.prop("disabled",true)
|
||||
this.selectMaquinaTarea.init()
|
||||
this.selectTarifaMaquina.init()
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: `/tarifas/maquinas/${this.type}/datatable/${this.tarifaId}`
|
||||
});
|
||||
this.events();
|
||||
}
|
||||
events() {
|
||||
this.btnNewTarifaMaquina.on("click", this.handleNewTarifaMaquina.bind(this));
|
||||
this.datatable.on("click", ".tarifa-maquina-btn-delete", this.handleDeleteTarifaMaquina.bind(this))
|
||||
}
|
||||
handleNewTarifaMaquina() {
|
||||
let key = `tarifa_${this.type}_id`
|
||||
let bodyData = {
|
||||
maquina_id: this.selectTarifaMaquina.getVal(),
|
||||
maquina_tarea_id: this.selectMaquinaTarea.getVal()
|
||||
}
|
||||
bodyData[key] = this.tarifaId;
|
||||
|
||||
const ajax = new Ajax(
|
||||
`/tarifas/maquinas/${this.type}`,
|
||||
bodyData,
|
||||
null,
|
||||
this.handleNewTarifaMaquinaSuccess.bind(this),
|
||||
this.handleNewTarifaMaquinaError.bind(this),
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handleNewTarifaMaquinaSuccess(response) {
|
||||
this.datatable.ajax.reload()
|
||||
this.selectMaquinaTarea.reset()
|
||||
this.selectTarifaMaquina.reset()
|
||||
console.log(response)
|
||||
}
|
||||
handleNewTarifaMaquinaError(error) { }
|
||||
|
||||
handleDeleteTarifaMaquina(event) {
|
||||
const tarifaMaquinaId = $(event.currentTarget).data("id")
|
||||
const ajax = new Ajax(
|
||||
`/tarifas/maquinas/${this.type}/${tarifaMaquinaId}`,
|
||||
null,
|
||||
null,
|
||||
this.handleDeleteTarifaMaquinaSuccess.bind(this),
|
||||
this.handleDeleteTarifaMaquinaError.bind(this),
|
||||
)
|
||||
ajax.delete()
|
||||
}
|
||||
handleDeleteTarifaMaquinaSuccess() {
|
||||
this.datatable.ajax.reload()
|
||||
}
|
||||
handleDeleteTarifaMaquinaError() { }
|
||||
|
||||
}
|
||||
export default TarifaMaquina
|
||||
Reference in New Issue
Block a user