mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
21 Commits
f73472c729
...
feat/tipo_
| Author | SHA1 | Date | |
|---|---|---|---|
| 0785e7fcc8 | |||
| ca2aeacd84 | |||
| 41ac08fcd8 | |||
| 709a802db4 | |||
| 5e8a36a345 | |||
| 54816180df | |||
| 9d6647548c | |||
| 40b53dc1e3 | |||
| 0a8ecdb939 | |||
| e3c4cf48ed | |||
| 1d7f2e044f | |||
| 702e6bf77c | |||
| 599fce7f2f | |||
| 7bb6329783 | |||
| ad8e0ac75b | |||
| e01b824045 | |||
| cc757b5db3 | |||
| df21b5ba05 | |||
| 2639fe705e | |||
| 3f65c9e92a | |||
| e804aa3768 |
@ -36,7 +36,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
$routes->get('gettipopapel', 'Papelesgenericos::getTipoPapelCliente');
|
||||
});
|
||||
|
||||
/* Papeles impresion */
|
||||
@ -53,6 +53,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
|
||||
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
|
||||
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
|
||||
$routes->get('getgramajecliente', 'Papelesimpresion::getGramajeCliente', ['as' => 'getGramajeCliente']);
|
||||
});
|
||||
|
||||
/* Maquinas */
|
||||
|
||||
@ -77,6 +77,14 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
*/
|
||||
public $alertStyle = 'alerts';
|
||||
|
||||
/**
|
||||
* Permiso requerido para borrar. Si es false/null, no se valida.
|
||||
* Si es un string (nombre del permiso), se valida.
|
||||
*
|
||||
* @var string|false|null
|
||||
*/
|
||||
protected $deletePermission = false;
|
||||
|
||||
|
||||
/**
|
||||
* An array of helpers to be loaded automatically upon
|
||||
@ -222,6 +230,13 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
*/
|
||||
public function delete($id = null)
|
||||
{
|
||||
|
||||
// 🔒 Verificar permiso solo si está definido como string
|
||||
if (is_string($this->deletePermission) && !auth()->user()->can($this->deletePermission)) {
|
||||
$message = lang('Basic.global.permissionDenied'); // O el mensaje que uses
|
||||
return $this->failWithNewToken($message, 403); // Estilo coherente con tu clase
|
||||
}
|
||||
|
||||
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
|
||||
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc) . '.' . static::$singularObjectNameCc));
|
||||
} else {
|
||||
@ -236,8 +251,10 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
} else {
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$rawResult = $this->model->where('id', $id)
|
||||
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag])
|
||||
->set([
|
||||
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag
|
||||
])
|
||||
->update();
|
||||
if (!$rawResult) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
@ -270,7 +287,8 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
}
|
||||
|
||||
if ($customValidationMessages == null) {
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;
|
||||
;
|
||||
} else {
|
||||
$validationErrorMessages = $customValidationMessages;
|
||||
}
|
||||
@ -366,12 +384,12 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
$queryStr = !is_null($query) ? $query->getQuery() : '';
|
||||
$dbError = $this->model->db->error();
|
||||
$userFriendlyErrMsg = lang('Basic.global.persistErr1', [static::$singularObjectNameCc]);
|
||||
if (isset($dbError['code']) && $dbError['code'] == 1062) :
|
||||
if (isset($dbError['code']) && $dbError['code'] == 1062):
|
||||
$userFriendlyErrMsg .= PHP_EOL . lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
|
||||
endif;
|
||||
// $userFriendlyErrMsg = str_replace("'", "\'", $userFriendlyErrMsg); // Uncomment if experiencing unescaped single quote errors
|
||||
log_message('error', $userFriendlyErrMsg . PHP_EOL . $e->getMessage() . PHP_EOL . $queryStr);
|
||||
if (isset($dbError['message']) && !empty($dbError['message'])) :
|
||||
if (isset($dbError['message']) && !empty($dbError['message'])):
|
||||
log_message('error', $dbError['code'] . ' : ' . $dbError['message']);
|
||||
endif;
|
||||
$this->viewData['errorMessage'] = $userFriendlyErrMsg;
|
||||
|
||||
@ -25,6 +25,7 @@ class Proveedores extends \App\Controllers\BaseResourceController {
|
||||
|
||||
protected $indexRoute = 'proveedorList';
|
||||
|
||||
protected $deletePermission = 'proveedores.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
|
||||
@ -26,6 +26,8 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'formaDePagoList';
|
||||
|
||||
protected $deletePermission = 'formas-pago.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -44,6 +46,7 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('formas-pago.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -61,6 +64,7 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('formas-pago.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -115,6 +119,7 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('formas-pago.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
|
||||
@ -21,6 +21,8 @@ class Group extends \App\Controllers\GoBaseController
|
||||
|
||||
protected $indexRoute = 'userGroupList';
|
||||
|
||||
protected $deletePermission = 'roles-permisos.delete';
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
self::$viewPath = getenv('theme.path') . 'form/group/';
|
||||
@ -37,6 +39,8 @@ class Group extends \App\Controllers\GoBaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('roles-permisos.menu');
|
||||
|
||||
$this->viewData['usingClientSideDataTable'] = true;
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Groups.group')]);
|
||||
// IMN
|
||||
@ -48,11 +52,12 @@ class Group extends \App\Controllers\GoBaseController
|
||||
public function add()
|
||||
{
|
||||
|
||||
checkPermission('roles-permisos.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$temp_data['id'] = $groupEntity->id;
|
||||
$temp_data['title'] = $postData['title'];
|
||||
$temp_data['description'] = $postData['description'];
|
||||
|
||||
@ -124,6 +129,7 @@ class Group extends \App\Controllers\GoBaseController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('roles-permisos.edit');
|
||||
|
||||
helper('general');
|
||||
|
||||
@ -243,30 +249,4 @@ class Group extends \App\Controllers\GoBaseController
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/maquinas/';
|
||||
|
||||
protected $indexRoute = 'maquinaList';
|
||||
|
||||
protected MaquinaService $maquinaService;
|
||||
protected Validation $validation;
|
||||
|
||||
@ -55,6 +56,7 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('maquinas.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -112,6 +114,8 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('maquinas.create');
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
@ -176,7 +180,7 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
checkPermission('maquinas.edit');
|
||||
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
|
||||
@ -28,6 +28,8 @@ class Maquinasdefecto extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'maquinaPorDefectoList';
|
||||
|
||||
protected $deletePermission = 'maquinas-defecto.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -45,6 +47,7 @@ class Maquinasdefecto extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('maquinas-defecto.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -63,7 +66,7 @@ class Maquinasdefecto extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
checkPermission('maquinas-defecto.create');
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
@ -138,6 +141,7 @@ class Maquinasdefecto extends \App\Controllers\BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
checkPermission('maquinas-defecto.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
|
||||
@ -100,6 +100,7 @@ class Maquinaspapelesimpresion extends \App\Controllers\BaseResourceController {
|
||||
$resourceData = $this->model->getResource($search, $isRotativa, $tarifas, $maquina_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
$query =$this->model->getLastQuery();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource("", $isRotativa, $tarifas, $maquina_id)->countAllResults(),
|
||||
|
||||
@ -29,6 +29,7 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'paisList';
|
||||
|
||||
protected $deletePermission = 'paises.delete';
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -47,6 +48,7 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('paises.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -65,6 +67,8 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
checkPermission('paises.create');
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
@ -119,6 +123,7 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('paises.edit');
|
||||
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
|
||||
@ -28,6 +28,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'papelGenericoList';
|
||||
|
||||
protected $deletePermission = 'papel-generico.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
@ -54,6 +55,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('papel-generico.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -71,6 +73,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('papel-generico.create');
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
@ -132,6 +135,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('papel-generico.edit');
|
||||
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
@ -301,114 +305,36 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getTipoPapelCliente(){
|
||||
|
||||
if($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getTiposPalelGenerico((object)$data_input);
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$result[$key]->texto = strtoupper(lang('PapelGenerico.' . $value->nombre));
|
||||
}
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
$guardas = goSanitize($this->request->getGet('guardas'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if(intval($cubierta) == 1 || intval($sobrecubierta) == 1){
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
if ($forSelect2) {
|
||||
$menu = array_map(function ($item) {
|
||||
if (isset($item->id)) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'id' => $item->gramaje,
|
||||
'name' => $item->gramaje
|
||||
];
|
||||
}
|
||||
}, $menu);
|
||||
|
||||
return $this->respond($menu);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
'papeles_especiales' => $menu2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getPapelGenerico((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
|
||||
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, false, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
}, $items);
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +52,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/papel/';
|
||||
|
||||
protected $indexRoute = 'papelImpresionList';
|
||||
|
||||
protected $deletePermission = 'papel-impresion.delete';
|
||||
|
||||
protected Validation $validation;
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
@ -69,6 +72,8 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$this->tpModel = new PapelImpresionTipologiaModel();
|
||||
$this->validation = service("validation");
|
||||
|
||||
$this->papelService = service('papel');
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
@ -81,6 +86,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('papel-impresion.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -98,7 +104,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
checkPermission('papel-impresion.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -161,6 +167,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('papel-impresion.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
@ -468,6 +475,22 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getGramajeCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getGramajes((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function papel_impresion_select()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
|
||||
@ -22,6 +22,8 @@ class SeriesFacturas extends BaseResourceController
|
||||
|
||||
protected $indexRoute = 'seriesFacturasList';
|
||||
|
||||
protected $deletePermission = 'series-facturas.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -40,6 +42,7 @@ class SeriesFacturas extends BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('series-facturas.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -57,6 +60,8 @@ class SeriesFacturas extends BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('series-facturas.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
@ -110,6 +115,8 @@ class SeriesFacturas extends BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
checkPermission('series-facturas.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
|
||||
@ -22,6 +22,8 @@ class Ubicaciones extends BaseResourceController
|
||||
|
||||
protected $indexRoute = 'ubicacionesList';
|
||||
|
||||
protected $deletePermission = 'ubicaciones.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -40,6 +42,7 @@ class Ubicaciones extends BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('ubicaciones.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -57,6 +60,8 @@ class Ubicaciones extends BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('ubicaciones.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
@ -111,6 +116,7 @@ class Ubicaciones extends BaseResourceController
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
checkPermission('ubicaciones.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
|
||||
@ -69,7 +69,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
public function add()
|
||||
{
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
@ -94,8 +94,8 @@ class Users extends \App\Controllers\GoBaseController
|
||||
// Obtener proveedor de usuarios
|
||||
$users = auth()->getProvider();
|
||||
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
if ($this->canValidate()) :
|
||||
if ($successfulResult = $this->canValidate()):
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
|
||||
// The Email is unique
|
||||
@ -134,17 +134,12 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $users->getInsertID();
|
||||
$this->group_user_model->where('user_id', $id)->delete();
|
||||
foreach ($currentGroups as $group) {
|
||||
$group_user_data = [
|
||||
'user_id' => $id,
|
||||
'group' => $group
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
// Asignar los grupos de usuarios a los que pertenece el usuario editado
|
||||
$this->saveUserGroupsSafely($id, $currentGroups);
|
||||
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->insert([
|
||||
@ -156,8 +151,8 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||
else:
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
@ -173,7 +168,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$this->viewData['user'] = isset($sanitizedData) ? new UserEntity($sanitizedData) : new UserEntity();
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems();
|
||||
$this->viewData['formAction'] = route_to('createUser');
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->where('id >', 0)->findAll();
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->findAll();
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
@ -191,12 +186,12 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$users = auth()->getProvider();
|
||||
$user = $users->findById($id);
|
||||
|
||||
if ($user == false) :
|
||||
if ($user == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Users.user')), $id]);
|
||||
return $this->redirect2listView('errorMessage', $message);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
@ -218,9 +213,9 @@ class Users extends \App\Controllers\GoBaseController
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
if ($successfulResult = $this->canValidate()):
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
|
||||
if (in_array('cliente-editor', $currentGroups) || in_array('cliente-administrador', $currentGroups)) {
|
||||
@ -249,16 +244,11 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$thenRedirect = false;
|
||||
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
// Asignar los grupos de usuarios a los que pertenece el usuario editado
|
||||
$this->saveUserGroupsSafely($user->id, $currentGroups);
|
||||
|
||||
$this->group_user_model->where('user_id', $user->id)->delete();
|
||||
foreach ($currentGroups as $group) {
|
||||
$group_user_data = [
|
||||
'user_id' => $user->id,
|
||||
'group' => $group
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->insert([
|
||||
@ -270,8 +260,8 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||
else:
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
@ -287,7 +277,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($user->cliente_id);
|
||||
$this->viewData['formAction'] = route_to('updateUser', $id);
|
||||
$this->viewData['selectedGroups'] = $this->group_model->getUsersRoles($requestedId);
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->where('id >', 0)->findAll();
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->select(["display", "name", "id as chatDepartmentId"])->findAll();
|
||||
$this->viewData['chatDepartmentUser'] = $this->chat_department_user_model->getChatDepartmentUser($user->id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.edit3');
|
||||
@ -299,18 +289,22 @@ class Users extends \App\Controllers\GoBaseController
|
||||
public function delete($requestedId = null, bool $deletePermanently = true)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$user = $this->model->find($id);
|
||||
|
||||
if ($user == false) :
|
||||
if ($user == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Users.user')), $id]);
|
||||
return $this->redirect2listView('errorMessage', $message);
|
||||
endif;
|
||||
|
||||
// Elimina todos los grupos actuales
|
||||
$this->group_user_model->where('user_id', $id)->delete();
|
||||
|
||||
// Elimina todos los grupos de chat actuales
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
|
||||
$users = auth()->getProvider();
|
||||
@ -433,11 +427,11 @@ class Users extends \App\Controllers\GoBaseController
|
||||
protected function getClienteListItems($selId = null)
|
||||
{
|
||||
$data = ['' => ""];
|
||||
if (!empty($selId)) :
|
||||
if (!empty($selId)):
|
||||
$clienteModel = model('App\Models\Clientes\ClienteModel');
|
||||
|
||||
$selOption = $clienteModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
@ -450,7 +444,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
['title' => lang("App.menu_change_session"), 'route' => route_to('maquinistaUserChangeList'), 'active' => true]
|
||||
];
|
||||
$maquinistas = [];
|
||||
$users = auth()->getProvider()->whereNotIn('id',[auth()->user()->id])->findAll();
|
||||
$users = auth()->getProvider()->whereNotIn('id', [auth()->user()->id])->findAll();
|
||||
foreach ($users as $key => $user) {
|
||||
if ($user->inGroup('maquina') && !$user->inGroup('admin', 'comercial', 'cliente-editor', 'cliente-admin')) {
|
||||
$maquinistas[] = $user;
|
||||
@ -467,4 +461,50 @@ class Users extends \App\Controllers\GoBaseController
|
||||
auth()->login($user);
|
||||
return redirect("home");
|
||||
}
|
||||
|
||||
/**
|
||||
* Asigna grupos a un usuario, asegurando que no se pueda inyectar el grupo 'root',
|
||||
* pero manteniéndolo si ya lo tenía previamente.
|
||||
*
|
||||
* @param int $userId ID del usuario al que se le asignarán los grupos
|
||||
* @param array $requestedGroups Grupos solicitados desde el formulario
|
||||
* @return void
|
||||
*/
|
||||
private function saveUserGroupsSafely(int $userId, array $requestedGroups): void
|
||||
{
|
||||
// Verifica si el usuario ya tenía el grupo 'root'
|
||||
$existingGroups = $this->group_user_model
|
||||
->where('user_id', $userId)
|
||||
->findColumn('group') ?? [];
|
||||
|
||||
$hasRoot = in_array('root', $existingGroups);
|
||||
|
||||
// Elimina todos los grupos actuales
|
||||
$this->group_user_model->where('user_id', $userId)->delete();
|
||||
|
||||
// Inserta solo los grupos válidos (sin 'root')
|
||||
foreach ($requestedGroups as $group) {
|
||||
if (!empty($group) && $group !== 'root') {
|
||||
$this->group_user_model->insert([
|
||||
'user_id' => $userId,
|
||||
'group' => $group,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
} elseif ($group === 'root') {
|
||||
log_message('alert', "Intento de asignar grupo 'root' al usuario ID $userId");
|
||||
}
|
||||
}
|
||||
|
||||
// Reasigna 'root' solo si el usuario ya lo tenía
|
||||
if ($hasRoot) {
|
||||
$this->group_user_model->insert([
|
||||
'user_id' => $userId,
|
||||
'group' => 'root',
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,8 @@ class Buscador extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'buscadorPresupuestosList';
|
||||
|
||||
protected $deletePermission = 'presupuesto.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -2203,16 +2203,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$lomo += floatval($linea['mano']);
|
||||
$info['lomo_interior'] += floatval($linea['mano']);
|
||||
}
|
||||
if ($extra_info) {
|
||||
$this->calcular_coste_linea(
|
||||
$linea,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$linea,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2251,13 +2251,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$costeInterior = 0.0;
|
||||
$peso_interior = 0.0;
|
||||
$lomo = 0;
|
||||
if ($extra_info) {
|
||||
$totalPapel = 0.0;
|
||||
$margenPapel = 0.0;
|
||||
$sumForFactor = 0.0;
|
||||
$totalImpresion = 0.0;
|
||||
$margenImpresion = 0.0;
|
||||
}
|
||||
$totalPapel = 0.0;
|
||||
$margenPapel = 0.0;
|
||||
$sumForFactor = 0.0;
|
||||
$totalImpresion = 0.0;
|
||||
$margenImpresion = 0.0;
|
||||
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += round(floatval($linea['total_impresion']), 2);
|
||||
@ -2266,17 +2265,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$lomo += floatval($linea['mano']);
|
||||
}
|
||||
$peso_interior += floatval($linea['peso']);
|
||||
if ($extra_info) {
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$linea,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
$this->calcular_coste_linea(
|
||||
$linea,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2321,17 +2319,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$lomo += floatval($cubierta['mano']);
|
||||
}
|
||||
|
||||
if ($extra_info) {
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$cubierta,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
$this->calcular_coste_linea(
|
||||
$cubierta,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
if ($coste_cubierta <= 0) {
|
||||
|
||||
@ -2382,13 +2377,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
return $return_data;
|
||||
}
|
||||
$coste_servicios += round(floatval($acabadoCubierta[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($acabadoCubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoCubierta[0]->total / (1 + $acabadoCubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoCubierta[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($acabadoCubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoCubierta[0]->total / (1 + $acabadoCubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoCubierta[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2422,13 +2416,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
return $return_data;
|
||||
}
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
|
||||
}
|
||||
}
|
||||
@ -2458,17 +2451,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
if (count($linea_sobrecubierta) > 0) {
|
||||
$coste_sobrecubierta += round(floatval($linea_sobrecubierta['total_impresion']), 2);
|
||||
$peso_sobrecubierta += round(floatval($linea_sobrecubierta['peso']), 2);
|
||||
if ($extra_info) {
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$linea_sobrecubierta,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
$this->calcular_coste_linea(
|
||||
$linea_sobrecubierta,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
|
||||
}
|
||||
if ($coste_sobrecubierta <= 0) {
|
||||
|
||||
@ -2519,13 +2511,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($acabadoSobrecubierta[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($acabadoSobrecubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoSobrecubierta[0]->total / (1 + $acabadoSobrecubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoSobrecubierta[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($acabadoSobrecubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoSobrecubierta[0]->total / (1 + $acabadoSobrecubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoSobrecubierta[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2567,17 +2558,15 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
if (intval($tirada[$t]) == intval($selected_tirada)) {
|
||||
$lomo += floatval($guardas['mano']);
|
||||
}
|
||||
if ($extra_info) {
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$guardas,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
$this->calcular_coste_linea(
|
||||
$guardas,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
if ($coste_guardas <= 0) {
|
||||
$errorModel = new ErrorPresupuesto();
|
||||
@ -2621,17 +2610,15 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$linea_faja['tipo_linea'] = 'lp_faja';
|
||||
$coste_faja += round(floatval($linea_faja['total_impresion']), 2);
|
||||
$peso_faja += floatval($linea_faja['peso']);
|
||||
if ($extra_info) {
|
||||
|
||||
$this->calcular_coste_linea(
|
||||
$linea_faja,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
$this->calcular_coste_linea(
|
||||
$linea_faja,
|
||||
$totalPapel,
|
||||
$margenPapel,
|
||||
$sumForFactor,
|
||||
$totalImpresion,
|
||||
$margenImpresion
|
||||
);
|
||||
}
|
||||
if ($coste_faja <= 0) {
|
||||
|
||||
@ -2681,13 +2668,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($acabadoFaja[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($acabadoFaja[0]->total), 2);
|
||||
$base = round(floatval($acabadoFaja[0]->total / (1 + $acabadoFaja[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoFaja[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($acabadoFaja[0]->total), 2);
|
||||
$base = round(floatval($acabadoFaja[0]->total / (1 + $acabadoFaja[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($acabadoFaja[0]->total - $base), 2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2736,13 +2723,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$costeServiciosDefecto += round(floatval($servicio->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($servicio->total), 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($servicio->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($servicio->total), 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($servicio->total - $base), 2);
|
||||
|
||||
}
|
||||
|
||||
$servDefectoMan = PresupuestoCLienteService::getServiciosManipuladoDefault([
|
||||
@ -2774,13 +2761,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$costeServiciosDefecto += round(floatval($servicio->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($servicio->total), 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($servicio->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($servicio->total), 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($servicio->total - $base), 2);
|
||||
}
|
||||
|
||||
if ($extra_info) {
|
||||
@ -2880,13 +2866,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
|
||||
} else if ($servicio->nombre == "ferro" || $servicio->nombre == "prototipo") {
|
||||
// Extra
|
||||
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
||||
@ -2913,13 +2899,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->precio), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->precio), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->precio), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
|
||||
} else if ($servicio->nombre == 'solapas_cubierta' || $servicio->nombre == 'solapas_sobrecubierta' || $servicio->nombre == 'solapas_faja') {
|
||||
// Servicios manipulado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
@ -2948,13 +2934,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2990,13 +2975,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
array_push($serviciosExtra, $resultado[0]);
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->precio), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->precio), 2);
|
||||
$base = round(floatval($resultado[0]->precio / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->precio - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->precio), 2);
|
||||
$base = round(floatval($resultado[0]->precio / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->precio - $base), 2);
|
||||
}
|
||||
|
||||
}
|
||||
@ -3030,13 +3014,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
if (is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630)) {
|
||||
@ -3068,13 +3051,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
if (is_array($faja) && $faja !== [] && ($faja['solapas'] > 0 && intval($linea_faja['dimension_desarrollo']['ancho']) > 630)) {
|
||||
@ -3106,13 +3088,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
//$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $cantidad_total), 2) * $cantidad_total;
|
||||
$totalServicios += $base;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
|
||||
/*$total_por_tirada = $costeInterior +
|
||||
@ -3471,31 +3452,37 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$return_data['interior']['negro']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['negro']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['negro']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['negro']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_color' || $linea->tipo == 'lp_colorhq' || $linea->tipo == 'lp_rot_color') {
|
||||
$return_data['interior']['color']['tipo'] = $linea->tipo == 'lp_color' || $linea->tipo == 'lp_rot_color' ? 'colorEstandar' : 'colorPremium';
|
||||
$return_data['interior']['color']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['color']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['color']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['color']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_cubierta') {
|
||||
$return_data['cubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['cubierta']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['cubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['cubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['cubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_sobrecubierta') {
|
||||
$return_data['sobrecubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['sobrecubierta']['papel_id'] = $linea->papel_id;
|
||||
$return_data['sobrecubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['sobrecubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['sobrecubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_faja') {
|
||||
$return_data['faja']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['faja']['papel_id'] = $linea->papel_id;
|
||||
$return_data['faja']['gramaje'] = $linea->gramaje;
|
||||
$return_data['faja']['paginas'] = $linea->paginas;
|
||||
$return_data['faja']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_guardas') {
|
||||
$return_data['guardas']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['guardas']['papel_id'] = $linea->papel_id;
|
||||
$return_data['guardas']['gramaje'] = $linea->gramaje;
|
||||
$return_data['guardas']['paginas'] = $linea->paginas;
|
||||
$return_data['guardas']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3686,21 +3673,30 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
public function download_zip()
|
||||
{
|
||||
$presupuesto_id = $this->request->getPost('presupuesto_id');
|
||||
$ot_id = $this->request->getPost('ot_id');
|
||||
|
||||
if (!$presupuesto_id) {
|
||||
return $this->response->setStatusCode(400)->setBody('Presupuesto ID requerido');
|
||||
}
|
||||
|
||||
// Definir prefijo si se recibió un ot_id válido
|
||||
$prefijo = (!empty($ot_id) && is_numeric($ot_id)) ? "OT_{$ot_id}" : null;
|
||||
|
||||
$ftpClient = new \App\Libraries\SafekatFtpClient();
|
||||
try {
|
||||
$zipPath = $ftpClient->downloadZipPresupuesto((int) $presupuesto_id);
|
||||
$zipPath = $ftpClient->downloadZipPresupuesto((int) $presupuesto_id, $prefijo);
|
||||
|
||||
if ($zipPath === null || !file_exists($zipPath)) {
|
||||
return $this->response->setStatusCode(404)->setBody('No se encontraron archivos');
|
||||
}
|
||||
|
||||
$nombreArchivo = $prefijo
|
||||
? "{$prefijo}_PRESUPUESTO_{$presupuesto_id}.zip"
|
||||
: "archivos_presupuesto_{$presupuesto_id}.zip";
|
||||
|
||||
return $this->response
|
||||
->download($zipPath, null) // null = usar nombre original del archivo
|
||||
->setFileName('archivos_presupuesto_' . $presupuesto_id . '.zip');
|
||||
->download($zipPath, null)
|
||||
->setFileName($nombreArchivo);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', $e->getMessage());
|
||||
return $this->response->setStatusCode(500)->setBody('Error interno');
|
||||
@ -3708,4 +3704,5 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Ordenmaquina extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Orden maquina';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Ordentrabajomaquetacion extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Orden maquetación';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Pedidoproduccion extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Pedido produccion';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@ class ServiciosAcabado extends BaseResourceController
|
||||
|
||||
protected $indexRoute = 'serviciosAcabadoList';
|
||||
|
||||
protected $deletePermission = 'tarifa-acabado.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -28,6 +28,8 @@ class TarifaAcabados extends BaseResourceController
|
||||
|
||||
protected $indexRoute = 'tarifaAcabadoList';
|
||||
|
||||
protected $deletePermission = 'tarifa-acabado.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -19,6 +19,8 @@ class Tarifaextra extends \App\Controllers\GoBaseController
|
||||
|
||||
protected $indexRoute = 'tarifaextraList';
|
||||
|
||||
protected $deletePermission = 'tarifa-extra.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -19,6 +19,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
|
||||
|
||||
protected $indexRoute = 'tarifapreimpresionList';
|
||||
|
||||
protected $deletePermission = 'tarifa-preimpresion.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -32,6 +32,8 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'tarifaEncuadernacionList';
|
||||
|
||||
protected $deletePermission = 'tarifa-encuadernacion.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -28,6 +28,8 @@ class Tarifasmanipulado extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'tarifaManipuladoList';
|
||||
|
||||
protected $deletePermission = 'tarifa-manipulado.delete';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
@ -49,7 +49,7 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
|
||||
"user_created_id" => 1,
|
||||
"user_update_id" => 1,
|
||||
"no_envio_base" => 0,
|
||||
"forzar_rotativa_pod" => 0,
|
||||
"forzar_rotativa_pod" => false,
|
||||
];
|
||||
protected $casts = [
|
||||
"comunidad_autonoma_id" => "?int",
|
||||
|
||||
@ -123,7 +123,7 @@ if (!function_exists('checkPermission')) {
|
||||
$response = \Config\Services::response();
|
||||
|
||||
if (!auth()->user()->can($sectionPermission)) {
|
||||
$session->setFlashdata('errorMessage', "No tiene permisos de acceso");
|
||||
$session->setFlashdata('errorMessage', lang('Basic.global.permissionDenied'));
|
||||
|
||||
$route = $redirectRoute ?? 'home';
|
||||
return $response->redirect(route_to($route));
|
||||
|
||||
@ -90,6 +90,7 @@ return [
|
||||
'wait' => 'Wait',
|
||||
'yes' => 'Yes',
|
||||
'back' => 'Back',
|
||||
'permissionDenied' => 'You do not have permission for this action'
|
||||
],
|
||||
|
||||
|
||||
|
||||
@ -94,6 +94,7 @@ return [
|
||||
'yes' => 'Si',
|
||||
'no' => 'No',
|
||||
'back' => 'Volver',
|
||||
'permissionDenied' => 'No tiene permisos de acceso'
|
||||
|
||||
],
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ return [
|
||||
'especiales' => 'Especiales',
|
||||
'reciclados' => 'Reciclados',
|
||||
'cartulinas' => 'Cartulinas',
|
||||
'verdujados' => 'Verdujados',
|
||||
'verjurados' => 'Verjurados',
|
||||
|
||||
'validation' => [
|
||||
'code' => [
|
||||
|
||||
@ -115,7 +115,7 @@ class SafekatFtpClient
|
||||
return implode('/', [$this->base_dir, 'pedidos_files', $rootIdExtern]);
|
||||
}
|
||||
|
||||
public function downloadZipPresupuesto(int $presupuesto_id): ?string
|
||||
public function downloadZipPresupuesto(int $presupuesto_id, ?string $prefijo = null): ?string
|
||||
{
|
||||
$modelPedidoLinea = model(PedidoLineaModel::class);
|
||||
$model = model(PresupuestoFicheroModel::class);
|
||||
@ -143,8 +143,11 @@ class SafekatFtpClient
|
||||
|
||||
foreach ($files as $file) {
|
||||
$originalName = $file->nombre ?? basename($file->file_path);
|
||||
$localFile = $localTempDir . '/' . $originalName;
|
||||
$prefixedName = $prefijo ? $prefijo . '_' . $originalName : $originalName;
|
||||
|
||||
$localFile = $localTempDir . '/' . $prefixedName;
|
||||
$remoteFile = $remotePath . '/' . basename($file->file_path);
|
||||
|
||||
$this->ftp->get($remoteFile, $localFile);
|
||||
}
|
||||
|
||||
@ -167,4 +170,5 @@ class SafekatFtpClient
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -120,6 +120,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
@ -572,4 +573,109 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
$query = $this->db->getLastQuery();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPapelGenericoCliente($data)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
|
||||
if ($data->POD == true && ($data->tipo == 'color')) {
|
||||
if ($data->tipo == 'color')
|
||||
$data->tipo = 'colorhq';
|
||||
else if ($data->tipo == 'negro')
|
||||
$data->tipo = 'negrohq';
|
||||
}
|
||||
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.nombre AS nombre",
|
||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.show_in_client", 1)
|
||||
->where("t1.tipo_papel_generico_id", $data->tipo_papel_generico_id)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
->where("t2.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.min <= ", $data->tirada)
|
||||
->where("t4.max >= ", $data->tirada)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $data->tipo)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t1.id", function ($subQuery) {
|
||||
$subQuery->select("t1_inner.id")
|
||||
->from("lg_papel_generico t1_inner")
|
||||
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t4.ancho_impresion >", $data->ancho)
|
||||
->where("t4.alto_impresion >", $data->alto)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.alto_impresion >", $data->ancho)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t2.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t2.guardas", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t2.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t2.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false) {
|
||||
$builder->where("t2.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t2.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//$query = $this->db->getLastQuery(); // DEBUG
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
|
||||
public function querySelect(?string $query)
|
||||
{
|
||||
$q = $this->builder()->select([
|
||||
$q = $this->builder()->select([
|
||||
"id",
|
||||
"nombre as name",
|
||||
]);
|
||||
@ -400,4 +400,104 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
return $q;
|
||||
}
|
||||
|
||||
public function getGramajeCliente($data) {
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
|
||||
if ($data->POD == true && ($data->tipo == 'color')) {
|
||||
if ($data->tipo == 'color')
|
||||
$data->tipo = 'colorhq';
|
||||
else if ($data->tipo == 'negro')
|
||||
$data->tipo = 'negrohq';
|
||||
}
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.gramaje as gramaje",
|
||||
// for debug, t1.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t1.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.isActivo", 1)
|
||||
->where("t1.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.min <= ", $data->tirada)
|
||||
->where("t4.max >= ", $data->tirada)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $data->tipo)
|
||||
->where("t2.id", $data->papel_id ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t2.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t2.id", function ($subQuery) {
|
||||
$subQuery->select("t2_inner.id")
|
||||
->from("lg_papel_generico t2_inner")
|
||||
->join("lg_papel_impresion t1_inner", "t1_inner.papel_generico_id = t2_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t1_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t4.ancho_impresion >", $data->ancho)
|
||||
->where("t4.alto_impresion >", $data->alto)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.alto_impresion >", $data->ancho)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t1.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t1.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t1.guardas", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t1.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t1.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false) {
|
||||
$builder->where("t1.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.gramaje", "asc")->get()->getResultObject();
|
||||
$query = $this->db->getLastQuery();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,5 +18,96 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\TipoPapelGenerico";
|
||||
|
||||
public function getTiposPapelCliente($data)
|
||||
{
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.clave AS nombre",
|
||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_generico t2", "t2.tipo_papel_generico_id = t1.id", "inner")
|
||||
->join("lg_papel_impresion t3", "t3.papel_generico_id = t2.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t4", "t4.papel_impresion_id = t3.id", "inner")
|
||||
->join("lg_maquinas t5", "t4.maquina_id = t5.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t6", "t6.maquina_id = t5.id", "inner")
|
||||
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t3.is_deleted", 0)
|
||||
->where("t3.isActivo", 1)
|
||||
->where("t3.use_in_client", 1)
|
||||
->where("t4.active", 1)
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.min <= ", $data->tirada ?? 0)
|
||||
->where("t5.max >= ", $data->tirada ?? 0)
|
||||
->where("t5.tipo", "impresion")
|
||||
->where("t6.is_deleted", 0)
|
||||
->where("t6.tipo", $data->tipo ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t2.id", function ($subQuery) {
|
||||
$subQuery->select("t1_inner.id")
|
||||
->from("lg_papel_generico t1_inner")
|
||||
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t5.ancho_impresion >", $data->ancho ?? 0)
|
||||
->where("t5.alto_impresion >", $data->alto ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.alto_impresion >", $data->ancho ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t3.cubierta", 1);
|
||||
$builder->where("t6.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t3.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t3.sobrecubierta", 1);
|
||||
$builder->where("t6.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t3.guardas", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t3.interior", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t3.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t3.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false || $data->forzar_rotativa_POD) {
|
||||
$builder->where("t3.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$return_data = $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
$query = $this->db->getLastQuery();
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,16 +2,25 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Models\Configuracion\TipoPapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
|
||||
class PapelService extends BaseService
|
||||
{
|
||||
protected TipoPapelGenericoModel $tipoPapelGenericoModel;
|
||||
protected PapelGenericoModel $papelGenericoModel;
|
||||
protected PapelImpresionModel $papelImpresionModel;
|
||||
protected ClienteModel $clienteModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->tipoPapelGenericoModel = model(TipoPapelGenericoModel::class);
|
||||
$this->papelGenericoModel = model(PapelGenericoModel::class);
|
||||
$this->papelImpresionModel = model(PapelImpresionModel::class);
|
||||
$this->clienteModel = model(ClienteModel::class);
|
||||
}
|
||||
|
||||
public function getTipoPapelGenerico()
|
||||
@ -24,4 +33,212 @@ class PapelService extends BaseService
|
||||
|
||||
return $tipoPapelGenericoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getTiposPalelGenerico($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
$cliente_id = $data->cliente_id ?? null;
|
||||
$forzar_rotativa_POD = false;
|
||||
if (isset($cliente_id) && !is_null($cliente_id)) {
|
||||
$cliente = $this->clienteModel->find($cliente_id);
|
||||
if ($cliente && isset($cliente->forzar_rotativa_pod)) {
|
||||
$forzar_rotativa_POD = boolval($cliente->forzar_rotativa_pod);
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD,
|
||||
'forzar_rotativa_POD' => $forzar_rotativa_POD
|
||||
];
|
||||
|
||||
$list = $this->tipoPapelGenericoModel->getTiposPapelCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getPapelGenerico($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
$tipo_papel_generico_id = $data->tipo_papel_generico_id ?? null;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'tipo_papel_generico_id' => $tipo_papel_generico_id,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD
|
||||
];
|
||||
|
||||
if (isset($data->selected_tipo_id)) {
|
||||
$data_output->selected_tipo_id = $data->selected_tipo_id;
|
||||
}
|
||||
|
||||
$list = $this->papelGenericoModel->getPapelGenericoCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getGramajes($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
|
||||
$forzar_rotativa_POD = $data->forzar_rotativa_POD ?? false;
|
||||
|
||||
|
||||
$papel_id = $data->papel_id ?? null;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'papel_id' => $papel_id,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD
|
||||
];
|
||||
|
||||
if (isset($data->selected_tipo_id)) {
|
||||
$data_output->selected_tipo_id = $data->selected_tipo_id;
|
||||
}
|
||||
|
||||
$list = $this->papelImpresionModel->getGramajeCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@
|
||||
data-bs-parent="#accordionPresupuestoFiles">
|
||||
<div class="accordion-body">
|
||||
<div class="col-12">
|
||||
<div class="dropzone needsclick" id="<?= $id ?>" data-id="<?= $modelId ?>">
|
||||
<div class="dropzone needsclick" id="<?= $id ?>" data-id="<?= $modelId ?>" data-ot-id="<?= $otId ?? '' ?>">
|
||||
|
||||
<div class="dz-message needsclick">
|
||||
Arrastre aquí los ficheros o haga click
|
||||
|
||||
@ -13,92 +13,110 @@
|
||||
<div class="col-xl-12">
|
||||
<div class="border rounded p-4 mb-3 pb-3">
|
||||
|
||||
<!-- Price Details -->
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-5 py-1 fw-normal text-end">Coste papel</dt>
|
||||
<dd class="py-1 col-6 text-end"><span id="totalCostePapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">Margen papel</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenPapel"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenPapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h5 class="mb-0">Costes detallados</h5>
|
||||
<button class="btn btn-sm btn-link p-0" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#detallesCostes" aria-expanded="true"
|
||||
aria-controls="detallesCostes" title="Mostrar/ocultar detalle de precios">
|
||||
<i class="ti ti-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse" data-bs-target=".costes-impresion" aria-expanded="false" aria-controls="costes-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Coste impresión
|
||||
</dt>
|
||||
<dd class="col-6 text-end py-1"><span id="totalCosteImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<div id="detallesCostes" class="collapse">
|
||||
<!-- Price Details -->
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-5 py-1 fw-normal text-end">Coste papel</dt>
|
||||
<dd class="py-1 col-6 text-end"><span id="totalCostePapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">Margen papel</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenPapel"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenPapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse"
|
||||
data-bs-target=".costes-impresion" aria-expanded="false"
|
||||
aria-controls="costes-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Coste impresión
|
||||
</dt>
|
||||
<dd class="col-6 text-end py-1"><span id="totalCosteImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteTinta" class="autonumeric-resumen-currency" ></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse" data-bs-target=".margen-impresion" aria-expanded="false" aria-controls="margen-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Margen impresión
|
||||
</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenImpresion"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteTinta" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse"
|
||||
data-bs-target=".margen-impresion" aria-expanded="false"
|
||||
aria-controls="margen-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Margen impresión
|
||||
</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenImpresion"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenTinta" class="autonumeric-resumen-currency" ></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenTinta" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste servicios</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="totalServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen servicios</dt>
|
||||
<dd class="col-3 text-end py-1 "><span id="porcentajeMargenServicios"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1 "><span id="margenServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="costeEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="margenEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste servicios</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="totalServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen servicios</dt>
|
||||
<dd class="col-3 text-end py-1 "><span id="porcentajeMargenServicios"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1 "><span id="margenServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="costeEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="margenEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
|
||||
<hr class="mx-n4">
|
||||
|
||||
@ -111,7 +129,7 @@
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="totalMargenes"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Total envío base</dt>
|
||||
<dt class="col-5 fw-normal text-end">Total envío base</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="precioEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
@ -168,7 +186,8 @@
|
||||
<div class="col-xl-12 mt-3">
|
||||
<div class="card border border-secondary-subtle rounded-3">
|
||||
<div class="card-body">
|
||||
<div id="div_ajustar_error" class="alert alert-danger d-flex align-items-baseline d-none" role="alert">
|
||||
<div id="div_ajustar_error" class="alert alert-danger d-flex align-items-baseline d-none"
|
||||
role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-ban ti-sm"></i>
|
||||
</span>
|
||||
@ -194,15 +213,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php /*if ($presupuestoEntity->estado_id == 2): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-1">
|
||||
<label for="totalAceptado"
|
||||
class="form-label"><?= lang('Presupuestos.totalAceptado') ?></label>
|
||||
<input disabled type="text" id="totalAceptado" name="totalAceptado"
|
||||
class="form-control text-center fs-5 autonumeric-resumen-currency" value="" <?php echo ($tipo_impresion_id == 21) ? ' max=80' : '' ?>>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; */ ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-1">
|
||||
<label for="totalAceptado"
|
||||
class="form-label"><?= lang('Presupuestos.totalAceptado') ?></label>
|
||||
<input disabled type="text" id="totalAceptado" name="totalAceptado"
|
||||
class="form-control text-center fs-5 autonumeric-resumen-currency" value="" <?php echo ($tipo_impresion_id == 21) ? ' max=80' : '' ?>>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; */ ?>
|
||||
<div class="row">
|
||||
<p>
|
||||
<span id="aprobado_by_at"></span>
|
||||
|
||||
@ -240,34 +240,34 @@
|
||||
<div class="row justify-content-center">
|
||||
<div id="fresado"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.jpg") ?>"
|
||||
alt="Fresado">
|
||||
<div class="form-text text-center">Fresado (a partir de 32 páginas)</div>
|
||||
<div class="form-text text-center">A partir de 32 páginas</div>
|
||||
</div>
|
||||
<div id="cosido"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.jpg") ?>"
|
||||
alt="Cosido">
|
||||
<div class="form-text text-center">Cosido (a partir de 32 páginas)</div>
|
||||
<div class="form-text text-center">A partir de 32 páginas</div>
|
||||
</div>
|
||||
<div id="grapado"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.jpg") ?>"
|
||||
alt="Grapado">
|
||||
<div class="form-text text-center">Grapado (entre 12 y 40 páginas)</div>
|
||||
<div class="form-text text-center">Entre 12 y 40 páginas</div>
|
||||
</div>
|
||||
<div id="espiral"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.jpg") ?>"
|
||||
alt="Espiral">
|
||||
<div class="form-text text-center">Espiral (a partir de 20 páginas)</div>
|
||||
<div class="form-text text-center">A partir de 20 páginas</div>
|
||||
</div>
|
||||
|
||||
<div id="wireo"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.png") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.jpg") ?>"
|
||||
alt="Wire-O">
|
||||
<div class="form-text text-center">Wire-O (a partir de 20 páginas)</div>
|
||||
<div class="form-text text-center">A partir de 20 páginas</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -49,27 +49,23 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div id="textoPapelInterior" class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none">
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none texto-papel-interior">
|
||||
<h3 class="mb-1 fw-bold"> Papel interior </h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<h5 id="textoTipoPapelInterior" class="mb-1 fw-bold">Tipo</h5>
|
||||
<div id="divTipoPapelInterior" name="div_tipo_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
|
||||
|
||||
</div>
|
||||
|
||||
<h5 class="mb-1 fw-bold texto-papel-interior">Papel</h5>
|
||||
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="divPapelEspecialInterior" name="div_papel_especial_interior"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
<div class="col-sm-5 mb-0">
|
||||
<label for="titulo" class="form-label">
|
||||
Seleccione el papel especial
|
||||
</label>
|
||||
<select id="papelEspecialInterior" name="papel_especial_interior"
|
||||
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h5 id="textoGramajeInterior" class="mb-1 fw-bold">Gramaje</h5>
|
||||
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
</div>
|
||||
|
||||
@ -102,34 +98,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="textoPapelInteriorColor" class="col-sm-8 mb-3 d-flex flex-column align-items-center interior-color d-none">
|
||||
<h3 class="mb-1 fw-bold"> Papel interior color</h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div id="divPapelInteriorColor" name="div_papel_interior_color"
|
||||
class="row col-sm-10 mb-5 interior-color justify-content-center interior-color d-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="divPapelEspecialInteriorColor" name="div_papel_especial_interior_color"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
<div class="col-sm-5 mb-0">
|
||||
<label for="titulo" class="form-label">
|
||||
Seleccione el papel especial
|
||||
</label>
|
||||
<select id="papelEspecialInteriorColor" name="papel_especial_interior_color"
|
||||
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divGramajeInteriorColor" name="div_gramaje_interior_color"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -1,5 +1,9 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?= view("themes/vuexy/components/dropzone",data: ['id' => 'dropzone-ot-files','modelId' => $presupuesto->id]) ?>
|
||||
<?= view("themes/vuexy/components/dropzone", data: [
|
||||
'id' => 'dropzone-ot-files',
|
||||
'modelId' => $presupuesto->id,
|
||||
'otId' => $ot->id
|
||||
]) ?>
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
@ -11,7 +11,10 @@ if (
|
||||
auth()->user()->can('maquinas.menu') ||
|
||||
auth()->user()->can('maquinas-defecto.menu') ||
|
||||
auth()->user()->can('usuarios.menu') ||
|
||||
auth()->user()->can('roles-permisos.menu')
|
||||
auth()->user()->can('roles-permisos.menu') ||
|
||||
auth()->user()->can('proveedores.menu') ||
|
||||
auth()->user()->can('ubicaciones.menu') ||
|
||||
auth()->user()->can('series-facturas.menu')
|
||||
) {
|
||||
?>
|
||||
<li class="menu-item">
|
||||
@ -63,14 +66,14 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("maquinaTareaList") ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_maquina_tareas") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("imposicionList") ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_imposiciones") ?></div>
|
||||
@ -112,29 +115,28 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_error_presupuesto") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_variables") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('configMessagesIndex') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_config_messages") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('festivosList') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_config_holidays") ?></div>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 MiB |
@ -1,6 +1,6 @@
|
||||
|
||||
import Ajax from '../ajax.js';
|
||||
import { alertSuccessMessage } from '../alerts/sweetAlert.js'
|
||||
import { alertSuccessMessage, alertWarningMessage } from '../alerts/sweetAlert.js'
|
||||
|
||||
const PREVIEW_TEMPLATE = `
|
||||
<div class="dz-preview dz-file-preview">
|
||||
@ -25,7 +25,7 @@ const PREVIEW_TEMPLATE = `
|
||||
class FileUploadDropzone {
|
||||
|
||||
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos" }) {
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos", otId = null }) {
|
||||
Dropzone.autoDiscover = false;
|
||||
this.domElement = domElement
|
||||
this.jqElement = $(domElement)
|
||||
@ -35,6 +35,7 @@ class FileUploadDropzone {
|
||||
this.btnDownloadFiles = $(`#${domElement.replace('#', '')}_btnDownloadFiles`);
|
||||
this.dataPost = {}
|
||||
this.nameId = nameId;
|
||||
this.otId = otId;
|
||||
this.getUri = getUri
|
||||
this.postUri = postUri
|
||||
this.dataPost[nameId] = this.modelId;
|
||||
@ -160,7 +161,8 @@ class FileUploadDropzone {
|
||||
url: `/presupuestoadmin/download_zip`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
[this.nameId]: this.modelId
|
||||
[this.nameId]: this.modelId,
|
||||
'ot_id': this.otId
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
@ -185,7 +187,7 @@ class FileUploadDropzone {
|
||||
window.URL.revokeObjectURL(url);
|
||||
},
|
||||
error: () => {
|
||||
alertWarningMessage("Error al descargar el archivo ZIP.");
|
||||
alertWarningMessage("Error", "Error al descargar el archivo ZIP.");
|
||||
},
|
||||
complete: () => {
|
||||
$("#loader").modal('hide');
|
||||
|
||||
@ -1062,14 +1062,14 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.removeClass('is-invalid');
|
||||
this.divPapelEspecial.removeClass('is-invalid');
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.textoPapelCubierta.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelCubierta.addClass("d-none");
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-cubierta d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -1102,7 +1102,7 @@ class DisenioCubierta {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.divPapelCubierta.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
@ -1124,7 +1124,7 @@ class DisenioCubierta {
|
||||
|
||||
radioButton.on('click', this.#handleGramajeCubierta.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
if (papel.id == this.papelCubierta) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
@ -1201,11 +1201,11 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
let papel = response.length > 0 ? response : response;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
|
||||
@ -18,15 +18,12 @@ class DisenioInterior {
|
||||
this.validatorStepper = validatorStepper;
|
||||
|
||||
this.disenioInterior = this.domItem.find(".disenio-interior");
|
||||
this.divTipoPapelInterior = this.domItem.find("#divTipoPapelInterior");
|
||||
this.textoTipoPapelInterior = this.domItem.find("#textoTipoPapelInterior");
|
||||
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
||||
this.textoPapelInterior = this.domItem.find("#textoPapelInterior");
|
||||
this.textoPapelInteriorColor = this.domItem.find("#textoPapelInteriorColor");
|
||||
this.divPapelInteriorColor = this.domItem.find("#divPapelInteriorColor");
|
||||
this.divPapelEspecialInterior = this.domItem.find("#divPapelEspecialInterior");
|
||||
this.divPapelEspecialInteriorColor = this.domItem.find("#divPapelEspecialInteriorColor");
|
||||
this.papelEspecialInterior = this.domItem.find("#papelEspecialInterior");
|
||||
this.textoPapelInterior = this.domItem.find(".texto-papel-interior");
|
||||
this.divGramajeInterior = this.domItem.find("#divGramajeInterior");
|
||||
this.divGramajeInteriorColor = this.domItem.find("#divGramajeInteriorColor");
|
||||
this.textoGramajeInterior = this.domItem.find("#textoGramajeInterior");
|
||||
|
||||
this.negroEstandar = this.domItem.find("#negroEstandar");
|
||||
this.negroPremium = this.domItem.find("#negroPremium");
|
||||
@ -49,42 +46,10 @@ class DisenioInterior {
|
||||
this.rl_papel_interior = $("#rl_papel_interior");
|
||||
this.rl_papel_interior_color = $("#rl_papel_interior_color");
|
||||
|
||||
this.papelEspecial = new ClassSelect($("#papelEspecialInterior"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
this.papelEspecialColor = new ClassSelect($("#papelEspecialInteriorColor"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
|
||||
this.papelInteriorDiferente = false;
|
||||
this.tipoPapel = null;
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
this.cargando = true;
|
||||
|
||||
@ -102,75 +67,75 @@ class DisenioInterior {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.papelEspecial.init();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelEspecialColor.init();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
|
||||
// Eventos
|
||||
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
|
||||
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
|
||||
|
||||
}
|
||||
|
||||
updateTiposPapeles() {
|
||||
|
||||
updatePapeles(papeles = null) {
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
cliente_id: () => this.presupuestoCliente.datosGenerales.getCliente(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillTiposPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
updatePapeles() {
|
||||
|
||||
const context = this;
|
||||
|
||||
if (papeles == 'color') {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapelesColor(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
if (papeles == 'negro' || papeles == null) {
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
fillPapeles(response) {
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.textoPapelInterior.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -199,117 +164,50 @@ class DisenioInterior {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInterior.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInterior) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecial.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInterior').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
fillPapelesColor(response) {
|
||||
|
||||
this.divPapelInteriorColor.empty()
|
||||
this.divGramajeInteriorColor.empty();
|
||||
fillTiposPapeles(response) {
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
this.textoPapelInteriorColor.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInteriorColor.addClass("d-none");
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if(response.length <= 0) {
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
return;
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
this.textoTipoPapelInterior.removeClass('d-none');
|
||||
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
class: 'custom-selector custom-selector-tipo-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelColor_' + papel.id, // ID único
|
||||
name: 'tipo-papel-interior',
|
||||
id: 'tipoPapel_' + papel.id, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelColor_' + papel.id,
|
||||
text: papel.nombre
|
||||
for: 'tipoPapel_' + papel.id,
|
||||
text: papel.texto
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
radioButton.on('click', this.#handleTipoPapelInterior.bind(this));
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
this.divTipoPapelInterior.append(container);
|
||||
|
||||
if (this.papelInteriorColor == papel.id) {
|
||||
if (this.tipoPapel == papel.id) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInteriorColor) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecialColor.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -317,63 +215,35 @@ class DisenioInterior {
|
||||
|
||||
this.papelInteriorDiferente = papelInteriorDiferente;
|
||||
|
||||
if (papelInteriorDiferente) {
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
if (datos.negro) {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
|
||||
}
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium_color.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar_color.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInteriorColor = datos.color.papel.id;
|
||||
this.gramajeColor = datos.color.gramaje;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar.addClass('selected');
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
this.colorEstandar.addClass('selected');
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
this.tipoPapel = datos.color.tipo_papel;
|
||||
}
|
||||
if (datos.paginasColorConsecutivas)
|
||||
this.updatePapeles();
|
||||
else
|
||||
this.updatePapeles('negro');
|
||||
else {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
this.tipoPapel = datos.negro.tipo_papel;
|
||||
}
|
||||
|
||||
this.updateTiposPapeles();
|
||||
this.updatePapeles();
|
||||
}
|
||||
|
||||
|
||||
@ -433,21 +303,11 @@ class DisenioInterior {
|
||||
|
||||
const papelSeleccionado = $('.custom-selector-papel input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
if (!$('#divPapelEspecialInterior').hasClass("d-none")) {
|
||||
if ($('#papelEspecialInterior').select2('data').length == 0) {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior_especial);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
|
||||
|
||||
} else {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior);
|
||||
@ -483,16 +343,6 @@ class DisenioInterior {
|
||||
return tipo;
|
||||
}
|
||||
|
||||
getTipoImpresionColor() {
|
||||
|
||||
let tipo = 'colorhq';
|
||||
if (this.colorEstandar_color.hasClass('selected'))
|
||||
tipo = 'color';
|
||||
|
||||
return tipo;
|
||||
}
|
||||
|
||||
|
||||
getIsHq() {
|
||||
|
||||
try {
|
||||
@ -574,72 +424,18 @@ class DisenioInterior {
|
||||
|
||||
if (this.papelInterior != null && checkedPapel != null && checkedPapel.length > 0) {
|
||||
|
||||
if (this.divPapelInteriorColor.hasClass('d-none')) {
|
||||
|
||||
if (forResumen) {
|
||||
if (forResumen) {
|
||||
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
if (radioButtonId == 'papelEspecialInterior')
|
||||
return capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
return this.papelInterior;
|
||||
else {
|
||||
return this.papelEspecial.getVal();
|
||||
}
|
||||
}
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
else {
|
||||
let checkedPapelColor = $('.custom-selector-papel-color input[type="radio"]:checked');
|
||||
|
||||
if (checkedPapelColor == null || checkedPapelColor.length == 0 || checkedPapel == null || checkedPapel.length == 0)
|
||||
return null;
|
||||
|
||||
let papelNegro = 0;
|
||||
let papelColor = 0;
|
||||
|
||||
if (forResumen) {
|
||||
|
||||
let radioButtonIdNegro = checkedPapel[0].id;
|
||||
if (radioButtonIdNegro == 'papelEspecialInterior')
|
||||
papelNegro = capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdNegro + '"]');
|
||||
papelNegro = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
let radioButtonIdColor = checkedPapelColor[0].id;
|
||||
if (radioButtonIdColor == 'papelEspecialInteriorColor')
|
||||
papelColor = capitalizeFirstLetter(this.papelEspecialColor.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdColor + '"]');
|
||||
papelColor = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
papelNegro = this.papelInterior;
|
||||
else {
|
||||
papelNegro = this.papelEspecial.getVal();
|
||||
}
|
||||
if (this.divPapelEspecialInteriorColor.hasClass('d-none'))
|
||||
papelColor = this.papelInteriorColor;
|
||||
else {
|
||||
papelColor = this.papelEspecialColor.getVal();
|
||||
}
|
||||
}
|
||||
return {
|
||||
negro: papelNegro,
|
||||
color: papelColor,
|
||||
}
|
||||
return this.papelInterior;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -707,10 +503,6 @@ class DisenioInterior {
|
||||
let class2Find = '.disenio-interior';
|
||||
if (element[0].closest('.image-container').id.includes('Color')) {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
$('#papelEspecialInteriorColor').off("change");
|
||||
this.papelEspecialColor.empty();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
class2Find = '.disenio-interior-color';
|
||||
@ -719,10 +511,6 @@ class DisenioInterior {
|
||||
}
|
||||
else {
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
$('#papelEspecialInterior').off("change");
|
||||
this.papelEspecial.empty();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.divPapelInterior.empty();
|
||||
@ -742,11 +530,15 @@ class DisenioInterior {
|
||||
// Para recalcular el presupuesto
|
||||
element.trigger('change');
|
||||
|
||||
if ($('.disenio-interior.selected').length != 0) {
|
||||
if (class2Find == '.disenio-interior-color')
|
||||
this.updatePapeles('color');
|
||||
else
|
||||
this.updatePapeles();
|
||||
if(element.closest(class2Find).parent().find(class2Find).hasClass('selected'))
|
||||
this.updateTiposPapeles();
|
||||
else{
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass('d-none');
|
||||
this.divPapelInterior.empty();
|
||||
this.textoPapelInterior.addClass('d-none');
|
||||
}
|
||||
|
||||
if (this.validateDisenioInterior()) {
|
||||
@ -782,37 +574,24 @@ class DisenioInterior {
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
if (element[0].id == 'papelEspecialInterior') {
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesimpresion/getgramajecliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel_id: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
if (!this.cargando)
|
||||
this.gramaje = null;
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.removeClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
if (!this.cargando) {
|
||||
this.gramaje = null;
|
||||
if (this.validatePapelInterior()) {
|
||||
@ -835,107 +614,34 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
#handlePapelInteriorEspecial() {
|
||||
|
||||
#handleTipoPapelInterior(event) {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.papelInterior = this.papelEspecial.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
#handlePapelInteriorColor(event) {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
this.divTipoPapelInterior.removeClass('is-invalid');
|
||||
this.divPapelInterior.removeClass('is-invalid');
|
||||
this.divGramajeInterior.removeClass('is-invalid');
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
|
||||
// Accede al ID del elemento que disparó el evento
|
||||
const element = $(event.target);
|
||||
const papel = element[0].id.split('_')[1];
|
||||
this.papelInteriorColor = papel;
|
||||
if (!this.cargando)
|
||||
this.gramajeColor = null;
|
||||
else {
|
||||
this.cargandoColor = false;
|
||||
}
|
||||
this.tipoPapel = papel;
|
||||
|
||||
$('#' + papel).prop('checked', true);
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
|
||||
if (element[0].id == 'papelEspecialInteriorColor') {
|
||||
|
||||
this.gramajeColor = null;
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.removeClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#handlePapelInteriorEspecialColor() {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.papelInteriorColor = this.papelEspecialColor.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
tipo_papel_generico_id: papel,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
@ -943,13 +649,14 @@ class DisenioInterior {
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
this.fillPapeles.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fillGramajes(response) {
|
||||
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
@ -957,11 +664,13 @@ class DisenioInterior {
|
||||
this.divGramajeInterior.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
this.textoGramajeInterior.removeClass('d-none');
|
||||
|
||||
let papel = response.length > 0 ? response : response;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
@ -1028,65 +737,6 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
fillGramajesColor(response) {
|
||||
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.divGramajeInteriorColor.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.papeles.forEach(valor => {
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-gramaje-color d-flex flex-column align-items-center justify-content-center gramaje-interior',
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: ' calcular-solapas calcular-presupuesto gramaje-interior-color',
|
||||
id: 'gramajeColor_' + valor.gramaje, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: "gramajeColor_" + valor.gramaje,
|
||||
text: valor.gramaje + " gr"
|
||||
});
|
||||
|
||||
radioButton.on('click', (event) => {
|
||||
const element = $(event.target);
|
||||
const gramaje = element[0].id;
|
||||
|
||||
this.presupuestoCliente.calcularSolapas(event);
|
||||
this.presupuestoCliente.checkForm(event);
|
||||
});
|
||||
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divGramajeInteriorColor').append(container);
|
||||
|
||||
if (this.gramaje != null) {
|
||||
if (this.gramaje == valor.gramaje) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
showGramaje = true;
|
||||
});
|
||||
|
||||
if ($("#divGramajeInteriorColor").hasClass("d-none") && showGramaje) {
|
||||
$("#divGramajeInteriorColor").removeClass("d-none");
|
||||
}
|
||||
else if (!showGramaje) {
|
||||
$("#divGramajeInteriorColor").addClass("d-none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ class OrdenTrabajo {
|
||||
this.otForm = this.item.find("#ot-edit-form")
|
||||
this.block = document.querySelector('.section-block');
|
||||
this.modelId = this.item.data("id");
|
||||
this.otId = parseInt($("#dropzone-ot-files").data("ot-id")) || null;
|
||||
this.tareasTableItem = this.item.find("#ot-task-table");
|
||||
this.tareasId = []
|
||||
this.summaryData = {}
|
||||
@ -70,6 +71,7 @@ class OrdenTrabajo {
|
||||
this.configUploadDropzone = {
|
||||
domElement: '#dropzone-ot-files',
|
||||
nameId: "presupuesto_id",
|
||||
otId: this.otId,
|
||||
getUri: '/presupuestos/presupuestocliente/get_files',
|
||||
postUri: '/presupuestos/presupuestocliente/upload_files'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user