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.baseURL = 'https://sk-jjo.imnavajas.es'
|
||||
app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||
app.baseURL = 'https://sk-jjo.imnavajas.es'
|
||||
# app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||
# app.baseURL = "http://safekat.test/"
|
||||
# app.forceGlobalSecureRequests = false
|
||||
|
||||
@ -41,22 +41,22 @@ app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||
# 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.database = sk_imn
|
||||
database.default.username = sk_imn
|
||||
database.default.password = Uyia19_87
|
||||
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.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.database = ci4
|
||||
# database.tests.username = root
|
||||
|
||||
@ -127,7 +127,7 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||
$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) {
|
||||
|
||||
@ -259,11 +259,20 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
|
||||
->validator( function($editor, $action, $data){
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||
foreach ($data['data'] as $pkey => $values ){
|
||||
$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');
|
||||
// Si no se quiere borrar...
|
||||
if($data['data'][$pkey]['is_deleted'] != 1)
|
||||
{
|
||||
|
||||
$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();
|
||||
|
||||
|
||||
// if unique key is set in DB
|
||||
/*// if unique key is set in DB
|
||||
if(isset($response['error'])){
|
||||
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
||||
str_contains($response['error'], "Duplicate entry ")){
|
||||
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
|
||||
@ -98,14 +98,15 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]).'.';
|
||||
$message .= anchor( "tarifamanipulado/{$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);
|
||||
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:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -160,25 +161,22 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
$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('Tarifamanipulado.tarifamanipulado'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$tarifaManipuladoEntity->fill($sanitizedData);
|
||||
|
||||
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);
|
||||
|
||||
$thenRedirect = true;
|
||||
$thenRedirect = true;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $tarifaManipuladoEntity->id ?? $id;
|
||||
@ -187,7 +185,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -223,7 +221,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$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';
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
@ -15,8 +15,11 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
/*
|
||||
$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_editor',
|
||||
'fetch_single_data',
|
||||
'datatableTintas',
|
||||
'collect',
|
||||
'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_max",
|
||||
"precio_unidad",
|
||||
"user_created_id",
|
||||
"is_deleted",
|
||||
|
||||
];
|
||||
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoLinea";
|
||||
|
||||
@ -97,12 +100,14 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->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)
|
||||
{
|
||||
$builder->where('tarifa_manipulado_id', $tarifa_manipulado_id);
|
||||
}
|
||||
//JJO
|
||||
$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)
|
||||
? $builder
|
||||
|
||||
@ -13,7 +13,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.nombre",
|
||||
0 => "t1.nombre",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
|
||||
@ -17,20 +17,27 @@
|
||||
<?= view("themes/backend/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<?= anchor(route_to("tarifaManipuladoList"), 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") ?>">
|
||||
<input type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
<?= anchor(route_to("tarifaManipuladoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
|
||||
</div><!-- /.card-footer -->
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</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">
|
||||
<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">
|
||||
<p><?= lang("TarifaAcabadoLineas.moduleTitle") ?></p>
|
||||
<p><?= lang("TarifaManipuladoLineas.moduleTitle") ?></p>
|
||||
</button>
|
||||
|
||||
</h2>
|
||||
@ -41,11 +48,11 @@
|
||||
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
|
||||
<th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th>
|
||||
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
|
||||
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
|
||||
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
|
||||
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
|
||||
<th><?= lang('TarifaManipuladoLineas.precioUnidad') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -86,7 +93,7 @@
|
||||
|
||||
editor = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfTarifaAcabadoLineas') ?>",
|
||||
url: "<?= route_to('editorOfTarifaManipuladoLineas') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
@ -197,7 +204,7 @@
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.edit', function (e) {
|
||||
editor.inline(
|
||||
|
||||
Reference in New Issue
Block a user