mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/maquina-tarea-form' into 'main'
change servicio cliente to maquina tareas See merge request jjimenez/safekat!477
This commit is contained in:
@ -122,13 +122,14 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
|||||||
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
|
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
|
||||||
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
|
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
|
||||||
});
|
});
|
||||||
$routes->group("servicios", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
$routes->group("maquina-tareas", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||||
$routes->get('', 'ServicioCliente::index', ['as' => 'servicioClienteList']);
|
$routes->get('', 'MaquinaTarea::index', ['as' => 'maquinaTareaList']);
|
||||||
$routes->get('(:num)', 'ServicioCliente::show/$1', ['as' => 'servicioClienteShow']);
|
$routes->get('(:num)', 'MaquinaTarea::show/$1', ['as' => 'maquinaTareaShow']);
|
||||||
$routes->post('(:num)', 'ServicioCliente::store/$1', ['as' => 'servicioClienteStore']);
|
$routes->delete('(:num)', 'MaquinaTarea::delete/$1', ['as' => 'maquinaTareaDelete']);
|
||||||
$routes->post('update/(:num)', 'ServicioCliente::update_servicio_cliente/$1', ['as' => 'updateServicioCliente']);
|
$routes->post('', 'MaquinaTarea::store/$1', ['as' => 'maquinaTareaStore']);
|
||||||
$routes->get('edit/(:num)', 'ServicioCliente::viewForm/$1', ['as' => 'servicioClienteViewForm']);
|
$routes->post('update/(:num)', 'MaquinaTarea::update_servicio_cliente/$1', ['as' => 'maquinaTareaUpdate']);
|
||||||
$routes->get('datatable', 'ServicioCliente::datatable', ['as' => 'servicioClienteDatatable']);
|
$routes->get('edit/(:num)', 'MaquinaTarea::viewForm/$1', ['as' => 'maquinaTareaViewForm']);
|
||||||
|
$routes->get('datatable', 'MaquinaTarea::datatable', ['as' => 'maquinaTareaDatatable']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
86
ci4/app/Controllers/Configuracion/MaquinaTarea.php
Normal file
86
ci4/app/Controllers/Configuracion/MaquinaTarea.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Configuracion;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Configuracion\MaquinaTareaModel;
|
||||||
|
use CodeIgniter\HTTP\Response;
|
||||||
|
use Hermawan\DataTables\DataTable;
|
||||||
|
use CodeIgniter\I18n\Time;
|
||||||
|
|
||||||
|
class MaquinaTarea extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected MaquinaTareaModel $maquinaTareaModel;
|
||||||
|
protected $format = 'json';
|
||||||
|
protected array $viewData = [];
|
||||||
|
|
||||||
|
|
||||||
|
protected static $viewPath = 'themes/vuexy/form/configuracion/maquina_tareas/';
|
||||||
|
protected static $controllerSlug = "maquina-tareas";
|
||||||
|
protected $indexRoute = 'viewMaquinaTarea';
|
||||||
|
protected $editRoute = 'editMaquinaTarea';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
$this->maquinaTareaModel = model(MaquinaTareaModel::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->viewData['breadcrumb'] = [
|
||||||
|
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||||
|
['title' => lang("App.menu_maquina_tareas"), 'route' => site_url('configuracion/maquina-tareas'), 'active' => true]
|
||||||
|
];
|
||||||
|
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||||
|
}
|
||||||
|
public function viewForm(int $maquina_tarea_id)
|
||||||
|
{
|
||||||
|
$maquinaTarea = $this->maquinaTareaModel->find($maquina_tarea_id);
|
||||||
|
$this->viewData['breadcrumb'] = [
|
||||||
|
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||||
|
['title' => lang("App.menu_maquina_tareas"), 'route' => site_url('configuracion/maquina-tareas'), 'active' => false],
|
||||||
|
['title' => $maquinaTarea->name, 'route' => site_url('configuracion/maquina-tareas/edit/' . $maquina_tarea_id), 'active' => true]
|
||||||
|
];
|
||||||
|
$this->viewData["model"] = $maquinaTarea;
|
||||||
|
|
||||||
|
return view(static::$viewPath . $this->editRoute, $this->viewData);
|
||||||
|
}
|
||||||
|
public function show(int $id)
|
||||||
|
{
|
||||||
|
$data = $this->maquinaTareaModel->find($id);
|
||||||
|
return $this->response->setJSON($data);
|
||||||
|
}
|
||||||
|
public function update_servicio_cliente(int $id)
|
||||||
|
{
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$status = $this->maquinaTareaModel->update($id, [
|
||||||
|
"name" => $data["name"],
|
||||||
|
"description" => $data["description"]
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status]);
|
||||||
|
}
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
$bodyData = $this->request->getPost();
|
||||||
|
$r = $this->maquinaTareaModel->insert($bodyData);
|
||||||
|
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]);
|
||||||
|
}
|
||||||
|
public function delete(int $maquina_tarea_id){
|
||||||
|
$r = $this->maquinaTareaModel->delete($maquina_tarea_id);
|
||||||
|
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $r]);
|
||||||
|
}
|
||||||
|
public function datatable()
|
||||||
|
{
|
||||||
|
$query = $this->maquinaTareaModel->getQueryDatatable()->orderBy("created_at", "DESC");
|
||||||
|
return DataTable::of($query)
|
||||||
|
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||||
|
->add("action", fn($q) => $q->id)
|
||||||
|
->toJson(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,89 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Configuracion;
|
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
|
||||||
use App\Models\Configuracion\ServicioClienteModel;
|
|
||||||
use CodeIgniter\HTTP\Response;
|
|
||||||
use Hermawan\DataTables\DataTable;
|
|
||||||
use CodeIgniter\I18n\Time;
|
|
||||||
|
|
||||||
class ServicioCliente extends BaseController
|
|
||||||
{
|
|
||||||
|
|
||||||
protected ServicioClienteModel $servicioClienteModel;
|
|
||||||
protected $format = 'json';
|
|
||||||
protected array $viewData = [];
|
|
||||||
|
|
||||||
|
|
||||||
protected static $viewPath = 'themes/vuexy/form/configuracion/servicios_cliente/';
|
|
||||||
protected static $controllerSlug = "servicios";
|
|
||||||
protected $indexRoute = 'viewServicioCliente';
|
|
||||||
protected $editRoute = 'ServicioClienteEdit';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
|
||||||
{
|
|
||||||
parent::initController($request, $response, $logger);
|
|
||||||
$this->servicioClienteModel = model(ServicioClienteModel::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$this->viewData['breadcrumb'] = [
|
|
||||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
|
||||||
['title' => lang("App.menu_servicios_cliente"), 'route' => site_url('configuracion/servicios'), 'active' => true]
|
|
||||||
];
|
|
||||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
|
||||||
}
|
|
||||||
public function viewForm(int $servicio_cliente_id)
|
|
||||||
{
|
|
||||||
$servicioCliente = $this->servicioClienteModel->find($servicio_cliente_id);
|
|
||||||
$this->viewData['breadcrumb'] = [
|
|
||||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
|
||||||
['title' => lang("App.menu_servicios_cliente"), 'route' => site_url('configuracion/servicios'), 'active' => false],
|
|
||||||
['title' => $servicioCliente->nombre, 'route' => site_url('configuracion/servicios/edit/' . $servicio_cliente_id), 'active' => true]
|
|
||||||
];
|
|
||||||
$this->viewData["model"] = $servicioCliente;
|
|
||||||
|
|
||||||
return view(static::$viewPath . 'ServicioClienteEdit', $this->viewData);
|
|
||||||
}
|
|
||||||
public function show(int $id)
|
|
||||||
{
|
|
||||||
$data = $this->servicioClienteModel->find($id)->withAllTarifas();
|
|
||||||
return $this->response->setJSON($data);
|
|
||||||
}
|
|
||||||
public function update_servicio_cliente(int $id)
|
|
||||||
{
|
|
||||||
$data = $this->request->getPost();
|
|
||||||
$status = $this->servicioClienteModel->update($id, [
|
|
||||||
"nombre" => $data["nombre"],
|
|
||||||
"code" => $data["code"]
|
|
||||||
]);
|
|
||||||
if (isset($data["tarifa_manipulado_id"])) {
|
|
||||||
$this->servicioClienteModel->upsertTarifaManipulado($id, $data["tarifa_manipulado_id"]);
|
|
||||||
}else if(isset($data["tarifa_acabado_id"])) {
|
|
||||||
|
|
||||||
$this->servicioClienteModel->upsertTarifaAcabado($id, $data["tarifa_acabado_id"]);
|
|
||||||
}else{
|
|
||||||
$this->servicioClienteModel->detachTarifas($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->response->setJSON(["message" => lang("App.global_success"), "status" => $status]);
|
|
||||||
}
|
|
||||||
public function store()
|
|
||||||
{
|
|
||||||
// $this->servicioClienteModel->update($id,[$this->request->getPost()]);
|
|
||||||
return $this->response->setJSON([]);
|
|
||||||
}
|
|
||||||
public function datatable()
|
|
||||||
{
|
|
||||||
$query = $this->servicioClienteModel->getQueryDatatable()->orderBy("created_at", "DESC");
|
|
||||||
return DataTable::of($query)
|
|
||||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
|
||||||
->add("action", fn($q) => $q->id)
|
|
||||||
->toJson(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -695,7 +695,7 @@ return [
|
|||||||
"menu_papelgenerico" => "Papel generico",
|
"menu_papelgenerico" => "Papel generico",
|
||||||
"menu_papelimpresion" => "Papel impresión",
|
"menu_papelimpresion" => "Papel impresión",
|
||||||
"menu_series_facturas" => "Series facturas",
|
"menu_series_facturas" => "Series facturas",
|
||||||
"menu_servicios_cliente" => "Servicios cliente",
|
"menu_maquina_tareas" => "Tareas máquinas",
|
||||||
"menu_ubicaciones" => "Ubicaciones",
|
"menu_ubicaciones" => "Ubicaciones",
|
||||||
"menu_serviciocliente" => "Servicio cliente",
|
"menu_serviciocliente" => "Servicio cliente",
|
||||||
"menu_tamanioformatos" => "Tamaño formatos",
|
"menu_tamanioformatos" => "Tamaño formatos",
|
||||||
|
|||||||
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"cardTitle" => "Servicios cliente",
|
"cardTitle" => "Máquina tareas",
|
||||||
|
"tarea_new" => "Crear tarea",
|
||||||
"infoTarifaManipulado" => "La tarifa seleccionada estará asociada al servicio.",
|
"infoTarifaManipulado" => "La tarifa seleccionada estará asociada al servicio.",
|
||||||
"infoTarifaAcabado" => "La tarifa seleccionada estará asociada al servicio.",
|
"infoTarifaAcabado" => "La tarifa seleccionada estará asociada al servicio.",
|
||||||
|
|
||||||
"datatable" => [
|
"datatable" => [
|
||||||
"nombre" => "Nombre",
|
"nombre" => "Nombre",
|
||||||
"code" => "Código",
|
"description" => "Descripción",
|
||||||
"created_at" => "Fecha creación",
|
"created_at" => "Fecha creación",
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -3,6 +3,9 @@
|
|||||||
namespace App\Models\Configuracion;
|
namespace App\Models\Configuracion;
|
||||||
|
|
||||||
use App\Entities\Tarifas\Maquinas\TareaMaquinaEntity;
|
use App\Entities\Tarifas\Maquinas\TareaMaquinaEntity;
|
||||||
|
use CodeIgniter\Database\BaseBuilder;
|
||||||
|
use CodeIgniter\Database\MySQLi\Builder;
|
||||||
|
use CodeIgniter\Database\Query;
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
class MaquinaTareaModel extends Model
|
class MaquinaTareaModel extends Model
|
||||||
@ -55,14 +58,19 @@ class MaquinaTareaModel extends Model
|
|||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function getSelectQuery(?string $q = null) : array
|
public function getSelectQuery(?string $q = null): array
|
||||||
{
|
{
|
||||||
$query = $this->builder()->select(["id","name","description"])
|
$query = $this->builder()->select(["id", "name", "description"])
|
||||||
->where("deleted_at",null);
|
->where("deleted_at", null);
|
||||||
if($q){
|
if ($q) {
|
||||||
$query->like("nombre",$q);
|
$query->like("nombre", $q);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query->get()->getResultArray();
|
return $query->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
public function getQueryDatatable(): BaseBuilder
|
||||||
|
{
|
||||||
|
return $this->builder()->select(["id","name","description","created_at"])
|
||||||
|
->where("deleted_at", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
<form class="form-control" id="<?= $id ?>" data-id="<?= $model?->id ?>">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<!-- Servicio cliente nombre-->
|
||||||
|
<div class="col-xs-12 col-md-12 col-lg-12 mb-2">
|
||||||
|
<label for="servicio-cliente-nombre" class="form-label"><?= @lang("MaquinaTarea.datatable.nombre") ?></label>
|
||||||
|
<input type="text" class="form-control" name="name" id="maquina-tarea-nombre">
|
||||||
|
</div>
|
||||||
|
<!-- Servicio cliente code-->
|
||||||
|
<div class="col-xs-12 col-md-12 col-lg-12 mb-2">
|
||||||
|
<label for="servicio-cliente-code" class="form-label"><?= @lang("MaquinaTarea.datatable.description") ?></label>
|
||||||
|
<textarea type="text" rows="5" cols="5" class="form-control" name="description" id="maquina-tarea-description"></textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-md-12 d-flex justify-content-start gap-4">
|
||||||
|
<button type="button" class="btn btn-primary btn-md d-none" id="btn-new-maquina-tarea"><?= lang("App.global_save") ?></button>
|
||||||
|
<button type="button" class="btn btn-primary btn-md d-none" id="btn-update-maquina-tarea"><?= lang("App.global_save") ?></button>
|
||||||
|
<a href="<?= route_to("maquinaTareaList")?>" type="button" class="btn btn-secondary btn-md d-none" id="btn-come-back"><?= lang("App.global_come_back") ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -1,61 +0,0 @@
|
|||||||
<form class="form-control" id="<?= $id ?>" data-id="<?= $model->id ?>">
|
|
||||||
<div class="row mb-2">
|
|
||||||
<!-- Servicio cliente nombre-->
|
|
||||||
<div class="col-xs-12 col-md-6 col-lg-6 mb-2">
|
|
||||||
<label for="servicio-cliente-nombre" class="form-label"><?= @lang("ServicioCliente.datatable.nombre") ?></label>
|
|
||||||
<input type="text" class="form-control" name="nombre" id="servicio-cliente-nombre">
|
|
||||||
</div>
|
|
||||||
<!-- Servicio cliente code-->
|
|
||||||
<div class="col-xs-12 col-md-6 col-lg-6 mb-2">
|
|
||||||
<label for="servicio-cliente-code" class="form-label"><?= @lang("ServicioCliente.datatable.code") ?></label>
|
|
||||||
<input type="text" class="form-control" name="code" id="servicio-cliente-code">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Tarifa acabado asociada a servicio -->
|
|
||||||
<div class="col-xs-12 col-md-8 col-lg-6 mb-2" id="container-tarifa-acabado-select">
|
|
||||||
<label for="servicio-cliente-tarifa-acabado" class="form-label"><?= @lang("Tarifaacabado.tarifaacabado") ?></label>
|
|
||||||
<select class="select2 form-select" name="tarifa_acabado_id" id="servicio-cliente-tarifa-acabado" placeholder="<?= @lang("Tarifaacabado.tarifasacabado") ?>">
|
|
||||||
</select>
|
|
||||||
<div class="form-text"><?= @lang("ServicioCliente.infoTarifaAcabado") ?></div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Tarifa manipulado asociada a servicio-->
|
|
||||||
<div class="col-xs-12 col-md-8 col-lg-6 mb-2 d-none" id="container-tarifa-manipulado-select">
|
|
||||||
<label for="servicio-cliente-tarifa-manipulado" class="form-label"><?= @lang("Tarifamanipulado.tarifamanipulado") ?></label>
|
|
||||||
<select class="select2 form-select" name="tarifa_manipulado_id" id="servicio-cliente-tarifa-manipulado" placeholder="<?= @lang("Tarifamanipulado.tarifasmanipulado") ?>">
|
|
||||||
</select>
|
|
||||||
<div class="form-text"><?= @lang("ServicioCliente.infoTarifaManipulado") ?></div>
|
|
||||||
</div>
|
|
||||||
<!-- Check tarifa acabado o manipulado -->
|
|
||||||
<div class="col-xs-12 col-md-4 col-lg-6 mb-2">
|
|
||||||
<div class="text-light small fw-medium mb-2">Seleccione tipo de tarifa</div>
|
|
||||||
<div class="switches-stacked">
|
|
||||||
<label class="switch">
|
|
||||||
<input type="radio" class="switch-input" id="check-tarifa-acabado" name="switches-stacked-radio" checked />
|
|
||||||
<span class="switch-toggle-slider">
|
|
||||||
<span class="switch-on"></span>
|
|
||||||
<span class="switch-off"></span>
|
|
||||||
</span>
|
|
||||||
<span class="switch-label"><?= @lang("Tarifaacabado.tarifasacabado") ?></span>
|
|
||||||
</label>
|
|
||||||
<label class="switch">
|
|
||||||
<input type="radio" class="switch-input" id="check-tarifa-manipulado" name="switches-stacked-radio" />
|
|
||||||
<span class="switch-toggle-slider">
|
|
||||||
<span class="switch-on"></span>
|
|
||||||
<span class="switch-off"></span>
|
|
||||||
</span>
|
|
||||||
<span class="switch-label"><?= @lang("Tarifamanipulado.tarifasmanipulado") ?></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-md-12 d-flex justify-content-start gap-4">
|
|
||||||
<button type="button" class="btn btn-primary btn-md d-none" id="btn-new-servicio-cliente"><?= lang("App.global_save") ?></button>
|
|
||||||
<button type="button" class="btn btn-primary btn-md d-none" id="btn-update-servicio-cliente"><?= lang("App.global_save") ?></button>
|
|
||||||
<button type="button" class="btn btn-secondary btn-md"><?= lang("App.global_come_back") ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('ServicioCliente.datatable.nombre') ?></th>
|
<th><?= lang('MaquinaTarea.datatable.nombre') ?></th>
|
||||||
<th><?= lang('ServicioCliente.datatable.code') ?></th>
|
<th><?= lang('MaquinaTarea.datatable.description') ?></th>
|
||||||
<th><?= lang('ServicioCliente.datatable.created_at') ?></th>
|
<th><?= lang('MaquinaTarea.datatable.created_at') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?= lang('ServicioCliente.cardTitle') ?></h3>
|
<h3 class="card-title"><?= $model->name ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<!--//.card-header -->
|
<!--//.card-header -->
|
||||||
<div class="card-body" id="serviciosClienteCard">
|
<div class="card-body" id="serviciosClienteCard">
|
||||||
|
|
||||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
|
|
||||||
<?= view('themes/vuexy/components/forms/servicio_cliente', ["id" => "formServicioCliente"]); ?>
|
<?= view('themes/vuexy/components/forms/maquina_tarea', ["id" => "maquina-tarea-form", "model" => $model]); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--//.card-body -->
|
<!--//.card-body -->
|
||||||
@ -31,7 +31,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--//.row -->
|
<!--//.row -->
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('css') ?>
|
||||||
|
<link rel="stylesheet" href="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.css") ?>" />
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/configuracion/servicio_cliente/edit.js") ?>">
|
<script type="module" src="<?= site_url("assets/js/safekat/pages/configuracion/maquina_tarea/edit.js") ?>"></script>
|
||||||
</script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||||
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
|
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content'); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
<div class="card card-info">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><?= lang('MaquinaTarea.cardTitle') ?></h3>
|
||||||
|
</div>
|
||||||
|
<!--//.card-header -->
|
||||||
|
<div class="card-body" id="maquinaTareaCard">
|
||||||
|
|
||||||
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
|
<div class="col-md-12 d-flex justify-content-end">
|
||||||
|
<button type="button" class="btn-primary btn btn-md" id="btn-maquina-tarea-new">
|
||||||
|
<i class="ti ti-plus ti-xs"></i> <?= lang("MaquinaTarea.tarea_new") ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?= view('themes/vuexy/components/tables/maquina_tarea_table', ["id" => "maquina-tarea-datatable"]); ?>
|
||||||
|
<div class="modal fade" id="modalNewMaquinaTarea" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3><?= lang("MaquinaTarea.tarea_new") ?></h3>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<?= view('themes/vuexy/components/forms/maquina_tarea', ["id" => "maquina-tarea-form", "model" => null]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--//.card-footer -->
|
||||||
|
</div>
|
||||||
|
<!--//.card -->
|
||||||
|
</div>
|
||||||
|
<!--//.col -->
|
||||||
|
</div>
|
||||||
|
<!--//.row -->
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
<?= $this->section('css') ?>
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
|
<script type="module" src="<?= site_url("assets/js/safekat/pages/configuracion/maquina_tarea/index.js") ?>"></script>
|
||||||
|
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -1,37 +0,0 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
|
||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
|
||||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
|
||||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
|
||||||
|
|
||||||
<?= $this->section('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
|
|
||||||
<div class="card card-info">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><?= lang('ServicioCliente.cardTitle') ?></h3>
|
|
||||||
</div>
|
|
||||||
<!--//.card-header -->
|
|
||||||
<div class="card-body" id="serviciosClienteCard">
|
|
||||||
|
|
||||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
|
||||||
|
|
||||||
<?= view('themes/vuexy/components/tables/servicios_cliente_table', ["id" => "tableServiciosCliente"]); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--//.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--//.card-footer -->
|
|
||||||
</div>
|
|
||||||
<!--//.card -->
|
|
||||||
</div>
|
|
||||||
<!--//.col -->
|
|
||||||
</div>
|
|
||||||
<!--//.row -->
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
|
||||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/configuracion/servicio_cliente/index.js") ?>">
|
|
||||||
</script>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -63,6 +63,13 @@ if (
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
||||||
|
<li class="menu-item">
|
||||||
|
<a href="<?= route_to("maquinaTareaList") ?>" class="menu-link">
|
||||||
|
<?= lang("App.menu_maquina_tareas") ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('usuarios.menu')) { ?>
|
<?php if (auth()->user()->can('usuarios.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
||||||
@ -98,13 +105,7 @@ if (
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
|
||||||
<li class="menu-item">
|
|
||||||
<a href="<?= route_to("servicioClienteList") ?>" class="menu-link">
|
|
||||||
<?= lang("App.menu_servicios_cliente") ?>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
|
||||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
|
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
|
||||||
|
|||||||
@ -18,3 +18,13 @@ export const alertConfirmationDelete = (title,type="primary") => {
|
|||||||
buttonsStyling: false
|
buttonsStyling: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const alertSuccessMessage = (title,type="primary") => {
|
||||||
|
return Swal.fire({
|
||||||
|
showCancelButton: false,
|
||||||
|
showConfirmButton : false,
|
||||||
|
title: title,
|
||||||
|
text: title,
|
||||||
|
icon: "success"
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
import Ajax from "../ajax.js";
|
||||||
|
import { alertConfirmationDelete, alertSuccessMessage } from "../alerts/sweetAlert.js";
|
||||||
|
|
||||||
|
class MaquinaTareaDatatable {
|
||||||
|
constructor(domItem) {
|
||||||
|
this.datatableItem = domItem
|
||||||
|
this.datatableColumns = [
|
||||||
|
{ data: 'name', searchable: true, sortable: true },
|
||||||
|
{ data: 'description', searchable: true, sortable: true },
|
||||||
|
{ data: 'created_at', searchable: true, sortable: true },
|
||||||
|
{
|
||||||
|
data: 'action', searchable: false, sortable: false,
|
||||||
|
render: (d, t) => {
|
||||||
|
return `<div class="btn-group btn-group-sm">
|
||||||
|
<a href="/configuracion/maquina-tareas/edit/${d}" class="maquina-tarea-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
||||||
|
<a type="button" data-id="${d}" class="maquina-tarea-delete"><i class="ti ti-trash ti-sm mx-2"></i></a>
|
||||||
|
|
||||||
|
</div>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
init() {
|
||||||
|
this.datatableItem.on('click','.maquina-tarea-delete',this.onDelete.bind(this))
|
||||||
|
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: '/configuracion/maquina-tareas/datatable'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onDelete(event){
|
||||||
|
const modelId = $(event.currentTarget).data("id");
|
||||||
|
alertConfirmationDelete("¿Estás seguro de realizar esta acción?").then(result => {
|
||||||
|
if(result.isConfirmed){
|
||||||
|
this.handleDeleteMaquinaTarea(modelId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
handleDeleteMaquinaTarea(modelId){
|
||||||
|
const ajax = new Ajax('/configuracion/maquina-tareas/' + modelId,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
(response) => {
|
||||||
|
alertSuccessMessage(response.message)
|
||||||
|
this.datatable.ajax.reload()
|
||||||
|
},
|
||||||
|
null
|
||||||
|
)
|
||||||
|
ajax.delete()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MaquinaTareaDatatable;
|
||||||
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
class ServicioClienteDatatable {
|
|
||||||
constructor(domItem) {
|
|
||||||
this.datatableItem = domItem
|
|
||||||
|
|
||||||
this.datatableColumns = [
|
|
||||||
{ data: 'nombre', searchable: true, sortable: true },
|
|
||||||
{ data: 'code', searchable: true, sortable: true },
|
|
||||||
{ data: 'created_at', searchable: true, sortable: true },
|
|
||||||
{
|
|
||||||
data: 'action', searchable: false, sortable: false,
|
|
||||||
render: (d, t) => {
|
|
||||||
return `<div class="btn-group btn-group-sm">
|
|
||||||
<a href="/configuracion/servicios/edit/${d}" class="servicio-cliente-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
|
||||||
</div>`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
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: '/configuracion/servicios/datatable'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ServicioClienteDatatable;
|
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
import Ajax from '../ajax.js'
|
||||||
|
import { alertSuccessMessage } from '../alerts/sweetAlert.js'
|
||||||
|
import ClassSelect from '../select2.js'
|
||||||
|
class MaquinaTareaForm {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} domItem jQuery item of the form html element
|
||||||
|
*/
|
||||||
|
constructor(domItem) {
|
||||||
|
this.item = domItem
|
||||||
|
this.btnNew = this.item.find("#btn-new-maquina-tarea")
|
||||||
|
this.btnUpdate = this.item.find("#btn-update-maquina-tarea")
|
||||||
|
this.btnComeBack = this.item.find("#btn-come-back")
|
||||||
|
|
||||||
|
}
|
||||||
|
init() {
|
||||||
|
this.modelId = this.item.data('id')
|
||||||
|
this.uri = `/configuracion/maquina-tareas/${this.modelId}`
|
||||||
|
this.uriUpdate = `/configuracion/maquina-tareas/update/${this.modelId}`
|
||||||
|
this.uriPost = `/configuracion/maquina-tareas`
|
||||||
|
this.btnNew.on("click", this.handlePost.bind(this))
|
||||||
|
this.btnUpdate.on("click", this.handlePut.bind(this))
|
||||||
|
this.handleGet()
|
||||||
|
this.btnUpdate.removeClass("d-none")
|
||||||
|
this.btnComeBack.removeClass("d-none")
|
||||||
|
|
||||||
|
}
|
||||||
|
initNew(){
|
||||||
|
this.uri = `/configuracion/maquina-tareas`
|
||||||
|
this.btnNew.on("click", this.handlePost.bind(this))
|
||||||
|
this.btnNew.removeClass("d-none")
|
||||||
|
}
|
||||||
|
handleGet() {
|
||||||
|
const ajax = new Ajax(
|
||||||
|
this.uri,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
this.handleGetSuccess.bind(this),
|
||||||
|
this.handleGetError.bind(this)
|
||||||
|
)
|
||||||
|
ajax.get()
|
||||||
|
}
|
||||||
|
handleGetSuccess(data) {
|
||||||
|
this.item.find('[name="name"]').val(data.name)
|
||||||
|
this.item.find('[name="description"]').val(data.description)
|
||||||
|
|
||||||
|
}
|
||||||
|
handleGetError(e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
handlePost() {
|
||||||
|
let bodyData = this.getFormData()
|
||||||
|
const ajax = new Ajax(
|
||||||
|
this.uriPost,
|
||||||
|
bodyData,
|
||||||
|
null,
|
||||||
|
this.handlePostSuccess.bind(this),
|
||||||
|
this.handlePostError.bind(this)
|
||||||
|
)
|
||||||
|
ajax.post()
|
||||||
|
}
|
||||||
|
handlePostSuccess(data) {
|
||||||
|
alertSuccessMessage(data.message)
|
||||||
|
$("#modalNewMaquinaTarea").modal('toggle')
|
||||||
|
}
|
||||||
|
handlePostError() { }
|
||||||
|
handlePut() {
|
||||||
|
let bodyData = this.getFormData()
|
||||||
|
const ajax = new Ajax(
|
||||||
|
this.uriUpdate,
|
||||||
|
bodyData,
|
||||||
|
null,
|
||||||
|
this.handlePutSuccess.bind(this),
|
||||||
|
this.handlePutError.bind(this)
|
||||||
|
)
|
||||||
|
ajax.post()
|
||||||
|
}
|
||||||
|
handlePutSuccess(data) {
|
||||||
|
// this.item.reset()
|
||||||
|
alertSuccessMessage(data.message)
|
||||||
|
this.handleGet(data)
|
||||||
|
}
|
||||||
|
handlePutError() { }
|
||||||
|
|
||||||
|
getFormData() {
|
||||||
|
let data = {}
|
||||||
|
this.item.serializeArray().forEach((e) => {
|
||||||
|
data[e.name] = e.value
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default MaquinaTareaForm
|
||||||
@ -1,125 +0,0 @@
|
|||||||
import Ajax from '../ajax.js'
|
|
||||||
import ClassSelect from '../select2.js'
|
|
||||||
|
|
||||||
class ServicioClienteForm {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {*} domItem jQuery item of the form html element
|
|
||||||
*/
|
|
||||||
constructor(domItem) {
|
|
||||||
this.item = domItem
|
|
||||||
this.btnNew = this.item.find("#btn-new-servicio-cliente")
|
|
||||||
this.btnUpdate = this.item.find("#btn-update-servicio-cliente")
|
|
||||||
this.selectItemTarifaAcabado = this.item.find("#servicio-cliente-tarifa-acabado")
|
|
||||||
this.selectItemTarifaManipulado = this.item.find("#servicio-cliente-tarifa-manipulado")
|
|
||||||
this.selectTarifaAcabado = new ClassSelect(this.selectItemTarifaAcabado, '/tarifas/acabados/select', "Seleccione una tarifa", true)
|
|
||||||
this.selectTarifaManipulado = new ClassSelect(this.selectItemTarifaManipulado, '/tarifasmanipulado/select', "Seleccione una tarifa", true)
|
|
||||||
this.checkTarifaAcabado = this.item.find("#check-tarifa-acabado")
|
|
||||||
this.checkTarifaManipulado = this.item.find("#check-tarifa-manipulado")
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
init() {
|
|
||||||
this.modelId = this.item.data('id')
|
|
||||||
this.uri = `/configuracion/servicios/${this.modelId}`
|
|
||||||
this.uriUpdate = `/configuracion/servicios/update/${this.modelId}`
|
|
||||||
this.uriPost = `/configuracion/servicios`
|
|
||||||
this.btnNew.on("click", this.handlePost.bind(this))
|
|
||||||
this.btnUpdate.on("click", this.handlePut.bind(this))
|
|
||||||
this.handleGet()
|
|
||||||
this.selectTarifaAcabado.init()
|
|
||||||
this.selectTarifaManipulado.init()
|
|
||||||
this.btnUpdate.removeClass("d-none")
|
|
||||||
this.checkTarifaAcabado.change(() => {
|
|
||||||
console.log("Acabado", this.checkTarifaAcabado.is(":checked"))
|
|
||||||
if (this.checkTarifaAcabado.is(":checked")) {
|
|
||||||
this.item.find("#container-tarifa-acabado-select").removeClass("d-none")
|
|
||||||
this.item.find("#container-tarifa-manipulado-select").addClass("d-none")
|
|
||||||
} else {
|
|
||||||
this.item.find("#container-tarifa-acabado-select").addClass("d-none")
|
|
||||||
this.item.find("#container-tarifa-manipulado-select").removeClass("d-none")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.checkTarifaManipulado.change(() => {
|
|
||||||
console.log("Manipulado", this.checkTarifaManipulado.is(":checked"))
|
|
||||||
if (this.checkTarifaManipulado.is(":checked")) {
|
|
||||||
this.item.find("#container-tarifa-acabado-select").addClass("d-none")
|
|
||||||
this.item.find("#container-tarifa-manipulado-select").removeClass("d-none")
|
|
||||||
} else {
|
|
||||||
this.item.find("#container-tarifa-acabado-select").removeClass("d-none")
|
|
||||||
this.item.find("#container-tarifa-manipulado-select").addClass("d-none")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
handleGet() {
|
|
||||||
const ajax = new Ajax(
|
|
||||||
this.uri,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
this.handleGetSuccess.bind(this),
|
|
||||||
this.handleGetError.bind(this)
|
|
||||||
)
|
|
||||||
ajax.get()
|
|
||||||
}
|
|
||||||
handleGetSuccess(data) {
|
|
||||||
this.item.find('[name="nombre"]').val(data.nombre)
|
|
||||||
this.item.find('[name="code"]').val(data.code)
|
|
||||||
if(data?.tarifas_acabado){
|
|
||||||
this.selectTarifaAcabado.setOption(data.tarifas_acabado.id,data.tarifas_acabado.nombre)
|
|
||||||
this.checkTarifaAcabado.prop("checked",true)
|
|
||||||
this.checkTarifaAcabado.trigger("change")
|
|
||||||
this.selectTarifaManipulado.reset()
|
|
||||||
}
|
|
||||||
if(data?.tarifas_manipulado){
|
|
||||||
this.checkTarifaManipulado.prop("checked",true)
|
|
||||||
this.selectTarifaManipulado.setOption(data.tarifas_manipulado.id,data.tarifas_manipulado.nombre)
|
|
||||||
this.checkTarifaManipulado.trigger("change")
|
|
||||||
this.selectTarifaAcabado.reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
handleGetError(e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
handlePost() {
|
|
||||||
let bodyData = this.getFormData()
|
|
||||||
const ajax = new Ajax(
|
|
||||||
this.uriPost,
|
|
||||||
bodyData,
|
|
||||||
null,
|
|
||||||
this.handlePostSuccess.bind(this),
|
|
||||||
this.handlePostError.bind(this)
|
|
||||||
)
|
|
||||||
ajax.post()
|
|
||||||
}
|
|
||||||
handlePostSuccess() {
|
|
||||||
this.item.reset()
|
|
||||||
}
|
|
||||||
handlePostError() { }
|
|
||||||
handlePut() {
|
|
||||||
let bodyData = this.getFormData()
|
|
||||||
const ajax = new Ajax(
|
|
||||||
this.uriUpdate,
|
|
||||||
bodyData,
|
|
||||||
null,
|
|
||||||
this.handlePutSuccess.bind(this),
|
|
||||||
this.handlePutError.bind(this)
|
|
||||||
)
|
|
||||||
ajax.post()
|
|
||||||
}
|
|
||||||
handlePutSuccess(data) {
|
|
||||||
// this.item.reset()
|
|
||||||
this.handleGet(data)
|
|
||||||
}
|
|
||||||
handlePutError() { }
|
|
||||||
|
|
||||||
getFormData() {
|
|
||||||
let data = {}
|
|
||||||
this.item.serializeArray().forEach((e) => {
|
|
||||||
data[e.name] = e.value
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default ServicioClienteForm
|
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import MaquinaTareaForm from '../../../components/forms/maquinaTareaForm.js'
|
||||||
|
|
||||||
|
$(() => {
|
||||||
|
const maquinaTareaForm = new MaquinaTareaForm($("#maquina-tarea-form"))
|
||||||
|
maquinaTareaForm.init()
|
||||||
|
})
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
import MaquinaTareaDatatable from '../../../components/datatables/MaquinaTareaDatatable.js'
|
||||||
|
import MaquinaTareaForm from '../../../components/forms/maquinaTareaForm.js'
|
||||||
|
import Modal from '../../../components/modal.js'
|
||||||
|
|
||||||
|
const maquinaTareaDatatable = new MaquinaTareaDatatable($("#maquina-tarea-datatable"))
|
||||||
|
maquinaTareaDatatable.init()
|
||||||
|
const maquinaTareaForm = new MaquinaTareaForm($("#maquina-tarea-form"))
|
||||||
|
maquinaTareaForm.initNew()
|
||||||
|
const modal = new Modal($("#modalNewMaquinaTarea"))
|
||||||
|
|
||||||
|
$("#btn-maquina-tarea-new").on('click',() => {
|
||||||
|
modal.show()
|
||||||
|
modal.item.on("hidden.bs.modal",() => {
|
||||||
|
maquinaTareaDatatable.datatable.ajax.reload()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import ServicioClienteForm from '../../../components/forms/servicioClienteForm.js'
|
|
||||||
|
|
||||||
$(document).ready(() => {
|
|
||||||
const formServicioCliente = new ServicioClienteForm($("#formServicioCliente"))
|
|
||||||
formServicioCliente.init()
|
|
||||||
})
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
import ServicioClienteDatatable from '../../../components/datatables/ServicioClienteDatatable.js'
|
|
||||||
|
|
||||||
const servicioClienteDatatable = new ServicioClienteDatatable($("#tableServiciosCliente"))
|
|
||||||
servicioClienteDatatable.init()
|
|
||||||
Reference in New Issue
Block a user