mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/servicios_externos' into 'main'
Dev/servicios externos See merge request jjimenez/safekat!202
This commit is contained in:
4
ci4/.gitignore
vendored
4
ci4/.gitignore
vendored
@ -41,7 +41,7 @@ $RECYCLE.BIN/
|
|||||||
#-------------------------
|
#-------------------------
|
||||||
# These should never be under version control,
|
# These should never be under version control,
|
||||||
# as it poses a security risk.
|
# as it poses a security risk.
|
||||||
.env
|
.env*
|
||||||
.vagrant
|
.vagrant
|
||||||
Vagrantfile
|
Vagrantfile
|
||||||
|
|
||||||
@ -125,3 +125,5 @@ nb-configuration.xml
|
|||||||
/phpunit*.xml
|
/phpunit*.xml
|
||||||
/.phpunit.*.cache
|
/.phpunit.*.cache
|
||||||
|
|
||||||
|
|
||||||
|
xdebug.log
|
||||||
@ -104,6 +104,20 @@ $routes->group('tarifapreimpresion', ['namespace' => 'App\Controllers\Tarifas'],
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$routes->group('tarifaextra', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||||
|
$routes->get('', 'Tarifaextra::index', ['as' => 'tarifaextraList']);
|
||||||
|
$routes->get('index', 'Tarifaextra::index', ['as' => 'tarifaextraIndex']);
|
||||||
|
$routes->get('list', 'Tarifaextra::index', ['as' => 'tarifaextraList2']);
|
||||||
|
$routes->get('add', 'Tarifaextra::add', ['as' => 'newTarifaextra']);
|
||||||
|
$routes->post('add', 'Tarifaextra::add', ['as' => 'createTarifaextra']);
|
||||||
|
$routes->get('edit/(:num)', 'Tarifaextra::edit/$1', ['as' => 'editTarifaextra']);
|
||||||
|
$routes->post('edit/(:num)', 'Tarifaextra::edit/$1', ['as' => 'updateTarifaextra']);
|
||||||
|
$routes->get('delete/(:num)', 'Tarifaextra::delete/$1', ['as' => 'deleteTarifaextra']);
|
||||||
|
$routes->post('allmenuitems', 'Tarifaextra::allItemsSelect', ['as' => 'select2ItemsOfTarifasextra']);
|
||||||
|
$routes->post('menuitems', 'Tarifaextra::menuItems', ['as' => 'menuItemsOfTarifasextra']);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
$routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||||
$routes->get('', 'Tarifasmanipulado::index', ['as' => 'tarifaManipuladoList']);
|
$routes->get('', 'Tarifasmanipulado::index', ['as' => 'tarifaManipuladoList']);
|
||||||
$routes->get('add', 'Tarifasmanipulado::add', ['as' => 'newTarifaManipulado']);
|
$routes->get('add', 'Tarifasmanipulado::add', ['as' => 'newTarifaManipulado']);
|
||||||
@ -550,6 +564,11 @@ $routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presu
|
|||||||
$routes->post('edit/(:num)', 'Presupuestopreimpresiones::edit/$1', ['as' => 'updatePresupuestopreimpresiones']);
|
$routes->post('edit/(:num)', 'Presupuestopreimpresiones::edit/$1', ['as' => 'updatePresupuestopreimpresiones']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$routes->group('serviciosextra', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
|
$routes->post('datatable', 'Presupuestoserviciosextra::datatable', ['as' => 'dataTableOfPresupuestoServiciosExtra']);
|
||||||
|
$routes->post('edit/(:num)', 'Presupuestoserviciosextra::edit/$1', ['as' => 'updatePresupuestoServiciosExtra']);
|
||||||
|
});
|
||||||
|
|
||||||
$routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
$routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
$routes->post('datatable', 'Presupuestodirecciones::datatable', ['as' => 'dataTableOfPresupuestoDirecciones']);
|
$routes->post('datatable', 'Presupuestodirecciones::datatable', ['as' => 'dataTableOfPresupuestoDirecciones']);
|
||||||
$routes->post('datatable_2', 'Presupuestodirecciones::datatable_2', ['as' => 'processDataDirecciones']);
|
$routes->post('datatable_2', 'Presupuestodirecciones::datatable_2', ['as' => 'processDataDirecciones']);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
|||||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||||
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||||
|
use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||||
|
|
||||||
use App\Services\PresupuestoService;
|
use App\Services\PresupuestoService;
|
||||||
use App\Models\Configuracion\PapelImpresionModel;
|
use App\Models\Configuracion\PapelImpresionModel;
|
||||||
@ -356,10 +357,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
// Servicios
|
// Servicios
|
||||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
|
||||||
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
||||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||||
|
$this->viewData['serviciosExtra'] = $this->getServiciosExtra();
|
||||||
|
|
||||||
[$cambios_en_servicios, $servicios] = $this->getLineasServicios($presupuestoEntity);
|
[$cambios_en_servicios, $servicios] = $this->getLineasServicios($presupuestoEntity);
|
||||||
$this->viewData['presupuestoEntity']->cambios_servicios=$cambios_en_servicios;
|
$this->viewData['presupuestoEntity']->cambios_servicios=$cambios_en_servicios;
|
||||||
@ -368,6 +369,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$this->viewData['serviciosAcabadosList'] = $servicios->serviciosAcabado;
|
$this->viewData['serviciosAcabadosList'] = $servicios->serviciosAcabado;
|
||||||
$this->viewData['serviciosManipuladoList'] = $servicios->serviciosManipulado;
|
$this->viewData['serviciosManipuladoList'] = $servicios->serviciosManipulado;
|
||||||
$this->viewData['serviciosPreimpresionList'] = $servicios->serviciosPreimpresion;
|
$this->viewData['serviciosPreimpresionList'] = $servicios->serviciosPreimpresion;
|
||||||
|
$this->viewData['serviciosExtraList'] = $servicios->serviciosExtra;
|
||||||
|
|
||||||
// Direciones presupuesto
|
// Direciones presupuesto
|
||||||
[$cambios_en_direcciones, $this->viewData['direccionesList']] = $this->getLineasDirecciones($presupuestoEntity);
|
[$cambios_en_direcciones, $this->viewData['direccionesList']] = $this->getLineasDirecciones($presupuestoEntity);
|
||||||
@ -459,6 +461,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$model = new PresupuestoManipuladosModel();
|
$model = new PresupuestoManipuladosModel();
|
||||||
$model->where("presupuesto_id", $id)->delete();
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran los servicios extra
|
||||||
|
$model = new PresupuestoServiciosExtraModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||||
@ -889,6 +895,12 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$preimpresion->presupuesto_id = $new_id;
|
$preimpresion->presupuesto_id = $new_id;
|
||||||
$presupuestoPreimpresionesModel->insert($preimpresion);
|
$presupuestoPreimpresionesModel->insert($preimpresion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$presupuestoServiciosExtraModel = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
|
||||||
|
foreach ($presupuestoServiciosExtraModel->where('presupuesto_id', $presupuesto->id)->findAll() as $servicioExtra) {
|
||||||
|
$servicioExtra->presupuesto_id = $new_id;
|
||||||
|
$presupuestoServiciosExtraModel->insert($preimpresion);
|
||||||
|
}
|
||||||
|
|
||||||
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||||
foreach ($presupuestoDireccionesModel->where('presupuesto_id', $presupuesto->id)->findAll() as $direccion) {
|
foreach ($presupuestoDireccionesModel->where('presupuesto_id', $presupuesto->id)->findAll() as $direccion) {
|
||||||
@ -1189,6 +1201,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getServiciosExtra()
|
||||||
|
{
|
||||||
|
$model = model('App\Models\Tarifas\TarifaextraModel');
|
||||||
|
$data = $model->getServiciosExtraSelector();
|
||||||
|
array_unshift($data, (object)array(
|
||||||
|
"value" => 0,
|
||||||
|
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioExtra'))])
|
||||||
|
));
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getServiciosEncuadernacion()
|
protected function getServiciosEncuadernacion()
|
||||||
{
|
{
|
||||||
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
@ -1246,6 +1269,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$serviciosPresupuesto->serviciosPreimpresion = (new PresupuestoPreimpresionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
$serviciosPresupuesto->serviciosPreimpresion = (new PresupuestoPreimpresionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||||
$serviciosPresupuesto->serviciosEncuadernacion = (new PresupuestoEncuadernacionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
$serviciosPresupuesto->serviciosEncuadernacion = (new PresupuestoEncuadernacionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||||
$serviciosPresupuesto->serviciosManipulado = (new PresupuestoManipuladosModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
$serviciosPresupuesto->serviciosManipulado = (new PresupuestoManipuladosModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||||
|
$serviciosPresupuesto->serviciosExtra = (new PresupuestoServiciosExtraModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||||
|
|
||||||
$input_data = [];
|
$input_data = [];
|
||||||
$input_data['presupuesto_id'] = $presupuestoEntity->id;
|
$input_data['presupuesto_id'] = $presupuestoEntity->id;
|
||||||
|
|||||||
113
ci4/app/Controllers/Presupuestos/Presupuestoserviciosextra.php
Executable file
113
ci4/app/Controllers/Presupuestos/Presupuestoserviciosextra.php
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
<?php namespace App\Controllers\Presupuestos;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Models\Collection;
|
||||||
|
|
||||||
|
use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||||
|
|
||||||
|
|
||||||
|
class Presupuestoserviciosextra extends \App\Controllers\GoBaseResourceController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $modelName = PresupuestoServiciosExtraModel::class;
|
||||||
|
protected $format = 'json';
|
||||||
|
|
||||||
|
protected static $singularObjectName = 'Presupuesto extra';
|
||||||
|
protected static $singularObjectNameCc = 'presupuestoPreimpresion';
|
||||||
|
protected static $pluralObjectName = 'Presupuestos extra';
|
||||||
|
protected static $pluralObjectNameCc = 'presupuestosPreimpresion';
|
||||||
|
|
||||||
|
protected static $controllerSlug = 'presupuesto-servicios-extra';
|
||||||
|
|
||||||
|
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit($requestedId = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($requestedId == null) :
|
||||||
|
return;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$postData = $this->request->getJSON();
|
||||||
|
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||||
|
if(count($tarifas)>0){
|
||||||
|
$this->model->deleteServiciosNotInArray($requestedId, $tarifas);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->model->deleteAllServicios($requestedId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($tarifas)>0){
|
||||||
|
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||||
|
}
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
$data = [
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($requestedId = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($requestedId == null) :
|
||||||
|
return;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$postData = $this->request->getJSON();
|
||||||
|
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
if(count($tarifas)>0){
|
||||||
|
foreach ($tarifas as $tarifa){
|
||||||
|
$values = $this->model->getPrecioTarifa($tarifa);
|
||||||
|
array_push($result, $values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
$data = [
|
||||||
|
'lines' => $result,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function datatable()
|
||||||
|
{
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
$reqData = $this->request->getPost();
|
||||||
|
|
||||||
|
$tarifa_extra_id = $reqData['tarifa_extra_id'] ?? 0;
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
|
$values = $this->model->getPrecioTarifa($tarifa_extra_id);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'values' => $values,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
248
ci4/app/Controllers/Tarifas/Tarifaextra.php
Executable file
248
ci4/app/Controllers/Tarifas/Tarifaextra.php
Executable file
@ -0,0 +1,248 @@
|
|||||||
|
<?php namespace App\Controllers\Tarifas;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entities\Tarifas\TarifaextraEntity;
|
||||||
|
|
||||||
|
class Tarifaextra extends \App\Controllers\GoBaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
use \CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
protected static $primaryModelName = 'App\Models\Tarifas\TarifaextraModel';
|
||||||
|
|
||||||
|
protected static $singularObjectNameCc = 'tarifaextra';
|
||||||
|
protected static $singularObjectName = 'Tarifaextra';
|
||||||
|
protected static $pluralObjectName = 'Tarifasextra';
|
||||||
|
protected static $controllerSlug = 'tarifaextra';
|
||||||
|
|
||||||
|
protected static $viewPath = 'themes/backend/vuexy/form/tarifas/extra/';
|
||||||
|
|
||||||
|
protected $indexRoute = 'tarifaextraList';
|
||||||
|
|
||||||
|
|
||||||
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
$this->viewData['pageTitle'] = lang('Tarifaextra.moduleTitle');
|
||||||
|
// Se indica que este controlador trabaja con soft_delete
|
||||||
|
$this->soft_delete = true;
|
||||||
|
// Se indica el flag para los ficheros borrados
|
||||||
|
$this->delete_flag = 1;
|
||||||
|
|
||||||
|
// Breadcrumbs
|
||||||
|
$this->viewData['breadcrumb'] = [
|
||||||
|
['title' => lang("App.menu_tarifas"), 'route' => "javascript:void(0);", 'active' => false],
|
||||||
|
['title' => lang("App.menu_tarifaextra"), 'route' => site_url('tarifas/tarifaextra'), 'active' => true]
|
||||||
|
];
|
||||||
|
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->viewData['usingClientSideDataTable'] = true;
|
||||||
|
|
||||||
|
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
|
||||||
|
parent::index();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$requestMethod = $this->request->getMethod();
|
||||||
|
|
||||||
|
if ($requestMethod === 'post') :
|
||||||
|
|
||||||
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
|
$postData = $this->request->getPost();
|
||||||
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||||
|
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$noException = true;
|
||||||
|
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->canValidate()) :
|
||||||
|
try {
|
||||||
|
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$noException = false;
|
||||||
|
$this->dealWithException($e);
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||||
|
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||||
|
endif;
|
||||||
|
if ($noException && $successfulResult) :
|
||||||
|
|
||||||
|
$id = $this->model->db->insertID();
|
||||||
|
|
||||||
|
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
|
if ($thenRedirect) :
|
||||||
|
if (!empty($this->indexRoute)) :
|
||||||
|
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||||
|
else:
|
||||||
|
return $this->redirect2listView('successMessage', $message);
|
||||||
|
endif;
|
||||||
|
else:
|
||||||
|
$this->session->setFlashData('sweet-success', $message);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
endif; // $noException && $successfulResult
|
||||||
|
|
||||||
|
endif; // ($requestMethod === 'post')
|
||||||
|
|
||||||
|
$this->viewData['tarifaextraEntity'] = isset($sanitizedData) ? new TarifaextraEntity($sanitizedData) : new TarifaextraEntity();
|
||||||
|
|
||||||
|
$this->viewData['formAction'] = route_to('createTarifaextra');
|
||||||
|
|
||||||
|
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.addNewSuffix');
|
||||||
|
|
||||||
|
|
||||||
|
return $this->displayForm(__METHOD__);
|
||||||
|
} // end function add()
|
||||||
|
|
||||||
|
public function edit($requestedId = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// JJO
|
||||||
|
$session = session();
|
||||||
|
|
||||||
|
if ($requestedId == null) :
|
||||||
|
return $this->redirect2listView();
|
||||||
|
endif;
|
||||||
|
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||||
|
$tarifaextraEntity = $this->model->find($id);
|
||||||
|
|
||||||
|
if ($tarifaextraEntity == false) :
|
||||||
|
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaextra.tarifaextra')), $id]);
|
||||||
|
return $this->redirect2listView('errorMessage', $message);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$requestMethod = $this->request->getMethod();
|
||||||
|
|
||||||
|
if ($requestMethod === 'post') :
|
||||||
|
|
||||||
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
|
$postData = $this->request->getPost();
|
||||||
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
|
// JJO
|
||||||
|
if (isset($this->model->user_updated_id)) {
|
||||||
|
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||||
|
}
|
||||||
|
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||||
|
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$noException = true;
|
||||||
|
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
if ($this->canValidate()) :
|
||||||
|
try {
|
||||||
|
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$noException = false;
|
||||||
|
$this->dealWithException($e);
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaextra.tarifaextra'))]);
|
||||||
|
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||||
|
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$tarifaextraEntity->fill($sanitizedData);
|
||||||
|
|
||||||
|
$thenRedirect = false;
|
||||||
|
endif;
|
||||||
|
if ($noException && $successfulResult) :
|
||||||
|
$id = $tarifaextraEntity->id ?? $id;
|
||||||
|
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
|
if ($thenRedirect) :
|
||||||
|
if (!empty($this->indexRoute)) :
|
||||||
|
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||||
|
else:
|
||||||
|
return $this->redirect2listView('successMessage', $message);
|
||||||
|
endif;
|
||||||
|
else:
|
||||||
|
$this->session->setFlashData('sweet-success', $message);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
endif; // $noException && $successfulResult
|
||||||
|
endif; // ($requestMethod === 'post')
|
||||||
|
|
||||||
|
$this->viewData['tarifaextraEntity'] = $tarifaextraEntity;
|
||||||
|
|
||||||
|
$this->viewData['formAction'] = route_to('updateTarifaextra', $id);
|
||||||
|
|
||||||
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.edit3');
|
||||||
|
|
||||||
|
|
||||||
|
return $this->displayForm(__METHOD__, $id);
|
||||||
|
} // end function edit(...)
|
||||||
|
|
||||||
|
|
||||||
|
public function allItemsSelect()
|
||||||
|
{
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
$onlyActiveOnes = true;
|
||||||
|
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||||
|
$menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false);
|
||||||
|
$nonItem = new \stdClass;
|
||||||
|
$nonItem->id = '';
|
||||||
|
$nonItem->nombre = '- ' . lang('Basic.global.None') . ' -';
|
||||||
|
array_unshift($menu, $nonItem);
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
$data = [
|
||||||
|
'menu' => $menu,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
return $this->respond($data);
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function menuItems()
|
||||||
|
{
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||||
|
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||||
|
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||||
|
$onlyActiveOnes = false;
|
||||||
|
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||||
|
$onlyActiveOnes = false;
|
||||||
|
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||||
|
$nonItem = new \stdClass;
|
||||||
|
$nonItem->id = '';
|
||||||
|
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||||
|
array_unshift($menu, $nonItem);
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
$data = [
|
||||||
|
'menu' => $menu,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
return $this->respond($data);
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
ci4/app/Entities/Presupuestos/PresupuestoServiciosExtraEntity.php
Executable file
23
ci4/app/Entities/Presupuestos/PresupuestoServiciosExtraEntity.php
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entities\Presupuestos;
|
||||||
|
|
||||||
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
|
class PresupuestoServiciosExtraEntity extends \CodeIgniter\Entity\Entity
|
||||||
|
{
|
||||||
|
protected $attributes = [
|
||||||
|
"id" => null,
|
||||||
|
"presupuesto_id" => null,
|
||||||
|
"tarifa_extra_id" => null,
|
||||||
|
"precio_total" => null,
|
||||||
|
"margen" => null,
|
||||||
|
"created_at" => null,
|
||||||
|
"updated_at" => null,
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
"presupuesto_id" => "int",
|
||||||
|
"tarifa_extra_id" => "int",
|
||||||
|
"precio_total" => "float",
|
||||||
|
"margen" => "float",
|
||||||
|
];
|
||||||
|
}
|
||||||
33
ci4/app/Entities/Tarifas/TarifaextraEntity.php
Executable file
33
ci4/app/Entities/Tarifas/TarifaextraEntity.php
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entities\Tarifas;
|
||||||
|
|
||||||
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
|
class TarifaextraEntity extends \CodeIgniter\Entity\Entity
|
||||||
|
{
|
||||||
|
protected $attributes = [
|
||||||
|
"id" => null,
|
||||||
|
"nombre" => null,
|
||||||
|
"precio" => null,
|
||||||
|
"precio_min" => 0,
|
||||||
|
"importe_fijo" => 0,
|
||||||
|
"margen" => 0,
|
||||||
|
"mostrar_en_presupuesto" => 1,
|
||||||
|
"user_created_id" => 1,
|
||||||
|
"user_update_id" => 1,
|
||||||
|
"is_deleted" => 0,
|
||||||
|
"deleted_at" => null,
|
||||||
|
"created_at" => null,
|
||||||
|
"updated_at" => null,
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
"precio" => "float",
|
||||||
|
"precio_min" => "float",
|
||||||
|
"importe_fijo" => "float",
|
||||||
|
"margen" => "float",
|
||||||
|
"mostrar_en_presupuesto" => "int",
|
||||||
|
"user_created_id" => "int",
|
||||||
|
"user_update_id" => "int",
|
||||||
|
"is_deleted" => "int",
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -781,6 +781,7 @@ return [
|
|||||||
|
|
||||||
"menu_tarifas" => "Tarifas",
|
"menu_tarifas" => "Tarifas",
|
||||||
"menu_tarifapreimpresion" => "Preimpresión",
|
"menu_tarifapreimpresion" => "Preimpresión",
|
||||||
|
"menu_tarifaextra" => "Serv. Extra",
|
||||||
"menu_tarifamanipulado" => "Manipulado",
|
"menu_tarifamanipulado" => "Manipulado",
|
||||||
"menu_tarifaencuadernacion" => "Encuadernación",
|
"menu_tarifaencuadernacion" => "Encuadernación",
|
||||||
"menu_tarifapapelcompra" => "Papel compra",
|
"menu_tarifapapelcompra" => "Papel compra",
|
||||||
|
|||||||
@ -182,11 +182,13 @@ return [
|
|||||||
|
|
||||||
'servicioAcabado' => 'Servicio de acabado',
|
'servicioAcabado' => 'Servicio de acabado',
|
||||||
'servicioPreimpresion' => 'Servicio de preimpresión',
|
'servicioPreimpresion' => 'Servicio de preimpresión',
|
||||||
|
'servicioExtra' => 'Servicio extra',
|
||||||
'servicioEncuadernado' => 'Servicio de encuadernación',
|
'servicioEncuadernado' => 'Servicio de encuadernación',
|
||||||
'servicioEncuadernadoList' => 'Servicios de encuadernación',
|
'servicioEncuadernadoList' => 'Servicios de encuadernación',
|
||||||
'servicioAcabadoList' => 'Servicios de acabado',
|
'servicioAcabadoList' => 'Servicios de acabado',
|
||||||
'servicioManipuladoList' => 'Servicios de manipulado',
|
'servicioManipuladoList' => 'Servicios de manipulado',
|
||||||
'servicioPreimpresionList' => 'Servicios de preimpresion',
|
'servicioPreimpresionList' => 'Servicios de preimpresion',
|
||||||
|
'servicioExtraList' => 'Servicios extra',
|
||||||
|
|
||||||
'servicioManipulado' => 'Servicio de manipulado',
|
'servicioManipulado' => 'Servicio de manipulado',
|
||||||
'comentarios' => 'Comentarios',
|
'comentarios' => 'Comentarios',
|
||||||
|
|||||||
50
ci4/app/Language/es/Tarifaextra.php
Executable file
50
ci4/app/Language/es/Tarifaextra.php
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'createdAt' => 'Creado en',
|
||||||
|
'deletedAt' => 'Borrado en',
|
||||||
|
'id' => 'ID',
|
||||||
|
'moduleTitle' => 'Tarifas Servicios Extra',
|
||||||
|
'nombre' => 'Nombre',
|
||||||
|
'precio' => 'Precio',
|
||||||
|
'precioMin' => 'Precio Mínimo',
|
||||||
|
'importeFijo' => 'Importe Fijo',
|
||||||
|
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||||
|
'margen' => 'Margen',
|
||||||
|
'tarifaextra' => 'Tarifa Servicios Extra',
|
||||||
|
'tarifaextraList' => 'Lista Tarifas Servicios Extra',
|
||||||
|
'tarifasextra' => 'Tarifas Servicios Extra',
|
||||||
|
'updatedAt' => 'Actualizado en',
|
||||||
|
'userCreatedId' => 'ID Usuario \"Creado en\"',
|
||||||
|
'userUpdateId' => 'ID Usuario \"Actualizado en\"',
|
||||||
|
'validation' => [
|
||||||
|
'nombre' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'precio' => [
|
||||||
|
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'user_created_id' => [
|
||||||
|
'integer' => 'El campo {field} debe contener un número entero.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'user_update_id' => [
|
||||||
|
'integer' => 'El campo {field} debe contener un número entero.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
@ -353,7 +353,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->where('presupuesto_id', $presupuesto_id)
|
->where('presupuesto_id', $presupuesto_id)
|
||||||
->where('tarifa_encuadernado_id', $tarifa->tarifa_id)
|
->where('tarifa_encuadernado_id', $tarifa->tarifa_id)
|
||||||
->set('proveedor_id', $proveedor, false)
|
->set('proveedor_id', $proveedor)
|
||||||
->set('precio_unidad', $tarifa->precio_unidad)
|
->set('precio_unidad', $tarifa->precio_unidad)
|
||||||
->set('precio_total', $tarifa->precio_total)
|
->set('precio_total', $tarifa->precio_total)
|
||||||
->set('margen', $tarifa->margen)
|
->set('margen', $tarifa->margen)
|
||||||
|
|||||||
158
ci4/app/Models/Presupuestos/PresupuestoServiciosExtraModel.php
Executable file
158
ci4/app/Models/Presupuestos/PresupuestoServiciosExtraModel.php
Executable file
@ -0,0 +1,158 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Presupuestos;
|
||||||
|
|
||||||
|
class PresupuestoServiciosExtraModel extends \App\Models\GoBaseModel
|
||||||
|
{
|
||||||
|
protected $table = "presupuesto_serviciosExtra";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether primary key uses auto increment.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
const SORTABLE = [
|
||||||
|
0 => "t2.nombre",
|
||||||
|
1 => "t1.precio_unidad",
|
||||||
|
2 => "t1.precio_total"
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $allowedFields = ["presupuesto_id", "tarifa_extra_id", "nombre", "precio_total", "precio_unidad", "margen"];
|
||||||
|
protected $returnType = "App\Entities\Presupuestos\PresupuestoServiciosExtraEntity";
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
|
||||||
|
protected $createdField = "created_at";
|
||||||
|
protected $updatedField = "updated_at";
|
||||||
|
|
||||||
|
public static $labelField = "nombre";
|
||||||
|
|
||||||
|
protected $validationRules = [
|
||||||
|
"precio_total" => [
|
||||||
|
"label" => "Presupuestos.precioTotal",
|
||||||
|
"rules" => "decimal|required",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $validationMessages = [
|
||||||
|
"precio_total" => [
|
||||||
|
"decimal" => "Presupuestos.validation.decimal",
|
||||||
|
"requerido" => "Presupuestos.validation.decimal",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function getPrecioTarifa($tarifa_extra_id){
|
||||||
|
|
||||||
|
$modelTarifa = model('App\Models\Tarifas\TarifaextraModel');
|
||||||
|
$tarifa_value = $modelTarifa->getTarifaPresupuestoExtra($tarifa_extra_id);
|
||||||
|
if (count($tarifa_value)>0) {
|
||||||
|
|
||||||
|
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||||
|
$ret_array[] = (object)[
|
||||||
|
'tarifa_id'=> $tarifa_value[0]->tarifa_extra_id,
|
||||||
|
'tarifa_nombre'=> $tarifa_value[0]->tarifa_extra_nombre,
|
||||||
|
'precio'=> $result_data[0],
|
||||||
|
'margen'=> $result_data[1],
|
||||||
|
];
|
||||||
|
return $ret_array;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$ret_array[] = (object)[
|
||||||
|
'tarifa_id'=> $tarifa_extra_id,
|
||||||
|
'tarifa_nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_extra_id)[0]->nombre,
|
||||||
|
'precio' => 0,
|
||||||
|
'margen' => 0,
|
||||||
|
];
|
||||||
|
return $ret_array;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function calcularTarifa($tarifa){
|
||||||
|
|
||||||
|
$precio = floatval($tarifa->precio);
|
||||||
|
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||||
|
$margen = $tarifa->margen;
|
||||||
|
|
||||||
|
return [$precio, $margen];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAllServicios($presupuesto_id){
|
||||||
|
|
||||||
|
$this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->where('presupuesto_id', $presupuesto_id)
|
||||||
|
->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteServiciosNotInArray($presupuesto_id, $tarifas_id){
|
||||||
|
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1");
|
||||||
|
$builder->where('presupuesto_id', $presupuesto_id);
|
||||||
|
foreach($tarifas_id as $id){
|
||||||
|
$builder->where('tarifa_extra_id !=', $id);
|
||||||
|
}
|
||||||
|
$builder->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateTarifas($presupuesto_id, $tarifas){
|
||||||
|
|
||||||
|
foreach($tarifas as $tarifa){
|
||||||
|
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1");
|
||||||
|
$builder->select("id");
|
||||||
|
$builder->where('presupuesto_id', $presupuesto_id);
|
||||||
|
$builder->where('tarifa_extra_id', $tarifa->tarifa_id);
|
||||||
|
$result = $builder->get()->getResultObject();
|
||||||
|
if(count($result)>0){
|
||||||
|
|
||||||
|
$this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->where('presupuesto_id', $presupuesto_id)
|
||||||
|
->where('tarifa_extra_id', $tarifa->tarifa_id)
|
||||||
|
->set('precio', $tarifa->precio)
|
||||||
|
->set('margen', $tarifa->margen)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->set('presupuesto_id', $presupuesto_id)
|
||||||
|
->set('tarifa_extra_id', $tarifa->tarifa_id)
|
||||||
|
->set('precio', $tarifa->precio)
|
||||||
|
->set('margen', $tarifa->margen)
|
||||||
|
->insert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get resource data.
|
||||||
|
*
|
||||||
|
* @param string $search
|
||||||
|
*
|
||||||
|
* @return \CodeIgniter\Database\BaseBuilder
|
||||||
|
*/
|
||||||
|
public function getResource($presupuesto_id = -1)
|
||||||
|
{
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.id AS id, t1.tarifa_extra_id AS tarifa_extra_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||||
|
);
|
||||||
|
|
||||||
|
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||||
|
$builder->join("tarifa_extra t2", "t1.tarifa_extra_id = t2.id", "left");
|
||||||
|
|
||||||
|
return $builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
130
ci4/app/Models/Tarifas/TarifaextraModel.php
Executable file
130
ci4/app/Models/Tarifas/TarifaextraModel.php
Executable file
@ -0,0 +1,130 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models\Tarifas;
|
||||||
|
|
||||||
|
class TarifaextraModel extends \App\Models\GoBaseModel
|
||||||
|
{
|
||||||
|
protected $table = "tarifa_extra";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether primary key uses auto increment.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
protected $allowedFields = [
|
||||||
|
"nombre",
|
||||||
|
"precio",
|
||||||
|
"precio_min",
|
||||||
|
"importe_fijo",
|
||||||
|
"margen",
|
||||||
|
"mostrar_en_presupuesto",
|
||||||
|
"deleted_at",
|
||||||
|
"is_deleted",
|
||||||
|
"user_created_id",
|
||||||
|
"user_updated_id"];
|
||||||
|
protected $returnType = "App\Entities\Tarifas\TarifaextraEntity";
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
|
||||||
|
protected $createdField = "created_at";
|
||||||
|
protected $updatedField = "updated_at";
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
public static $labelField = "nombre";
|
||||||
|
|
||||||
|
protected $validationRules = [
|
||||||
|
"nombre" => [
|
||||||
|
"label" => "Tarifaextra.nombre",
|
||||||
|
"rules" => "trim|required|max_length[255]",
|
||||||
|
],
|
||||||
|
"precio" => [
|
||||||
|
"label" => "Tarifaextra.precio",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
|
"precio_min" => [
|
||||||
|
"label" => "Tarifaextra.precioMin",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
|
"importe_fijo" => [
|
||||||
|
"label" => "Tarifaextra.importeFijo",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
|
"margen" => [
|
||||||
|
"label" => "Tarifaextra.margen",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $validationMessages = [
|
||||||
|
"nombre" => [
|
||||||
|
"max_length" => "Tarifaextra.validation.nombre.max_length",
|
||||||
|
"required" => "Tarifaextra.validation.nombre.required",
|
||||||
|
],
|
||||||
|
"precio" => [
|
||||||
|
"decimal" => "Tarifaextra.validation.precio.decimal",
|
||||||
|
"required" => "Tarifaextra.validation.precio.required",
|
||||||
|
],
|
||||||
|
"precio_min" => [
|
||||||
|
"required" => "Tarifaextra.validation.precio_min.required",
|
||||||
|
"decimal" => "Tarifaextra.validation.precio_min.decimal",
|
||||||
|
],
|
||||||
|
"importe_fijo" => [
|
||||||
|
"required" => "Tarifaextra.validation.importe_fijo.required",
|
||||||
|
"decimal" => "Tarifaextra.validation.importe_fijo.decimal",
|
||||||
|
],
|
||||||
|
"margen" => [
|
||||||
|
"required" => "Tarifaextra.validation.margen.required",
|
||||||
|
"decimal" => "Tarifaextra.validation.margen.decimal",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
public function getServiciosExtraSelector()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Todos los servicios de extra activas que se pueden usar en presupuestos
|
||||||
|
*/
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.id as value, t1.nombre AS label"
|
||||||
|
)
|
||||||
|
->where("t1.is_deleted", 0)
|
||||||
|
->where("t1.mostrar_en_presupuesto", 1);
|
||||||
|
|
||||||
|
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTarifaPresupuestoExtra($tarifa_id){
|
||||||
|
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.id AS tarifa_extra_id, t1.nombre AS tarifa_extra_nombre, t1.precio AS precio, t1.margen AS margen"
|
||||||
|
)
|
||||||
|
->where("t1.is_deleted", 0);
|
||||||
|
//->where("t1.mostrar_en_presupuesto", 1)
|
||||||
|
|
||||||
|
$builder->where('t1.id =', $tarifa_id);
|
||||||
|
|
||||||
|
return $builder->get()->getResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombreTarifaExtra($id=-1)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Todos los servicios de encuadernacion activas que se pueden usar en presupuestos
|
||||||
|
*/
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.nombre AS nombre"
|
||||||
|
)
|
||||||
|
->where("t1.id", $id)
|
||||||
|
->where("t1.is_deleted", 0);
|
||||||
|
|
||||||
|
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1232,6 +1232,8 @@ class PresupuestoService extends BaseService
|
|||||||
$opciones_papel = PresupuestoService::get_opciones_papel('interior', $isColor);
|
$opciones_papel = PresupuestoService::get_opciones_papel('interior', $isColor);
|
||||||
|
|
||||||
if($linea->tipo == 'lp_guardas'){
|
if($linea->tipo == 'lp_guardas'){
|
||||||
|
$data['uso'] = 'guardas';
|
||||||
|
$tipo = 'colorhq';
|
||||||
$data['datosPedido']->paginas_impresion = $linea->paginas_impresion;
|
$data['datosPedido']->paginas_impresion = $linea->paginas_impresion;
|
||||||
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||||
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||||
@ -1335,7 +1337,7 @@ class PresupuestoService extends BaseService
|
|||||||
$cambio_en_servicios = $cambio_en_servicios? $cambio_en_servicios: $cambio;
|
$cambio_en_servicios = $cambio_en_servicios? $cambio_en_servicios: $cambio;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Los servicios de preimpresion se dejan tal y como esten
|
// Los servicios de preimpresion y los extra se dejan tal y como esten
|
||||||
|
|
||||||
return [$cambio_en_servicios, $servicios];
|
return [$cambio_en_servicios, $servicios];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ $('.nav-servicios button').on('shown.bs.tab', function(){
|
|||||||
$("#tableOfServiciosPreimpresion").DataTable().columns.adjust();
|
$("#tableOfServiciosPreimpresion").DataTable().columns.adjust();
|
||||||
$("#tableOfServiciosManipulado").DataTable().columns.adjust();
|
$("#tableOfServiciosManipulado").DataTable().columns.adjust();
|
||||||
$("#tableOfServiciosAcabado").DataTable().columns.adjust();
|
$("#tableOfServiciosAcabado").DataTable().columns.adjust();
|
||||||
|
$("#tableOfServiciosExtra").DataTable().columns.adjust();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ $(document).on('click', '.btn-delete-serv', function(e) {
|
|||||||
else if($(this).closest('table').attr('id').includes('tableOfServiciosPreimpresion')){
|
else if($(this).closest('table').attr('id').includes('tableOfServiciosPreimpresion')){
|
||||||
table = "tableOfServiciosPreimpresion";
|
table = "tableOfServiciosPreimpresion";
|
||||||
}
|
}
|
||||||
|
else if($(this).closest('table').attr('id').includes('tableOfServiciosExtra')){
|
||||||
|
table = "tableOfServiciosExtra";
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
table = "";
|
table = "";
|
||||||
}
|
}
|
||||||
@ -60,6 +64,7 @@ $(document).on('click', '.btn-delete-serv', function(e) {
|
|||||||
check_serv_acabado_error()
|
check_serv_acabado_error()
|
||||||
check_serv_preimpresion_error()
|
check_serv_preimpresion_error()
|
||||||
check_serv_manipulado_error()
|
check_serv_manipulado_error()
|
||||||
|
check_serv_extra_error()
|
||||||
updatePresupuesto({
|
updatePresupuesto({
|
||||||
update_lineas: false,
|
update_lineas: false,
|
||||||
update_servicios: false,
|
update_servicios: false,
|
||||||
@ -77,6 +82,7 @@ function save_servicios(){
|
|||||||
var datosEnc = get_datos_encuadernacion()
|
var datosEnc = get_datos_encuadernacion()
|
||||||
var datosManipulado = get_datos_manipulado()
|
var datosManipulado = get_datos_manipulado()
|
||||||
var datosPreimpresion = get_datos_preimpresion()
|
var datosPreimpresion = get_datos_preimpresion()
|
||||||
|
var datosServiciosExtra = get_datos_serviciosextra()
|
||||||
|
|
||||||
const domain = window.location.origin
|
const domain = window.location.origin
|
||||||
|
|
||||||
@ -135,7 +141,21 @@ function save_servicios(){
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
})
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
.then(
|
||||||
|
fetch(domain + "/presupuestos/presupuestoserviciosextra/edit/" + id , {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(Object.assign({datos: datosServiciosExtra}, window.token_ajax)),
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
yeniden(data[window.csrf_token]);
|
||||||
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +176,16 @@ var tableServiciosAcabado = new DataTable('#tableOfServiciosAcabado',{
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tableServiciosAcabado.on('draw', function(){
|
||||||
|
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
function init_servicio_acabado(){
|
function init_servicio_acabado(){
|
||||||
|
|
||||||
$('#add_servicio_acabado_list').select2({
|
$('#add_servicio_acabado_list').select2({
|
||||||
@ -190,15 +220,7 @@ function init_servicio_acabado(){
|
|||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true})
|
update_tiradas_alternativas: true})
|
||||||
})
|
})
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
check_serv_acabado_error()
|
check_serv_acabado_error()
|
||||||
}
|
}
|
||||||
@ -273,16 +295,6 @@ function get_tarifas_acabado(tarifa_id = -1, uso=null){
|
|||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
if(data.values.lenght > 0){
|
|
||||||
//updateTotales(false, true, false)
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
check_serv_acabado_error()
|
check_serv_acabado_error()
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
@ -479,6 +491,14 @@ var tableServiciosEnc = new DataTable('#tableOfServiciosEncuadernacion',{
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tableServiciosEnc.on('draw', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
function init_servicio_encuadernado(){
|
function init_servicio_encuadernado(){
|
||||||
|
|
||||||
@ -560,14 +580,6 @@ function init_servicio_encuadernado(){
|
|||||||
});
|
});
|
||||||
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
|
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
|
||||||
});
|
});
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
check_serv_enc_error()
|
check_serv_enc_error()
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -602,13 +614,6 @@ function proveedor_enc_event(){
|
|||||||
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
||||||
$('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2))
|
$('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2))
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -746,17 +751,6 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(data.values.lenght > 0){
|
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
check_serv_enc_error()
|
check_serv_enc_error()
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
return true;
|
return true;
|
||||||
@ -781,6 +775,8 @@ $('#insertar_serv_enc').on('click', function(){
|
|||||||
}
|
}
|
||||||
check_serv_enc_error()
|
check_serv_enc_error()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function get_datos_encuadernacion(){
|
function get_datos_encuadernacion(){
|
||||||
|
|
||||||
var datosEnc = []
|
var datosEnc = []
|
||||||
@ -882,6 +878,15 @@ var tableServiciosManipulado = new DataTable('#tableOfServiciosManipulado',{
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tableServiciosManipulado.on('draw', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
function init_servicio_manipulado(){
|
function init_servicio_manipulado(){
|
||||||
|
|
||||||
$('#add_servicio_manipulado_list').select2({
|
$('#add_servicio_manipulado_list').select2({
|
||||||
@ -989,17 +994,6 @@ async function get_tarifas_manipulado(tipo=null, tarifa_id = -1){
|
|||||||
update_tiradas_alternativas: true})
|
update_tiradas_alternativas: true})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
if(data.values.lenght > 0){
|
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
check_serv_manipulado_error()
|
check_serv_manipulado_error()
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
return true;
|
return true;
|
||||||
@ -1133,6 +1127,15 @@ var tableServiciosPreimpresion = new DataTable('#tableOfServiciosPreimpresion',{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tableServiciosPreimpresion.on('draw', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
function init_servicio_preimpresion(){
|
function init_servicio_preimpresion(){
|
||||||
|
|
||||||
@ -1163,14 +1166,6 @@ function init_servicio_preimpresion(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
check_serv_preimpresion_error()
|
check_serv_preimpresion_error()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,7 +1202,7 @@ function get_tarifas_preimpresion(tarifa_id = -1){
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: window.routes_servicios.dataTableOfPresupuestoPreimpresiones,
|
url: window.routes_servicios.dataTableOfPresupuestoPreimpresion,
|
||||||
data: datos,
|
data: datos,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
@ -1231,17 +1226,6 @@ function get_tarifas_preimpresion(tarifa_id = -1){
|
|||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(data.values.lenght > 0){
|
|
||||||
|
|
||||||
updatePresupuesto({
|
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: false,
|
|
||||||
update_envios: false,
|
|
||||||
update_resumen: true,
|
|
||||||
update_tiradas_alternativas: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
check_serv_preimpresion_error()
|
check_serv_preimpresion_error()
|
||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
return true;
|
return true;
|
||||||
@ -1375,6 +1359,225 @@ async function get_servPreimpresion_tiradasAlternativas(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************************
|
||||||
|
* Seccion para los servicios extra
|
||||||
|
***************************************************************************************/
|
||||||
|
var tableServiciosExtra = new DataTable('#tableOfServiciosExtra',{
|
||||||
|
scrollX: true,
|
||||||
|
searching: false,
|
||||||
|
paging: false,
|
||||||
|
info: false,
|
||||||
|
ordering: false,
|
||||||
|
responsive: true,
|
||||||
|
select: false,
|
||||||
|
language: {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tableServiciosExtra.on('draw', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
|
function init_servicio_extra(){
|
||||||
|
|
||||||
|
|
||||||
|
$('#add_servicio_extra_list').select2({
|
||||||
|
allowClear: false,
|
||||||
|
minimumResultsForSearch: -1,
|
||||||
|
placeholder: window.Presupuestos.servicioextraList
|
||||||
|
})
|
||||||
|
|
||||||
|
window.serviciosextraList.forEach((element) =>{
|
||||||
|
|
||||||
|
tableServiciosExtra.row.add([
|
||||||
|
element.tarifa_extra_id,
|
||||||
|
element.nombre,
|
||||||
|
'<input class="update-totales-servicios" id="precio_servicioextra_' + element.tarifa_extra_id +'" value="' + parseFloat(element.precio).toFixed(2) + '"></input>',
|
||||||
|
'<span style="display: none;" class="update-totales" id="servicioextra_margen_' + element.tarifa_extra_id + '">' + parseFloat(element.margen).toFixed(2) + '</span>',
|
||||||
|
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_extra_id +'"></i></a>'
|
||||||
|
]).draw(false)
|
||||||
|
|
||||||
|
$('#precio_servicioextra_' + element.tarifa_extra_id).on('change', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
check_serv_extra_error()
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_serv_extra_error(){
|
||||||
|
|
||||||
|
var htmlString = '';
|
||||||
|
|
||||||
|
$('#tableOfServiciosExtra tr').each(function(){
|
||||||
|
|
||||||
|
if(parseFloat($(this).find('td:eq(2) input').val()) == '0'){
|
||||||
|
htmlString = `
|
||||||
|
<div class="alert alert-danger d-flex align-items-baseline" role="alert">
|
||||||
|
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||||
|
<i class="ti ti-ban ti-sm"></i>
|
||||||
|
</span>
|
||||||
|
<div class="d-flex flex-column ps-1">
|
||||||
|
<h5 class="alert-heading mb-2">` +
|
||||||
|
window.Presupuestos.errores.error_servicios_anadidos +
|
||||||
|
`</h5>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$('#serv-preimpresion-error').html(htmlString)
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_tarifas_extra(tarifa_id = -1){
|
||||||
|
|
||||||
|
var datos = {
|
||||||
|
tarifa_extra_id : tarifa_id,
|
||||||
|
};
|
||||||
|
datos = Object.assign(datos, window.token_ajax)
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: window.routes_servicios.dataTableOfPresupuestoServiciosExtra,
|
||||||
|
data: datos,
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
data.values.forEach((row) => {
|
||||||
|
|
||||||
|
tableServiciosExtra.row.add([
|
||||||
|
row.tarifa_id,
|
||||||
|
row.tarifa_nombre,
|
||||||
|
'<input class="update-totales-servicios" id="precio_servicioextra_' + row.tarifa_id +'" value="' + parseFloat(row.precio).toFixed(2) + '"></input>',
|
||||||
|
'<span style="display: none;" class="update-totales" id="servicioextra_margen_' + row.tarifa_id + '">' + parseFloat(row.margen).toFixed(2) + '</span>',
|
||||||
|
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||||
|
]).draw(false)
|
||||||
|
|
||||||
|
$('#precio_servicioextra_' + row.tarifa_id).on('change', function(){
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: false,
|
||||||
|
update_servicios: false,
|
||||||
|
update_envios: false,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
check_serv_extra_error()
|
||||||
|
yeniden(data[window.csrf_token]);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function(e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#insertar_serv_extra').on('click', function(){
|
||||||
|
const tarifa_text = $('#add_servicio_extra_list').select2('data')[0].text.trim()
|
||||||
|
|
||||||
|
if( $('#add_servicio_extra_list').select2('data')[0].text.trim().length > 0){
|
||||||
|
if($('#tableOfServiciosExtra tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||||
|
get_tarifas_extra($('#add_servicio_extra_list').select2('data')[0].id);
|
||||||
|
else{
|
||||||
|
popErrorAlert(window.Presupuestos.errores.error_servicios_duplicados, 'serv-extra-alert')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check_serv_extra_error()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function get_datos_serviciosextra(){
|
||||||
|
|
||||||
|
var datosServiciosExtra = []
|
||||||
|
if($("#tableOfServiciosExtra").DataTable().rows().count()>0){
|
||||||
|
|
||||||
|
$("#tableOfServiciosExtra tr").each(function (index,tr) {
|
||||||
|
var values = {}
|
||||||
|
$(this).find("td").each(function (index2) {
|
||||||
|
|
||||||
|
switch (index2) {
|
||||||
|
case 0:
|
||||||
|
values['tarifa_id'] = $(this).text()
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
values['precio'] = $(this).children(":first").val()
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
values['margen'] = $(this).text()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(Object.keys(values).length>0)
|
||||||
|
datosServiciosExtra.push(values)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return datosServiciosExtra;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function get_servExtra_tiradasAlternativas(){
|
||||||
|
|
||||||
|
const url = window.location.href;
|
||||||
|
const url_parts = url.split('/');
|
||||||
|
var id = -1;
|
||||||
|
if(url_parts[url_parts.length-2] == 'edit'){
|
||||||
|
id = url_parts[url_parts.length-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
var serviciosExtra ={
|
||||||
|
coste: 0.0,
|
||||||
|
margen: 0.0,
|
||||||
|
}
|
||||||
|
var json_data = {
|
||||||
|
datos: get_datos_serviciosextra(),
|
||||||
|
POD: $('#POD').val()
|
||||||
|
}
|
||||||
|
if(json_data.datos.length>0){
|
||||||
|
|
||||||
|
json_data = Object.assign(json_data, window.token_ajax);
|
||||||
|
|
||||||
|
await fetch(window.location.origin + "/presupuestos/presupuestoserviciosextra/update/" + id , {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(json_data),
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
//const values = await response.json();
|
||||||
|
yeniden(data[window.csrf_token]);
|
||||||
|
data.lines.forEach((line) => {
|
||||||
|
serviciosExtra.coste += parseFloat(line[0].precio);
|
||||||
|
serviciosExtra.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return serviciosExtra;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************************
|
||||||
|
* Seccion para "otros"
|
||||||
|
***************************************************************************************/
|
||||||
async function actualizar_servicios(update_preimpresion=false){
|
async function actualizar_servicios(update_preimpresion=false){
|
||||||
|
|
||||||
const domain = window.location.origin
|
const domain = window.location.origin
|
||||||
@ -1425,6 +1628,11 @@ async function actualizar_servicios(update_preimpresion=false){
|
|||||||
datos_json_preimpresion = Object.assign(datos_json_preimpresion, window.token_ajax);
|
datos_json_preimpresion = Object.assign(datos_json_preimpresion, window.token_ajax);
|
||||||
|
|
||||||
|
|
||||||
|
var datos_json_serviciosextra = {
|
||||||
|
datos: get_datos_serviciosextra(),
|
||||||
|
}
|
||||||
|
datos_json_preimpresion = Object.assign(datos_json_preimpresion, window.token_ajax);
|
||||||
|
|
||||||
fetch(domain + "/presupuestos/presupuestoacabados/update/" + id , {
|
fetch(domain + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(datos_json_acabados),
|
body: JSON.stringify(datos_json_acabados),
|
||||||
@ -1507,6 +1715,26 @@ async function actualizar_servicios(update_preimpresion=false){
|
|||||||
yeniden(data[window.csrf_token]);
|
yeniden(data[window.csrf_token]);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}).then(function(){
|
||||||
|
if(update_preimpresion){
|
||||||
|
fetch(domain + "/presupuestos/presupuestoserviciosextra/update/" + id , {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(datos_json_serviciosextra),
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
|
||||||
|
data.lines.forEach((line) => {
|
||||||
|
$('#precio_serviciosextra_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||||
|
$('#serviciosextra_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||||
|
});
|
||||||
|
check_serv_preimpresion_error();
|
||||||
|
yeniden(data[window.csrf_token]);
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1531,4 +1759,4 @@ function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
|||||||
$('#' + containerId).fadeOut("slow");
|
$('#' + containerId).fadeOut("slow");
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,18 @@
|
|||||||
<?= lang("Presupuestos.servicioManipulado") ?>
|
<?= lang("Presupuestos.servicioManipulado") ?>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="nav-link"
|
||||||
|
role="tab"
|
||||||
|
data-bs-toggle="tab"
|
||||||
|
data-bs-target="#servicios-extra"
|
||||||
|
aria-controls="servicios-extra"
|
||||||
|
aria-selected="false">
|
||||||
|
<?= lang("Presupuestos.servicioExtra") ?>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content border border-container">
|
<div class="tab-content border border-container">
|
||||||
<div class="tab-pane fade show active" id="servicios-acabado" role="tabpanel">
|
<div class="tab-pane fade show active" id="servicios-acabado" role="tabpanel">
|
||||||
@ -221,6 +233,42 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="servicios-extra" role="tabpanel">
|
||||||
|
<div id="serv-extra-alert">
|
||||||
|
</div>
|
||||||
|
<div id="serv-extra-error">
|
||||||
|
</div>
|
||||||
|
<table id="tableOfServiciosExtra" class="table table-striped table-hover tiradas-alternativas update-resumen-presupuesto" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= lang('Presupuestos.id') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.tarifaextra') ?></th>
|
||||||
|
<th><?= lang('Presupuestos.precio') ?></th>
|
||||||
|
<th></th>
|
||||||
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="row mb-3 px-4">
|
||||||
|
<div class="col-md-12 col-lg-4 py-4">
|
||||||
|
<select id="add_servicio_extra_list" class="select2bs2" style="width: 100%;">
|
||||||
|
<option></option>
|
||||||
|
<?php foreach ($serviciosExtra as $item) : ?>
|
||||||
|
<option value="<?= $item->value ?>" >
|
||||||
|
<?= $item->label ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||||
|
<button id="insertar_serv_extra" type="button" class="btn btn-secondary waves-effect waves-light float-start tiradas-alternativas"><?= lang("Presupuestos.insertar")?></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- //.accordion-body -->
|
</div> <!-- //.accordion-body -->
|
||||||
@ -243,12 +291,15 @@
|
|||||||
|
|
||||||
window.serviciospreimpresionList = <?php echo json_encode($serviciosPreimpresionList); ?>;
|
window.serviciospreimpresionList = <?php echo json_encode($serviciosPreimpresionList); ?>;
|
||||||
|
|
||||||
|
window.serviciosextraList = <?php echo json_encode($serviciosExtraList); ?>;
|
||||||
|
|
||||||
window.routes_servicios = {
|
window.routes_servicios = {
|
||||||
dataTableOfPresupuestoAcabados: "<?=route_to('dataTableOfPresupuestoAcabados') ?>",
|
dataTableOfPresupuestoAcabados: "<?=route_to('dataTableOfPresupuestoAcabados') ?>",
|
||||||
dataTableOfPresupuestoPreimpresion: "<?=route_to('dataTableOfPresupuestoPreimpresiones') ?>",
|
dataTableOfPresupuestoPreimpresion: "<?=route_to('dataTableOfPresupuestoPreimpresiones') ?>",
|
||||||
dataTableOfPresupuestoEncuadernaciones: "<?=route_to('dataTableOfPresupuestoEncuadernaciones') ?>",
|
dataTableOfPresupuestoEncuadernaciones: "<?=route_to('dataTableOfPresupuestoEncuadernaciones') ?>",
|
||||||
dataTableOfPresupuestoManipulados: "<?=route_to('dataTableOfPresupuestoManipulados') ?>",
|
dataTableOfPresupuestoManipulados: "<?=route_to('dataTableOfPresupuestoManipulados') ?>",
|
||||||
menuItemsOfPresupuestoEncuadernaciones: '<?= route_to("menuItemsOfPresupuestoEncuadernaciones") ?>',
|
menuItemsOfPresupuestoEncuadernaciones: '<?= route_to("menuItemsOfPresupuestoEncuadernaciones") ?>',
|
||||||
|
dataTableOfPresupuestoServiciosExtra: "<?=route_to('dataTableOfPresupuestoServiciosExtra') ?>",
|
||||||
}
|
}
|
||||||
|
|
||||||
init_servicio_acabado()
|
init_servicio_acabado()
|
||||||
@ -258,5 +309,7 @@
|
|||||||
init_servicio_manipulado()
|
init_servicio_manipulado()
|
||||||
|
|
||||||
init_servicio_preimpresion()
|
init_servicio_preimpresion()
|
||||||
|
|
||||||
|
init_servicio_extra()
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -114,6 +114,17 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof $("#tableOfServiciosExtra").DataTable() !== 'undefined' && $("#tableOfServiciosExtra").DataTable().rows().count() > 0){
|
||||||
|
|
||||||
|
$('#tableOfServiciosExtra tbody tr').each(function(){
|
||||||
|
var currentRow = $(this).closest("tr");
|
||||||
|
var subId = $('#tableOfServiciosExtra').DataTable().cell(currentRow,0).node().innerHTML;
|
||||||
|
var total = parseFloat($('#precio_servicioextra_' + subId)[0].value)
|
||||||
|
totalServicios += total
|
||||||
|
margenServicios += (total*parseFloat($('#servicioextra_margen_' + subId)[0].innerHTML)/100.0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if ( typeof $("#tableOfServiciosManipulado").DataTable() !== 'undefined' && $("#tableOfServiciosManipulado").DataTable().rows().count() > 0){
|
if ( typeof $("#tableOfServiciosManipulado").DataTable() !== 'undefined' && $("#tableOfServiciosManipulado").DataTable().rows().count() > 0){
|
||||||
|
|
||||||
$('#tableOfServiciosManipulado tbody tr').each(function(){
|
$('#tableOfServiciosManipulado tbody tr').each(function(){
|
||||||
|
|||||||
@ -143,6 +143,10 @@ async function add_tirada_alternativa(tirada_alt) {
|
|||||||
costes_servicios += parseFloat(valuePreimpresion.coste);
|
costes_servicios += parseFloat(valuePreimpresion.coste);
|
||||||
margen_servicios += parseFloat(valuePreimpresion.margen);
|
margen_servicios += parseFloat(valuePreimpresion.margen);
|
||||||
|
|
||||||
|
const valueServiciosExtra = await get_servExtra_tiradasAlternativas(parseInt(datos.tirada));
|
||||||
|
costes_servicios += parseFloat(valueServiciosExtra.coste);
|
||||||
|
margen_servicios += parseFloat(valueServiciosExtra.margen);
|
||||||
|
|
||||||
//console.log('coste preimpresion ('+ datos.tirada +'): ' + valuePreimpresion.coste);
|
//console.log('coste preimpresion ('+ datos.tirada +'): ' + valuePreimpresion.coste);
|
||||||
|
|
||||||
const valueTransporte = await get_coste_envio_tiradasAlternativas(parseInt(datos.tirada));
|
const valueTransporte = await get_coste_envio_tiradasAlternativas(parseInt(datos.tirada));
|
||||||
|
|||||||
@ -84,14 +84,16 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const domain = window.location.origin
|
||||||
|
const url = window.location.href;
|
||||||
|
const url_parts = url.split('/');
|
||||||
|
var id = -1;
|
||||||
|
if(url_parts[url_parts.length-2] == 'edit'){
|
||||||
|
id = url_parts[url_parts.length-1];
|
||||||
|
}
|
||||||
|
|
||||||
if(gotaNegro){
|
if(gotaNegro){
|
||||||
const domain = window.location.origin
|
|
||||||
const url = window.location.href;
|
|
||||||
const url_parts = url.split('/');
|
|
||||||
var id = -1;
|
|
||||||
if(url_parts[url_parts.length-2] == 'edit'){
|
|
||||||
id = url_parts[url_parts.length-1];
|
|
||||||
}
|
|
||||||
asyncMessageDialog('<?= lang("Basic.global.Warning") ?>', '<?= lang("Presupuestos.duplicarConTipologias") ?>', function() {
|
asyncMessageDialog('<?= lang("Basic.global.Warning") ?>', '<?= lang("Presupuestos.duplicarConTipologias") ?>', function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
@ -117,6 +119,30 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
|
||||||
|
|
||||||
|
data: {
|
||||||
|
tipo: 'duplicar',
|
||||||
|
presupuesto_id: id,
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success:function(response){
|
||||||
|
|
||||||
|
token=response.<?= csrf_token() ?>;
|
||||||
|
yeniden(token);
|
||||||
|
// redirect
|
||||||
|
new_location = '<?= site_url("presupuestos/cosidotapablanda/edit/") ?>' + response.id
|
||||||
|
window.location.href = new_location;
|
||||||
|
}
|
||||||
|
}).fail(function (jqXHR, textStatus, error) {
|
||||||
|
// Handle error here
|
||||||
|
console.log(jqXHR)
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -365,14 +391,14 @@
|
|||||||
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/datosLibro_js') ?>"></script>
|
<script src="<?= site_url('js_loader/datosLibro_js') ?>"></script>
|
||||||
<?php if (str_contains($formAction, 'edit')): ?>
|
<?php if (str_contains($formAction, 'edit')): ?>
|
||||||
|
<script src="<?= site_url('js_loader/datosEnvios_js') ?>"></script>
|
||||||
|
<script src="<?= site_url('js_loader/resumenPresupuestos_js') ?>"></script>
|
||||||
|
<script src="<?= site_url('js_loader/presupuestos_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
|
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script>
|
<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/tiradasAlternativas_js') ?>"></script>
|
<script src="<?= site_url('js_loader/tiradasAlternativas_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/datosEnvios_js') ?>"></script>
|
|
||||||
<script src="<?= site_url('js_loader/resumenPresupuestos_js') ?>"></script>
|
|
||||||
<script src="<?= site_url('js_loader/presupuestos_js') ?>"></script>
|
|
||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -0,0 +1,93 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-12 px-4">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="nombre" class="form-label">
|
||||||
|
<?= lang('Tarifaextra.nombre') ?>*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nombre"
|
||||||
|
name="nombre"
|
||||||
|
required
|
||||||
|
maxLength="255"
|
||||||
|
class="form-control"
|
||||||
|
value="<?= old('nombre', $tarifaextraEntity->nombre) ?>"
|
||||||
|
>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="precio" class="form-label">
|
||||||
|
<?= lang('Tarifaextra.precio') ?>*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="precio"
|
||||||
|
name="precio"
|
||||||
|
required
|
||||||
|
maxLength="31"
|
||||||
|
step="0.01"
|
||||||
|
class="form-control"
|
||||||
|
value="<?= old('precio', $tarifaextraEntity->precio) ?>"
|
||||||
|
>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="precio_min" class="form-label">
|
||||||
|
<?= lang('Tarifaextra.precioMin') ?>*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="precio_min"
|
||||||
|
name="precio_min"
|
||||||
|
required
|
||||||
|
class="form-control"
|
||||||
|
value="<?= old('precio_min', $tarifaextraEntity->precio_min) ?>"
|
||||||
|
>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="importe_fijo" class="form-label">
|
||||||
|
<?= lang('Tarifaextra.importeFijo') ?>*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="importe_fijo"
|
||||||
|
name="importe_fijo"
|
||||||
|
required
|
||||||
|
class="form-control"
|
||||||
|
value="<?= old('importe_fijo', $tarifaextraEntity->importe_fijo) ?>"
|
||||||
|
>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="margen" class="form-label">
|
||||||
|
<?= lang('Tarifaextra.margen') ?>*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="margen"
|
||||||
|
name="margen"
|
||||||
|
required
|
||||||
|
class="form-control"
|
||||||
|
value="<?= old('margen', $tarifaextraEntity->margen) ?>"
|
||||||
|
>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="mostrar_en_presupuesto"
|
||||||
|
name="mostrar_en_presupuesto"
|
||||||
|
value="1"
|
||||||
|
class="form-check-input"<?= $tarifaextraEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>
|
||||||
|
>
|
||||||
|
<label for="mostrar_en_presupuesto" class="form-check-label">
|
||||||
|
<?= lang('Tarifaextra.mostrar_en_presupuesto') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!--//.col -->
|
||||||
|
|
||||||
|
</div><!-- //.row -->
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||||
|
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||||
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
<?= $this->section("content") ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card card-info">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||||
|
</div><!--//.card-header -->
|
||||||
|
<form id="tarifaextraForm" method="post" class="card-body" action="<?= $formAction ?>">
|
||||||
|
<?= csrf_field() ?>
|
||||||
|
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||||
|
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||||
|
<?= view("themes/backend/vuexy/form/tarifas/extra/_tarifaextraFormItems") ?>
|
||||||
|
<div class="pt-4">
|
||||||
|
<input
|
||||||
|
type="submit"
|
||||||
|
class="btn btn-primary float-start me-sm-3 me-1"
|
||||||
|
name="save"
|
||||||
|
value="<?= lang("Basic.global.Save") ?>"
|
||||||
|
/>
|
||||||
|
<?= anchor(route_to("tarifaextraList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>
|
||||||
|
|
||||||
|
</div><!-- /.card-footer -->
|
||||||
|
</form>
|
||||||
|
</div><!-- //.card -->
|
||||||
|
</div><!--//.col -->
|
||||||
|
</div><!--//.row -->
|
||||||
|
<?= $this->endSection() ?>
|
||||||
120
ci4/app/Views/themes/backend/vuexy/form/tarifas/extra/viewTarifaextraList.php
Executable file
120
ci4/app/Views/themes/backend/vuexy/form/tarifas/extra/viewTarifaextraList.php
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
|
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
<?=$this->section('content'); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
<div class="card card-info">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><?=lang('Tarifaextra.tarifaextraList') ?></h3>
|
||||||
|
<?=anchor(route_to('newTarifaextra'), lang('Basic.global.addNew').' '.lang('Tarifaextra.tarifaextra'), ['class'=>'btn btn-primary float-end']); ?>
|
||||||
|
</div><!--//.card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
|
|
||||||
|
<table id="tableOfTarifasextra" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= lang('Tarifaextra.nombre') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.precio') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.precioMin') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.importeFijo') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.margen') ?></th>
|
||||||
|
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
|
||||||
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($tarifaextraList as $item ) : ?>
|
||||||
|
<tr>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= esc($item->precio) ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= esc($item->precio_min) ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= esc($item->importe_fijo) ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= esc($item->margen) ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle text-center text-nowrap">
|
||||||
|
<?=anchor(route_to('editTarifaextra', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
|
||||||
|
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div><!--//.card-body -->
|
||||||
|
<div class="card-footer">
|
||||||
|
|
||||||
|
</div><!--//.card-footer -->
|
||||||
|
</div><!--//.card -->
|
||||||
|
</div><!--//.col -->
|
||||||
|
</div><!--//.row -->
|
||||||
|
|
||||||
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
<?=$this->section('css') ?>
|
||||||
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||||
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||||
|
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||||
|
|
||||||
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
<?=$this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
|
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
|
||||||
|
theTable = $('.using-exportable-data-table').DataTable({
|
||||||
|
"responsive": true,
|
||||||
|
"paging": true,
|
||||||
|
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||||
|
"pageLength": 50,
|
||||||
|
"lengthChange": true,
|
||||||
|
"searching": true,
|
||||||
|
"ordering": true,
|
||||||
|
"info": true,
|
||||||
|
"dom": 'lfBrtip', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
|
||||||
|
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
|
||||||
|
"buttons": [
|
||||||
|
'copy', 'csv', 'excel', 'print', {
|
||||||
|
extend: 'pdfHtml5',
|
||||||
|
orientation: 'landscape',
|
||||||
|
pageSize: 'A4'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"autoWidth": true,
|
||||||
|
"scrollX": true,
|
||||||
|
"stateSave": true,
|
||||||
|
"language": {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
},
|
||||||
|
"columnDefs": [
|
||||||
|
{
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
targets: [lastColNr2]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
<?=$this->endSection() ?>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?php $menus = getMenuControl(); ?>
|
<?php $menus = getMenuControl(); ?>
|
||||||
|
|
||||||
<!-- Menu -->
|
<!-- Menu -->
|
||||||
<aside id="layout-menu" class="layout-menu menu-vertical menu bg-menu-theme">
|
<aside id="layout-menu" class="layout-menu menu-vertical menu bg-menu-theme">
|
||||||
@ -409,7 +409,7 @@
|
|||||||
*/
|
*/
|
||||||
if (allowMenuSection($menus,
|
if (allowMenuSection($menus,
|
||||||
['Tarifaacabado', 'Tarifasenvios', 'Tarifaimpresion', 'Tarifamanipulado', 'Tarifaencuadernacion',
|
['Tarifaacabado', 'Tarifasenvios', 'Tarifaimpresion', 'Tarifamanipulado', 'Tarifaencuadernacion',
|
||||||
'Tarifapapelcompra', 'Tarifapapeldefecto', 'Tarifapreimpresion'
|
'Tarifapapelcompra', 'Tarifapapeldefecto', 'Tarifapreimpresion', 'Tarifaextra'
|
||||||
], 'index')): ?>
|
], 'index')): ?>
|
||||||
<!-- Prices -->
|
<!-- Prices -->
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
@ -490,6 +490,15 @@
|
|||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifaextra')) > 0): ?>
|
||||||
|
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
|
||||||
|
<li class="menu-item">
|
||||||
|
<a href="<?= site_url("tarifas/tarifaextra") ?>" class="menu-link">
|
||||||
|
<div data-i18n="<?= lang("App.menu_tarifaextra") ?>"><?= lang("App.menu_tarifaextra") ?></div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
@ -556,7 +556,7 @@
|
|||||||
* MENU TARIFAS
|
* MENU TARIFAS
|
||||||
*/
|
*/
|
||||||
if (allowMenuSection($menus,
|
if (allowMenuSection($menus,
|
||||||
['Tarifapreimpresion', 'Tarifasmanipulado', 'Tarifaacabado', 'Tarifasenvios', 'Tarifasencuadernacion'], 'index')): ?>
|
['Tarifapreimpresion', 'Tarifasmanipulado', 'Tarifaacabado', 'Tarifasenvios', 'Tarifasencuadernacion, Tarifasextra'], 'index')): ?>
|
||||||
<!-- Prices -->
|
<!-- Prices -->
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||||
@ -609,6 +609,15 @@
|
|||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifaextra')) > 0): ?>
|
||||||
|
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
|
||||||
|
<li class="menu-item">
|
||||||
|
<a href="<?= site_url("tarifas/tarifaextra") ?>" class="menu-link">
|
||||||
|
<div data-i18n="<?= lang("App.menu_tarifaextra") ?>"><?= lang("App.menu_tarifaextra") ?></div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
31913
xdebug.log
31913
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user