Merge branch 'dev/fixes' into 'dev/presupuestos3'

Dev/fixes

See merge request jjimenez/safekat!65
This commit is contained in:
2023-10-10 09:21:51 +00:00
39 changed files with 2997 additions and 516 deletions

4
.idea/php.xml generated
View File

@ -10,7 +10,9 @@
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.3" />
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>

View File

@ -22,8 +22,8 @@ CI_ENVIRONMENT = development
# APP
#--------------------------------------------------------------------
app.baseURL = 'https://sk-jjo.imnavajas.es'
#app.baseURL = 'https://sk-imn.imnavajas.es'
#app.baseURL = 'https://sk-jjo.imnavajas.es'
app.baseURL = 'https://sk-imn.imnavajas.es'
# app.baseURL = "http://safekat.test/"
# app.forceGlobalSecureRequests = false

View File

@ -479,6 +479,27 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
});
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoAcabados::datatable', ['as' => 'dataTableOfPresupuestoAcabados']);
$routes->post('datatable_editor', 'PresupuestoAcabados::datatable_editor', ['as' => 'editorOfPresupuestoAcabados']);
});
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoEncuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
$routes->post('datatable_editor', 'PresupuestoEncuadernaciones::datatable_editor', ['as' => 'editorOfPresupuestoEncuadernaciones']);
});
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoManipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
$routes->post('datatable_editor', 'PresupuestoManipulados::datatable_editor', ['as' => 'editorOfPresupuestoManipulados']);
});
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoPreimpresiones::datatable', ['as' => 'dataTableOfPresupuestoPreimpresiones']);
$routes->post('datatable_editor', 'PresupuestoPreimpresiones::datatable_editor', ['as' => 'editorOfPresupuestoPreimpresiones']);
});
/*
* --------------------------------------------------------------------
* Additional Routing

View File

@ -146,6 +146,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
// Tarifas
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
/*
$this->viewData['formAction'] = route_to('createCosidotapablanda');
@ -342,7 +353,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
$this->viewData['formAction'] = route_to('updatePresupuesto', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitle') . ' ' . lang('Basic.global.edit3');
@ -387,8 +397,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
if (isset($item->causa_cancelacion) && strlen($item->causa_cancelacion) > 100) :
$item->causa_cancelacion = character_limiter($item->causa_cancelacion, 100);
endif;
if (isset($item->comentarios) && strlen($item->comentarios) > 100) :
$item->comentarios = character_limiter($item->comentarios, 100);
if (isset($item->comentarios_cliente) && strlen($item->comentarios_cliente) > 100) :
$item->comentarios_cliente = character_limiter($item->comentarios_cliente, 100);
endif;
if (isset($item->comentarios_safekat) && strlen($item->comentarios_safekat) > 100) :
$item->comentarios_safekat = character_limiter($item->comentarios_safekat, 100);
@ -840,4 +850,439 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
));
return $data;
}
protected function getServiciosPreimpresion()
{
$model = model('App\Models\Tarifas\TarifapreimpresionModel');
$data = $model->getServiciosPreimpresionSelector();
array_unshift($data, (object)array(
"value" => 0,
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioPreimpresion'))])
));
return $data;
}
protected function getServiciosEncuadernacion()
{
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
$data = $model->getServiciosEncuadernacionSelector();
array_unshift($data, (object)array(
"value" => 0,
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioEncuadernado'))])
));
return $data;
}
protected function getServiciosAcabado()
{
$model = model('App\Models\Tarifas\TarifaacabadoModel');
$data = $model->getServiciosAcabadoSelector();
array_unshift($data, (object)array(
"value" => 0,
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioAcabado'))])
));
return $data;
}
protected function getServiciosManipulado()
{
$model = model('App\Models\Tarifas\TarifaManipuladoModel');
$data = $model->getServiciosManipuladoSelector();
array_unshift($data, (object)array(
"value" => 0,
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioManipulado'))])
));
return $data;
}
/*
protected function getUbicacionLibroListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('LgUbicacionesLibros.ubicacionLibro'))])];
if (!empty($selId)) :
$ubicacionesLibroModel = model('App\Models\Configuracion\UbicacionesLibroModel');
$selOption = $ubicacionesLibroModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getFormaPagoListItems()
{
$formasPagoModel = model('App\Models\Configuracion\FormasPagoModel');
$onlyActiveOnes = true;
$data = $formasPagoModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
return $data;
}
protected function getPapelImpresionListItems4($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])];
if (!empty($selId)) :
$papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel');
$selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPresupuestoEstadoListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PresupuestoEstados.presupuestoEstado'))])];
if (!empty($selId)) :
$presupuestoEstadoModel = model('App\Models\Presupuestos\PresupuestoEstadoModel');
$selOption = $presupuestoEstadoModel->where('id', $selId)->findColumn('estado');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelGenericoListItems3($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])];
if (!empty($selId)) :
$papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel');
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelImpresionListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])];
if (!empty($selId)) :
$papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel');
$selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinaListItems3($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) :
$maquinaModel = model('App\Models\Presupuestos\MaquinaModel');
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinasTarifasImpresionListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])];
if (!empty($selId)) :
$maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel');
$selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelGenericoListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])];
if (!empty($selId)) :
$papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel');
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) :
$maquinaModel = model('App\Models\Presupuestos\MaquinaModel');
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinaListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) :
$maquinaModel = model('App\Models\Presupuestos\MaquinaModel');
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getTipologiasLibroListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TipologiasLibros.tipologiasLibro'))])];
if (!empty($selId)) :
$tipologiasLibroModel = model('App\Models\Presupuestos\TipologiasLibroModel');
$selOption = $tipologiasLibroModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelImpresionListItems3($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])];
if (!empty($selId)) :
$papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel');
$selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinasTarifasImpresionListItems4($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])];
if (!empty($selId)) :
$maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel');
$selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getUserListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
if (!empty($selId)) :
$userModel = model('App\Models\Presupuestos\UserModel');
$selOption = $userModel->where('id_user', $selId)->findColumn('first_name');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinasTarifasImpresionListItems3($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])];
if (!empty($selId)) :
$maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel');
$selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('id');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getUserListItems3($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
if (!empty($selId)) :
$userModel = model('App\Models\Presupuestos\UserModel');
$selOption = $userModel->where('id_user', $selId)->findColumn('first_name');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelImpresionListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])];
if (!empty($selId)) :
$papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel');
$selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getTiposImpresionListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TiposImpresions.tiposImpresion'))])];
if (!empty($selId)) :
$tiposImpresionModel = model('App\Models\Presupuestos\TiposImpresionModel');
$selOption = $tiposImpresionModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinasTarifasImpresionListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])];
if (!empty($selId)) :
$maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel');
$selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelGenericoListItems4($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])];
if (!empty($selId)) :
$papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel');
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinaListItems4($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) :
$maquinaModel = model('App\Models\Presupuestos\MaquinaModel');
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getUserListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
if (!empty($selId)) :
$userModel = model('App\Models\Presupuestos\UserModel');
$selOption = $userModel->where('id_user', $selId)->findColumn('first_name');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPapelGenericoListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])];
if (!empty($selId)) :
$papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel');
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPaginasCubiertaOptions()
{
$paginasCubiertaOptions = [
'' => lang('Basic.global.pleaseSelect'),
'4x0' => '4x0',
'4x4' => '4x4',
];
return $paginasCubiertaOptions;
}
protected function getPaginasPortadaOptions()
{
$paginasPortadaOptions = [
'' => lang('Basic.global.pleaseSelect'),
'4x0' => '4x0',
'4x4' => '4x4',
];
return $paginasPortadaOptions;
}
*/
}

View File

@ -1,19 +0,0 @@
<?php
namespace App\Controllers\Presupuestos;
use App\Controllers\BaseController;
class Cosidotapablandasolapas extends BaseController
{
function __construct()
{
}
public function index()
{
echo 'Presupuesto >> Libros >> Cosido tapa blanda con solapas [en desarrollo].';
}
}

View File

@ -0,0 +1,131 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Clientes\ClienteContactoEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
use function App\Controllers\Clientes\csrf_hash;
use function App\Controllers\Clientes\csrf_token;
use function App\Controllers\Clientes\lang;
use function App\Controllers\Clientes\model;
use function App\Controllers\Clientes\redirect;
use function App\Controllers\Clientes\route_to;
use function App\Controllers\Clientes\view;
use const App\Controllers\Clientes\APPPATH;
class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoAcabadosModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto acabado';
protected static $singularObjectNameCc = 'presupuestoAcabado';
protected static $pluralObjectName = 'Presupuestos acabado';
protected static $pluralObjectNameCc = 'presupuestosAcabado';
protected static $controllerSlug = 'presupuesto-acabados';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoAcabadosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_acabados' )
->fields(
Field::inst( 'tarifa_acabado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,131 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Clientes\ClienteContactoEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
use function App\Controllers\Clientes\csrf_hash;
use function App\Controllers\Clientes\csrf_token;
use function App\Controllers\Clientes\lang;
use function App\Controllers\Clientes\model;
use function App\Controllers\Clientes\redirect;
use function App\Controllers\Clientes\route_to;
use function App\Controllers\Clientes\view;
use const App\Controllers\Clientes\APPPATH;
class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoEncuadernacionesModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto encuadernaciones';
protected static $singularObjectNameCc = 'presupuestoEncuadernaciones';
protected static $pluralObjectName = 'Presupuestos encuadernaciones';
protected static $pluralObjectNameCc = 'presupuestosEncuadernaciones';
protected static $controllerSlug = 'presupuesto-encuadernaciones';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoEncuadernacionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_acabados' )
->fields(
Field::inst( 'tarifa_encuadernado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,131 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Clientes\ClienteContactoEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Presupuestos\PresupuestoManipuladosModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
use function App\Controllers\Clientes\csrf_hash;
use function App\Controllers\Clientes\csrf_token;
use function App\Controllers\Clientes\lang;
use function App\Controllers\Clientes\model;
use function App\Controllers\Clientes\redirect;
use function App\Controllers\Clientes\route_to;
use function App\Controllers\Clientes\view;
use const App\Controllers\Clientes\APPPATH;
class PresupuestoManipulados extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoManipuladosModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto manipulado';
protected static $singularObjectNameCc = 'presupuestoManipulado';
protected static $pluralObjectName = 'Presupuestos manipulado';
protected static $pluralObjectNameCc = 'presupuestosManipulado';
protected static $controllerSlug = 'presupuesto-manipulado';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoManipuladosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_manipulados' )
->fields(
Field::inst( 'tarifa_manipulado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,125 @@
<?php namespace App\Controllers\Presupuestos;
use App\Models\Collection;
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
use function App\Controllers\Clientes\csrf_hash;
use function App\Controllers\Clientes\csrf_token;
use function App\Controllers\Clientes\lang;
use function App\Controllers\Clientes\model;
use function App\Controllers\Clientes\redirect;
use function App\Controllers\Clientes\route_to;
use function App\Controllers\Clientes\view;
use const App\Controllers\Clientes\APPPATH;
class PresupuestoPreimpresiones extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoPreimpresionesModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto preimpresion';
protected static $singularObjectNameCc = 'presupuestoPreimpresion';
protected static $pluralObjectName = 'Presupuestos preimpresion';
protected static $pluralObjectNameCc = 'presupuestosPreimpresion';
protected static $controllerSlug = 'presupuesto-preimpresiones';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoPreimpresionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_preimpresiones' )
->fields(
Field::inst( 'tarifa_preimpresion_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseController;
class Tarifaenvio extends BaseController
{
function __construct()
{
}
public function index()
{
echo 'Tarifa envio';
}
public function delete()
{
}
public function add()
{
}
public function edit()
{
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_acabado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_acabado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_encuadernado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_encuadernado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -50,7 +50,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"merma" => null,
"merma_portada" => 6.0,
"imagenes_bn_interior" => false,
"comentarios" => null,
"comentarios_cliente" => null,
"comentarios_safekat" => null,
"comentarios_pdf" => null,
"comentarios_tarifa" => null,

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoManipuladosEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_manipulado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_manipulado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoPreimpresionesEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_preimpresion_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_preimpresion_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -12,6 +12,8 @@ return [
'Close' => 'Close',
'Dashboard' => 'Dashboard',
'Delete' => 'Delete',
'Clone' => 'Clone',
'Print' => 'Print',
'Error' => 'Error',
'Groups' => 'Groups',
'Home' => 'Home',

View File

@ -10,6 +10,7 @@ return [
'datosPresupuesto' => 'Budget information',
'datosLibro' => 'Book information',
'datosServicios' => 'Other Services',
'datosPresupuestoCliente' => 'Client budget data (comparator)',
'id' => 'Budget Number',

View File

@ -745,7 +745,6 @@ return [
"menu_libros_fresasdo_tapa_blanda" => "Fresado tapa blanda",
"menu_libros_cosido_tapa_dura" => "Cosidos tapa dura",
"menu_libros_cosido_tapa_blanda" => "Cosidos tapa blanda",
"menu_libros_cosido_tapa_blanda_solapas" => "Cosidos tapa blanda con solapas",
"menu_libros_grapados" => "Grapados",
"menu_libros_espiral_tapa_dura" => "Espiral tapa dura",
"menu_libros_espiral_tapa_blanda" => "Espiral tapa blanda",

View File

@ -12,6 +12,8 @@ return [
'Close' => 'Cerrar',
'Dashboard' => 'Panel de control',
'Delete' => 'Borrar',
'Clone' => 'Duplicar',
'Print' => 'Imprimir',
'Error' => 'Error',
'Groups' => 'Grupos',
'Home' => 'Inicio',

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ return [
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'tarifaacabado' => 'Tarifas Acabado',
'tarifaacabado' => 'Tarifa Acabado',
'tarifaacabadoList' => 'Lista Tarifas Acabado',
'tarifasacabado' => 'Tarifas Acabado',
'updatedAt' => 'Actualizado en',

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoAcabadosModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_acabados";
/**
* 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_acabado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoAcabadosEntity";
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",
],
];
/**
* 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_acabado_id AS tarifa_acabado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
return $builder;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_encuadernaciones";
/**
* 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_encuadernado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity";
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",
],
];
/**
* 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_encuadernado_id AS tarifa_encuadernado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernado_id = t2.id", "left");
return $builder;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoManipuladosModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_manipulados";
/**
* 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_manipulado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoManipuladosEntity";
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",
],
];
/**
* 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_manipulado_id AS tarifa_manipulado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_manipulado_id = t2.id", "left");
return $builder;
}
}

View File

@ -71,7 +71,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"merma",
"merma_portada",
"imagenes_bn_interior",
"comentarios",
"comentarios_cliente",
"comentarios_safekat",
"comentarios_pdf",
"comentarios_tarifa",
@ -234,8 +234,8 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"label" => "Presupuestos.coleccion",
"rules" => "trim|max_length[255]",
],
"comentarios" => [
"label" => "Presupuestos.comentarios",
"comentarios_cliente" => [
"label" => "Presupuestos.comentarios_cliente",
"rules" => "trim|required|max_length[16313]",
],
"comentarios_pdf" => [
@ -671,9 +671,9 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"coleccion" => [
"max_length" => "Presupuestos.validation.coleccion.max_length",
],
"comentarios" => [
"max_length" => "Presupuestos.validation.comentarios.max_length",
"required" => "Presupuestos.validation.comentarios.required",
"comentarios_cliente" => [
"max_length" => "Presupuestos.validation.comentarios_cliente.max_length",
"required" => "Presupuestos.validation.comentarios_cliente.required",
],
"comentarios_pdf" => [
"max_length" => "Presupuestos.validation.comentarios_pdf.max_length",

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_preimpresiones";
/**
* 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_preimpresion_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoPreimpresionesEntity";
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",
],
];
/**
* 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_preimpresion_id AS tarifa_preimpresion_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_preimpresion_id = t2.id", "left");
return $builder;
}
}

View File

@ -94,4 +94,22 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosEncuadernacionSelector()
{
/*
Todos los servicios de encuadernacion 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();
}
}

View File

@ -93,4 +93,20 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosManipuladoSelector()
{
/*
Todos los servicios de manipulado 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();
}
}

View File

@ -94,4 +94,22 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosAcabadoSelector()
{
/*
Todos los servicios de acabado activos 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();
}
}

View File

@ -79,4 +79,22 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
"decimal" => "Tarifapreimpresion.validation.margen.decimal",
],
];
public function getServiciosPreimpresionSelector()
{
/*
Todos los servicios de preimpresion 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();
}
}

View File

@ -13,7 +13,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-bs-dismiss="modal"><?= lang('Basic.global.deleteConfirmationCancel') ?></button>
<a href="javascript:void(0);" class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
<a id="confirmDelete" href="javascript:void(0);" class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
</div><!--//.modal-footer -->
</div><!--//.modal-content -->
</div><!--//.modal-dialog -->

View File

@ -175,6 +175,12 @@
$(this).find('.btn-confirm').attr('href', $(e.relatedTarget).data('href'));
});
$('#confirm2delete').keypress(function(e) { // Attach the form handler to the keypress event
if (e.keyCode == 13) { // If the the enter key was pressed.
$('#confirmDelete').click(); // Trigger the button(elementId) click event.
}
});
function toggleAllCheckboxes($cssClass, $io=null) {
$('.'+$cssClass).prop('checked', $io);
}

View File

@ -0,0 +1,117 @@
<div class="accordion mt-3" id="accordionComentarios">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionComentariosTip" aria-expanded="false"
aria-controls="accordionComentariosTip">
<h4><?= lang("Presupuestos.comentarios") ?></h4>
</button>
</h2>
<div id="accordionComentariosTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionComentarios">
<div class="accordion-body">
<div class="nav-align-top mb-4">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item">
<button
type="button"
class="nav-link active"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-cliente"
aria-controls="comentarios-cliente"
aria-selected="true">
<?= lang("Presupuestos.comentariosCliente") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-safekat"
aria-controls="comentarios-safekat"
aria-selected="false">
<?= lang("Presupuestos.comentariosSafekat") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-presupuesto"
aria-controls="comentarios-presupuesto"
aria-selected="false">
<?= lang("Presupuestos.comentariosPresupuesto") ?>
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="comentarios-cliente" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosCliente"
name="comentarios_cliente"
required style="height: 10em;"
class="form-control"><?= old('comentarios', $presupuestoEntity->comentarios_cliente) ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-safekat" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosSafekat"
name="comentarios_safekat"
required
style="height: 10em;"
class="form-control"><?=old('comentarios_safekat', $presupuestoEntity->comentarios_safekat) ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-presupuesto" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosPdf"
name="comentarios_pdf"
required style="height: 10em;"
class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_pdf) ?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento ?????. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
<?= $this->endSection() ?>

View File

@ -204,26 +204,11 @@
<div class="mb-3">
<label for="comentarios" class="form-label">
<?=lang('Presupuestos.comentarios') ?>*
</label>
<textarea rows="3" id="comentarios" name="comentarios" required style="height: 10em;" class="form-control"><?=old('comentarios', $presupuestoEntity->comentarios) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosSafekat" class="form-label">
<?=lang('Presupuestos.comentariosSafekat') ?>*
</label>
<textarea rows="3" id="comentariosSafekat" name="comentarios_safekat" required style="height: 10em;" class="form-control"><?=old('comentarios_safekat', $presupuestoEntity->comentarios_safekat) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosPdf" class="form-label">
<?=lang('Presupuestos.comentariosPdf') ?>*
</label>
<textarea rows="3" id="comentariosPdf" name="comentarios_pdf" required style="height: 10em;" class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_pdf) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosTarifa" class="form-label">

View File

@ -247,7 +247,7 @@
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button id="accordion-button-int-plana" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorPlanaTip" aria-expanded="false" aria-controls="accordionCompInteriorPlanaTip">
<h6 id='title_int_plana'><?= lang("Presupuestos.compInteriorPlana") ?></h4>
<h4><?= lang("Presupuestos.compInteriorPlana") ?></h4>
</button>
</h2>
@ -297,7 +297,7 @@
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingTwo">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorRotativaTip" aria-expanded="false" aria-controls="accordionCompInteriorRotativaTip">
<h6 id='title_int_rot'><?= lang("Presupuestos.compInteriorRotativa") ?></h4>
<h4><?= lang("Presupuestos.compInteriorRotativa") ?></h4>
</button>
</h2>
@ -350,7 +350,7 @@
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingThree">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompCubiertaSobrecubiertaTip" aria-expanded="false" aria-controls="accordionCompCubiertaSobrecubiertaTip">
<h6><?= lang("Presupuestos.cubierta") ?></h4>
<h4><?= lang("Presupuestos.cubierta") ?></h4>
</button>
</h2>

View File

@ -0,0 +1,712 @@
<div class="accordion mt-3" id="accordionDatosServicios">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionDatosServiciosTip" aria-expanded="false"
aria-controls="accordionDatosServiciosTip">
<h4><?= lang("Presupuestos.datosServicios") ?></h4>
</button>
</h2>
<div id="accordionDatosServiciosTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionDatosServicios">
<div class="accordion-body">
<div class="nav-align-top mb-4">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item">
<button
type="button"
class="nav-link active"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-acabado"
aria-controls="servicios-acabado"
aria-selected="true">
<?= lang("Presupuestos.servicioAcabado") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-preimpresion"
aria-controls="servicios-preimpresion"
aria-selected="false">
<?= lang("Presupuestos.servicioPreimpresion") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-encuadernacion"
aria-controls="servicios-encuadernacion"
aria-selected="false">
<?= lang("Presupuestos.servicioEncuadernado") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-manipulado"
aria-controls="servicios-manipulado"
aria-selected="false">
<?= lang("Presupuestos.servicioManipulado") ?>
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="servicios-acabado" role="tabpanel">
<table id="tableOfServiciosAcabado" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifaacabado.tarifaacabado') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-preimpresion" role="tabpanel">
<table id="tableOfServiciosPreimpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifapreimpresion.tarifapreimpresion') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-encuadernacion" role="tabpanel">
<table id="tableOfServiciosEncuadernacion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifaencuadernacion.tarifaencuadernacion') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-manipulado" role="tabpanel">
<table id="tableOfServiciosManipulado" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifamanipulado.tarifamanipulado') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios acabado. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfServiciosAcabado').find("tr:first th").length - 1;
const url = window.location.href;
const url_parts = url.split('/');
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
else{
id = 200000; // id=-1
}
const actionBtns = function(data) {
return `
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoAcabados') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosAcabado",
idSrc: 'id',
fields: [ {
"name": "tarifa_acabado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const acabadosList = <?php echo json_encode($serviciosAcabado); ?>;
editor.field( 'tarifa_acabado_id' ).update( acabadosList );
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {
theTable.clearPipeline();
theTable.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosAcabado').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/presupuestos/presupuestoacabados/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
var theTable = $('#tableOfServiciosAcabado').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoAcabados') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_acabado_id',
render: function(data, type, row, meta) {
var value = acabadosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios encuadernacion. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr2 = $('#tableOfServiciosEncuadernacion').find("tr:first th").length - 1;
editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoEncuadernaciones') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosEncuadernacion",
idSrc: 'id',
fields: [ {
"name": "tarifa_encuadernado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const encuadernadosList = <?php echo json_encode($serviciosEncuadernacion); ?>;
editor2.field( 'tarifa_encuadernado_id' ).update( encuadernadosList );
editor2.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor2.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor2.on( 'submitSuccess', function ( e, json, data, action ) {
theTable2.clearPipeline();
theTable2.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosEncuadernacion').on( 'click', 'tbody span.edit', function (e) {
editor2.inline(
theTable2.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
var theTable2 = $('#tableOfServiciosEncuadernacion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoEncuadernaciones') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_encuadernado_id',
render: function(data, type, row, meta) {
var value = encuadernadosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr2]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor2,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios manipulados. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr3 = $('#tableOfServiciosManipulado').find("tr:first th").length - 1;
editor3 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoManipulados') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosManipulado",
idSrc: 'id',
fields: [ {
"name": "tarifa_manipulado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const manipuladosList = <?php echo json_encode($serviciosManipulado); ?>;
editor3.field( 'tarifa_manipulado_id' ).update( manipuladosList );
editor3.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor3.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor3.on( 'submitSuccess', function ( e, json, data, action ) {
theTable3.clearPipeline();
theTable3.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosManipulado').on( 'click', 'tbody span.edit', function (e) {
editor3.inline(
theTable3.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
var theTable3 = $('#tableOfServiciosManipulado').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoManipulados') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_manipulado_id',
render: function(data, type, row, meta) {
var value = manipuladosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr3]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor3,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios preimpresion. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr4 = $('#tableOfServiciosPreimpresion').find("tr:first th").length - 1;
editor4 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoPreimpresiones') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosPreimpresion",
idSrc: 'id',
fields: [ {
"name": "tarifa_preimpresion_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const preimpresionesList = <?php echo json_encode($serviciosPreimpresion); ?>;
editor4.field( 'tarifa_preimpresion_id' ).update( preimpresionesList );
editor4.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor4.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor4.on( 'submitSuccess', function ( e, json, data, action ) {
theTable4.clearPipeline();
theTable4.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosPreimpresion').on( 'click', 'tbody span.edit', function (e) {
editor4.inline(
theTable4.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
var theTable4 = $('#tableOfServiciosPreimpresion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoPreimpresiones') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_preimpresion_id',
render: function(data, type, row, meta) {
var value = preimpresionesList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr4]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor4,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>

View File

@ -0,0 +1,81 @@
<div class="accordion mt-3 col-xl-6" id="accordionResumen">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionResumenTip" aria-expanded="false"
aria-controls="accordionResumenTip">
<h4><?= lang("Presupuestos.resumen") ?></h4>
</button>
</h2>
<div id="accordionResumenTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionResumen">
<div class="accordion-body">
<div class="col-xl-12">
<div class="border rounded p-4 mb-3 pb-3">
<!-- Price Details -->
<h6>Detalles del presupuesto</h6>
<dl class="row mb-0">
<dt class="col-6 fw-normal text-end">Coste papel</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen papel</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste servicios</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen servicios</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Costes</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Descuento</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Precio unidad</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste de envío</dt>
<dd class="col-6 text-end">NaN €</dd>
</dl>
<hr class="mx-n4">
<dl class="row mb-0">
<dt class="col-6 fw-normal text-end">Total impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 text-end">Total presupuesto</dt>
<dd class="col-6 fw-semibold text-end mb-0">NaN €</dd>
</dl>
</div>
<div class="d-grid float-end mb-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="confirmar_presupuesto" name="solapas" value="1" <?= $presupuestoEntity->confirmarPresupuesto == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.confirmar') ?></label>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento ?????. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
<?= $this->endSection() ?>

View File

@ -17,13 +17,18 @@
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_comentariosItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems") ?>
<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("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
<?= anchor(route_to("#"), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",]) ?>
<?= anchor(route_to("#"), lang("Basic.global.Clone"), ["class" => "btn btn-info float-start me-sm-3 me-1",]) ?>
<?= anchor(route_to("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
</div>
</form>
</div><!-- //.card -->
@ -684,19 +689,19 @@
<?= $this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>

View File

@ -76,7 +76,7 @@
<?php if (allowMenuSection(
$menus,
['Fresadotapadura', 'Fresadotapablanda', 'Cosidotapadura', 'Cosidotapablanda',
'Cosidotapablandasolapas', 'Grapados', 'Espiraltapadura', 'Espiraltapablanda',
'Grapados', 'Espiraltapadura', 'Espiraltapablanda',
'Wireotapadura', 'Wireotapablanda'],
'index')):
?>
@ -125,16 +125,6 @@
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Cosidotapablandasolapas')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("presupuestos/cosidotapablandasolapas") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_libros_cosido_tapa_blanda_solapas") ?>"><?= lang("App.menu_libros_cosido_tapa_blanda_solapas") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Grapados')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">