Trabajando en los campos del form

This commit is contained in:
Jaime Jimenez
2023-09-13 08:15:55 +02:00
parent 5d251a1b2c
commit 4a2d930b57
17 changed files with 2314 additions and 2067 deletions

View File

@ -457,7 +457,7 @@ $routes->group('clientecontactos', ['namespace' => 'App\Controllers\Clientes'],
$routes->resource('ClienteContactos', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'ClienteContactos', 'except' => 'show,new,create,update']);
$routes->group('Cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('', 'Cosidotapablanda::index', ['as' => 'cosidotapablandaList']);
$routes->get('add', 'Cosidotapablanda::add', ['as' => 'newCosidotapablanda']);
$routes->post('add', 'Cosidotapablanda::add', ['as' => 'createCosidotapablanda']);
@ -468,7 +468,7 @@ $routes->group('Cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
$routes->post('allmenuitems', 'Cosidotapablanda::allItemsSelect', ['as' => 'select2ItemsOfCosidotapablanda']);
$routes->post('menuitems', 'Cosidotapablanda::menuItems', ['as' => 'menuItemsOfCosidotapablanda']);
});
$routes->resource('Cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
/*
* --------------------------------------------------------------------

View File

@ -0,0 +1,271 @@
<?php namespace App\Controllers\Configuracion;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Configuracion\PapelFormatoEntity;
use App\Models\Configuracion\PapelFormatoModel;
class Papelformato extends \App\Controllers\GoBaseResourceController {
protected $modelName = PapelFormatoModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Papel Formato';
protected static $singularObjectNameCc = 'papelFormato';
protected static $pluralObjectName = 'Papeles Formatos';
protected static $pluralObjectNameCc = 'papelesFormatos';
protected static $controllerSlug = 'papelformato';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/papelformato/';
protected $indexRoute = 'papelFormatoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('LgPapelFormatoes.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
}
public function index() {
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('LgPapelFormatoes.papelFormato')]),
'papelFormatoEntity' => new PapelFormatoEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewPapelFormatoList', $viewData);
}
public function add() {
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('LgPapelFormatoes.papelFormato'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
endif;
if ($noException && $successfulResult) :
$id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('LgPapelFormatoes.papelFormato'))]).'.';
$message .= anchor( "admin/papelformato/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['papelFormatoEntity'] = isset($sanitizedData) ? new PapelFormatoEntity($sanitizedData) : new PapelFormatoEntity();
$this->viewData['formAction'] = route_to('createPapelFormato');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('LgPapelFormatoes.moduleTitle').' '.lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null) {
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$papelFormatoEntity = $this->model->find($id);
if ($papelFormatoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('LgPapelFormatoes.papelFormato')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$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('LgPapelFormatoes.papelFormato'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$papelFormatoEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $papelFormatoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('LgPapelFormatoes.papelFormato'))]).'.';
$message .= anchor( "admin/papelformato/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['papelFormatoEntity'] = $papelFormatoEntity;
$this->viewData['formAction'] = route_to('updatePapelFormato', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('LgPapelFormatoes.moduleTitle').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable() {
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PapelFormatoModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', ancho', 'ancho', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->ancho = '- '.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 ?? 'ancho'];
$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);
}
}
}

View File

@ -17,7 +17,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
protected $format = 'json';
protected static $singularObjectName = 'Cosido Tapa Blanda';
protected static $singularObjectNameCc = 'cosidoTapaBlanda';
protected static $singularObjectNameCc = 'Cosidotapablanda';
protected static $pluralObjectName = 'Cosidos Tapa Blanda';
protected static $pluralObjectNameCc = 'cosidosTapaBlanda';
@ -32,7 +32,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Presupuestos.moduleTitle');
$this->viewData['pageTitle'] = lang('Presupuestos.moduleTitleCosidoTB');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
$this->model = new PresupuestoModel();
@ -125,13 +125,20 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['presupuestoEntity'] = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
$this->viewData['incReiList'] = array('incidencia'=>lang('Presupuestos.incidencia'), 'reimpresion'=>lang('Presupuestos.reimpresion'), 'sin_cargo'=>lang('Presupuestos.sinCargo'));
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
/*
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
@ -153,10 +160,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
$this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
$this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();
*/
$this->viewData['formAction'] = route_to('createCosidotapablanda');
$this->viewData['formAction'] = route_to('createPresupuesto');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
@ -463,6 +470,20 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
}
protected function getClienteListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Clientes.cliente'))])];
if (!empty($selId)) :
$clienteModel = model('App\Models\Clientes\ClienteModel');
$selOption = $clienteModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPaisListItems()
{
$paisModel = model('App\Models\Configuracion\PaisModel');
@ -472,6 +493,19 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
return $data;
}
protected function getPapelFormatoListItems($selId = null)
{
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$data = $papelFormatoModel->getElementsForMenu();
array_unshift($data, (object)['id'=>'', 'tamanio' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papelFormatoId'))])]);
return $data;
}
/*
protected function getUbicacionLibroListItems($selId = null)
{
@ -618,19 +652,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
}
protected function getPapelFormatoListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('LgPapelFormatoes.papelFormato'))])];
if (!empty($selId)) :
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$selOption = $papelFormatoModel->where('id', $selId)->findColumn('id');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getMaquinaListItems2($selId = null)
@ -798,21 +819,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
}
protected function getClienteListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Clientes.cliente'))])];
if (!empty($selId)) :
$clienteModel = model('App\Models\Clientes\ClienteModel');
$selOption = $clienteModel->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'))])];
@ -879,4 +886,5 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
];
return $paginasPortadaOptions;
}
*/
}

View File

@ -15,11 +15,10 @@ class Test extends BaseController
public function index()
{
/*
$papel = new Papelesimpresion();
var_dump($papel->datatablePG());*/
$session = session();
var_dump($session->id_user);
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$data = $papelFormatoModel->getElementsForMenu();
var_dump($data);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class PapelFormatoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"ancho" => null,
"alto" => null,
"is_deleted" => 0,
"deleted_at" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"ancho" => "float",
"alto" => "float",
"is_deleted" => "int",
];
}

View File

@ -29,7 +29,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"papel_formato_personalizado" => false,
"papel_formato_ancho" => null,
"papel_formato_alto" => null,
"titulo" => "titulo",
"titulo" => "",
"autor" => null,
"coleccion" => null,
"numero_edicion" => null,
@ -43,7 +43,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"sobrecubiertas" => false,
"sobrecubiertas_ancho" => 0.0,
"merma" => null,
"merma_cubierta" => 6.0,
"merma_portada" => 6.0,
"imagenes_bn_interior" => false,
"comentarios" => null,
"comentarios_safekat" => null,
@ -201,7 +201,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"sobrecubiertas" => "boolean",
"sobrecubiertas_ancho" => "float",
"merma" => "float",
"merma_cubierta" => "float",
"merma_portada" => "float",
"imagenes_bn_interior" => "boolean",
"en_produccion" => "boolean",
"en_espera" => "boolean",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
<?php
namespace App\Models\Configuracion;
class PapelFormatoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_papel_formato";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "t1.id",
2 => "t1.ancho",
3 => "t1.alto",
4 => "t1.created_at",
5 => "t1.updated_at",
];
protected $allowedFields = ["ancho", "alto"];
protected $returnType = "App\Entities\Configuracion\PapelFormatoEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "ancho";
protected $validationRules = [
"alto" => [
"label" => "LgPapelFormatoes.alto",
"rules" => "required|decimal",
],
"ancho" => [
"label" => "LgPapelFormatoes.ancho",
"rules" => "required|decimal",
],
];
protected $validationMessages = [
"alto" => [
"decimal" => "LgPapelFormatoes.validation.alto.decimal",
"required" => "LgPapelFormatoes.validation.alto.required",
],
"ancho" => [
"decimal" => "LgPapelFormatoes.validation.ancho.decimal",
"required" => "LgPapelFormatoes.validation.ancho.required",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "")
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.ancho AS ancho, t1.alto AS alto, t1.created_at AS created_at, t1.updated_at AS updated_at"
);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->groupEnd();
}
public function getElementsForMenu(){
return $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS tamanio"
)->get()->getResultObject();
}
}

View File

@ -0,0 +1,19 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="ancho" class="form-label">
<?=lang('LgPapelFormatoes.ancho') ?>*
</label>
<input type="number" id="ancho" name="ancho" required maxLength="8" step="0.01" class="form-control" value="<?=old('ancho', $papelFormatoEntity->ancho) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="alto" class="form-label">
<?=lang('LgPapelFormatoes.alto') ?>*
</label>
<input type="number" id="alto" name="alto" required maxLength="8" step="0.01" class="form-control" value="<?=old('alto', $papelFormatoEntity->alto) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,26 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/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="papelFormatoForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/papelformato/_papelFormatoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("papelFormatoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>

View File

@ -0,0 +1,187 @@
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/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('LgPapelFormatoes.papelFormatoList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfPapelesformatos" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('LgPapelFormatoes.id')?></th>
<th><?= lang('LgPapelFormatoes.ancho') ?></th>
<th><?= lang('LgPapelFormatoes.alto') ?></th>
<th><?= lang('LgPapelFormatoes.createdAt') ?></th>
<th><?= lang('LgPapelFormatoes.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newPapelFormato'), lang('Basic.global.addNew').' '.lang('LgPapelFormatoes.papelFormato'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfPapelesformatos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfPapelesformatos').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfrtipB', // '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'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPapelesFormatos') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [0,lastColNr]
}
],
columns : [
{ 'data': actionBtns },
{ 'data': 'id' },
{ 'data': 'ancho' },
{ 'data': 'alto' },
{ 'data': 'created_at' },
{ 'data': 'updated_at' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const dateCols = [4, 5];
const shortDateFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY')?>';
const dateTimeFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY h:i a')?>';
for (let coln of dateCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
const datestr = cell.innerHTML;
const dateStrLen = datestr.toString().trim().length;
if (dateStrLen > 0) {
let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
const d = new Date(...dateTimeParts); // new Date(datestr);
const md = moment(d);
const usingThisFormat = dateStrLen > 11 ? dateTimeFormat : shortDateFormat;
const formattedDateStr = md.format(usingThisFormat);
cell.innerHTML = formattedDateStr;
}
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('papelFormatoList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('LgPapelFormatoes.papel formato'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('papelFormatoList') ?>/${dataId}`,
method: 'DELETE',
}).done((data, textStatus, jqXHR) => {
Toast.fire({
icon: 'success',
title: data.msg ?? jqXHR.statusText,
});
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
Toast.fire({
icon: 'error',
title: jqXHR.responseJSON.messages.error,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -98,20 +98,7 @@
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('Presupuestos.paisId') ?>*
</label>
<select id="paisId" name="pais_id" required class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('Presupuestos.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$presupuestoEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="serieId" class="form-label">
@ -157,141 +144,25 @@
<textarea rows="3" id="causaCancelacion" name="causa_cancelacion" style="height: 10em;" class="form-control"><?=old('causa_cancelacion', $presupuestoEntity->causa_cancelacion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="recogerEnTaller" class="form-check-label">
<input type="checkbox" id="recogerEnTaller" name="recoger_en_taller" value="1" class="form-check-input"<?=$presupuestoEntity->recoger_en_taller== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.recogerEnTaller') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="ferro" class="form-check-label">
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input"<?=$presupuestoEntity->ferro== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.ferro') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="ferroDigital" class="form-check-label">
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input"<?=$presupuestoEntity->ferro_digital== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.ferroDigital') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="marcapaginas" class="form-check-label">
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input"<?=$presupuestoEntity->marcapaginas== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.marcapaginas') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="papelFormatoId" class="form-label">
<?=lang('Presupuestos.papelFormatoId') ?>*
</label>
<select id="papelFormatoId" name="papel_formato_id" required class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList) ) :
foreach ($papelFormatoList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$presupuestoEntity->papel_formato_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="papelFormatoPersonalizado" class="form-check-label">
<input type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" class="form-check-input"<?=$presupuestoEntity->papel_formato_personalizado== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.papelFormatoPersonalizado') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="papelFormatoAncho" class="form-label">
<?=lang('Presupuestos.papelFormatoAncho') ?>
</label>
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?=old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="papelFormatoAlto" class="form-label">
<?=lang('Presupuestos.papelFormatoAlto') ?>
</label>
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?=old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="titulo" class="form-label">
<?=lang('Presupuestos.titulo') ?>*
</label>
<textarea rows="3" id="titulo" name="titulo" required style="height: 10em;" class="form-control" placeholder="titulo"><?=old('titulo', $presupuestoEntity->titulo) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="autor" class="form-label">
<?=lang('Presupuestos.autor') ?>*
</label>
<input type="text" id="autor" name="autor" required maxLength="150" class="form-control" value="<?=old('autor', $presupuestoEntity->autor) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="coleccion" class="form-label">
<?=lang('Presupuestos.coleccion') ?>
</label>
<input type="text" id="coleccion" name="coleccion" maxLength="255" class="form-control" value="<?=old('coleccion', $presupuestoEntity->coleccion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="numeroEdicion" class="form-label">
<?=lang('Presupuestos.numeroEdicion') ?>
</label>
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="<?=old('numero_edicion', $presupuestoEntity->numero_edicion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="isbn" class="form-label">
<?=lang('Presupuestos.isbn') ?>
</label>
<input type="text" id="isbn" name="isbn" maxLength="50" class="form-control" value="<?=old('isbn', $presupuestoEntity->isbn) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="referenciaCliente" class="form-label">
<?=lang('Presupuestos.referenciaCliente') ?>*
</label>
<input type="text" id="referenciaCliente" name="referencia_cliente" required maxLength="100" class="form-control" value="<?=old('referencia_cliente', $presupuestoEntity->referencia_cliente) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paginas" class="form-label">
<?=lang('Presupuestos.paginas') ?>*
</label>
<input type="number" id="paginas" name="paginas" required maxLength="11" class="form-control" value="<?=old('paginas', $presupuestoEntity->paginas) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tirada" class="form-label">
<?=lang('Presupuestos.tirada') ?>*
</label>
<input type="number" id="tirada" name="tirada" required maxLength="11" class="form-control" value="<?=old('tirada', $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
@ -310,15 +181,7 @@
<input type="number" id="solapasAncho" name="solapas_ancho" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('solapas_ancho', $presupuestoEntity->solapas_ancho) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="cosido" class="form-check-label">
<input type="checkbox" id="cosido" name="cosido" value="1" class="form-check-input"<?=$presupuestoEntity->cosido== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.cosido') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
@ -337,29 +200,9 @@
<input type="number" id="sobresobrecubiertasAncho" name="sobresobrecubiertas_ancho" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('sobresobrecubiertas_ancho', $presupuestoEntity->sobresobrecubiertas_ancho) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="merma" class="form-label">
<?=lang('Presupuestos.merma') ?>*
</label>
<input type="number" id="merma" name="merma" required maxLength="8" step="0.01" class="form-control" value="<?=old('merma', $presupuestoEntity->merma) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="mermacubierta" class="form-label">
<?=lang('Presupuestos.mermacubierta') ?>*
</label>
<input type="number" id="mermacubierta" name="merma_sobrecubierta" required placeholder="6.00" maxLength="8" step="0.01" class="form-control" value="<?=old('merma_sobrecubierta', $presupuestoEntity->merma_sobrecubierta) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="imagenesBnInterior" class="form-check-label">
<input type="checkbox" id="imagenesBnInterior" name="imagenes_bn_interior" value="1" class="form-check-input"<?=$presupuestoEntity->imagenes_bn_interior== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.imagenesBnInterior') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentarios" class="form-label">

View File

@ -0,0 +1,201 @@
<div class="accordion mt-3" id="accordionDatosLibro">
<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="#accordionDatosLibroTip" aria-expanded="false" aria-controls="accordionDatosLibroTip">
<h3><?= lang("Presupuestos.datosLibro") ?></h3>
</button>
</h2>
<div id="accordionDatosLibroTip" class="accordion-collapse collapse show" data-bs-parent="#accordionDatosLibro">
<div class="accordion-body">
<!-- Fila 1 -->
<div class="row">
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="paginas" class="form-label">
<?=lang('Presupuestos.paginas') ?>*
</label>
<input type="number" id="paginas" name="paginas" required maxLength="11" class="form-control" value="<?=old('paginas', $presupuestoEntity->paginas) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="tirada" class="form-label">
<?=lang('Presupuestos.tirada') ?>*
</label>
<input type="number" id="tirada" name="tirada" required maxLength="11" class="form-control" value="<?=old('tirada', $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-4 px-4">
<div class="mb-3">
<label for="papelFormatoId" class="form-label">
<?=lang('Presupuestos.papelFormatoId') ?>*
</label>
<select id="papelFormatoId" name="papel_formato_id" required class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList) ) :
foreach ($papelFormatoList as $formato) : ?>
<option value="<?=$formato->id ?>"<?=$formato->id==$presupuestoEntity->papel_formato_id ? ' selected':'' ?>>
<?=$formato->tamanio ?>
</option>
<?php endforeach;
endif; ?>
</select>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" <?=$presupuestoEntity->papel_formato_personalizado== true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?=lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="merma" class="form-label">
<?=lang('Presupuestos.merma') ?>*
</label>
<input type="number" id="merma" name="merma" required maxLength="8" step="0.01" class="form-control" value="<?=old('merma', $presupuestoEntity->merma) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="mermaportada" class="form-label">
<?=lang('Presupuestos.mermaportada') ?>*
</label>
<input type="number" id="mermaportada" name="merma_sobrecubierta" required placeholder="6.00" maxLength="8" step="0.01" class="form-control" value="<?=old('merma_sobrecubierta', $presupuestoEntity->merma_sobrecubierta) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div> <!--//.row -->
<!-- Fila 2 -->
<div class="row">
<div class="col-md-12 col-lg-2 px-4">
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label style="display: none" id="label_papelFormatoAncho" for="papelFormatoAncho" class="form-label">
<?=lang('Presupuestos.papelFormatoAncho') ?>
</label>
<input style="display: none"type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?=old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label style="display: none" id="label_papelFormatoAlto" for="papelFormatoAlto" class="form-label">
<?=lang('Presupuestos.papelFormatoAlto') ?>
</label>
<input style="display: none" type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?=old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
</div><!--//.col -->
</div> <!--//.row -->
<!-- Fila 3 -->
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="cosido" class="form-check-label">
<input type="checkbox" id="cosido" name="cosido" value="1" class="form-check-input"<?=$presupuestoEntity->cosido== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.cosido') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="ferro" class="form-check-label">
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input"<?=$presupuestoEntity->ferro== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.ferro') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="ferroDigital" class="form-check-label">
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input"<?=$presupuestoEntity->ferro_digital== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.ferroDigital') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
Prototipo
</div><!--//.col -->
</div> <!--//.row -->
<!-- Fila 4 -->
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="imagenesBnInterior" class="form-check-label">
<input type="checkbox" id="imagenesBnInterior" name="imagenes_bn_interior" value="1" class="form-check-input"<?=$presupuestoEntity->imagenes_bn_interior== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.imagenesBnInterior') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="recogerEnTaller" class="form-check-label">
<input type="checkbox" id="recogerEnTaller" name="recoger_en_taller" value="1" class="form-check-input"<?=$presupuestoEntity->recoger_en_taller== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.recogerEnTaller') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="marcapaginas" class="form-check-label">
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input"<?=$presupuestoEntity->marcapaginas== true ? 'checked' : ''; ?>>
<?=lang('Presupuestos.marcapaginas') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div> <!--//.row -->
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->

View File

@ -0,0 +1,169 @@
<div class="accordion mt-3" id="accordionDatosPresupuesto">
<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="#accordionDatosPresupuestoTip" aria-expanded="false" aria-controls="accordionDatosPresupuestoTip">
<h3><?= lang("Presupuestos.datosPresupuesto") ?></h3>
</button>
</h2>
<div id="accordionDatosPresupuestoTip" class="accordion-collapse collapse show" data-bs-parent="#accordionDatosPresupuesto">
<div class="accordion-body">
<!-- Fila 1 -->
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="id" class="form-label">
<?= lang('Presupuestos.id') ?>
</label>
<input readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="<?= old('id', $presupuestoEntity->id) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="created_at" class="form-label">
<?= lang('Presupuestos.created_at') ?>
</label>
<input readonly style="background: #E8E8E8;" id="created_at" name="created_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->created_at)) ? $presupuestoEntity->created_at : date("d/m/Y")) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="estadoId" class="form-label">
<?= lang('Presupuestos.presupuestoEstado') ?>
</label>
<input readonly style="background: #E8E8E8 ;" id="estadoId" name="estado_id" maxLength="12" class="form-control" value="<?= old('estadoId', (isset($presupuestoEntity->estadoId)) ? $presupuestoEntity->estadoId : lang('Presupuestos.presupuestoEstadoBorrador')) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="incRei" class="form-label">
<?= lang('Presupuestos.incRei') ?>
</label>
<select id="incRei" name="inc_rei" maxLength="11" class="form-control" value="<?= old('inc_rei', $presupuestoEntity->inc_rei) ?>">
<?php if (isset($incReiList) && is_array($incReiList) && !empty($incReiList)) : ?>
<option> </option>
<?php foreach ($incReiList as $k => $v) : ?>
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->estado_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div> <!--//.row -->
<!-- Fila 2 -->
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="titulo" class="form-label">
<?=lang('Presupuestos.titulo') ?>*
</label>
<input type="text" id="titulo" name="titulo" required maxLength="300" class="form-control" value="<?=old('titulo', $presupuestoEntity->titulo) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="autor" class="form-label">
<?=lang('Presupuestos.autor') ?>*
</label>
<input type="text" id="autor" name="autor" required maxLength="150" class="form-control" value="<?=old('autor', $presupuestoEntity->autor) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div> <!--//.row -->
<!-- Fila 3 -->
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="coleccion" class="form-label">
<?=lang('Presupuestos.coleccion') ?>
</label>
<input type="text" id="coleccion" name="coleccion" maxLength="255" class="form-control" value="<?=old('coleccion', $presupuestoEntity->coleccion) ?>">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="numeroEdicion" class="form-label">
<?=lang('Presupuestos.numeroEdicion') ?>
</label>
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="<?=old('numero_edicion', $presupuestoEntity->numero_edicion) ?>">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="isbn" class="form-label">
<?=lang('Presupuestos.isbn') ?>
</label>
<input type="text" id="isbn" name="isbn" maxLength="50" class="form-control" value="<?=old('isbn', $presupuestoEntity->isbn) ?>">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('Presupuestos.paisId') ?>*
</label>
<select id="paisId" name="pais_id" required class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('Presupuestos.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$presupuestoEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
</div>
</div> <!--//.row -->
<!-- Fila 3 -->
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="clienteId" class="form-label">
<?= lang('Presupuestos.clienteId') ?>*
</label>
<select id="clienteId" name="cliente_id" required class="form-control select2bs2" style="width: 100%;">
<?php if (isset($clienteList) && is_array($clienteList) && !empty($clienteList)) :
foreach ($clienteList as $k => $v) : ?>
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->cliente_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="referenciaCliente" class="form-label">
<?=lang('Presupuestos.referenciaCliente') ?>
</label>
<input type="text" id="referenciaCliente" name="referencia_cliente" maxLength="100" class="form-control" value="<?=old('referencia_cliente', $presupuestoEntity->referencia_cliente) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div> <!--//.row -->
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->

View File

@ -1,6 +1,6 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $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">
@ -8,59 +8,33 @@
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="presupuestoForm" method="post" action="<?= $formAction ?>">
<form id="presupuestoForm" class="card-body" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/presupuestos/_presupuestoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("presupuestoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems") ?>
<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",]) ?>
</div>
</form>
</div><!-- //.card -->
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS para los selects -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
$('#papelFormatoId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelesFormatos") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'id',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#clienteId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfClientes") ?>',
@ -77,677 +51,46 @@
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginassobrecubiertaPapelImpresionId').select2({
theme: 'bootstrap-5',
$('#incRei').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#tipoImpresionId').select2({
theme: 'bootstrap-5',
$('#paisId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfTiposImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasColorTarifaImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinasTarifasImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'precio',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasColorPapelId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelGenericoes") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasNegroTarifaImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinasTarifasImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'precio',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasNegroPapelId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelGenericoes") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginassobrecubiertaTarifaImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinasTarifasImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'precio',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginassobrecubiertaPapelId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelGenericoes") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginascubiertaPapelId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelGenericoes") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#totalConfirmadoUserId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfUsers") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id_user',
text: 'first_name',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#tipologiaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfTipologiasLibros") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#aprobadoUserId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfUsers") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id_user',
text: 'first_name',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#pedidoEsperaUserId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfUsers") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id_user',
text: 'first_name',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasNegroMaquinaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#estadoId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPresupuestosEstados") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'estado',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasColorMaquinaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasNegroPapelImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginassobrecubiertaMaquinaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginascubiertaMaquinaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginascubiertaTarifaImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinasTarifasImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'id',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginasColorPapelImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paginascubiertaPapelImpresionId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelImpresions") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS comportamiento general pag. -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
$('#papelFormatoPersonalizado').on("click",function(){
var checkbox = document.getElementById('papelFormatoPersonalizado');
if(checkbox.checked == true){
document.getElementById("label_papelFormatoAncho").style.display = "block";
document.getElementById("papelFormatoAncho").style.display = "block";
document.getElementById("label_papelFormatoAlto").style.display = "block";
document.getElementById("papelFormatoAlto").style.display = "block";
document.getElementById("papelFormatoId").disabled = true;
}
else{
document.getElementById("label_papelFormatoAncho").style.display = "none";
document.getElementById("papelFormatoAncho").style.display = "none";
document.getElementById("label_papelFormatoAlto").style.display = "none";
document.getElementById("papelFormatoAlto").style.display = "none";
document.getElementById("papelFormatoId").disabled = false;
}
});
<?= $this->endSection() ?>

View File

@ -9,7 +9,7 @@
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Presupuestos.presupuestoList') ?></h3>
<h3 class="card-title"><?=lang('Presupuestos.presupuestoCosidotapablandaList') ?></h3>
<?=anchor(route_to('newCosidotapablanda'), lang('Basic.global.addNew').' '.lang('Presupuestos.presupuesto'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
@ -28,7 +28,7 @@
<th><?= lang('Presupuestos.paginas') ?></th>
<th><?= lang('Presupuestos.tirada') ?></th>
<th><?= lang('Presupuestos.totalPedido') ?></th>
<th><?= lang('PresupuestoEstados.presupuestoEstado') ?></th>
<th><?= lang('Presupuestos.presupuestoEstado') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -51,12 +51,13 @@
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<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>
</div>
</td>`;
</td>`;
};
theTable = $('#tableOfPresupuestos').DataTable({
processing: true,
@ -69,7 +70,7 @@
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
'colvis', 'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
@ -113,8 +114,7 @@
theTable.on( 'draw.dt', function () {
const dateCols = [1];
const shortDateFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY')?>';
const dateTimeFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY h:i a')?>';
const priceCols = [9];
for (let coln of dateCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
@ -124,56 +124,49 @@ theTable.on( 'draw.dt', function () {
let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
const d = new Date(...dateTimeParts); // new Date(datestr);
const md = moment(d);
const usingThisFormat = dateStrLen > 11 ? dateTimeFormat : shortDateFormat;
const formattedDateStr = md.format(usingThisFormat);
cell.innerHTML = formattedDateStr;
cell.innerHTML = d.toLocaleDateString();
}
});
}
for (let coln of priceCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = parseFloat(cell.innerHTML).toFixed(2);
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('presupuestoList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Presupuestos.presupuesto'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('presupuestoList') ?>/${dataId}`,
method: 'DELETE',
}).done((data, textStatus, jqXHR) => {
Toast.fire({
icon: 'success',
title: data.msg ?? jqXHR.statusText,
});
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
Toast.fire({
icon: 'error',
title: jqXHR.responseJSON.messages.error,
});
})
}
});
window.location.href = `/presupuestos/cosidotapablanda/edit/${$(this).attr('data-id')}`;
});
$(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/cosidotapablanda/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)
})
}
});
@ -190,6 +183,8 @@ $(document).on('click', '.btn-delete', function(e) {
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.colVis.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>