mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminando servicios manipulados y preimpresion
This commit is contained in:
@ -12,6 +12,8 @@ use App\Models\Presupuestos\PresupuestoModel;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
|
||||
use App\Services\PresupuestoService;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
@ -284,6 +286,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||
$this->viewData['serviciosEncuadernacionList'] = (new PresupuestoEncuadernacionesModel())->getResource($id)->get()->getResultObject();
|
||||
$this->viewData['serviciosAcabadosList'] = (new PresupuestoAcabadosModel())->getResource($id)->get()->getResultObject();
|
||||
$this->viewData['serviciosManipuladoList'] = (new PresupuestoManipuladosModel())->getResource($id)->get()->getResultObject();
|
||||
$this->viewData['serviciosPreimpresionList'] = (new PresupuestoPreimpresionesModel())->getResource($id)->get()->getResultObject();
|
||||
|
||||
$this->viewData['POD'] = $this->getPOD();
|
||||
|
||||
|
||||
@ -1,123 +0,0 @@
|
||||
<?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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,117 +0,0 @@
|
||||
<?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;
|
||||
|
||||
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(50, $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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -7,9 +7,7 @@ use App\Models\Collection;
|
||||
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
|
||||
|
||||
|
||||
class Presupuestoacabados extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
89
ci4/app/Controllers/Presupuestos/Presupuestomanipulados.php
Executable file
89
ci4/app/Controllers/Presupuestos/Presupuestomanipulados.php
Executable file
@ -0,0 +1,89 @@
|
||||
<?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;
|
||||
|
||||
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/';
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_manipulado_id = $reqData['tarifa_manipulado_id'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$POD = $reqData['POD'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_manipulado_id, $tirada, $POD);
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
83
ci4/app/Controllers/Presupuestos/Presupuestopreimpresiones.php
Executable file
83
ci4/app/Controllers/Presupuestos/Presupuestopreimpresiones.php
Executable file
@ -0,0 +1,83 @@
|
||||
<?php namespace App\Controllers\Presupuestos;
|
||||
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
|
||||
|
||||
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/';
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_preimpresion_id = $reqData['tarifa_preimpresion_id'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_preimpresion_id);
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
ci4/app/Controllers/Tarifas/Tarifaencuadernacionlineashoras.php
Normal file → Executable file
0
ci4/app/Controllers/Tarifas/Tarifaencuadernacionlineashoras.php
Normal file → Executable file
Reference in New Issue
Block a user