mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el formulario maquinas
This commit is contained in:
@ -224,6 +224,36 @@ $routes->group('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas']
|
||||
$routes->resource('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaacabadolineas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinas::index', ['as' => 'maquinaList']);
|
||||
$routes->get('add', 'Maquinas::add', ['as' => 'newMaquina']);
|
||||
$routes->post('add', 'Maquinas::add', ['as' => 'createMaquina']);
|
||||
$routes->post('create', 'Maquinas::create', ['as' => 'ajaxCreateMaquina']);
|
||||
$routes->put('update/(:num)', 'Maquinas::update/$1', ['as' => 'ajaxUpdateMaquina']);
|
||||
$routes->post('edit/(:num)', 'Maquinas::edit/$1', ['as' => 'updateMaquina']);
|
||||
$routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
|
||||
$routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
|
||||
$routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
|
||||
});
|
||||
$routes->resource('maquinas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinastarifasimpresion::index', ['as' => 'maquinasTarifaImpresionList']);
|
||||
$routes->get('add', 'Maquinastarifasimpresion::add', ['as' => 'newMaquinasTarifaImpresion']);
|
||||
$routes->post('add', 'Maquinastarifasimpresion::add', ['as' => 'createMaquinasTarifaImpresion']);
|
||||
$routes->post('create', 'Maquinastarifasimpresion::create', ['as' => 'ajaxCreateMaquinasTarifaImpresion']);
|
||||
$routes->put('(:num)/update', 'Maquinastarifasimpresion::update/$1', ['as' => 'ajaxUpdateMaquinasTarifaImpresion']);
|
||||
$routes->post('(:num)/edit', 'Maquinastarifasimpresion::edit/$1', ['as' => 'updateMaquinasTarifaImpresion']);
|
||||
$routes->post('datatable_editor', 'Maquinastarifasimpresion::datatable_editor', ['as' => 'editorOfMaquinasTarifaImpresion']);
|
||||
$routes->post('datatable', 'Maquinastarifasimpresion::datatable', ['as' => 'dataTableOfMaquinasTarifasImpresion']);
|
||||
$routes->post('allmenuitems', 'Maquinastarifasimpresion::allItemsSelect', ['as' => 'select2ItemsOfMaquinasTarifasImpresion']);
|
||||
$routes->post('menuitems', 'Maquinastarifasimpresion::menuItems', ['as' => 'menuItemsOfMaquinasTarifasImpresion']);
|
||||
});
|
||||
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
|
||||
$routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->get('', 'Profile::index', ['as' => 'profileList']);
|
||||
$routes->get('index', 'Profile::index', ['as' => 'profileIndex']);
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Maquina extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Maquina';
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
328
ci4/app/Controllers/Configuracion/Maquinas.php
Normal file
328
ci4/app/Controllers/Configuracion/Maquinas.php
Normal file
@ -0,0 +1,328 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
class Maquinas extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
protected $modelName = MaquinaModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Maquina';
|
||||
protected static $singularObjectNameCc = 'maquina';
|
||||
protected static $pluralObjectName = 'Maquinas';
|
||||
protected static $pluralObjectNameCc = 'maquinas';
|
||||
|
||||
protected static $controllerSlug = 'maquinas';
|
||||
|
||||
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/maquinas/';
|
||||
|
||||
protected $indexRoute = 'maquinaList';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
$this->viewData['pageTitle'] = lang('Maquinas.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Se indica que este controlador trabaja con soft_delete
|
||||
$this->soft_delete = true;
|
||||
// Se indica el flag para los ficheros borrados
|
||||
$this->delete_flag = 1;
|
||||
|
||||
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index() {
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Maquinas.maquina')]),
|
||||
'maquina' => new Maquina(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath.'viewMaquinaList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add() {
|
||||
|
||||
// JJO
|
||||
$session = session();
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_created_id'] = $session->id_user;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.';
|
||||
$message .= anchor( "maquinas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('configuracion/maquinas/edit/'.$id))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['maquina'] = isset($sanitizedData) ? new Maquina($sanitizedData) : new Maquina();
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($maquina->padre_id ?? null);
|
||||
$this->viewData['tipoList'] = $this->getTipoOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createMaquina');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Maquinas.moduleTitle').' '.lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null) {
|
||||
|
||||
// JJO
|
||||
$session = session();
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$maquina = $this->model->find($id);
|
||||
|
||||
if ($maquina == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Maquinas.maquina')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
if ($this->request->getPost('is_padre') == null ) {
|
||||
$sanitizedData['is_padre'] = false;
|
||||
}
|
||||
if ($this->request->getPost('is_rotativa') == null ) {
|
||||
$sanitizedData['is_rotativa'] = false;
|
||||
}
|
||||
if ($this->request->getPost('is_tinta') == null ) {
|
||||
$sanitizedData['is_tinta'] = false;
|
||||
}
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$maquina->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = true;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $maquina->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.';
|
||||
$message .= anchor( "maquinas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['maquina'] = $maquina;
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($maquina->padre_id ?? null);
|
||||
$this->viewData['tipoList'] = $this->getTipoOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateMaquina', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Maquinas.moduleTitle').' '.lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
|
||||
public function datatable() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = MaquinaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
foreach ($resourceData as $item) :
|
||||
if (isset($item->observaciones) && strlen($item->observaciones) > 100) :
|
||||
$item->observaciones = character_limiter($item->observaciones, 100);
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->nombre = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getMaquinaListItems($selId = null) {
|
||||
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
|
||||
if (!empty($selId)) :
|
||||
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getTipoOptions() {
|
||||
$tipoOptions = [
|
||||
'' => lang('Basic.global.pleaseSelect'),
|
||||
'impresion' => 'impresion',
|
||||
'manipulado' => 'manipulado',
|
||||
'acabado' => 'acabado',
|
||||
];
|
||||
return $tipoOptions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Configuracion\MaquinasTarifasImpresionEntity;
|
||||
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
|
||||
class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
public function datatable_maquinas() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = MaquinasTarifasImpresionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
// el primer dato representa el uso y el segundo el tipo
|
||||
$tarifas = $reqData['tarifas'] ?? null;
|
||||
// Para saber si el papel que se tiene que mostrar es para rotativa
|
||||
$isRotativa= $reqData['isRotativa'] ?? false;
|
||||
|
||||
$resourceData = $this->model->getResource("", $tarifas, $isRotativa)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
423
ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
Normal file
423
ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
Normal file
@ -0,0 +1,423 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Configuracion\MaquinasTarifasImpresionEntity;
|
||||
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
|
||||
class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
protected $modelName = MaquinasTarifasImpresionModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Maquinas Tarifa Impresion';
|
||||
protected static $singularObjectNameCc = 'maquinasTarifaImpresion';
|
||||
protected static $pluralObjectName = 'Maquinas Tarifas Impresion';
|
||||
protected static $pluralObjectNameCc = 'maquinasTarifasImpresion';
|
||||
|
||||
protected static $controllerSlug = 'maquinastarifasimpresion';
|
||||
|
||||
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/maquinas/';
|
||||
|
||||
protected $indexRoute = 'maquinasTarifaImpresionList';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
$this->viewData['pageTitle'] = lang('MaquinasTarifasImpresions.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index() {
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')]),
|
||||
'maquinasTarifasImpresion' => new MaquinasTarifasImpresion(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath.'viewMaquinasTarifaImpresionList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add() {
|
||||
|
||||
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.';
|
||||
$message .= anchor( "maquinastarifasimpresion/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['maquinasTarifasImpresion'] = isset($sanitizedData) ? new MaquinasTarifasImpresion($sanitizedData) : new MaquinasTarifasImpresion();
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($maquinasTarifasImpresion->maquina_id ?? null);
|
||||
$this->viewData['tipoList'] = $this->getTipoOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createMaquinasTarifaImpresion');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('MaquinasTarifasImpresions.moduleTitle').' '.lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null) {
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$maquinasTarifasImpresion = $this->model->find($id);
|
||||
|
||||
if ($maquinasTarifasImpresion == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
if ($this->request->getPost('predeterminado') == null ) {
|
||||
$sanitizedData['predeterminado'] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$maquinasTarifasImpresion->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = true;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $maquinasTarifasImpresion->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.';
|
||||
$message .= anchor( "maquinastarifasimpresion/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['maquinasTarifasImpresion'] = $maquinasTarifasImpresion;
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($maquinasTarifasImpresion->maquina_id ?? null);
|
||||
$this->viewData['tipoList'] = $this->getTipoOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateMaquinasTarifaImpresion', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('MaquinasTarifasImpresions.moduleTitle').' '.lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function datatable_editor() {
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst( $db, 'lg_maquinas_tarifas_impresion' )
|
||||
->fields(
|
||||
Field::inst( 'uso' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.uso.required') )
|
||||
),
|
||||
Field::inst( 'tipo' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
||||
),
|
||||
Field::inst( 'precio' )
|
||||
->validator( 'Validate::numeric', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal') )
|
||||
)
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
||||
),
|
||||
Field::inst( 'predeterminado' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
||||
),
|
||||
Field::inst( 'maquina_id' ),
|
||||
Field::inst( 'user_created_id' ),
|
||||
Field::inst( 'created_at' ),
|
||||
Field::inst( 'user_updated_id' ),
|
||||
Field::inst( 'updated_at' ),
|
||||
Field::inst( 'is_deleted' ),
|
||||
Field::inst( 'deleted_at' ),
|
||||
|
||||
)
|
||||
->validator( function($editor, $action, $data){
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||
foreach ($data['data'] as $pkey => $values ){
|
||||
// Si no se quiere borrar...
|
||||
if($data['data'][$pkey]['is_deleted'] != 1)
|
||||
{
|
||||
|
||||
$builder = $this->model->select('*')
|
||||
->where(array(
|
||||
'maquina_id'=> $values['maquina_id'],
|
||||
'tipo'=> $values['tipo'],
|
||||
'uso'=> $values['uso'],
|
||||
'is_deleted'=> 0));
|
||||
|
||||
if ($builder->countAllResults() >= 1){
|
||||
if(($action === Editor::ACTION_EDIT && $builder->get()->getFirstRow()->id != $pkey)
|
||||
|| $action === Editor::ACTION_CREATE)
|
||||
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->on( 'preCreate', function ( $editor, &$values ) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field( 'user_created_id' )
|
||||
->setValue( $session->id_user );
|
||||
$editor
|
||||
->field( 'created_at' )
|
||||
->setValue( $datetime->format('Y-m-d H:i:s') );
|
||||
} )
|
||||
->on( 'preEdit', function ( $editor, &$values ) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field( 'user_updated_id' )
|
||||
->setValue( $session->id_user );
|
||||
$editor
|
||||
->field( 'updated_at' )
|
||||
->setValue( $datetime->format('Y-m-d H:i:s') );
|
||||
} )
|
||||
->debug(true)
|
||||
->process( $_POST )
|
||||
->data();
|
||||
|
||||
|
||||
/*// if unique key is set in DB
|
||||
if(isset($response['error'])){
|
||||
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
||||
str_contains($response['error'], "Duplicate entry ")){
|
||||
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
||||
}
|
||||
}*/
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$response[$csrfTokenName] = $newTokenHash;
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = MaquinasTarifasImpresionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$id_M = $reqData['id_maquina'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource("", $id_M)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal.', maquina_id', 'maquina_id', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->maquina_id = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'maquina_id'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getMaquinaListItems($selId = null) {
|
||||
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
|
||||
if (!empty($selId)) :
|
||||
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getTipoOptions() {
|
||||
$tipoOptions = [
|
||||
'' => lang('Basic.global.pleaseSelect'),
|
||||
'negro' => 'negro',
|
||||
'color' => 'color',
|
||||
'negrohq' => 'negrohq',
|
||||
'bicolor' => 'bicolor',
|
||||
];
|
||||
return $tipoOptions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -120,7 +120,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
$this->viewData['tarifaManipuladoEntity'] = isset($sanitizedData) ? new TarifaManipuladoEntity($sanitizedData) : new TarifaManipuladoEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createTarifaManipulado');
|
||||
$this->viewData['formAction'] = site_url('configuracion/maquinas/add');//route_to('createTarifaManipulado');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Tarifamanipulado.moduleTitle').' '.lang('Basic.global.addNewSuffix');
|
||||
|
||||
@ -156,7 +156,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
// JJO
|
||||
if(isset($this->model->user_update_id)){
|
||||
$sanitizedData['user_update_id'] = $session->id_user;
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
|
||||
@ -18,8 +18,8 @@ class Test extends BaseController
|
||||
/*
|
||||
$papel = new Papelesimpresion();
|
||||
var_dump($papel->datatablePG());*/
|
||||
return redirect()->to(site_url('tarifas/tarifaacabado/edit/'. 30))->with('sweet-success', 'OK');
|
||||
//return redirect()->to('https://sk-jjo.imnavajas.es/tarifas/tarifaacabado/edit/30');
|
||||
$session = session();
|
||||
var_dump($session->id_user);
|
||||
}
|
||||
}
|
||||
|
||||
65
ci4/app/Entities/Configuracion/Maquina.php
Normal file
65
ci4/app/Entities/Configuracion/Maquina.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class Maquina extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"nombre" => null,
|
||||
"is_padre" => false,
|
||||
"tipo" => null,
|
||||
"velocidad" => 0.0,
|
||||
"ancho" => null,
|
||||
"alto" => null,
|
||||
"ancho_impresion" => 0.0,
|
||||
"alto_impresion" => 0.0,
|
||||
"alto_click" => 0.0,
|
||||
"padre_id" => null,
|
||||
"min" => 1,
|
||||
"max" => 1000000,
|
||||
"duracion_jornada" => 8,
|
||||
"orden_planning" => 1,
|
||||
"is_rotativa" => false,
|
||||
"precio_tinta_negro" => 0.0,
|
||||
"is_tinta" => false,
|
||||
"precio_tinta_color" => 0.0,
|
||||
"velocidad_corte" => 0.0,
|
||||
"precio_hora_corte" => 0.0,
|
||||
"metrosxminuto" => null,
|
||||
"forzar_num_formas_horizontales_portada" => null,
|
||||
"forzar_num_formas_verticales_portada" => null,
|
||||
"observaciones" => null,
|
||||
"is_deleted" => 0,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
"user_created_id" => 0,
|
||||
"user_updated_id" => 0,
|
||||
];
|
||||
protected $casts = [
|
||||
"is_padre" => "boolean",
|
||||
"velocidad" => "float",
|
||||
"ancho" => "?float",
|
||||
"alto" => "?float",
|
||||
"ancho_impresion" => "float",
|
||||
"alto_impresion" => "float",
|
||||
"alto_click" => "float",
|
||||
"padre_id" => "?int",
|
||||
"min" => "int",
|
||||
"max" => "int",
|
||||
"duracion_jornada" => "int",
|
||||
"orden_planning" => "int",
|
||||
"is_rotativa" => "boolean",
|
||||
"precio_tinta_negro" => "float",
|
||||
"is_tinta" => "boolean",
|
||||
"precio_tinta_color" => "float",
|
||||
"velocidad_corte" => "float",
|
||||
"precio_hora_corte" => "float",
|
||||
"forzar_num_formas_horizontales_portada" => "?int",
|
||||
"forzar_num_formas_verticales_portada" => "?int",
|
||||
"is_deleted" => "int",
|
||||
"user_created_id" => "int",
|
||||
"user_updated_id" => "int",
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class MaquinasPapelesImpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"maquina_id" => null,
|
||||
"papel_impresion_id" => null,
|
||||
"active" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"maquina_id" => "int",
|
||||
"papel_impresion_id" => "int",
|
||||
"active" => "int",
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class MaquinasTarifasImpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"maquina_id" => null,
|
||||
"tipo" => null,
|
||||
"precio" => null,
|
||||
"uso" => null,
|
||||
"predeterminado" => false,
|
||||
"user_created_id" => 0,
|
||||
"user_updated_id" => 0,
|
||||
"is_deleted" => 0,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"maquina_id" => "int",
|
||||
"precio" => "float",
|
||||
"predeterminado" => "boolean",
|
||||
"user_created_id" => "int",
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
}
|
||||
165
ci4/app/Language/en/Maquinas.php
Normal file
165
ci4/app/Language/en/Maquinas.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'acabado' => 'finish',
|
||||
'alto' => 'Height',
|
||||
'altoClick' => 'Height Click',
|
||||
'altoImpresion' => 'Height Printing',
|
||||
'ancho' => 'Width',
|
||||
'anchoImpresion' => 'Width Printing',
|
||||
'createdAt' => 'Created At',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'duracionJornada' => 'Working day duration',
|
||||
'forzarNumFormasHorizontalesPortada' => 'Force Number of Shapes Horizontal Cover',
|
||||
'forzarNumFormasVerticalesPortada' => 'Force Number of Shapes Vertical Cover',
|
||||
'id' => 'ID',
|
||||
'impresion' => 'Printing',
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'isPadre' => 'Use for variant',
|
||||
'isRotativa' => 'Is Rotary?',
|
||||
'isTinta' => 'Is Ink',
|
||||
'manipulado' => 'handling',
|
||||
'maquina' => 'Machine',
|
||||
'maquinaList' => 'Maniches List',
|
||||
'maquinas' => 'Machines',
|
||||
'max' => 'Max POD',
|
||||
'metrosxminuto' => 'Meters x minute',
|
||||
'min' => 'Min POD',
|
||||
'moduleTitle' => 'Machines',
|
||||
'nombre' => 'Name',
|
||||
'observaciones' => 'Remarks',
|
||||
'ordenPlanning' => 'Planning order',
|
||||
'padreId' => 'Variante',
|
||||
'precioHoraCorte' => 'Price Hour cut',
|
||||
'precioTintaColor' => 'Price Ink Colour',
|
||||
'precioTintaNegro' => 'Price Ink black',
|
||||
'tipo' => 'Type',
|
||||
'updatedAt' => 'Updated At',
|
||||
'userCreatedId' => 'User Created ID',
|
||||
'userUpdatedId' => 'User Updated ID',
|
||||
'velocidad' => 'Speed',
|
||||
'velocidadCorte' => 'Cut speed',
|
||||
'validation' => [
|
||||
'alto' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
|
||||
],
|
||||
|
||||
'ancho' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
|
||||
],
|
||||
|
||||
'forzar_num_formas_horizontales_portada' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
|
||||
],
|
||||
|
||||
'forzar_num_formas_verticales_portada' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
|
||||
],
|
||||
|
||||
'alto_click' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'alto_impresion' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'ancho_impresion' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'duracion_jornada' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'max' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'metrosxminuto' => [
|
||||
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'min' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'nombre' => [
|
||||
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'observaciones' => [
|
||||
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'orden_planning' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'precio_hora_corte' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'precio_tinta_color' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'precio_tinta_negro' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'tipo' => [
|
||||
'in_list' => 'The {field} field must be one of: {param}.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'velocidad' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
'velocidad_corte' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'The {field} field is required.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
52
ci4/app/Language/en/MaquinasTarifasImpresions.php
Normal file
52
ci4/app/Language/en/MaquinasTarifasImpresions.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'createdAt' => 'Created At',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'id' => 'ID',
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'maquinaId' => 'Machine',
|
||||
'maquinasTarifaImpresion' => 'Printing rate',
|
||||
'maquinasTarifaImpresionList' => 'Printing rate List',
|
||||
'maquinasTarifasImpresion' => 'Printing rates',
|
||||
'maquinastarifasimpresion' => 'Printing rates',
|
||||
'moduleTitle' => 'Machine printing rates',
|
||||
'precio' => 'Price',
|
||||
'predeterminado' => 'Default',
|
||||
'tipo' => 'Type',
|
||||
'updatedAt' => 'Updated At',
|
||||
'userCreatedId' => 'User Created ID',
|
||||
'userUpdatedId' => 'User Updated ID',
|
||||
'uso' => 'Use',
|
||||
'interior' => 'inside',
|
||||
'portada' => 'cover',
|
||||
'negro' => 'black',
|
||||
'color' => 'color',
|
||||
'negrohq' => 'blackhq',
|
||||
'bicolor' => 'bicolor',
|
||||
'validation' => [
|
||||
'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",
|
||||
'tipo' => [
|
||||
'in_list' => 'The {field} field must be one of: {param}.',
|
||||
'required' => 'Required field.',
|
||||
],
|
||||
|
||||
'precio' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'required' => 'Required field.',
|
||||
|
||||
],
|
||||
|
||||
'uso' => [
|
||||
'in_list' => 'The {field} field must be one of: {param}.',
|
||||
'required' => 'Required field.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
@ -31,6 +31,7 @@ return [
|
||||
'referencia' => 'Reference',
|
||||
'rotativa' => 'Rotary',
|
||||
'updatedAt' => 'Updated At',
|
||||
'activo' => 'Active?',
|
||||
'userUpdateId' => 'User Update ID',
|
||||
|
||||
'consumo_tintas_rotativas' => 'Rotary ink consumption',
|
||||
|
||||
165
ci4/app/Language/es/Maquinas.php
Normal file
165
ci4/app/Language/es/Maquinas.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'acabado' => 'acabado',
|
||||
'alto' => 'Alto',
|
||||
'altoClick' => 'Alto Click',
|
||||
'altoImpresion' => 'Alto Impresion',
|
||||
'ancho' => 'Ancho',
|
||||
'anchoImpresion' => 'Ancho Impresion',
|
||||
'createdAt' => 'Created At',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'duracionJornada' => 'Duracion Jornada',
|
||||
'forzarNumFormasHorizontalesPortada' => 'Forzar Num Formas Horizontales Portada',
|
||||
'forzarNumFormasVerticalesPortada' => 'Forzar Num Formas Verticales Portada',
|
||||
'id' => 'ID',
|
||||
'impresion' => 'impresion',
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'isPadre' => 'Usar para variante?',
|
||||
'isRotativa' => 'Es Rotativa?',
|
||||
'isTinta' => 'Es Tinta?',
|
||||
'manipulado' => 'manipulado',
|
||||
'maquina' => 'Maquina',
|
||||
'maquinaList' => 'Lista Máquinas',
|
||||
'maquinas' => 'Máquinas',
|
||||
'max' => 'POD Max',
|
||||
'metrosxminuto' => 'Metros x minuto',
|
||||
'min' => 'POD Min',
|
||||
'moduleTitle' => 'Máquinas',
|
||||
'nombre' => 'Nombre',
|
||||
'observaciones' => 'Observaciones',
|
||||
'ordenPlanning' => 'Orden Planning',
|
||||
'padreId' => 'Variante',
|
||||
'precioHoraCorte' => 'Precio Hora Corte',
|
||||
'precioTintaColor' => 'Precio Tinta Color',
|
||||
'precioTintaNegro' => 'Precio Tinta Negro',
|
||||
'tipo' => 'Tipo',
|
||||
'updatedAt' => 'Updated At',
|
||||
'userCreatedId' => 'User Created ID',
|
||||
'userUpdatedId' => 'User Updated ID',
|
||||
'velocidad' => 'Velocidad',
|
||||
'velocidadCorte' => 'Velocidad Corte',
|
||||
'validation' => [
|
||||
'alto' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
|
||||
],
|
||||
|
||||
'ancho' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
|
||||
],
|
||||
|
||||
'forzar_num_formas_horizontales_portada' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
|
||||
],
|
||||
|
||||
'forzar_num_formas_verticales_portada' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
|
||||
],
|
||||
|
||||
'alto_click' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'alto_impresion' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'ancho_impresion' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'duracion_jornada' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'max' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'metrosxminuto' => [
|
||||
'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'min' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'nombre' => [
|
||||
'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'observaciones' => [
|
||||
'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'orden_planning' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'precio_hora_corte' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'precio_tinta_color' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'precio_tinta_negro' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'tipo' => [
|
||||
'in_list' => 'El campo {field} debe ser uno uno de: {param}.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'velocidad' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'velocidad_corte' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
53
ci4/app/Language/es/MaquinasTarifasImpresions.php
Normal file
53
ci4/app/Language/es/MaquinasTarifasImpresions.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'createdAt' => 'Created At',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'id' => 'ID',
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'maquinaId' => 'Maquina',
|
||||
'maquinasTarifaImpresion' => 'Tarifa Impresion Máquinas ',
|
||||
'maquinasTarifaImpresionList' => 'Lista Tarifas Impresion Máquinas',
|
||||
'maquinasTarifasImpresion' => 'Tarifas Impresion Máquinas',
|
||||
'maquinastarifasimpresion' => 'Tarifas Impresion Máquinas',
|
||||
'moduleTitle' => 'Tarifas Impresion máquina',
|
||||
'precio' => 'Precio',
|
||||
'predeterminado' => 'Predeterminado',
|
||||
'tipo' => 'Tipo',
|
||||
'updatedAt' => 'Updated At',
|
||||
'userCreatedId' => 'User Created ID',
|
||||
'userUpdatedId' => 'User Updated ID',
|
||||
'uso' => 'Uso',
|
||||
'interior' => 'interior',
|
||||
'portada' => 'portada',
|
||||
'negro' => 'negro',
|
||||
'color' => 'color',
|
||||
'negrohq' => 'negrohq',
|
||||
'bicolor' => 'bicolor',
|
||||
'validation' => [
|
||||
'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",
|
||||
'tipo' => [
|
||||
'in_list' => 'El campo {field} debe contener uno de: {param}.',
|
||||
'required' => 'Campo obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'precio' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'Campo obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'uso' => [
|
||||
'max_length' => 'El campo {field} no puede exceder de {param} caracteres de longitud.',
|
||||
'required' => 'Campo obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
@ -31,6 +31,7 @@ return [
|
||||
'referencia' => 'Referencia',
|
||||
'rotativa' => 'Rotativa',
|
||||
'updatedAt' => 'Actualizado en',
|
||||
'activo' => 'Activo?',
|
||||
'userUpdateId' => 'ID usuario actualización',
|
||||
|
||||
'consumo_tintas_rotativas' => 'Consumo tintas rotativas',
|
||||
|
||||
325
ci4/app/Models/Configuracion/MaquinaModel.php
Normal file
325
ci4/app/Models/Configuracion/MaquinaModel.php
Normal file
@ -0,0 +1,325 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class MaquinaModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_maquinas";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
//1 => "t1.id",
|
||||
0 => "t1.nombre",
|
||||
1 => "t2.nombre",
|
||||
2 => "t1.tipo",
|
||||
3 => "t1.velocidad",
|
||||
4 => "t1.duracion_jornada",
|
||||
5 => "t1.ancho",
|
||||
6 => "t1.alto",
|
||||
7 => "t1.ancho_impresion",
|
||||
8 => "t1.alto_impresion",
|
||||
9 => "t1.orden_planning",
|
||||
10 => "t1.min",
|
||||
11 => "t1.max",
|
||||
|
||||
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"is_padre",
|
||||
"tipo",
|
||||
"velocidad",
|
||||
"ancho",
|
||||
"alto",
|
||||
"ancho_impresion",
|
||||
"alto_impresion",
|
||||
"alto_click",
|
||||
"padre_id",
|
||||
"min",
|
||||
"max",
|
||||
"duracion_jornada",
|
||||
"orden_planning",
|
||||
"is_rotativa",
|
||||
"precio_tinta_negro",
|
||||
"is_tinta",
|
||||
"precio_tinta_color",
|
||||
"velocidad_corte",
|
||||
"precio_hora_corte",
|
||||
"metrosxminuto",
|
||||
"forzar_num_formas_horizontales_portada",
|
||||
"forzar_num_formas_verticales_portada",
|
||||
"observaciones",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
"user_updated_id"
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\Maquina";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"alto" => [
|
||||
"label" => "Maquinas.alto",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"alto_click" => [
|
||||
"label" => "Maquinas.altoClick",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"alto_impresion" => [
|
||||
"label" => "Maquinas.altoImpresion",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"ancho" => [
|
||||
"label" => "Maquinas.ancho",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"ancho_impresion" => [
|
||||
"label" => "Maquinas.anchoImpresion",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"duracion_jornada" => [
|
||||
"label" => "Maquinas.duracionJornada",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"forzar_num_formas_horizontales_portada" => [
|
||||
"label" => "Maquinas.forzarNumFormasHorizontalesPortada",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"forzar_num_formas_verticales_portada" => [
|
||||
"label" => "Maquinas.forzarNumFormasVerticalesPortada",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"max" => [
|
||||
"label" => "Maquinas.max",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"metrosxminuto" => [
|
||||
"label" => "Maquinas.metrosxminuto",
|
||||
"rules" => "max_length[31]",
|
||||
],
|
||||
"min" => [
|
||||
"label" => "Maquinas.min",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"nombre" => [
|
||||
"label" => "Maquinas.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"observaciones" => [
|
||||
"label" => "Maquinas.observaciones",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"orden_planning" => [
|
||||
"label" => "Maquinas.ordenPlanning",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"precio_hora_corte" => [
|
||||
"label" => "Maquinas.precioHoraCorte",
|
||||
"rules" => "decimal",
|
||||
],
|
||||
"precio_tinta_color" => [
|
||||
"label" => "Maquinas.precioTintaColor",
|
||||
"rules" => "decimal",
|
||||
],
|
||||
"precio_tinta_negro" => [
|
||||
"label" => "Maquinas.precioTintaNegro",
|
||||
"rules" => "decimal",
|
||||
],
|
||||
"tipo" => [
|
||||
"label" => "Maquinas.tipo",
|
||||
"rules" => "required|in_list[impresion,manipulado,acabado]",
|
||||
],
|
||||
"velocidad" => [
|
||||
"label" => "Maquinas.velocidad",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"velocidad_corte" => [
|
||||
"label" => "Maquinas.velocidadCorte",
|
||||
"rules" => "decimal",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"alto" => [
|
||||
"decimal" => "Maquinas.validation.alto.decimal",
|
||||
],
|
||||
"alto_click" => [
|
||||
"decimal" => "Maquinas.validation.alto_click.decimal",
|
||||
"required" => "Maquinas.validation.alto_click.required",
|
||||
],
|
||||
"alto_impresion" => [
|
||||
"decimal" => "Maquinas.validation.alto_impresion.decimal",
|
||||
"required" => "Maquinas.validation.alto_impresion.required",
|
||||
],
|
||||
"ancho" => [
|
||||
"decimal" => "Maquinas.validation.ancho.decimal",
|
||||
],
|
||||
"ancho_impresion" => [
|
||||
"decimal" => "Maquinas.validation.ancho_impresion.decimal",
|
||||
"required" => "Maquinas.validation.ancho_impresion.required",
|
||||
],
|
||||
"duracion_jornada" => [
|
||||
"integer" => "Maquinas.validation.duracion_jornada.integer",
|
||||
"required" => "Maquinas.validation.duracion_jornada.required",
|
||||
],
|
||||
"forzar_num_formas_horizontales_portada" => [
|
||||
"integer" => "Maquinas.validation.forzar_num_formas_horizontales_portada.integer",
|
||||
],
|
||||
"forzar_num_formas_verticales_portada" => [
|
||||
"integer" => "Maquinas.validation.forzar_num_formas_verticales_portada.integer",
|
||||
],
|
||||
"max" => [
|
||||
"integer" => "Maquinas.validation.max.integer",
|
||||
"required" => "Maquinas.validation.max.required",
|
||||
],
|
||||
"metrosxminuto" => [
|
||||
"max_length" => "Maquinas.validation.metrosxminuto.max_length",
|
||||
"required" => "Maquinas.validation.metrosxminuto.required",
|
||||
],
|
||||
"min" => [
|
||||
"integer" => "Maquinas.validation.min.integer",
|
||||
"required" => "Maquinas.validation.min.required",
|
||||
],
|
||||
"nombre" => [
|
||||
"max_length" => "Maquinas.validation.nombre.max_length",
|
||||
"required" => "Maquinas.validation.nombre.required",
|
||||
],
|
||||
"observaciones" => [
|
||||
"max_length" => "Maquinas.validation.observaciones.max_length",
|
||||
"required" => "Maquinas.validation.observaciones.required",
|
||||
],
|
||||
"orden_planning" => [
|
||||
"integer" => "Maquinas.validation.orden_planning.integer",
|
||||
"required" => "Maquinas.validation.orden_planning.required",
|
||||
],
|
||||
"precio_hora_corte" => [
|
||||
"decimal" => "Maquinas.validation.precio_hora_corte.decimal",
|
||||
"required" => "Maquinas.validation.precio_hora_corte.required",
|
||||
],
|
||||
"precio_tinta_color" => [
|
||||
"decimal" => "Maquinas.validation.precio_tinta_color.decimal",
|
||||
"required" => "Maquinas.validation.precio_tinta_color.required",
|
||||
],
|
||||
"precio_tinta_negro" => [
|
||||
"decimal" => "Maquinas.validation.precio_tinta_negro.decimal",
|
||||
"required" => "Maquinas.validation.precio_tinta_negro.required",
|
||||
],
|
||||
"tipo" => [
|
||||
"in_list" => "Maquinas.validation.tipo.in_list",
|
||||
"required" => "Maquinas.validation.tipo.required",
|
||||
],
|
||||
"velocidad" => [
|
||||
"decimal" => "Maquinas.validation.velocidad.decimal",
|
||||
"required" => "Maquinas.validation.velocidad.required",
|
||||
],
|
||||
"velocidad_corte" => [
|
||||
"decimal" => "Maquinas.validation.velocidad_corte.decimal",
|
||||
"required" => "Maquinas.validation.velocidad_corte.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS padre FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_maquinas t2 ON t1.padre_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_portada AS forzar_num_formas_horizontales_portada, t1.forzar_num_formas_verticales_portada AS forzar_num_formas_verticales_portada, t1.observaciones AS observaciones, t2.nombre AS padre"
|
||||
);
|
||||
$builder->join("lg_maquinas t2", "t1.padre_id = t2.id", "left");
|
||||
|
||||
//JJO
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.velocidad", $search)
|
||||
->orLike("t1.ancho", $search)
|
||||
->orLike("t1.alto", $search)
|
||||
->orLike("t1.ancho_impresion", $search)
|
||||
->orLike("t1.alto_impresion", $search)
|
||||
->orLike("t1.alto_click", $search)
|
||||
->orLike("t1.min", $search)
|
||||
->orLike("t1.max", $search)
|
||||
->orLike("t1.duracion_jornada", $search)
|
||||
->orLike("t1.orden_planning", $search)
|
||||
->orLike("t1.precio_tinta_negro", $search)
|
||||
->orLike("t1.precio_tinta_color", $search)
|
||||
->orLike("t1.velocidad_corte", $search)
|
||||
->orLike("t1.precio_hora_corte", $search)
|
||||
->orLike("t1.metrosxminuto", $search)
|
||||
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
|
||||
->orLike("t1.forzar_num_formas_verticales_portada", $search)
|
||||
->orLike("t1.observaciones", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.velocidad", $search)
|
||||
->orLike("t1.ancho", $search)
|
||||
->orLike("t1.alto", $search)
|
||||
->orLike("t1.ancho_impresion", $search)
|
||||
->orLike("t1.alto_impresion", $search)
|
||||
->orLike("t1.alto_click", $search)
|
||||
->orLike("t1.padre_id", $search)
|
||||
->orLike("t1.min", $search)
|
||||
->orLike("t1.max", $search)
|
||||
->orLike("t1.duracion_jornada", $search)
|
||||
->orLike("t1.orden_planning", $search)
|
||||
->orLike("t1.precio_tinta_negro", $search)
|
||||
->orLike("t1.precio_tinta_color", $search)
|
||||
->orLike("t1.velocidad_corte", $search)
|
||||
->orLike("t1.precio_hora_corte", $search)
|
||||
->orLike("t1.metrosxminuto", $search)
|
||||
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
|
||||
->orLike("t1.forzar_num_formas_verticales_portada", $search)
|
||||
->orLike("t1.observaciones", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_maquina_papel_impresion";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.maquina_id",
|
||||
2 => "t1.papel_impresion_id",
|
||||
3 => "t1.active",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["maquina_id", "papel_impresion_id", "active"];
|
||||
protected $returnType = "App\Entities\Configuracion\MaquinasPapelesImpresionEntity";
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $tarifas = null, $isRotativa = false)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.maquina_id AS maquina_id, t1.papel_impresion_id AS papel_impresion_id, t1.active AS active, t2.nombre AS maquina, t3.nombre AS papel_impresion"
|
||||
);
|
||||
|
||||
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
||||
$builder->join("lg_papel_impresion t3", "t3.papel_impresion_id = t3.id", "left");
|
||||
|
||||
$isFirst = false;
|
||||
$where_str = "";
|
||||
if (!is_null($tarifas)){
|
||||
foreach ($tarifas as $tarifa){
|
||||
if (!$isFirst)
|
||||
$where_str += ' OR ';
|
||||
if ($tarifa->uso == 'portada')
|
||||
$where_str += "t3.portada=1 AND ";
|
||||
if ($tarifa->tipo == 'negro' || $tarifa->tipo == 'negrohq')
|
||||
$where_str += "t3.bn=1";
|
||||
else
|
||||
$where_str += "t3.bn=1";
|
||||
}
|
||||
|
||||
$builder->where($where_str);
|
||||
}
|
||||
if($isRotativa){
|
||||
$builder->where("t3.rotativa", 1);
|
||||
}
|
||||
else{
|
||||
$builder->where("t3.rotativa", 0);
|
||||
}
|
||||
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
$builder->where("t3.is_deleted", 0);
|
||||
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t2.nombre", $search)
|
||||
->orLike("t3.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
125
ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
Normal file
125
ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_maquinas_tarifas_impresion";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.maquina_id",
|
||||
3 => "t1.tipo",
|
||||
4 => "t1.precio",
|
||||
5 => "t1.uso",
|
||||
6 => "t1.predeterminado",
|
||||
7 => "t2.nombre",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["maquina_id", "tipo", "precio", "uso", "predeterminado"];
|
||||
protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "maquina_id";
|
||||
|
||||
protected $validationRules = [
|
||||
"precio" => [
|
||||
"label" => "MaquinasTarifasImpresions.precio",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"tipo" => [
|
||||
"label" => "MaquinasTarifasImpresions.tipo",
|
||||
"rules" => "permit_empty|in_list[negro,color,negrohq,bicolor]",
|
||||
],
|
||||
"uso" => [
|
||||
"label" => "MaquinasTarifasImpresions.uso",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"precio" => [
|
||||
"decimal" => "MaquinasTarifasImpresions.validation.precio.decimal",
|
||||
"required" => "MaquinasTarifasImpresions.validation.precio.required",
|
||||
],
|
||||
"tipo" => [
|
||||
"in_list" => "MaquinasTarifasImpresions.validation.tipo.in_list",
|
||||
],
|
||||
"uso" => [
|
||||
"max_length" => "MaquinasTarifasImpresions.validation.uso.max_length",
|
||||
"required" => "MaquinasTarifasImpresions.validation.uso.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS maquina FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_maquinas t2 ON t1.maquina_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $maquina_id=-1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t1.predeterminado AS predeterminado, t2.nombre AS maquina"
|
||||
);
|
||||
|
||||
//JJO
|
||||
$builder->where('maquina_id', $maquina_id);
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.precio", $search)
|
||||
->orLike("t1.uso", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.maquina_id", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.precio", $search)
|
||||
->orLike("t1.uso", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
@ -66,6 +66,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
"portada",
|
||||
"cubierta",
|
||||
"rotativa",
|
||||
"isActivo",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_update_id",
|
||||
@ -208,7 +209,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.ancho AS ancho, t1.alto AS alto, t1.mano AS mano, t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada, t1.margen AS margen, t1.peso_por_pliego AS peso_por_pliego, t1.precio_pliego AS precio_pliego, t1.bn AS bn, t1.color AS color, t1.portada AS portada, t1.cubierta AS cubierta, t1.rotativa AS rotativa, t2.nombre AS papel_generico_id"
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.ancho AS ancho, t1.alto AS alto, t1.mano AS mano, t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada, t1.margen AS margen, t1.peso_por_pliego AS peso_por_pliego, t1.precio_pliego AS precio_pliego, t1.bn AS bn, t1.color AS color, t1.portada AS portada, t1.cubierta AS cubierta, t1.rotativa AS rotativa, t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
|
||||
);
|
||||
|
||||
$builder->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left");
|
||||
|
||||
@ -21,7 +21,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
"user_update_id"
|
||||
"user_updated_id"
|
||||
];
|
||||
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity";
|
||||
|
||||
|
||||
@ -0,0 +1,299 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 px-4">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 col-lg-4 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?=lang('Maquinas.nombre') ?>*
|
||||
</label>
|
||||
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $maquina->nombre) ?>">
|
||||
</div><!--//.col -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="min" class="form-label">
|
||||
<?=lang('Maquinas.min') ?>*
|
||||
</label>
|
||||
<input type="number" id="min" name="min" required placeholder="1" maxLength="11" class="form-control" value="<?=old('min', $maquina->min) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="max" class="form-label">
|
||||
<?=lang('Maquinas.max') ?>*
|
||||
</label>
|
||||
<input type="number" id="max" name="max" required placeholder="1000000" maxLength="11" class="form-control" value="<?=old('max', $maquina->max) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="velocidad" class="form-label">
|
||||
<?=lang('Maquinas.velocidad') ?>*
|
||||
</label>
|
||||
<input type="number" id="velocidad" name="velocidad" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('velocidad', $maquina->velocidad) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="tipo" class="form-label">
|
||||
<?=lang('Maquinas.tipo') ?>*
|
||||
</label>
|
||||
<select id="tipo" name="tipo" required class="form-control select2bs" style="width: 100%;" >
|
||||
<option value="" selected="selected"><?=lang('Basic.global.pleaseSelectOne') ?></option>
|
||||
<option value="impresion"<?=$maquina->tipo == 'impresion' ? ' selected':'' ?>><?= lang('Maquinas.impresion') ?></option>
|
||||
<option value="manipulado"<?=$maquina->tipo == 'manipulado' ? ' selected':'' ?>><?= lang('Maquinas.manipulado') ?></option>
|
||||
<option value="acabado"<?=$maquina->tipo == 'acabado' ? ' selected':'' ?>><?= lang('Maquinas.acabado') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="ancho" class="form-label">
|
||||
<?=lang('Maquinas.ancho') ?>*
|
||||
</label>
|
||||
<input type="number" id="ancho" name="ancho" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho', $maquina->ancho) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="alto" class="form-label">
|
||||
<?=lang('Maquinas.alto') ?>*
|
||||
</label>
|
||||
<input type="number" id="alto" name="alto" maxLength="8" step="0.01" class="form-control" value="<?=old('alto', $maquina->alto) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="anchoImpresion" class="form-label">
|
||||
<?=lang('Maquinas.anchoImpresion') ?>*
|
||||
</label>
|
||||
<input type="number" id="anchoImpresion" name="ancho_impresion" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho_impresion', $maquina->ancho_impresion) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="altoImpresion" class="form-label">
|
||||
<?=lang('Maquinas.altoImpresion') ?>*
|
||||
</label>
|
||||
<input type="number" id="altoImpresion" name="alto_impresion" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_impresion', $maquina->alto_impresion) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="altoClick" class="form-label">
|
||||
<?=lang('Maquinas.altoClick') ?>*
|
||||
</label>
|
||||
<input type="number" id="altoClick" name="alto_click" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_click', $maquina->alto_click) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="duracionJornada" class="form-label" >
|
||||
<?=lang('Maquinas.duracionJornada') ?>*
|
||||
</label>
|
||||
<input type="number" id="duracionJornada" name="duracion_jornada" required placeholder="8" maxLength="11" class="form-control" value="<?=old('duracion_jornada', $maquina->duracion_jornada) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="ordenPlanning" class="form-label">
|
||||
<?=lang('Maquinas.ordenPlanning') ?>*
|
||||
</label>
|
||||
<input type="number" id="ordenPlanning" name="orden_planning" required placeholder="1" maxLength="11" class="form-control" value="<?=old('orden_planning', $maquina->orden_planning) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="forzarNumFormasHorizontalesPortada" class="form-label">
|
||||
<?=lang('Maquinas.forzarNumFormasHorizontalesPortada') ?>
|
||||
</label>
|
||||
<input type="number" id="forzarNumFormasHorizontalesPortada" name="forzar_num_formas_horizontales_portada" maxLength="11" class="form-control" value="<?=old('forzar_num_formas_horizontales_portada', $maquina->forzar_num_formas_horizontales_portada) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="forzarNumFormasVerticalesPortada" class="form-label">
|
||||
<?=lang('Maquinas.forzarNumFormasVerticalesPortada') ?>
|
||||
</label>
|
||||
<input type="number" id="forzarNumFormasVerticalesPortada" name="forzar_num_formas_verticales_portada" maxLength="11" class="form-control" value="<?=old('forzar_num_formas_verticales_portada', $maquina->forzar_num_formas_verticales_portada) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-1 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isTinta" class="form-label">
|
||||
<?=lang('Maquinas.isRotativa') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isRotativa" class="form-check-label">
|
||||
<input type="checkbox" id="isRotativa" name="is_rotativa" value="1" class="form-check-input"<?=$maquina->is_rotativa== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-1 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isTinta" class="form-label">
|
||||
<?=lang('Maquinas.isTinta') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isTinta" class="form-check-label">
|
||||
<input type="checkbox" id="isTinta" name="is_tinta" value="1" class="form-check-input"<?=$maquina->is_tinta== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isPadre" class="form-label">
|
||||
<?=lang('Maquinas.isPadre') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isPadre" class="form-check-label">
|
||||
<input type="checkbox" id="isPadre" name="is_padre" value="1" class="form-check-input"<?=$maquina->is_padre== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div id="selectVariante" class="mb-3" style="display:none">
|
||||
<label for="padreId" class="form-label">
|
||||
<?=lang('Maquinas.padreId') ?>
|
||||
</label>
|
||||
|
||||
<select id="padreId" name="padre_id" class="form-control select2bs2" style="width: 100%;" >
|
||||
<?php if ( isset($maquinaList) && is_array($maquinaList) && !empty($maquinaList) ) :
|
||||
foreach ($maquinaList as $k => $v) : ?>
|
||||
<option value="<?=$k ?>"<?=$k==$maquina->padre_id ? ' selected':'' ?>>
|
||||
<?=$v ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
<?php if($maquina->is_rotativa== false): ?>
|
||||
<div class="row" id="datosRotativa" style="display:none">
|
||||
<?php else: ?>
|
||||
<div class="row" id="datosRotativa">
|
||||
<?php endif; ?>
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precioTintaNegro" class="form-label">
|
||||
<?=lang('Maquinas.precioTintaNegro') ?>
|
||||
</label>
|
||||
<input type="number" id="precioTintaNegro" name="precio_tinta_negro" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('precio_tinta_negro', $maquina->precio_tinta_negro) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="precioTintaColor" class="form-label">
|
||||
<?=lang('Maquinas.precioTintaColor') ?>
|
||||
</label>
|
||||
<input type="number" id="precioTintaColor" name="precio_tinta_color" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('precio_tinta_color', $maquina->precio_tinta_color) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="velocidadCorte" class="form-label">
|
||||
<?=lang('Maquinas.velocidadCorte') ?>
|
||||
</label>
|
||||
<input type="number" id="velocidadCorte" name="velocidad_corte" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('velocidad_corte', $maquina->velocidad_corte) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="precioHoraCorte" class="form-label">
|
||||
<?=lang('Maquinas.precioHoraCorte') ?>
|
||||
</label>
|
||||
<input type="number" id="precioHoraCorte" name="precio_hora_corte" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('precio_hora_corte', $maquina->precio_hora_corte) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="metrosxminuto" class="form-label">
|
||||
<?=lang('Maquinas.metrosxminuto') ?>
|
||||
</label>
|
||||
<input type="number" id="metrosxminuto" name="metrosxminuto" placeholder="48" maxLength="31" step="0.01" class="form-control" value="<?=old('metrosxminuto', $maquina->metrosxminuto) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 px-4">
|
||||
<label for="observaciones" class="form-label">
|
||||
<?=lang('Maquinas.observaciones') ?>
|
||||
</label>
|
||||
<textarea rows="2" id="observaciones" name="observaciones" style="height: 5em;" class="form-control"><?=old('observaciones', $maquina->observaciones) ?></textarea>
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -0,0 +1,389 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/datatables") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section("content") ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<form id="maquinaForm" method="post" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<div class="card-body">
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?= view("themes/backend/vuexy/form/configuracion/maquinas/_maquinaFormItems") ?>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<input type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
<?= anchor(route_to("maquinaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
|
||||
<div class="accordion mt-3" id="accordianTarifasImpresion">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordianTarifasImpresion">
|
||||
<div class="accordion-body">
|
||||
|
||||
<table id="tableOfMaquinastarifasimpresion" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.predeterminado') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
|
||||
<div class="accordion mt-3" id="accordianPapelesImpresion">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordianPapelesImpresion">
|
||||
<div class="accordion-body">
|
||||
|
||||
<table id="tableOfPapelesImpresion" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.predeterminado') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$(document).ready(function () {
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#datosRotativa").show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#isRotativa').on("click",function(el){
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#datosRotativa").show();
|
||||
}else{
|
||||
document.getElementById("precioTintaNegro").value = null;
|
||||
document.getElementById("precioTintaColor").value = null;
|
||||
document.getElementById("velocidadCorte").value = null;
|
||||
document.getElementById("precioHoraCorte").value = null;
|
||||
document.getElementById("metrosxminuto").value = null;
|
||||
$("#datosRotativa").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#isPadre').on("click",function(el){
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#selectVariante").show();
|
||||
}else{
|
||||
|
||||
$("#padreId").select2('val', -1);
|
||||
$("#selectVariante").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#padreId').select2({
|
||||
theme: 'bootstrap-5',
|
||||
allowClear: false,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfMaquinas") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
id: 'id',
|
||||
text: 'nombre',
|
||||
searchTerm: params.term,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
const lastColNr = $('#tableOfTarifamanipuladolineas').find("tr:first th").length - 1;
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
else{
|
||||
id = -1;
|
||||
}
|
||||
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
<span class="edit"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></span>
|
||||
<span class="cancel"></span>
|
||||
<span class="remove"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></span>
|
||||
`;
|
||||
};
|
||||
|
||||
|
||||
editor = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfMaquinasTarifaImpresion') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfMaquinastarifasimpresion",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
name: "uso",
|
||||
type: "select",
|
||||
options: ['<?= lang('MaquinasTarifasImpresions.interior') ?>', '<?= lang('MaquinasTarifasImpresions.portada') ?>']
|
||||
}, {
|
||||
name: "tipo",
|
||||
type: "select",
|
||||
options: ['<?= lang('MaquinasTarifasImpresions.negro') ?>', '<?= lang('MaquinasTarifasImpresions.color') ?>',
|
||||
'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', '<?= lang('MaquinasTarifasImpresions.bicolor') ?>']
|
||||
}, {
|
||||
name: "precio",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
}, {
|
||||
name: "predeterminado",
|
||||
type: "checkbox",
|
||||
separator: "",
|
||||
options: [
|
||||
{ label: "", value: 1 }
|
||||
],
|
||||
unselectedValue: 0
|
||||
|
||||
}, {
|
||||
"name": "maquina_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "is_deleted",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
} );
|
||||
|
||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['maquina_id'] = id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
d.data[v]['maquina_id'] = id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
});
|
||||
|
||||
|
||||
var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 0, "asc" ]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: "Bltp",
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfMaquinasTarifasImpresion') ?>',
|
||||
data: {
|
||||
id_maquina: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'uso' },
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'precio' },
|
||||
{ 'data': 'predeterminado' },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
},
|
||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||
|
||||
],
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
buttons: [ {
|
||||
className: 'btn btn-primary float-end me-sm-3 me-1',
|
||||
extend: "createInline",
|
||||
editor: editor,
|
||||
formOptions: {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<i class="ti ti-device-floppy"/>'
|
||||
}
|
||||
} ]
|
||||
} );
|
||||
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.edit', function (e) {
|
||||
editor.inline(
|
||||
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
cancelHtml: '<i class="ti ti-x"></i>',
|
||||
cancelTrigger: 'span.cancel',
|
||||
submitHtml: '<i class="ti ti-device-floppy"></i>',
|
||||
submitTrigger: 'span.edit',
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.remove', function (e) {
|
||||
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
editor
|
||||
.create( false )
|
||||
.edit( this.parentNode, false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
@ -0,0 +1,190 @@
|
||||
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->extend('themes/backend/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('Maquinas.maquinaList') ?></h3>
|
||||
<?=anchor(route_to('newMaquina'), lang('Basic.global.addNew').' '.lang('Maquinas.maquina'), ['class'=>'btn btn-primary float-end']); ?>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableOfMaquinas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Maquinas.nombre') ?></th>
|
||||
<th><?= lang('Maquinas.padreId') ?></th>
|
||||
<th><?= lang('Maquinas.tipo') ?></th>
|
||||
<th><?= lang('Maquinas.velocidad') ?></th>
|
||||
<th><?= lang('Maquinas.duracionJornada') ?></th>
|
||||
<th><?= lang('Maquinas.ancho') ?></th>
|
||||
<th><?= lang('Maquinas.alto') ?></th>
|
||||
<th><?= lang('Maquinas.anchoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.altoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.ordenPlanning') ?></th>
|
||||
<th><?= lang('Maquinas.min') ?></th>
|
||||
<th><?= lang('Maquinas.max') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr = $('#tableOfMaquinas').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
return `<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
||||
</div>
|
||||
</td>`;
|
||||
};
|
||||
theTable = $('#tableOfMaquinas').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip',
|
||||
"buttons": [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4'
|
||||
}
|
||||
],
|
||||
stateSave: true,
|
||||
order: [[0, 'asc']],
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfMaquinas') ?>',
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'padre' },
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'velocidad' },
|
||||
{ 'data': 'duracion_jornada' },
|
||||
{ 'data': 'ancho' },
|
||||
{ 'data': 'alto' },
|
||||
{ 'data': 'ancho_impresion' },
|
||||
{ 'data': 'alto_impresion' },
|
||||
{ 'data': 'orden_planning' },
|
||||
{ 'data': 'min' },
|
||||
{ 'data': 'max' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="text-success bi bi-check-lg"></i>' : '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
//window.location.href = `<?= route_to('maquinaList') ?>/${$(this).attr('data-id')}/edit`;
|
||||
window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Maquinas.maquina'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
//url: `<?= route_to('maquinaList') ?>/${dataId}`,
|
||||
//method: 'DELETE',
|
||||
url: `/configuracion/maquinas/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
@ -73,6 +73,16 @@
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="isActivo" class="form-check-label">
|
||||
<input type="checkbox" id="isActivo" name="isActivo" value="1" class="form-check-input" <?= $papelImpresion->isActivo == true ? 'checked' : ''; ?>>
|
||||
<?= lang('PapelImpresion.activo') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
<th><?= lang('PapelImpresion.portada') ?></th>
|
||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||
<th><?= lang('PapelImpresion.activo') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -99,13 +100,14 @@
|
||||
{ 'data': 'portada' },
|
||||
{ 'data': 'cubierta' },
|
||||
{ 'data': 'rotativa' },
|
||||
{ 'data': 'isActivo' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3, 4, 5, 6, 7];
|
||||
const boolCols = [3, 4, 5, 6, 7, 8];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
Reference in New Issue
Block a user