Integracion de la lista tarifaacabado sacada del Mac.Comit antes del merge para que nacho lo coja y meta el vuexy

This commit is contained in:
Jaime Jiménez
2023-05-05 13:38:24 +02:00
parent e9e6421b50
commit 80016b57f5
26 changed files with 2442 additions and 35 deletions

View File

@ -32,6 +32,26 @@ $routes->setAutoRoute(true);
// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->group('', [], function($routes) {
$routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
$routes->get('', 'Tarifaacabado::index', ['as' => 'tarifaacabadoList']);
$routes->get('index', 'Tarifaacabado::index', ['as' => 'tarifaacabadoIndex']);
$routes->get('list', 'Tarifaacabado::index', ['as' => 'tarifaacabadoList2']);
$routes->get('add', 'Tarifaacabado::add', ['as' => 'newTarifaacabado']);
$routes->post('add', 'Tarifaacabado::add', ['as' => 'createTarifaacabado']);
$routes->get('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'editTarifaacabado']);
$routes->post('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'updateTarifaacabado']);
$routes->get('delete/(:num)', 'Tarifaacabado::delete/$1', ['as' => 'deleteTarifaacabado']);
$routes->post('allmenuitems', 'Tarifaacabado::allItemsSelect', ['as' => 'select2ItemsOfTarifasacabado']);
$routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasacabado']);
});
});
//WEB ROUTER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('/', 'Home::index');
@ -68,3 +88,5 @@ $routes->delete('api/user/(:segment)','Api::user/delete/$1');
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}

View File

@ -0,0 +1,490 @@
<?php
namespace App\Controllers;
/**
* Class GoBaseController
*
* GoBaseController is an extension of BaseController class that
* provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends GoBaseController
*
* For security be sure to declare any new methods as protected or private.
*
* @package CodeIgniter
*/
use CodeIgniter\Controller;
use CodeIgniter\Database\Query;
use App\Models\NotificationModel;
abstract class GoBaseController extends Controller {
/**
*
* @var string
*/
public $pageTitle;
/**
* Additional string to display after page title
*
* @var string
*/
public $pageSubTitle;
/**
*
* @var boolean
*/
protected $usePageSubTitle = true;
/**
* Whether this is a front-end controller
*
* @var boolean
*/
protected $isFrontEnd = false;
/**
* Whether this is a back-end controller
*
* @var boolean
*/
protected $isBackEnd = false;
/**
* Name of the primary Model class
*
* @var string
*/
protected static $primaryModelName;
protected static $modelPath = '';
/**
* Singular noun of primary object
*
* @var string
*/
protected static $singularObjectName;
/**
* Plural form of primary object name
*
* @var string
*/
protected static $pluralObjectName;
/**
* Singular object name in camel case
*/
protected static $singularObjectNameCc = 'record';
/**
* Current error message to obtain from session flash data
*
* @var string
*/
protected $errorMessage;
/**
* Current success message to obtain from session flash data
*
* @var string
*/
protected $successMessage;
/**
* Refactored class-wide data array variable
*
* @var array
*/
public $viewData;
public $currentAction;
/**
* Path of the views directory for this controller
*
* @var string
*/
protected static $viewPath;
protected $currentView;
protected static $controllerPath = '';
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = ['session', 'go_common', 'text', 'general','jwt']; //JJO
public static $queries = [];
/**
* Constructor.
*/
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
// Do Not Edit This Line
parent::initController($request, $response, $logger);
//--------------------------------------------------------------------
// Preload any models, libraries, etc, here.
//--------------------------------------------------------------------
// E.g.:
$this->session = \Config\Services::session();
if ((!isset($this->viewData['pageTitle']) || empty($this->viewData['pageTitle']) ) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
$this->viewData['pageTitle'] = ucfirst(static::$pluralObjectName);
}
/*if ($this->usePageSubTitle) {
$this->pageSubTitle = config('Basics')->appName;
$this->viewData['pageSubTitle'] = ' '.$this->pageSubTitle;
}*/
$this->viewData['errorMessage'] = $this->session->getFlashdata('errorMessage');
$this->viewData['successMessage'] = $this->session->getFlashdata('successMessage');
if (empty(static::$controllerSlug)) {
$reflect = new \ReflectionClass($this);
$className = $reflect->getShortName();
$this->viewData['currentModule'] = slugify(convertToSnakeCase(str_replace('Controller','',$className)));
} else {
$this->viewData['currentModule'] = strtolower(static::$controllerSlug);
}
$this->viewData['viewPath'] = static::$viewPath;
if (!empty(static::$primaryModelName)) {
$primaryModel = model(static::$primaryModelName, true);
$this->primaryModel = $primaryModel;
$this->model = &$this->primaryModel;
}
// Preload any models, libraries, etc, here.
// Language Validate
$language = \Config\Services::language();
$language->setLocale($this->session->lang);
// Set TimeZone
if(empty($this->session->get('settings'))){
$settingsModel = new SettingsModel();
$settings = $settingsModel->select('default_timezone')->first()??[];
date_default_timezone_set($this->$settings['default_timezone']??'America/Sao_Paulo');
}else{
date_default_timezone_set($this->session->get('settings')['default_timezone']??'America/Sao_Paulo');
}
// Get notification
if(!empty($this->session->get('token'))) {
$notificationModel = new NotificationModel();
$pulse = $notificationModel->where('user_recipient',$this->session->get('token'))->where('is_read',false)->countAllResults() ?? 0;
$notification = $notificationModel->select('token,title,is_read,created_at')->where('user_recipient',$this->session->get('token'))->orderBy('created_at','desc')->findAll(5) ?? [];
$this->session->set('notification', $notification);
$this->session->set('pulse', $pulse);
}else{
$this->session->set('notification', []);
$this->session->set('pulse', 0);
}
$this->viewData['currentLocale'] = $this->request->getLocale();
}
public function index() {
helper('text');
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle']) ) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
$this->viewData['boxTitle'] = ucfirst(static::$pluralObjectName);
}
if (isset($this->primaryModel) && isset(static::$singularObjectNameCc) && !empty(static::$singularObjectNameCc) && !isset($this->viewData[(static::$singularObjectNameCc) . 'List'])) {
$this->viewData[(static::$singularObjectNameCc) . 'List'] = $this->primaryModel->asObject()->findAll();
}
// if $this->currentView is assigned a view name, use it, otherwise assume the view something like 'viewSingleObjectList'
$viewFilePath = static::$viewPath . (empty($this->currentView) ? 'view' . ucfirst(static::$singularObjectNameCc) . 'List' : $this->currentView);
echo view($viewFilePath, $this->viewData);
}
/**
* Convenience method to display the form of a module
* @param $forMethod
* @param null $objId
* @return string
*/
protected function displayForm($forMethod, $objId = null) {
helper('form');
$this->viewData['usingSelect2'] = true;
$validation = \Config\Services::validation();
$action = str_replace(static::class . '::', '', $forMethod);
$actionSuffix = ' ';
$formActionSuffix = '';
if ($action === 'add') {
$actionSuffix = empty(static::$singularObjectName) || stripos(static::$singularObjectName, 'new') === false ? ' a New ' : ' ';
} elseif ($action === 'edit' && $objId != null) {
$formActionSuffix = $objId . '/';
}
if (!isset($this->viewData['action'])) {
$this->viewData['action'] = $action;
}
if (!isset($this->viewData['formAction'])) {
$this->viewData['formAction'] = base_url(strtolower($this->viewData['currentModule']) . '/' . $action . '/' . $formActionSuffix);
}
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle']) ) && isset(static::$singularObjectName) && !empty(static::$singularObjectName)) {
$this->viewData['boxTitle'] = ucfirst($action) . $actionSuffix . ucfirst(static::$singularObjectName);
}
$this->viewData['validation'] = $validation;
$viewFilePath = static::$viewPath . 'view' . ucfirst(static::$singularObjectNameCc) . 'Form';
return view($viewFilePath, $this->viewData);
}
protected function redirect2listView($flashDataKey = null, $flashDataValue = null) {
if (!empty($this->indexRoute)) {
$uri = base_url(route_to($this->indexRoute));
} else {
$reflect = new \ReflectionClass($this);
$className = $reflect->getShortName();
$routes = \Config\Services::routes();
$routesOptions = $routes->getRoutesOptions();
if (!empty(static::$controllerSlug)) {
if (isset($routesOptions[static::$controllerSlug])) {
$namedRoute = $routesOptions[static::$controllerSlug]['as'];
$uri = route_to($namedRoute);
} else {
$getHandlingRoutes = $routes->getRoutes('get');
$indexMethod = array_search('\\App\\Controllers\\'.$className.'::index', $getHandlingRoutes);
if ($indexMethod) {
$uri = route_to('App\\Controllers\\'.$className.'::index');
} else {
$uri = base_url(static::$controllerSlug);
}
}
} else {
$uri = base_url($className);
}
}
if ($flashDataKey != null && $flashDataValue != null) {
return redirect()->to($uri)->with($flashDataKey, $flashDataValue);
} else {
return redirect()->to($uri);
}
}
public function delete($requestedId, bool $deletePermanently = true) {
if (is_string($requestedId)) :
if (is_numeric($requestedId)) :
$id = filter_var($requestedId, FILTER_SANITIZE_NUMBER_INT);
else:
$onlyAlphaNumeric = true;
$fromGetRequest = true;
$idSanitization = goSanitize($requestedId, $onlyAlphaNumeric, $fromGetRequest); // filter_var(trim($requestedId), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$id = $idSanitization[0];
endif;
else:
$id = intval($requestedId);
endif;
if (empty($id) || $id === 0) :
$error = 'Invalid identifier provided to delete the object.';
endif;
$rawResult = null;
if (!isset($error)) :
try {
if ($deletePermanently) :
if (is_numeric($id)) :
$rawResult = $this->primaryModel->delete($id);
else:
$rawResult = $this->primaryModel->where($this->primaryModel->getPrimaryKeyName(), $id)->delete();
endif;
else:
$rawResult = $this->primaryModel->update($id, ['deleted' => true]);
endif;
} catch (\Exception $e) {
log_message('error', "Exception: Error deleting object named '".(static::$singularObjectName ?? 'unknown')."' with $id :\r\n".$e->getMessage());
}
endif;
$ar = $this->primaryModel->db->affectedRows();
try {
$dbError = $this->primaryModel->db->error();
} catch (\Exception $e2) {
if ($e2->getMessage() != "Trying to get property 'errno' of non-object") {
log_message('error', $e2->getCode() . ' : ' . $e2->getMessage()) ;
}
}
if (isset($dbError['code']) && isset($dbError['message'])) {
log_message('error', $dbError['code'].' '.$dbError['message']);
} else {
$dbError = ['code' => '', 'message'=>''];
}
$result = ['persisted'=>$ar>0, 'ar'=>$ar, 'persistedId'=>null, 'affectedRows'=>$ar, 'errorCode'=>$dbError['code'], 'error'=>$dbError['message']];
$nameOfDeletedObject = static::$singularObjectNameCc;
if ($ar < 1) :
$errorMessage = lang('Basic.global.deleteError', [$nameOfDeletedObject]); // 'No ' . static::$singularObjectName . ' was deleted now, because it probably had already been deleted.';
$fdKey = isset($this->viewData['usingSweetAlert'] ) && $this->viewData['usingSweetAlert'] ? 'sweet-error' : 'errorMessage';
$errorMessage = str_replace("'", "\'", $errorMessage);
return $this->redirect2listView($fdKey, str_replace("'", '', $errorMessage));
else:
$message = lang('Basic.global.deleteSuccess', [$nameOfDeletedObject]); // 'The ' . static::$singularObjectName . ' was successfully deleted.';
$fdKey = isset($this->viewData['usingSweetAlert'] ) && $this->viewData['usingSweetAlert'] ? 'sweet-success' : 'successMessage';
if ($result['affectedRows']>1) :
log_message('warning', "More than one row has been deleted in attempt to delete row for object named '".(static::$singularObjectName ?? 'unknown')."' with id: $id");
endif;
$message = str_replace("'", "\'", $message);
return $this->redirect2listView($fdKey, $message);
endif;
}
/**
* Convenience method to validate form submission
* @return bool
*/
protected function canValidate()
{
$validationRules = $this->model->validationRules ?? $this->formValidationRules ?? null;
if ($validationRules == null) {
return true;
}
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
if ($validationErrorMessages != null) {
$valid = $this->validate($validationRules, $validationErrorMessages);
} else {
$valid = $this->validate($validationRules);
}
$this->validationErrors = $valid ? '' : $this->validator->getErrors();
/*
// As of version 1.1.5 of CodeIgniter Wizard, the following is replaced by custom validation errors template supported by CodeIgniter 4
// If you are not using Bootstrap templates, however, you might want to uncomment this block...
$validation = \Config\Services::validation();
$this->validation = $validation;
if (!$valid) {
$this->viewData['errorMessage'] .= $validation->listErrors();
}
*/
return $valid;
}
/**
* Method for post(ed) input sanitization. Override this when you have custom transformation needs, etc.
* @param array|null $postData
* @return array
*/
protected function sanitized(array $postData = null, bool $nullIfEmpty = false) {
if ($postData == null) {
$postData = $this->request->getPost();
}
$sanitizedData = [];
foreach ($postData as $k => $v) {
if ($k == csrf_token()) {
continue;
}
$sanitizationResult = goSanitize($v, $nullIfEmpty);
$sanitizedData[$k] = $sanitizationResult[0];
}
return $sanitizedData;
}
/**
* Convenience method for common exception handling
* @param \Exception $e
*/
protected function dealWithException(\Exception $e) {
// using another try / catch block to prevent to avoid CodeIgniter bug throwing trivial exceptions for querying DB errors
try {
$query = $this->model->db->getLastQuery();
$queryStr = !is_null($query) ? $query->getQuery() : '';
$dbError = $this->model->db->error();
$userFriendlyErrMsg = lang('Basic.global.persistErr1', [static::$singularObjectNameCc]);
if (isset($dbError['code']) && $dbError['code'] == 1062) :
$userFriendlyErrMsg .= PHP_EOL.lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
endif;
// $userFriendlyErrMsg = str_replace("'", "\'", $userFriendlyErrMsg); // Uncomment if experiencing unescaped single quote errors
log_message('error', $userFriendlyErrMsg.PHP_EOL.$e->getMessage().PHP_EOL.$queryStr);
if (isset($dbError['message']) && !empty($dbError['message'])) :
log_message('error', $dbError['code'].' : '.$dbError['message']);
endif;
$this->viewData['errorMessage'] = $userFriendlyErrMsg;
} catch (\Exception $e2) {
log_message('debug', 'You can probably safely ignore this: In attempt to check DB errors, CodeIgniter threw: '.PHP_EOL.$e2->getMessage());
}
}
// Collect the queries so something can be done with them later.
public static function collect(Query $query) {
static::$queries[] = $query;
}
/**
* Class casting
*
* @param string|object $destination
* @param object $sourceObject
* @return object
*/
function cast($destination, $sourceObject) {
if (is_string($destination)) {
$destination = new $destination();
}
$sourceReflection = new ReflectionObject($sourceObject);
$destinationReflection = new ReflectionObject($destination);
$sourceProperties = $sourceReflection->getProperties();
foreach ($sourceProperties as $sourceProperty) {
$sourceProperty->setAccessible(true);
$name = $sourceProperty->getName();
$value = $sourceProperty->getValue($sourceObject);
if ($destinationReflection->hasProperty($name)) {
$propDest = $destinationReflection->getProperty($name);
$propDest->setAccessible(true);
$propDest->setValue($destination, $value);
} else {
$destination->$name = $value;
}
}
return $destination;
}
}

View File

@ -1,35 +1,231 @@
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseController;
<?php namespace App\Controllers\Tarifas;
class Tarifaacabado extends BaseController
{
function __construct()
{
use App\Entities\Tarifas\TarifaacabadoEntity;
use App\Controllers\GoBaseController;
class Tarifaacabado extends GoBaseController {
use \CodeIgniter\API\ResponseTrait;
protected static $primaryModelName = 'App\Models\Tarifas\TarifaacabadoModel';
protected static $singularObjectNameCc = 'tarifaacabado';
protected static $singularObjectName = 'Tarifaacabado';
protected static $pluralObjectName = 'Tarifasacabado';
protected static $controllerSlug = 'tarifaacabado';
static $viewPath = '';
protected $indexRoute = 'tarifaacabadoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('Tarifaacabado.moduleTitle');
self::$viewPath = getenv('theme.path').'form/tarifas/acabado/';
parent::initController($request, $response, $logger);
}
public function index() {
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaacabado.tarifaacabado')]);
parent::index();
}
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('Tarifaacabado.tarifaacabado'))]);
$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('Tarifaacabado.tarifaacabado'))]).'.';
$message .= anchor(route_to('editTarifaacabado', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
else:
return $this->redirect2listView('successMessage', $message);
endif;
else:
$this->viewData['successMessage'] = $message;
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaacabado_'] = isset($sanitizedData) ? new Tarifaacabado_($sanitizedData) : new Tarifaacabado_();
$this->viewData['formAction'] = route_to('createTarifaacabado');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Tarifaacabado.tarifaacabado').' '.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);
$tarifaacabado_ = $this->model->find($id);
if ($tarifaacabado_ == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaacabado.tarifaacabado')), $id]);
return $this->redirect2listView('errorMessage', $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('Tarifaacabado.tarifaacabado'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$tarifaacabado_->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $tarifaacabado_->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]).'.';
$message .= anchor(route_to('editTarifaacabado', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
else:
return $this->redirect2listView('successMessage', $message);
endif;
else:
$this->viewData['successMessage'] = $message;
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaacabado_'] = $tarifaacabado_;
$this->viewData['formAction'] = route_to('updateTarifaacabado', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Tarifaacabado.tarifaacabado').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', Select a field...', 'Select a field...', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
//$nonItem->Select a field... = '- '.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 ?? 'Select a field...'];
$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);
public function index()
{
echo 'Tarifa acabado';
}
public function delete()
{
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function add()
{
}
public function edit()
{
}
}

View File

@ -32,7 +32,7 @@ class Group extends BaseController
$data['btn_add'] = [
'title' => lang("App.group_btn_add"),
'route' => '/group/add',
'route' => '/usuarios/group/add',
'class' => 'btn btn-lg btn-primary float-md-right',
'icon' => 'fas fa-plus'
];
@ -54,7 +54,7 @@ class Group extends BaseController
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.group_title"), 'route' => "/group", 'active' => false],
['title' => lang("App.group_title"), 'route' => "/usuarios/group", 'active' => false],
['title' => lang("App.group_add_title"), 'route' => "", 'active' => true]
];

View File

@ -0,0 +1,32 @@
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
class TarifaacabadoEntity extends Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"tirada_min" => 0,
"precio_min" => 0,
"tirada_max" => 0,
"precio_max" => null,
"ajuste" => 0,
"formula_price" => null,
"user_created_id" => 1,
"user_update_id" => 1,
"deleted_at" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tirada_min" => "int",
"precio_min" => "float",
"tirada_max" => "int",
"precio_max" => "float",
"ajuste" => "float",
"user_created_id" => "int",
"user_update_id" => "int",
];
}

View File

@ -140,6 +140,7 @@ class LoginAuthFilter implements FilterInterface
'Migrate',
'Test',
];
}

View File

@ -0,0 +1,89 @@
<?php
return [
'global' => [
'About' => 'About',
'AboutSuffix' => '',
'Action' => 'Action',
'Cancel' => 'Cancel',
'ChangePassword' => 'Change Password',
'Close' => 'Close',
'Dashboard' => 'Dashboard',
'Delete' => 'Delete',
'Error' => 'Error',
'Groups' => 'Groups',
'Home' => 'Home',
'Logout' => 'Logout',
'ManageAllRecords' => 'Manage All {0} Records',
'MemberSince' => 'Member since',
'Members' => 'Members',
'MoreInfo' => 'More Info',
'None' => 'None',
'Permissions' => 'Permissions',
'Profile' => 'Profile',
'Roles' => 'Roles',
'Save' => 'Save',
'Sections' => 'Sections',
'SignOut' => 'Sign Out',
'Success' => 'Success',
'UserProfile' => 'User Profile',
'Warning' => 'Warning',
'add' => 'New',
'addNew' => 'Add a New',
'addNewSuffix' => '',
'allRightsReserved' => 'All rights reserved.',
'continueEditing' => 'Continue editing',
'createdWith' => 'created with',
'createdWithSuffix' => '.',
'deleteConfirmation' => 'Confirmation to Delete Record',
'deleteConfirmationButton' => 'Yes, Delete it!',
'deleteConfirmationCancel' => 'Cancel',
'deleteConfirmationQuestion' => 'Are you sure you want to delete this record?',
'deleteError' => 'No {0} was deleted now, because it probably had already been deleted.',
'deleteExistingFile' => 'Delete existing file',
'deleteSuccess' => 'The {0} was successfully deleted.',
'edit' => 'Edit',
'edit2' => 'Edit',
'edit3' => '',
'for' => 'for',
'forPrefix' => 'for',
'forSuffix' => '',
'formErr1' => 'The {0} was not saved due to an erroneous value entered on the form. ',
'formErr2' => 'Please correct the errors below:',
'formErrTitle' => 'There are some errors on the form that need to be corrected: ',
'jsNeedMsg' => 'Either you have turned JavaScript off, or your browser does not support JavaScript which this page needs to function properly.',
'need2login' => 'To access the members-only area, please sign in.',
'notFoundWithIdErr' => 'No such {0} ( with identifier {1} ) was found in the database.',
'persistDuplErr' => 'There already is an existing {0} on our database with the same data.',
'persistErr1' => 'An error occurred in an attempt to save a new {0} to the database : ',
'persistErr2' => 'The {0} was not saved because of an error.',
'persistErr3' => 'An error occurred in an attempt to update the {0} with {1} {2} in the database : ',
'pleaseSelect' => 'Please select...',
'pleaseSelectA' => 'Please select a {0}... ',
'pleaseSelectOne' => 'Please select one...',
'record' => 'the record',
'saveSuccess' => 'The {0} was successfully saved ',
'saveSuccess1' => 'The {0} ',
'saveSuccess2' => ' was successfully saved ',
'saveSuccess3Suffix' => '',
'saveSucessWithId' => ' with {0} {1}',
'saveSucessWithName' => ' with name {0}',
'updateFailure' => 'The {0} could not be updated ',
'updateSuccess' => 'The {0} was successfully updated ',
'updated' => 'Updated',
'sweet' => [
'deleteConfirmationButton' => 'Yes, Delete it!',
'sureToDeleteText' => 'This action cannot be undone.',
'sureToDeleteTitle' => 'Are you sure you want to delete this {0}?',
'text' => 'This action cannot be undone.',
'title' => 'Are you sure?',
],
],
];

View File

@ -0,0 +1,63 @@
<?php
return [
'code' => 'Code',
'code3' => 'Code3',
'id' => 'ID',
'keyErp' => 'Key Erp',
'moduleTitle' => 'Paises',
'moneda' => 'Moneda',
'nombre' => 'Nombre',
'pais' => 'Pais',
'paisList' => 'Pais List',
'paises' => 'Paises',
'showErp' => 'Show Erp',
'urlErp' => 'URL Erp',
'userErp' => 'User Erp',
'validation' => [
'code3' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'key_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'url_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'user_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'moneda' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
'code' => [
'is_unique' => 'The {field} field must contain a unique value',
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
],
];

View File

@ -0,0 +1,82 @@
<?php
return [
'ajuste' => 'A',
'createdAt' => 'Created At',
'deletedAt' => 'Deleted At',
'formulaPrice' => 'Formula Price',
'id' => 'ID',
'moduleTitle' => 'Finishing Rates',
'nombre' => 'Name',
'precioMax' => 'Price Max',
'precioMin' => 'Price Min',
'tarifaacabado' => 'Finishing Rates',
'tarifaacabadoList' => 'Finishing Rates List',
'tarifasacabado' => 'Finishing Rates',
'tiradaMax' => 'Print Max',
'tiradaMin' => 'Print Min',
'updatedAt' => 'Updated At',
'userCreatedId' => 'User ID Created At',
'userUpdateId' => 'User ID Update At',
'validation' => [
'ajuste' => [
'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.',
],
'formula_price' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
'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.',
],
'tirada_max' => [
'integer' => 'The {field} field must contain an integer.',
'required' => 'The {field} field is required.',
],
'tirada_min' => [
'integer' => 'The {field} field must contain an integer.',
'required' => 'The {field} field is required.',
],
'user_created_id' => [
'integer' => 'The {field} field must contain an integer.',
'required' => 'The {field} field is required.',
],
'user_update_id' => [
'integer' => 'The {field} field must contain an integer.',
'required' => 'The {field} field is required.',
],
],
];

View File

@ -0,0 +1,89 @@
<?php
return [
'global' => [
'About' => 'Acerca',
'AboutSuffix' => '',
'Action' => 'Acción',
'Cancel' => 'Cancelar',
'ChangePassword' => 'Cambiar contraseña',
'Close' => 'Cerrar',
'Dashboard' => 'Panel de control',
'Delete' => 'Borrar',
'Error' => 'Error',
'Groups' => 'Grupos',
'Home' => 'Inicio',
'Logout' => 'Salir',
'ManageAllRecords' => 'Administrar todos {0} los registros',
'MemberSince' => 'Miembro desde',
'Members' => 'Miembro',
'MoreInfo' => 'Mas Info',
'None' => 'Ninguno',
'Permissions' => 'Permisos',
'Profile' => 'Perfil',
'Roles' => 'Roles',
'Save' => 'Guardar',
'Sections' => 'Secciones',
'SignOut' => 'Desconectar',
'Success' => 'Éxito',
'UserProfile' => 'Perfil de usuario',
'Warning' => 'Advertencia',
'add' => 'Nuevo',
'addNew' => 'Añadir nuevo',
'addNewSuffix' => '',
'allRightsReserved' => 'Todos los derechos reservados.',
'continueEditing' => 'Continuar editando',
'createdWith' => 'creado con',
'createdWithSuffix' => '.',
'deleteConfirmation' => 'Confirmacion para Eliminar Registro',
'deleteConfirmationButton' => 'Si, bórralo!',
'deleteConfirmationCancel' => 'Cancelar',
'deleteConfirmationQuestion' => '¿Está seguro de borrar este registro?',
'deleteError' => 'No se eliminó {0} ahora, porque probablemente ya se había eliminado.',
'deleteExistingFile' => 'Borrar fichero existente',
'deleteSuccess' => 'El {0} se eliminó correctamente',
'edit' => 'Editar',
'edit2' => 'Editar',
'edit3' => '',
'for' => 'para',
'forPrefix' => 'para',
'forSuffix' => '',
'formErr1' => 'El {0} no se guardó debido a un valor erróneo ingresado en el formulario.',
'formErr2' => 'Por favor corrija los siguientes errores:',
'formErrTitle' => 'Hay algunos errores en el formulario que deben corregirse:',
'jsNeedMsg' => 'Ha desactivado JavaScript o su navegador no es compatible con JavaScript, que esta página necesita para funcionar correctamente.',
'need2login' => 'Para acceder al área exclusiva para miembros, inicie sesión.',
'notFoundWithIdErr' => 'No se encontró ningún {0} (con identificador {1}) en la base de datos.',
'persistDuplErr' => 'Ya existe un {0} en nuestra base de datos con los mismos datos.',
'persistErr1' => 'Se produjo un error al intentar guardar un nuevo {0} en la base de datos:',
'persistErr2' => 'El {0} no se guardó debido a un error.',
'persistErr3' => 'Se produjo un error al intentar actualizar {0} con {1} {2} en la base de datos:',
'pleaseSelect' => 'Por favor seleccione...',
'pleaseSelectA' => 'Por favor seleccione un {0}... ',
'pleaseSelectOne' => 'Por favor selecione un...',
'record' => 'el registro',
'saveSuccess' => 'El {0} se ha guardado satisfactoriamente',
'saveSuccess1' => 'El {0} ',
'saveSuccess2' => ' se ha guardado satisfactoriamente',
'saveSuccess3Suffix' => '',
'saveSucessWithId' => ' con {0} {1}',
'saveSucessWithName' => ' con nombre {0}',
'updateFailure' => 'El {0} no se pudo actualizar',
'updateSuccess' => 'El {0} se ha actualizado correctamente',
'updated' => 'Actualizado',
'sweet' => [
'deleteConfirmationButton' => 'Si, bórralo!',
'sureToDeleteText' => 'Esta acción no se puede deshacer.',
'sureToDeleteTitle' => 'Está seguro de borrar {0}?',
'text' => 'Esta acción no se puede deshacer.',
'title' => 'Está seguro?',
],
],
];

View File

@ -0,0 +1,87 @@
<?php
return [
'code' => 'Code',
'code3' => 'Code3',
'id' => 'ID',
'keyErp' => 'Key Erp',
'moduleTitle' => 'Paises',
'moneda' => 'Moneda',
'nombre' => 'Nombre',
'pais' => 'Pais',
'paisList' => 'Pais List',
'paises' => 'Paises',
'showErp' => 'Show Erp',
'urlErp' => 'URL Erp',
'userErp' => 'User Erp',
'validation' => [
'code' => [
'is_unique' => 'The {field} field must contain a unique value',
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
],
'validation' => [
'code3' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
],
'validation' => [
'key_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
],
'validation' => [
'moneda' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
],
'validation' => [
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
],
'validation' => [
'url_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
],
'validation' => [
'user_erp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
],
];

View File

@ -0,0 +1,114 @@
<?php
return [
'ajuste' => 'Ajuste',
'createdAt' => 'Creado en',
'deletedAt' => 'Borrado en',
'formulaPrice' => 'Fórmula precio',
'id' => 'ID',
'moduleTitle' => 'Tarifas Acabado',
'nombre' => 'Nombre',
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'tarifaacabado' => 'Tarifas Acabado',
'tarifaacabadoList' => 'Lista Tarifas Acabado',
'tarifasacabado' => 'Tarifas Acabado',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'updatedAt' => 'Actualizado en',
'userCreatedId' => 'ID Usuario "Creado en"',
'userUpdateId' => 'ID Usuario "Actualizado en"',
'validation' => [
'formula_price' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'nombre' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'precio_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'precio_min' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'tirada_max' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'tirada_min' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'user_created_id' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'user_update_id' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
],
'validation' => [
'ajuste' => [
'decimal' => 'El campo {field} debe contener un número decimal',
'required' => 'El campo {field} es obligatorio.',
],
],
];

View File

@ -0,0 +1,249 @@
<?php
/*
The MIT License (MIT)
Copyright (c) 2020 Gökhan Ozar (https://gokhan.ozar.net/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace App\Models;
use CodeIgniter\Model;
/**
* Description of GoBaseModel
*
* @author Gökhan Ozar
*/
abstract class GoBaseModel extends Model {
/**
* The name of the field (attribute) in this model which will be used to refer to as a human-friendly object name
*/
public static $labelField;
/**
* Returns the model's DB table name
*
* @return string
*/
public function getDbTableName() {
return $this->table;
}
/**
* Returns the model's DB table name (Alias of getDbTableName() )
*
* @return string
*/
public function getTableName() {
return $this->table;
}
/**
* Returns the model's name of primary key in the database
*
* @return string
*/
public function getPrimaryKeyName() {
return $this->primaryKey;
}
/**
* Returns the number of rows in the database table
*
* @return int
*/
public function getCount() {
$name = $this->table;
$count = $this->db->table($name)->countAll();
return $count;
}
/**
* @param string $columns2select
* @param string $resultSorting
* @param bool $onlyActiveOnes
* @param bool $alsoDeletedOnes
* @param array $additionalConditions
* @return array
*/
public function getAllForMenu($columns2select='*', $resultSorting='id', bool $onlyActiveOnes=false, bool $alsoDeletedOnes=true, $additionalConditions = []) {
$theseConditionsAreMet = [];
if ($onlyActiveOnes) {
if ( in_array('enabled', $this->allowedFields) ) {
$theseConditionsAreMet['enabled'] = true;
} elseif (in_array('active', $this->allowedFields)) {
$theseConditionsAreMet['active'] = true;
}
}
// This check is deprecated and left here only for backward compatibility and this method should be overridden in extending classes so as to check if the bound entity class has these attributes
if (!$alsoDeletedOnes) {
if (in_array('deleted_at', $this->allowedFields)) {
$theseConditionsAreMet['deleted_at'] = null;
}
if (in_array('deleted', $this->allowedFields) ) {
$theseConditionsAreMet['deleted'] = false;
}
if (in_array('date_time_deleted', $this->allowedFields)) {
$theseConditionsAreMet['date_time_deleted'] = null;
}
}
if (!empty($additionalConditions)) {
$theseConditionsAreMet = array_merge($theseConditionsAreMet, $additionalConditions);
}
$queryBuilder = $this->db->table($this->table);
$queryBuilder->select($columns2select);
if (!empty($theseConditionsAreMet)) {
$queryBuilder->where($theseConditionsAreMet);
}
$queryBuilder->orderBy($resultSorting);
$result = $queryBuilder->get()->getResult();
return $result;
}
/**
*
* @param mixed $columns2select either array or string
* @param mixed $sortResultsBy either string or array
* @param bool $onlyActiveOnes
* @param string $select1str e.g. 'Please select one...'
* @param bool $alsoDeletedOnes
* @param array $additionalConditions
* @return array for use in dropdown menus
*/
public function getAllForCiMenu( $columns2select = ['id', 'designation'], $sortResultsBy = 'id', bool $onlyActiveOnes=false, $selectionRequestLabel = 'Please select one...', bool $alsoDeletedOnes = true, $additionalConditions = []) {
$ciDropDownOptions = [];
if (is_array($columns2select) && count($columns2select) >= 2) {
$key = $columns2select[0];
$val = $columns2select[1];
$cols2selectStr = implode(',', $columns2select);
$valInd = strpos($val, ' AS ');
if ($valInd !== false) {
$val = substr($val, $valInd+4);
}
} elseif (is_string($columns2select) && strpos($columns2select,',')!==false) {
$cols2selectStr = $columns2select;
$arr = explode(",", $columns2select, 2);
$key = trim($arr[0]);
$val = trim($arr[1]);
} else {
return ['error'=>'Invalid argument for columns/fields to select'];
}
$resultList = $this->getAllForMenu($cols2selectStr, $sortResultsBy, $onlyActiveOnes, $alsoDeletedOnes, $additionalConditions);
if ($resultList != false) {
if (!empty($selectionRequestLabel)) {
$ciDropDownOptions[''] = $selectionRequestLabel;
}
foreach ($resultList as $res) {
if (isset($res->$key) && isset($res->$val)) {
$ciDropDownOptions[$res->$key] = $res->$val;
}
}
}
return $ciDropDownOptions;
}
/**
* @param array|string[] $columns2select
* @param null $resultSorting
* @param bool|bool $onlyActiveOnes
* @param null $searchStr
* @return array
*/
public function getSelect2MenuItems(array $columns2select = ['id', 'designation'], $resultSorting=null, bool $onlyActiveOnes=true, $searchStr = null) {
$theseConditionsAreMet = [];
$id = $columns2select[0].' AS id';
$text = $columns2select[1].' AS text';
if (empty($resultSorting)) {
$resultSorting = $this->getPrimaryKeyName();
}
if ($onlyActiveOnes) {
if ( in_array('enabled', $this->allowedFields) ) {
$theseConditionsAreMet['enabled'] = true;
} elseif (in_array('active', $this->allowedFields)) {
$theseConditionsAreMet['active'] = true;
}
}
$queryBuilder = $this->db->table($this->table);
$queryBuilder->select([$id, $text]);
$queryBuilder->where($theseConditionsAreMet);
if (!empty($searchStr)) {
$queryBuilder->groupStart()
->like($columns2select[0], $searchStr)
->orLike($columns2select[1], $searchStr)
->groupEnd();
}
$queryBuilder->orderBy($resultSorting);
$result = $queryBuilder->get()->getResult();
return $result;
}
/**
* Custom method allowing you to add a form validation rule to the model on-the-fly
* @param string $fieldName
* @param string $rule
* @param string|null $msg
*/
public function addValidationRule(string $fieldName, string $rule, string $msg = null ) {
if (empty(trim($fieldName)) ||empty(trim($fieldName))) {
return;
}
if (!isset($this->validationRules[$fieldName]) || empty($this->validationRules[$fieldName])) {
$this->validationRules[$fieldName] = substr($rule, 0, 1) == '|' ? substr($rule, 1) : trim($rule);
} else if (isset($this->validationRules[$fieldName]['rules'])) {
$this->validationRules[$fieldName]['rules'] .= substr($rule, 0, 1) == '|' ? trim($rule) : '|' . trim($rule);
} else {
$this->validationRules[$fieldName] .= $rule;
}
if (isset($msg) && !empty(trim($msg))) {
$ruleKey = strtok($rule, '[');
if ($ruleKey === false) {
return;
}
$item = [$ruleKey => "'".$msg."'"];
if (!isset($this->validationMessages[$fieldName]) || empty(trim($this->validationMessages[$fieldName]))) {
$this->validationMessages[$fieldName] = $item;
} else {
$this->validationMessages[$fieldName][$ruleKey] = "'".$msg."'";
}
}
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace App\Models\Tarifas;
class TarifaacabadoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_tarifa_acabado";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
protected $allowedFields = [
"nombre",
"tirada_min",
"precio_min",
"tirada_max",
"precio_max",
"ajuste",
"formula_price",
"user_created_id",
"user_update_id",
];
protected $returnType = "App\Entities\Admin\Tarifaacabado";
public static $labelField = "Select a field...";
protected $validationRules = [
"ajuste" => [
"label" => "Acabadoes.ajuste",
"rules" => "required|decimal",
],
"formula_price" => [
"label" => "Acabadoes.formulaPrice",
"rules" => "trim|required|max_length[1073241]",
],
"nombre" => [
"label" => "Acabadoes.nombre",
"rules" => "trim|required|max_length[255]",
],
"precio_max" => [
"label" => "Acabadoes.precioMax",
"rules" => "required|decimal",
],
"precio_min" => [
"label" => "Acabadoes.precioMin",
"rules" => "required|decimal",
],
"tirada_max" => [
"label" => "Acabadoes.tiradaMax",
"rules" => "required|integer",
],
"tirada_min" => [
"label" => "Acabadoes.tiradaMin",
"rules" => "required|integer",
],
"user_created_id" => [
"label" => "Acabadoes.userCreatedId",
"rules" => "required|integer",
],
"user_update_id" => [
"label" => "Acabadoes.userUpdateId",
"rules" => "required|integer",
],
];
protected $validationMessages = [
"ajuste" => [
"decimal" => "Acabadoes.validation.ajuste.decimal",
"required" => "Acabadoes.validation.ajuste.required",
],
"formula_price" => [
"max_length" => "Acabadoes.validation.formula_price.max_length",
"required" => "Acabadoes.validation.formula_price.required",
],
"nombre" => [
"max_length" => "Acabadoes.validation.nombre.max_length",
"required" => "Acabadoes.validation.nombre.required",
],
"precio_max" => [
"decimal" => "Acabadoes.validation.precio_max.decimal",
"required" => "Acabadoes.validation.precio_max.required",
],
"precio_min" => [
"decimal" => "Acabadoes.validation.precio_min.decimal",
"required" => "Acabadoes.validation.precio_min.required",
],
"tirada_max" => [
"integer" => "Acabadoes.validation.tirada_max.integer",
"required" => "Acabadoes.validation.tirada_max.required",
],
"tirada_min" => [
"integer" => "Acabadoes.validation.tirada_min.integer",
"required" => "Acabadoes.validation.tirada_min.required",
],
"user_created_id" => [
"integer" => "Acabadoes.validation.user_created_id.integer",
"required" => "Acabadoes.validation.user_created_id.required",
],
"user_update_id" => [
"integer" => "Acabadoes.validation.user_update_id.integer",
"required" => "Acabadoes.validation.user_update_id.required",
],
];
}

View File

@ -0,0 +1,81 @@
<?php
// Open-Source License Information:
/*
The MIT License (MIT)
Copyright (c) 2020 Ozar (https://www.ozar.net/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
$errorMessage = $errorMessage ?? session('errorMessage');
$warningMessage = session('warningMessage');
if (session()->has('message')) {
$successMessage = session('message');
}
if (session()->has('error')) {
$errorMessage = is_array(session('error')) ? implode(session('error')) : session('error');
} /* // Uncomment this block if you want the errors listed line by line in the alert
elseif (session()->has('errors')) {
$errorMessage = '<ul class="text-start">';
foreach (session('errors') as $error) :
$errorMessage .= '<li>' . $error . '</li>';
endforeach;
$errorMessage .= '</ul>';
}
*/
?>
<?php if (isset($successMessage) && $successMessage): ?>
<div class="alert alert-success" role="alert">
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Success:"><use xlink:href="#check-circle-fill"/></svg>
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
<div>
<h4><?=lang('Basic.global.Success')?>!</h4>
<?= $successMessage; ?>
</div>
</div>
<?php endif; ?>
<?php if (isset($errorMessage) && $errorMessage): ?>
<div class="alert alert-danger" role="alert">
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Error:"><use xlink:href="#exclamation-triangle-fill"/></svg>
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
<div>
<h4><?=lang('Basic.global.Error')?>!</h4>
<?= $errorMessage; ?>
</div>
</div>
<?php endif; ?>
<?php if (isset($warningMessage) && $warningMessage): ?>
<div class="alert alert-warning" role="alert">
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Error:"><use xlink:href="#exclamation-triangle-fill"/></svg>
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
<div>
<h4 class="text-start"><?=lang('Basic.global.Warning')?></h4>
<?= $warningMessage ?>
</div>
</div>
<?php endif; ?>

View File

@ -0,0 +1,17 @@
<div class="modal fade" id="confirm2delete" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="confirm2deleteLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirm2deleteLabel">Confirm to delete record</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Are you sure you want to delete this record?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button>
<a class="btn btn-danger btn-confirm"> Yes, Delete It! </a>
</div><!--//.modal-footer -->
</div><!--//.modal-content -->
</div><!--//.modal-dialog -->
</div><!--//.modal -->

View File

@ -0,0 +1,35 @@
<?php if (config('Basics')->theme['name'] == 'Bootstrap5') { ?>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</symbol>
</svg>
<div class="alert alert-warning" role="alert">
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Success:"><use xlink:href="#exclamation-triangle-fill"/></svg>
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
<div class="fdfs">
<h4>Please correct the errors below:</h4>
<ul>
<?php foreach ($errors as $error) : ?>
<li><?= esc($error) ?></li>
<?php endforeach ?>
</ul>
</div>
</div>
<?php } else { ?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-dismissible alert-warning">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fas fa-exclamation-triangle"></i> Please correct the errors below:</h4>
<ul>
<?php foreach ($errors as $error) : ?>
<li><?= esc($error) ?></li>
<?php endforeach ?>
</ul>
</div><!--//.alert-->
</div><!--//.col-->
</div><!--//.row -->
<?php } ?>

View File

@ -0,0 +1,184 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
<?= $this->endSection() ?>
<?= $this->section('footerAdditions') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->endSection() ?>
<!-- Push additional js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment-with-locales.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap5.min.js"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
moment.locale('<?= $currentLocale ?? config('App')->defaultLocale ?>');
<?php if (isset($usingServerSideDataTable) && $usingServerSideDataTable) : ?>
// Pipelining function for DataTables. To be used to the `ajax` option of DataTables
$.fn.dataTable.pipeline = function (opts) {
// Configuration options
let conf = $.extend({
pages: 5, // number of pages to cache
url: '',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'}
}, opts);
// Private variables for storing the cache
let cacheLower = -1;
let cacheUpper = null;
let cacheLastRequest = null;
let cacheLastJson = null;
return function (request, drawCallback, settings) {
let ajax = false;
let requestStart = request.start;
let drawStart = request.start;
let requestLength = request.length;
let requestEnd = requestStart + requestLength;
if (settings.clearCache) {
// API requested that the cache be cleared
ajax = true;
settings.clearCache = false;
} else if (cacheLower < 0 || requestStart < cacheLower || requestEnd > cacheUpper) {
// outside cached data - need to make a request
ajax = true;
} else if (JSON.stringify(request.order) !== JSON.stringify(cacheLastRequest.order) ||
JSON.stringify(request.columns) !== JSON.stringify(cacheLastRequest.columns) ||
JSON.stringify(request.search) !== JSON.stringify(cacheLastRequest.search)
) {
// properties changed (ordering, columns, searching)
ajax = true;
}
// Store the request for checking next time around
cacheLastRequest = $.extend(true, {}, request);
if (ajax) {
// Need data from the server
if (requestStart < cacheLower) {
requestStart = requestStart - (requestLength * (conf.pages - 1));
if (requestStart < 0) {
requestStart = 0;
}
}
cacheLower = requestStart;
cacheUpper = requestStart + (requestLength * conf.pages);
request.start = requestStart;
request.length = requestLength * conf.pages;
// Provide the same `data` options as DataTables.
if (typeof conf.data === 'function') {
// As a function it is executed with the data object as an arg
// for manipulation. If an object is returned, it is used as the
// data object to submit
let d = conf.data(request);
if (d) {
$.extend(request, d);
}
} else if ($.isPlainObject(conf.data)) {
// As an object, the data given extends the default
$.extend(request, conf.data);
}
request.<?=csrf_token()?> = <?=csrf_token()?>v;
return $.ajax({
"type": conf.method,
"url": conf.url,
"data": request,
"dataType": "json",
"cache": false,
"success": function (json) {
cacheLastJson = $.extend(true, {}, json);
if (cacheLower != drawStart) {
json.data.splice(0, drawStart - cacheLower);
}
if (requestLength >= -1) {
json.data.splice(requestLength, json.data.length);
}
drawCallback(json);
yeniden(json.token);
},
error: function (jqXHR, textStatus, errorThrown) {
$('.dataTables_processing').hide();
const theData = jqXHR.responseJSON;
drawCallback(theData);
Toast.fire({
icon: 'error',
title: errorThrown,
});
}
});
} else {
let json = $.extend(true, {}, cacheLastJson);
json.draw = request.draw; // Update the echo for each response
json.data.splice(0, requestStart - cacheLower);
json.data.splice(requestLength, json.data.length);
drawCallback(json);
}
}
};
// Register an API method that will empty the pipelined data, forcing an Ajax
// fetch on the next draw (i.e. `table.clearPipeline().draw()`)
$.fn.dataTable.Api.register('clearPipeline()', function () {
return this.iterator('table', function (settings) {
settings.clearCache = true;
});
});
<?php endif; ?>
<?php if (isset($usingClientSideDataTable) && $usingClientSideDataTable) { ?>
let lastColNr = $(".using-data-table").find("tr:first th").length - 1;
theTable = $('.using-data-table').DataTable({
"responsive": true,
"paging": true,
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
"pageLength": 10,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
"scrollX": true,
"stateSave": true,
"language": {
url: "//cdn.datatables.net/plug-ins/1.10.25/i18n/languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [0,lastColNr]
}
]
});
<?php } ?>
$('#confirm2delete').on('show.bs.modal', function (e) {
$(this).find('.btn-confirm').attr('href', $(e.relatedTarget).data('href'));
});
function toggleAllCheckboxes($cssClass, $io=null) {
$('.'+$cssClass).prop('checked', $io);
}
<?= $this->endSection() ?>

View File

@ -0,0 +1,19 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.1.1/dist/select2-bootstrap-5-theme.min.css" />
<?= $this->endSection() ?>
<!-- Push additional js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.full.min.js"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
$('.select2bs').select2({
theme: "bootstrap-5",
allowClear: false,
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,48 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@9.7.2/dist/sweetalert2.min.css">
<?= $this->endSection() ?>
<!-- Push section js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.7.2/dist/sweetalert2.all.min.js"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
var Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 6000,
timerProgressBar: true,
onOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
});
<?php if (session('sweet-success')) { ?>
Toast.fire({
icon: 'success',
title: '<?= session('sweet-success.') ?>'
});
<?php } ?>
<?php if (session('sweet-warning')) { ?>
Toast.fire({
icon: 'warning',
title: '<?= session('sweet-warning.') ?>'
});
<?php } ?>
<?php if (session('sweet-error')) { ?>
Toast.fire({
icon: 'error',
title: '<?= session('sweet-error.') ?>'
});
<?php } ?>
<?= $this->endSection() ?>

View File

@ -0,0 +1,70 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaacabado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaacabado_->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiradaMin" class="form-label">
<?=lang('Tarifaacabado.tiradaMin') ?>*
</label>
<input type="number" id="tiradaMin" name="tirada_min" required placeholder="0" maxLength="11" class="form-control" value="<?=old('tirada_min', $tarifaacabado_->tirada_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precioMin" class="form-label">
<?=lang('Tarifaacabado.precioMin') ?>*
</label>
<input type="number" id="precioMin" name="precio_min" required placeholder="0" maxLength="31" step="0.01" class="form-control" value="<?=old('precio_min', $tarifaacabado_->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiradaMax" class="form-label">
<?=lang('Tarifaacabado.tiradaMax') ?>*
</label>
<input type="number" id="tiradaMax" name="tirada_max" required placeholder="0" maxLength="11" class="form-control" value="<?=old('tirada_max', $tarifaacabado_->tirada_max) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precioMax" class="form-label">
<?=lang('Tarifaacabado.precioMax') ?>*
</label>
<input type="number" id="precioMax" name="precio_max" required maxLength="31" step="0.01" class="form-control" value="<?=old('precio_max', $tarifaacabado_->precio_max) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ajuste" class="form-label">
<?=lang('Tarifaacabado.ajuste') ?>*
</label>
<input type="number" id="ajuste" name="ajuste" required placeholder="0" maxLength="31" step="0.01" class="form-control" value="<?=old('ajuste', $tarifaacabado_->ajuste) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="formulaPrice" class="form-label">
<?=lang('Tarifaacabado.formulaPrice') ?>*
</label>
<textarea rows="3" id="formulaPrice" name="formula_price" required style="height: 10em;" class="form-control"><?=old('formula_price', $tarifaacabado_->formula_price) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userCreatedId" class="form-label">
<?=lang('Tarifaacabado.userCreatedId') ?>*
</label>
<input type="number" id="userCreatedId" name="user_created_id" required placeholder="1" maxLength="10" class="form-control" value="<?=old('user_created_id', $tarifaacabado_->user_created_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userUpdateId" class="form-label">
<?=lang('Tarifaacabado.userUpdateId') ?>*
</label>
<input type="number" id="userUpdateId" name="user_update_id" required placeholder="1" maxLength="10" class="form-control" value="<?=old('user_update_id', $tarifaacabado_->user_update_id) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,25 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $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="tarifaacabadoForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("admin/acabadoViews/_tarifaacabadoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("tarifaacabadoList2"), 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,93 @@
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?=$this->extend('themes/backend/focus2/main/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('Tarifaacabado.tarifaacabadoList') ?></h3>
<?=anchor(route_to('newTarifaacabado'), lang('Basic.global.addNew').' '.lang('Tarifaacabado.tarifaacabado'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfTarifasacabado" class="table table-striped table-hover using-data-table" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifaacabado.id') ?></th>
<th><?= lang('Tarifaacabado.nombre') ?></th>
<th><?= lang('Tarifaacabado.tiradaMin') ?></th>
<th><?= lang('Tarifaacabado.precioMin') ?></th>
<th><?= lang('Tarifaacabado.tiradaMax') ?></th>
<th><?= lang('Tarifaacabado.precioMax') ?></th>
<th><?= lang('Tarifaacabado.ajuste') ?></th>
<th><?= lang('Tarifaacabado.formulaPrice') ?></th>
<th><?= lang('Tarifaacabado.userCreatedId') ?></th>
<th><?= lang('Tarifaacabado.userUpdateId') ?></th>
<th><?= lang('Tarifaacabado.deletedAt') ?></th>
<th><?= lang('Tarifaacabado.createdAt') ?></th>
<th><?= lang('Tarifaacabado.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($tarifaacabadoList as $item ) : ?>
<tr>
<td class="align-middle text-center">
<?=$item->id ?>
</td>
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle">
<?= esc($item->tirada_min) ?>
</td>
<td class="align-middle">
<?= esc($item->precio_min) ?>
</td>
<td class="align-middle">
<?= esc($item->tirada_max) ?>
</td>
<td class="align-middle">
<?= esc($item->precio_max) ?>
</td>
<td class="align-middle">
<?= esc($item->ajuste) ?>
</td>
<td class="align-middle">
<?= empty($item->formula_price) || strlen($item->formula_price) < 51 ? esc($item->formula_price) : character_limiter(esc($item->formula_price), 50) ?>
</td>
<td class="align-middle">
<?= esc($item->user_created_id) ?>
</td>
<td class="align-middle">
<?= esc($item->user_update_id) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->deleted_at) ? '' : date('d/m/Y H:m:s', strtotime($item->deleted_at)) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->created_at) ? '' : date('d/m/Y H:m:s', strtotime($item->created_at)) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->updated_at) ? '' : date('d/m/Y H:m:s', strtotime($item->updated_at)) ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifaacabado', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteTarifaacabado', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>

View File

@ -0,0 +1,211 @@
<?php
$settings = session()->get('settings');
$picture = session()->get('picture');
$pulse = session()->get('pulse');
$notification = session()->get('notification');
?>
<?php
?>
<!DOCTYPE html>
<html lang="<?= $settings['default_language']??'en'=='pt' ? 'pt-br' : $settings['default_language']??'en' ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title']??'' ?></title>
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="<?=site_url('themes/focus2/images/favicon.png')?>">
<link href="<?=site_url('themes/focus2/vendor/owl-carousel/css/owl.carousel.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/owl-carousel/css/owl.theme.default.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/jqvmap/css/jqvmap.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/datatables/css/jquery.dataTables.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/select2/css/select2.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/sweetalert2/dist/sweetalert2.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/lou-multi-select/css/multi-select.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/nestable2/css/jquery.nestable.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/toastr/css/toastr.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/css/style.css')?>" rel="stylesheet">
</head>
<body>
<div id="preloader">
<div class="sk-three-bounce">
<div class="sk-child sk-bounce1"></div>
<div class="sk-child sk-bounce2"></div>
<div class="sk-child sk-bounce3"></div>
</div>
</div>
<div id="mainWrapper">
<!--Nav Header-->
<div class="nav-header">
<a href="<?=site_url('home')?>" class="brand-logo">
<!--- Insertar logo safekat --->
</a>
<div class="nav-control">
<div class="hamburger">
<span class="line"></span><span class="line"></span><span class="line"></span>
</div>
</div>
</div>
<!--Header-->
<div class="header">
<div class="header-content">
<nav class="navbar navbar-expand">
<div class="collapse navbar-collapse justify-content-between">
<div class="header-left"></div>
<ul class="navbar-nav header-right">
<li class="nav-item dropdown header-profile">
<a class="nav-link" href="#" role="button" data-toggle="dropdown">
<i class="fas fa-globe-americas"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= site_url('lang/en'); ?>" class="dropdown-item">
<img src="<?=site_url('assets/flags/us_32_circle.png')?>">
<span class="ml-2"><?= lang("App.lang_en") ?></span>
</a>
<a href="<?= site_url('lang/es'); ?>" class="dropdown-item">
<img src="<?=site_url('assets/flags/es_32_circle.png')?>">
<span class="ml-2"><?= lang("App.lang_es") ?></span>
</a>
</div>
</li>
<li class="nav-item dropdown header-profile">
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<img src="<?= $picture??''?>" class="btn-circle btn-circle-sm" style="width: 50px ; height: 50px;">
</a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= site_url('profile'); ?>" class="dropdown-item">
<i class="fas fa-user"></i>
<span class="ml-2"><?= lang("App.menu_profile") ?></span>
</a>
<!--- JJO
<a href="<?= site_url('activity'); ?>" class="dropdown-item">
<i class="fas fa-list"></i>
<span class="ml-2"><?= lang("App.menu_activity") ?></span>
</a>
--->
<a href="<?= site_url('login/logout'); ?>" class="dropdown-item">
<i class="fas fa-sign-out-alt"></i>
<span class="ml-2"><?= lang("App.menu_logout") ?></span>
</a>
</div>
</li>
</ul>
</div>
</nav>
</div>
</div>
<?php include "menu.php" ?>
<div class="content-body">
<div class="container-fluid">
<?= $this->renderSection('content') ?>
</div>
</div> -->
</div>
<!-- Required vendors -->
<script src="<?=site_url("themes/focus2/vendor/global/global.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/js/quixnav-init.js")?>"></script>
<script src="<?=site_url("themes/focus2/js/custom.min.js")?>"></script>
<!-- Datatable -->
<script src="<?=site_url("themes/focus2/vendor/datatables/js/jquery.dataTables.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/pickers/daterange/moment.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/dataTables.datetime.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/dataTables.buttons.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.bootstrap4.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/jszip.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/pdfmake.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/vfs_fonts.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.html5.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.print.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.colVis.min.js")?>"></script>
<!-- Alert -->
<script src="<?=site_url("themes/focus2/vendor/sweetalert2/dist/sweetalert2.min.js")?>"></script>
<script src="<?=site_url("themes/focus2/vendor/toastr/js/toastr.min.js")?>"></script>
<!-- Custom -->
<script src="<?=site_url("assets/js/main.js")?>"></script>
<script>
"use strict";
</script>
<?= sweetAlert() ?>
<?= $this->renderSection('footerAdditions') ?>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<?= $this->renderSection('additionalExternalJs') ?>
<script type="text/javascript">
var theTable;
var <?=csrf_token() ?? 'token'?>v = '<?= csrf_hash() ?>';
function yeniden(andac = null) {
if (andac == null) {
andac = <?= csrf_token() ?>v;
} else {
<?= csrf_token() ?>v = andac;
}
$('input[name="<?= csrf_token() ?>"]').val(andac);
$('meta[name="<?= config('Security')->tokenName ?>"]').attr('content', andac)
$.ajaxSetup({ headers: {'<?= config('Security')->headerName ?>': andac, 'X-Requested-With': 'XMLHttpRequest' }, <?=csrf_token()?>: andac });
}
document.addEventListener('DOMContentLoaded', function() {
function adjustSidebar4ContentWrapper() {
if ($('#sidebar').hasClass('d-none') && $(window).width() <= 768) {
$('#contentWrapper').addClass('full-width');
} else {
if (!$('#sidebar').hasClass('inactive')) {
$('#contentWrapper').removeClass('full-width');
}
}
}
adjustSidebar4ContentWrapper();
$('#sidebarCollapse').on('click', function () {
if ($('#sidebar').hasClass('d-none') && $(window).width() <= 768 ) {
$('#sidebar').removeClass('d-none d-sm-none d-md-block');
$('#contentWrapper').removeClass('full-width');
} else {
$('#sidebar').toggleClass('inactive');
$('#contentWrapper').toggleClass('full-width');
$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
}
});
$(window).resize(function() {
adjustSidebar4ContentWrapper();
});
<?= $this->renderSection('additionalInlineJs') ?>
});
</script>
</body>
</html>

View File

@ -38,9 +38,7 @@ $notification = session()->get('notification');
<!--Nav Header-->
<div class="nav-header">
<a href="<?=site_url('home')?>" class="brand-logo">
<img class="logo-abbr" src="<?=site_url('themes/focus2/images/logo.png')?>" alt="">
<img class="logo-compact" src="<?=site_url('themes/focus2/images/logo-text.png')?>" alt="">
<img class="brand-title" src="<?=site_url('themes/focus2/images/logo-text.png')?>" alt="">
</a>
<div class="nav-control">
<div class="hamburger">

View File

@ -174,9 +174,9 @@
<?php endif; ?>
<?php if(allowMenuSection($menus, ['Tarifaacabado', 'Tarifaenvio', 'Tarifaimpresion', 'Tarifamanipulado', 'Tarifapapelcompra', 'Tarifapapeldefecto', 'Tarifapreimpresion'], 'index')): ?>
<li><a class="has-arrow" href="Javascript:void()" aria-expanded="false"><i class="icon-arrow-down"></i><span class="nav-text"><?= lang("App.menu_produccion") ?></span></a>
<li><a class="has-arrow" href="Javascript:void()" aria-expanded="false"><i class="icon-arrow-down"></i><span class="nav-text"><?= lang("App.menu_tarifas") ?></span></a>
<ul aria-expanded="false">
<?php if (count($temp=getArrayItem($menus,'name','Taricaacabado')) > 0): ?>
<?php if (count($temp=getArrayItem($menus,'name','Tarifaacabado')) > 0): ?>
<?php if (count(getArrayItem($temp,'methods','index',true)) > 0): ?>
<li><a href="<?= site_url("tarifas/tarifaacabado")?>" aria-expanded="false"><i class="icon-list"></i><span class="nav-text"><?= lang("App.menu_tarifaacabado") ?></span></a></li>
<?php endif; ?>