mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
tarifas manipulado actualizado
This commit is contained in:
26
ci4/.env
26
ci4/.env
@ -22,8 +22,8 @@ CI_ENVIRONMENT = development
|
|||||||
# APP
|
# APP
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
# app.baseURL = 'https://sk-jjo.imnavajas.es'
|
app.baseURL = 'https://sk-jjo.imnavajas.es'
|
||||||
app.baseURL = 'https://sk-imn.imnavajas.es'
|
# app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||||
# app.baseURL = "http://safekat.test/"
|
# app.baseURL = "http://safekat.test/"
|
||||||
# app.forceGlobalSecureRequests = false
|
# app.forceGlobalSecureRequests = false
|
||||||
|
|
||||||
@ -41,22 +41,22 @@ app.baseURL = 'https://sk-imn.imnavajas.es'
|
|||||||
# DATABASE
|
# DATABASE
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
# database.default.hostname = localhost
|
|
||||||
# database.default.database = sk_jjo
|
|
||||||
# database.default.username = sk_jjo
|
|
||||||
# database.default.password = 61tv&G1Zf^XY
|
|
||||||
# database.default.DBDriver = MySQLi
|
|
||||||
# database.default.DBPrefix =
|
|
||||||
# database.default.dump =
|
|
||||||
|
|
||||||
database.default.hostname = localhost
|
database.default.hostname = localhost
|
||||||
database.default.database = sk_imn
|
database.default.database = sk_jjo
|
||||||
database.default.username = sk_imn
|
database.default.username = sk_jjo
|
||||||
database.default.password = Uyia19_87
|
database.default.password = 61tv&G1Zf^XY
|
||||||
database.default.DBDriver = MySQLi
|
database.default.DBDriver = MySQLi
|
||||||
database.default.DBPrefix =
|
database.default.DBPrefix =
|
||||||
database.default.dump =
|
database.default.dump =
|
||||||
|
|
||||||
|
# database.default.hostname = localhost
|
||||||
|
# database.default.database = sk_imn
|
||||||
|
# database.default.username = sk_imn
|
||||||
|
# database.default.password = Uyia19_87
|
||||||
|
# database.default.DBDriver = MySQLi
|
||||||
|
# database.default.DBPrefix =
|
||||||
|
# database.default.dump =
|
||||||
|
|
||||||
# database.tests.hostname = localhost
|
# database.tests.hostname = localhost
|
||||||
# database.tests.database = ci4
|
# database.tests.database = ci4
|
||||||
# database.tests.username = root
|
# database.tests.username = root
|
||||||
|
|||||||
@ -127,7 +127,7 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
|||||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||||
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
||||||
});
|
});
|
||||||
$routes->resource('tarifamanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|
||||||
$routes->group('tarifamanipuladolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
$routes->group('tarifamanipuladolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||||
|
|||||||
@ -259,11 +259,20 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
|
|||||||
->validator( function($editor, $action, $data){
|
->validator( function($editor, $action, $data){
|
||||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||||
foreach ($data['data'] as $pkey => $values ){
|
foreach ($data['data'] as $pkey => $values ){
|
||||||
$count = $this->model->select('*')
|
// Si no se quiere borrar...
|
||||||
->where(array('tarifa_manipulado_id'=> $values['tarifa_manipulado_id'], 'tirada_min'=> $values['tirada_min'], 'tirada_max'=> $values['tirada_max'], 'is_deleted'=> 0))
|
if($data['data'][$pkey]['is_deleted'] != 1)
|
||||||
->countAllResults();
|
{
|
||||||
if ($count >= 1){
|
|
||||||
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
$count = $this->model->select('*')
|
||||||
|
->where(array(
|
||||||
|
'tarifa_manipulado_id'=> $values['tarifa_manipulado_id'],
|
||||||
|
'tirada_min'=> $values['tirada_min'],
|
||||||
|
'tirada_max'=> $values['tirada_max'],
|
||||||
|
'is_deleted'=> 0))
|
||||||
|
->countAllResults();
|
||||||
|
if ($count >= 1){
|
||||||
|
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,13 +302,13 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
|
|||||||
->data();
|
->data();
|
||||||
|
|
||||||
|
|
||||||
// if unique key is set in DB
|
/*// if unique key is set in DB
|
||||||
if(isset($response['error'])){
|
if(isset($response['error'])){
|
||||||
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
||||||
str_contains($response['error'], "Duplicate entry ")){
|
str_contains($response['error'], "Duplicate entry ")){
|
||||||
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
|||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect) :
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)) :
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
return redirect()->to(site_url('tarifas/tarifasmanipulado/edit/'.$id))->with('sweet-success', $message);
|
||||||
|
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
endif;
|
endif;
|
||||||
@ -160,25 +161,22 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
|||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
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('Tarifamanipulado.tarifamanipulado'))]);
|
||||||
|
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||||
|
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$tarifaManipuladoEntity->fill($sanitizedData);
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
$thenRedirect = true;
|
||||||
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('Tarifamanipulado.tarifamanipulado'))]);
|
|
||||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
|
||||||
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$tarifaManipuladoEntity->fill($sanitizedData);
|
|
||||||
|
|
||||||
$thenRedirect = true;
|
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult) :
|
||||||
$id = $tarifaManipuladoEntity->id ?? $id;
|
$id = $tarifaManipuladoEntity->id ?? $id;
|
||||||
@ -223,7 +221,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
|||||||
$length = $reqData['length'] ?? 5;
|
$length = $reqData['length'] ?? 5;
|
||||||
$search = $reqData['search']['value'];
|
$search = $reqData['search']['value'];
|
||||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||||
$order = TarifaManipuladoModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
$order = TarifaManipuladoModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||||
|
|
||||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||||
|
|||||||
@ -15,8 +15,11 @@ class Test extends BaseController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
$papel = new Papelesimpresion();
|
$papel = new Papelesimpresion();
|
||||||
var_dump($papel->datatablePG());
|
var_dump($papel->datatablePG());*/
|
||||||
|
return redirect()->to(site_url('tarifas/tarifaacabado/edit/'. 30))->with('sweet-success', 'OK');
|
||||||
|
//return redirect()->to('https://sk-jjo.imnavajas.es/tarifas/tarifaacabado/edit/30');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,6 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
'datatable',
|
'datatable',
|
||||||
'datatable_editor',
|
'datatable_editor',
|
||||||
'fetch_single_data',
|
'fetch_single_data',
|
||||||
'datatableTintas',
|
|
||||||
'collect',
|
'collect',
|
||||||
'cast',
|
'cast',
|
||||||
];
|
];
|
||||||
|
|||||||
49
ci4/app/Language/en/TarifaManipuladoLineas.php
Normal file
49
ci4/app/Language/en/TarifaManipuladoLineas.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => 'ID',
|
||||||
|
'moduleTitle' => 'Handling rates Lines',
|
||||||
|
'deleteLine' => 'the selected register',
|
||||||
|
'precioMax' => 'Max Price',
|
||||||
|
'precioMin' => 'Min Price',
|
||||||
|
'precioUnidad' => 'Price Unit',
|
||||||
|
'tiradaMax' => 'Print Max',
|
||||||
|
'tiradaMin' => 'Print Min',
|
||||||
|
'validation' => [
|
||||||
|
'precio_max' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'precio_min' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'precio_unidad' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'tirada_max' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'tirada_min' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
49
ci4/app/Language/es/TarifaManipuladoLineas.php
Normal file
49
ci4/app/Language/es/TarifaManipuladoLineas.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => 'ID',
|
||||||
|
'moduleTitle' => 'Tarifa Manipulado Lineas',
|
||||||
|
'deleteLine' => 'el registro seleccionado',
|
||||||
|
'precioMax' => 'Precio Max',
|
||||||
|
'precioMin' => 'Precio Min',
|
||||||
|
'precioUnidad' => 'Precio Unidad',
|
||||||
|
'tiradaMax' => 'Tirada Max',
|
||||||
|
'tiradaMin' => 'Tirada Min',
|
||||||
|
'validation' => [
|
||||||
|
'precio_max' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'precio_min' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'precio_unidad' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'tirada_max' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'tirada_min' => [
|
||||||
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
'required' => 'The {field} field is required.',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
@ -27,6 +27,9 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
|
|||||||
"precio_min",
|
"precio_min",
|
||||||
"precio_max",
|
"precio_max",
|
||||||
"precio_unidad",
|
"precio_unidad",
|
||||||
|
"user_created_id",
|
||||||
|
"is_deleted",
|
||||||
|
|
||||||
];
|
];
|
||||||
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoLinea";
|
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoLinea";
|
||||||
|
|
||||||
@ -97,12 +100,14 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
|
|||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad"
|
"t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad, t2.id AS tarifa_manipulado"
|
||||||
);
|
);
|
||||||
if($tarifa_manipulado_id>=0)
|
//JJO
|
||||||
{
|
$builder->where('tarifa_manipulado_id', $tarifa_manipulado_id);
|
||||||
$builder->where('tarifa_manipulado_id', $tarifa_manipulado_id);
|
$builder->where("t1.is_deleted", 0);
|
||||||
}
|
|
||||||
|
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_manipulado_id = t2.id", "left");
|
||||||
|
|
||||||
|
|
||||||
return empty($search)
|
return empty($search)
|
||||||
? $builder
|
? $builder
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
|
|||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
const SORTABLE = [
|
const SORTABLE = [
|
||||||
1 => "t1.nombre",
|
0 => "t1.nombre",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
|
|||||||
@ -17,20 +17,27 @@
|
|||||||
<?= view("themes/backend/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
|
<?= view("themes/backend/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
|
||||||
</div><!-- /.card-body -->
|
</div><!-- /.card-body -->
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<?= anchor(route_to("tarifaManipuladoList"), lang("Basic.global.Cancel"), [
|
<input type="submit"
|
||||||
"class" => "btn btn-secondary float-start",
|
class="btn btn-primary float-start me-sm-3 me-1"
|
||||||
]) ?>
|
name="save"
|
||||||
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
|
value="<?= lang("Basic.global.Save") ?>"
|
||||||
|
/>
|
||||||
|
<?= anchor(route_to("tarifaManipuladoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||||
|
|
||||||
</div><!-- /.card-footer -->
|
</div><!-- /.card-footer -->
|
||||||
</form>
|
</form>
|
||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|
||||||
<div class="accordion mt-3" id="accordionManipuladoLineas">
|
<?php if($formAction == route_to('createTarifaManipulado')): ?>
|
||||||
|
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:hidden" >
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:visible" >
|
||||||
|
<?php endif; ?>
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingOne">
|
<h2 class="accordion-header" id="headingOne">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||||
<p><?= lang("TarifaAcabadoLineas.moduleTitle") ?></p>
|
<p><?= lang("TarifaManipuladoLineas.moduleTitle") ?></p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
@ -41,11 +48,11 @@
|
|||||||
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
|
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.precioUnidad') ?></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -86,7 +93,7 @@
|
|||||||
|
|
||||||
editor = new $.fn.dataTable.Editor( {
|
editor = new $.fn.dataTable.Editor( {
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfTarifaAcabadoLineas') ?>",
|
url: "<?= route_to('editorOfTarifaManipuladoLineas') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user