Merge branch 'main' into 'dev/ui-cliente_contactos'

# Conflicts:
#   ci4/app/Config/Routes.php
This commit is contained in:
Ignacio Martinez Navajas
2023-08-18 13:44:59 +00:00
87 changed files with 2989 additions and 349 deletions

View File

@ -378,23 +378,32 @@ $routes->group('tarifaencuadernacionlineas', ['namespace' => 'App\Controllers\Ta
});
$routes->resource('tarifaencuadernacionlineas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaencuadernacionlineas', 'except' => 'show,new,create,update']);
$routes->group('clientecontactos', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
$routes->get('', 'Clientecontactos::index', ['as' => 'ClienteContactosList']);
$routes->get('add', 'Clientecontactos::add', ['as' => 'newClienteContactos']);
$routes->post('add', 'Clientecontactos::add', ['as' => 'createClienteContactos']);
$routes->post('create', 'Clientecontactos::create', ['as' => 'ajaxCreateClienteContactos']);
$routes->put('(:num)/update', 'Clientecontactos::update/$1', ['as' => 'ajaxUpdateClienteContactos']);
$routes->post('(:num)/edit', 'Clientecontactos::edit/$1', ['as' => 'updateClienteContactos']);
$routes->post('datatable', 'Clientecontactos::datatable', ['as' => 'dataTableOfClienteContactos']);
$routes->post('datatable_editor', 'Clientecontactos::datatable_editor', ['as' => 'editorOfClienteContactos']);
$routes->post('allmenuitems', 'Clientecontactos::allItemsSelect', ['as' => 'select2ItemsOfClienteContactos']);
$routes->post('menuitems', 'Clientecontactos::menuItems', ['as' => 'menuItemsOfClienteContactos']);
$routes->group('tarifaencuadernaciontiradas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
$routes->post('datatable', 'Tarifaencuadernaciontiradas::datatable', ['as' => 'dataTableOfTarifaEncuadernacionTiradas']);
$routes->post('datatable_editor', 'Tarifaencuadernaciontiradas::datatable_editor', ['as' => 'editorOfTarifaEncuadernacionTiradas']);
$routes->post('menuitems', 'Tarifaencuadernaciontiradas::menuItems', ['as' => 'menuItemsOfTarifaencuadernaciontiradas']);
});
$routes->resource('tarifaencuadernaciontiradas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaencuadernaciontiradas', 'except' => 'show,new,create,update']);
$routes->group('proveedores', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
$routes->get('', 'Proveedores::index', ['as' => 'proveedorList']);
$routes->get('add', 'Proveedores::add', ['as' => 'newProveedor']);
$routes->post('add', 'Proveedores::add', ['as' => 'createProveedor']);
$routes->post('create', 'Proveedores::create', ['as' => 'ajaxCreateProveedor']);
$routes->put('(:num)/update', 'Proveedores::update/$1', ['as' => 'ajaxUpdateProveedor']);
$routes->post('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'updateProveedor']);
$routes->post('datatable', 'Proveedores::datatable', ['as' => 'dataTableOfProveedores']);
$routes->post('allmenuitems', 'Proveedores::allItemsSelect', ['as' => 'select2ItemsOfProveedores']);
$routes->post('menuitems', 'Proveedores::menuItems', ['as' => 'menuItemsOfProveedores']);
});
$routes->resource('ClienteContactos', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'ClienteContactos', 'except' => 'show,new,create,update']);
$routes->resource('proveedores', ['namespace' => 'App\Controllers\Compras', 'controller' => 'Proveedores', 'except' => 'show,new,create,update']);
$routes->group('proveedorestipos', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
$routes->post('menuitems', 'ProveedoresTipos::menuItems', ['as' => 'menuItemsOfProveedoresTipos']);
});
$routes->resource('proveedorestipos', ['namespace' => 'App\Controllers\Compras', 'controller' => 'ProveedoresTipos', 'except' => 'show,new,create,update']);
/*
* --------------------------------------------------------------------

View File

@ -0,0 +1,329 @@
<?php namespace App\Controllers\Compras;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Compras\ProveedorEntity;
use App\Models\Compras\ProveedorModel;
class Proveedores extends \App\Controllers\GoBaseResourceController {
protected $modelName = ProveedorModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Proveedor';
protected static $singularObjectNameCc = 'proveedor';
protected static $pluralObjectName = 'Proveedores';
protected static $pluralObjectNameCc = 'proveedores';
protected static $controllerSlug = 'proveedores';
protected static $viewPath = 'themes/backend/vuexy/form/compras/proveedores/';
protected $indexRoute = 'proveedorList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('Proveedores.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
$this->viewData = ['usingServerSideDataTable' => true];
// Breadcrumbs (IMN)
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_proveedores"), 'route' => site_url('compras/proveedores'), 'active' => true]
];
parent::initController($request, $response, $logger);
}
public function index() {
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Proveedores.proveedor')]),
'proveedorEntity' => new ProveedorEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewProveedorList', $viewData);
}
public function add() {
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Proveedores.proveedor'))]);
$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('Proveedores.proveedor'))]).'.';
$message .= anchor( "admin/proveedores/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['proveedorEntity'] = isset($sanitizedData) ? new ProveedorEntity($sanitizedData) : new ProveedorEntity();
$this->viewData['proveedorTipoList'] = $this->getProveedorTipoListItems($proveedorEntity->tipo_id ?? null);
$this->viewData['provinciaList'] = $this->getProvinciaListItems($proveedorEntity->provincia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['formAction'] = route_to('createProveedor');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Proveedores.moduleTitle').' '.lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null) {
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$proveedorEntity = $this->model->find($id);
if ($proveedorEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Proveedores.proveedor')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Proveedores.proveedor'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$proveedorEntity->fill($sanitizedData);
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
$id = $proveedorEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
//$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Proveedores.proveedor'))]).'.';
//$message .= anchor( "admin/proveedores/{$id}/edit" , lang('Basic.global.continueEditing').'?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['proveedorEntity'] = $proveedorEntity;
$this->viewData['proveedorTipoList'] = $this->getProveedorTipoListItems($proveedorEntity->tipo_id ?? null);
$this->viewData['provinciaList'] = $this->getProvinciaListItems($proveedorEntity->provincia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['formAction'] = route_to('updateProveedor', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Proveedores.moduleTitle').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable() {
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = ProveedorModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->nombre = '- '.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 ?? 'nombre'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getProveedorTipoListItems($selId = null) {
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Proveedores.tipoId'))])];
if (!empty($selId)) :
$proveedorTipoModel = model('App\Models\Compras\ProveedorTipoModel');
$selOption = $proveedorTipoModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPaisListItems() {
$paisModel = model('App\Models\Configuracion\PaisModel');
$onlyActiveOnes = true;
$data = $paisModel->getAllForMenu('id, nombre','nombre', $onlyActiveOnes );
return $data;
}
protected function getProvinciaListItems($selId = null) {
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
if (!empty($selId)) :
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel');
$selOption = $provinciaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
}

View File

@ -0,0 +1,271 @@
<?php namespace App\Controllers\Compras;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Compras\ProveedorTipoEntity;
use App\Models\Compras\ProveedorTipoModel;
class ProveedoresTipos extends \App\Controllers\GoBaseResourceController {
protected $modelName = ProveedorTipoModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Proveedor Tipo';
protected static $singularObjectNameCc = 'proveedorTipo';
protected static $pluralObjectName = 'Proveedores Tipos';
protected static $pluralObjectNameCc = 'proveedoresTipos';
protected static $controllerSlug = 'proveedorestipos';
protected static $viewPath = 'themes/backend/vuexy/form/compras/proveedores/';
protected $indexRoute = 'proveedorTipoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('LgProveedoresTipos.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
}
public function index() {
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('LgProveedoresTipos.proveedorTipo')]),
'proveedorTipoEntity' => new ProveedorTipoEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewProveedorTipoList', $viewData);
}
public function add() {
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('LgProveedoresTipos.proveedorTipo'))]);
$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('LgProveedoresTipos.proveedorTipo'))]).'.';
$message .= anchor( "admin/proveedorestipos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['proveedorTipoEntity'] = isset($sanitizedData) ? new ProveedorTipoEntity($sanitizedData) : new ProveedorTipoEntity();
$this->viewData['formAction'] = route_to('createProveedorTipo');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('LgProveedoresTipos.moduleTitle').' '.lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null) {
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$proveedorTipoEntity = $this->model->find($id);
if ($proveedorTipoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('LgProveedoresTipos.proveedorTipo')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('LgProveedoresTipos.proveedorTipo'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$proveedorTipoEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $proveedorTipoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('LgProveedoresTipos.proveedorTipo'))]).'.';
$message .= anchor( "admin/proveedorestipos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['proveedorTipoEntity'] = $proveedorTipoEntity;
$this->viewData['formAction'] = route_to('updateProveedorTipo', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('LgProveedoresTipos.moduleTitle').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable() {
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = ProveedorTipoModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->nombre = '- '.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 ?? 'nombre'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -419,6 +419,7 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
'color' => 'color',
'negrohq' => 'negrohq',
'bicolor' => 'bicolor',
'colorhq' => 'colorhq',
];
return $tipoOptions;
}

View File

@ -84,7 +84,9 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
// JJO
$sanitizedData['user_created_id'] = $session->id_user;
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -164,6 +166,9 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
// JJO
$sanitizedData['user_updated_id'] = $session->id_user;
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;

View File

@ -47,6 +47,11 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController
$this->viewData['pageTitle'] = lang('TarifaAcabadoLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
}
@ -248,19 +253,19 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst($db, 'tarifa_acabado_lineas')
->fields(
Field::inst('paginas_min')
Field::inst('tirada_min')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.required'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.required'))
),
Field::inst('paginas_max')
Field::inst('tirada_max')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.required'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.required'))
),
Field::inst('precio_min')
->validator('Validate::numeric', array(
@ -298,8 +303,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController
// Si no se quiere borrar...
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$process_data['tirada_min'] = $data['data'][$pkey]['tirada_min'];
$process_data['tirada_max'] = $data['data'][$pkey]['tirada_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_acabado_id']);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {

View File

@ -44,6 +44,11 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$this->viewData['pageTitle'] = lang('TarifaEncuadernacionLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
}
@ -245,7 +250,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
),
Field::inst('tarifa_encuadernacion_id'),
Field::inst('tirada_encuadernacion_id'),
Field::inst('user_created_id'),
Field::inst('created_at'),
Field::inst('user_updated_id'),
@ -261,7 +266,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_encuadernacion_id']);
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tirada_encuadernacion_id']);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {
return $response;
@ -322,14 +327,14 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$order = TarifaEncuadernacionLineaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_TM = $reqData['id_tarifaencuadernacion'] ?? -1;
$id_TE = $reqData['tirada_id'] ?? -1;
$resourceData = $this->model->getResource("", $id_TM)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource("", $id_TE)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search, $id_TM)->countAllResults()
$this->model->getResource("", $id_TE)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
@ -341,10 +346,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal . ', tarifa_encuadernacion_id', 'tarifa_encuadernacion_id', $onlyActiveOnes, false);
$menu = $this->model->getAllForMenu($reqVal . ', tirada_encuadernacion_id', 'tirada_encuadernacion_id', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->tarifa_encuadernacion_id = '- ' . lang('Basic.global.None') . ' -';
$nonItem->tirada_encuadernacion_id = '- ' . lang('Basic.global.None') . ' -';
array_unshift($menu, $nonItem);
$newTokenHash = csrf_hash();
@ -366,7 +371,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'tarifa_encuadernacion_id'];
$columns2select = [$reqId ?? 'id', $reqText ?? 'tirada_encuadernacion_id'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;

View File

@ -0,0 +1,237 @@
<?php namespace App\Controllers\Tarifas;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Tarifas\TarifaEncuadernacionTirada;
use App\Models\Tarifas\TarifaEncuadernacionTiradaModel;
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
use App\Models\Compras\ProveedorModel;
use App\Models\Compras\ProveedorTipoModel;
use
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceController
{
protected static $controllerSlug = 'tarifaencuadernaciontiradas';
protected $modelName = TarifaEncuadernacionTiradaModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Tarifa Encuadernacion Tirada';
protected static $singularObjectNameCc = 'tarifaEncuadernacionTirada';
protected static $pluralObjectName = 'Tarifa Encuadernacion Tiradas';
protected static $pluralObjectNameCc = 'tarifaEncuadernacionTiradas';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
parent::initController($request, $response, $logger);
}
public function delete($id = null)
{
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc).'.'.static::$singularObjectNameCc));
} else {
$objName = lang('Basic.global.record');
}
if (!$this->soft_delete){
if (!$this->model->delete($id)) {
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
}
}
else{
$datetime = (new \CodeIgniter\I18n\Time("now"));
$lineaModel = new TarifaEncuadernacionLineaModel();
$lineaResult = $lineaModel->removeAllEncuadernacionLineas($id, $datetime, $this->delete_flag);
$rawResult = $this->model->where('id',$id)
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
'is_deleted' => $this->delete_flag])
->update();
if (!$rawResult && !$lineaResult) {
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
}
}
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
return $response;
}
public function datatable_editor()
{
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst($db, 'tarifa_encuadernacion_tiradas')
->fields(
Field::inst('tirada_min')
->validator('Validate::numeric', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
),
Field::inst('tirada_max')
->validator('Validate::numeric', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
),
Field::inst('proveedor_id')
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
),
Field::inst('tarifa_encuadernacion_id'),
Field::inst('user_created_id'),
Field::inst('created_at'),
Field::inst('user_updated_id'),
Field::inst('updated_at'),
Field::inst('is_deleted'),
Field::inst('deleted_at'),
)
->validator(function ($editor, $action, $data) {
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar...
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['tirada_min'] = $data['data'][$pkey]['tirada_min'];
$process_data['tirada_max'] = $data['data'][$pkey]['tirada_max'];
$process_data['proveedor_id'] = $data['data'][$pkey]['proveedor_id'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_encuadernacion_id']);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {
return $response;
}
}
}
}
})
->on('preCreate', function ($editor, &$values) {
$session = session();
$datetime = (new \CodeIgniter\I18n\Time("now"));
$editor
->field('user_created_id')
->setValue($session->id_user);
$editor
->field('created_at')
->setValue($datetime->format('Y-m-d H:i:s'));
})
->on('preEdit', function ($editor, &$values) {
$session = session();
$datetime = (new \CodeIgniter\I18n\Time("now"));
$editor
->field('user_updated_id')
->setValue($session->id_user);
$editor
->field('updated_at')
->setValue($datetime->format('Y-m-d H:i:s'));
})
->debug(true)
->process($_POST)
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$order = TarifaEncuadernacionTiradaModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_TM = $reqData['id_tarifaencuadernacion'] ?? -1;
$model = new TarifaEncuadernacionTiradaModel();
$resourceData = $model->getResource("", $id_TM)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$model->getResource()->countAllResults(),
$model->getResource($search, $id_TM)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems()
{
if ($this->request->isAJAX()) {
$provTipoModel = new ProveedorTipoModel();
$provModel = new ProveedorModel();
$tipoId = $provTipoModel->getTipoId("Encuadernacion");
$provList = $provModel->getProvList($tipoId);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'data' => $provList,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -43,6 +43,12 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController
{
$this->viewData['pageTitle'] = lang('TarifaManipuladoLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
parent::initController($request, $response, $logger);
}
@ -210,19 +216,19 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst($db, 'tarifa_manipulado_lineas')
->fields(
Field::inst('paginas_min')
Field::inst('tirada_min')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.required'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.required'))
),
Field::inst('paginas_max')
Field::inst('tirada_max')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.required'))
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.required'))
),
Field::inst('precio_min')
->validator('Validate::numeric', array(
@ -259,8 +265,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController
foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar...
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$process_data['tirada_min'] = $data['data'][$pkey]['tirada_min'];
$process_data['tirada_max'] = $data['data'][$pkey]['tirada_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_manipulado_id']);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {

View File

@ -62,6 +62,10 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -140,6 +144,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
if (isset($this->model->user_updated_id)) {
$sanitizedData['user_updated_id'] = $session->id_user;
}
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :

View File

@ -8,6 +8,9 @@ use App\Models\Collection;
use App\Entities\Tarifas\TarifaEncuadernacionEntity;
use App\Models\Tarifas\TarifaEncuadernacionModel;
use App\Models\Compras\ProveedorModel;
use App\Models\Compras\ProveedorTipoModel;
class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
{
@ -86,6 +89,9 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
if (isset($this->model->user_updated_id)) {
$sanitizedData['user_created_id'] = $session->id_user;
}
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -167,6 +173,9 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
if (isset($this->model->user_updated_id)) {
$sanitizedData['user_updated_id'] = $session->id_user;
}
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -210,6 +219,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tarifaencuadernacion.moduleTitle') . ' ' . lang('Basic.global.edit3');
//JJO
$this->viewData['proveedores'] = $this->getProveedores();
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
@ -293,4 +304,11 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
}
}
private function getProveedores(){
$provTipoModel = new ProveedorTipoModel();
$provModel = new ProveedorModel();
$tipoId = $provTipoModel->getTipoId("Encuadernacion");
return $provModel->getProvList($tipoId);
}
}

View File

@ -86,6 +86,9 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController
if (isset($this->model->user_updated_id)) {
$sanitizedData['user_created_id'] = $session->id_user;
}
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -167,6 +170,9 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController
if (isset($this->model->user_updated_id)) {
$sanitizedData['user_updated_id'] = $session->id_user;
}
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :

View File

@ -0,0 +1,32 @@
<?php
namespace App\Entities\Compras;
use CodeIgniter\Entity;
class ProveedorEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"tipo_id" => null,
"razon_social" => null,
"cif" => null,
"direccion" => null,
"cp" => null,
"ciudad" => null,
"provincia_id" => null,
"pais_id" => 1,
"persona_contacto" => null,
"email" => null,
"telefono" => null,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tipo_id" => "?int",
"provincia_id" => "int",
"pais_id" => "int",
"is_deleted" => "int",
];
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Entities\Compras;
use CodeIgniter\Entity;
class ProveedorTipoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"is_deleted" => "int",
];
}

View File

@ -8,8 +8,8 @@ class TarifaAcabadoLinea extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"tarifa_acabado_id" => 0,
"paginas_min" => 0,
"paginas_max" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"precio_min" => 0,
"precio_max" => 0,
"margen" => 0,

View File

@ -11,6 +11,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
"nombre" => null,
"precio_min" => 0,
"importe_fijo" => 0,
"mostrar_en_presupuesto" => 1,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
@ -21,6 +22,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
protected $casts = [
"precio_min" => "float",
"importe_fijo" => "float",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",

View File

@ -7,7 +7,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"tarifa_encuadernacion_id" => 0,
"tirada_encuadernacion_id" => 0,
"paginas_min" => 0,
"paginas_max" => 0,
"precio_min" => 0,
@ -20,7 +20,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
"updated_at" => null,
];
protected $casts = [
"tarifa_encuadernacion_id" => "int",
"tirada_encuadernacion_id" => "int",
"paginas_min" => "float",
"paginas_max" => "float",
"precio_min" => "float",

View File

@ -0,0 +1,29 @@
<?php
namespace App\Entities\Tarifas;
use CodeIgniter\Entity;
class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"tarifa_encuadernacion_id" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"proveedor_id" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tarifa_encuadernacion_id" => "int",
"tirada_min" => "float",
"tirada_max" => "float",
"proveedor_id" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",
];
}

View File

@ -11,6 +11,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
"nombre" => null,
"precio_min" => 0,
"importe_fijo" => 0,
"mostrar_en_presupuesto" => 1,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
@ -21,6 +22,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
protected $casts = [
"precio_min" => "float",
"importe_fijo" => "float",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",

View File

@ -8,8 +8,8 @@ class TarifaManipuladoLinea extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"tarifa_manipulado_id" => 0,
"paginas_min" => 0,
"paginas_max" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"precio_min" => 0,
"precio_max" => 0,
"margen" => 0,
@ -21,8 +21,8 @@ class TarifaManipuladoLinea extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"tarifa_manipulado_id" => "int",
"paginas_min" => "float",
"paginas_max" => "float",
"tirada_min" => "float",
"tirada_max" => "float",
"precio_min" => "float",
"precio_max" => "float",
"margen" => "float",

View File

@ -10,6 +10,7 @@ class TarifaacabadoEntity extends \CodeIgniter\Entity\Entity
"nombre" => null,
"precio_min" => 0,
"importe_fijo" => 0,
"mostrar_en_presupuesto" => 1,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
@ -20,6 +21,7 @@ class TarifaacabadoEntity extends \CodeIgniter\Entity\Entity
protected $casts = [
"precio_min" => "float",
"importe_fijo" => "float",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",

View File

@ -12,6 +12,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
"precio_min" => 0,
"importe_fijo" => 0,
"margen" => 0,
"mostrar_en_presupuesto" => 1,
"user_created_id" => 1,
"user_update_id" => 1,
"is_deleted" => 0,
@ -24,6 +25,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
"precio_min" => "float",
"importe_fijo" => "float",
"margen" => "float",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_update_id" => "int",
"is_deleted" => "int",

View File

@ -26,6 +26,7 @@ return [
'negro' => 'Black',
'color' => 'Color',
'negrohq' => 'Black HQ',
'colorhq' => 'Color HQ',
'bicolor' => 'Bicolor',
'validation' => [
'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",

View File

@ -0,0 +1,85 @@
<?php
return [
'cif' => 'CIF',
'ciudad' => 'City',
'cp' => 'Postal code',
'createdAt' => 'Created At',
'deletedAt' => 'Deleted At',
'direccion' => 'Address',
'email' => 'Email',
'id' => 'ID',
'isDeleted' => 'Is Deleted',
'moduleTitle' => 'Suppliers',
'nombre' => 'Name',
'paisId' => 'Country',
'personaContacto' => 'Contact Person',
'propiedades' => 'Properties',
'proveedor' => 'Supplier',
'proveedorList' => 'Suppliers List',
'proveedores' => 'Suppliers',
'provinciaId' => 'Region',
'razonSocial' => 'Business Name',
'telefono' => 'Phone',
'tipoId' => 'Type',
'updatedAt' => 'Updated At',
'validation' => [
'cif' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'ciudad' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'cp' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'direccion' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'persona_contacto' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'razon_social' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'telefono' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
],
'email' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'valid_email' => 'The {field} field must contain a valid email address.',
],
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
'tipo' => [
'required' => 'The {field} field is required.',
],
],
];

View File

@ -9,12 +9,12 @@ return [
'precioMax' => 'Max Price',
'precioMin' => 'Min Price',
'precioUnidad' => 'Price Unit',
'paginasMax' => 'Max Pages',
'paginasMin' => 'Min Pages',
'tiradaMax' => 'Max Printing',
'tiradaMin' => 'Min Printing',
'margen' => 'Margin',
'validation' => [
'error_paginas_overlap' => 'The range [Min Pages, Max Pages] is overlapped with another one for the selected type.',
'error_paginas_range' => 'The field Min Pages must be lower than the field Max Pages',
'error_tirada_overlap' => 'The range [Min Printing, Max Printing] is overlapped with another one for the selected type.',
'error_tirada_range' => 'The field Min Printing must be lower than the field Max Printing',
'precio_max' => [
'decimal' => 'The field must contain a decimal number.',
'required' => 'The field is required.',
@ -27,13 +27,13 @@ return [
],
'paginas_max' => [
'tirada_max' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',
],
'paginas_min' => [
'tirada_min' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',

View File

@ -11,8 +11,10 @@ return [
'precioUnidad' => 'Price Unit',
'paginasMax' => 'Max Pages',
'paginasMin' => 'Min Pages',
'moduleExplanation' => 'The number of pages indicated in this section refers per copy, not to the total of the order.',
'margen' => 'Margin',
'validation' => [
'error_seleccion_tiradas' => 'A line from the Printings table must be selected before creating a new record.',
'error_paginas_overlap' => 'The range [Min Pages, Max Pages] is overlapped with another one for the selected type.',
'error_paginas_range' => 'The field Min Pages must be lower than the field Max Pages',
'precio_max' => [

View File

@ -0,0 +1,26 @@
<?php
return [
'id' => 'ID',
'moduleTitle' => 'Printings Binding rates',
'deleteLine' => 'the selected register',
'proveedor' => 'Supplier',
'seleccion' => 'Selection',
'tiradaMax' => 'Max Printing',
'tiradaMin' => 'Min Printing',
'validation' => [
'error_tirada_overlap' => 'El rango [Tirada Min, Tirada Max] se solapa con otro existente para el tipo seleccionado.',
'error_tirada_range' => 'El campo Tirada Min debe ser menor que el campo Tirada Max',
'tirada_max' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',
],
'tirada_min' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',
],
],
];

View File

@ -9,12 +9,12 @@ return [
'precioMax' => 'Max Price',
'precioMin' => 'Min Price',
'precioUnidad' => 'Price Unit',
'paginasMax' => 'Max Pages',
'paginasMin' => 'Min Pages',
'tiradaMax' => 'Max Printing',
'tiradaMin' => 'Min Printing',
'margen' => 'Margin',
'validation' => [
'error_paginas_overlap' => 'The range [Min Pages, Max Pages] is overlapped with another one for the selected type.',
'error_paginas_range' => 'The field Min Pages must be lower than the field Max Pages',
'error_tirada_overlap' => 'The range [Min Printing, Max Printing] is overlapped with another one for the selected type.',
'error_tirada_range' => 'The field Min Printing must be lower than the field Max Printing',
'precio_max' => [
'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.',
@ -27,13 +27,13 @@ return [
],
'paginas_max' => [
'tirada_max' => [
'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.',
],
'paginas_min' => [
'tirada_min' => [
'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.',

View File

@ -15,6 +15,7 @@ return [
'precioMin' => 'Min Price',
'importeFijo' => 'Fixed amount',
'margen' => 'Margin',
'mostrar_en_presupuesto' => 'Show in budget',
'tarifaacabado' => 'Finishing Rates',
'tarifaacabadoList' => 'Finishing Rates List',
'tarifasacabado' => 'Finishing Rates',

View File

@ -21,6 +21,7 @@ return [
'tarifasencuadernacion' => 'Binding rates',
'tiradaMax' => 'Print Max',
'tiradaMin' => 'Print Min',
'mostrar_en_presupuesto' => 'Show in budget',
'updatedAt' => 'Updated At',
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',

View File

@ -15,6 +15,7 @@ return [
'precioMin' => 'Price Min',
'precioMin' => 'Min Price',
'importeFijo' => 'Fixed amount',
'mostrar_en_presupuesto' => 'Show in budget',
'margen' => 'Margin',
'tarifamanipulado' => 'Handling rate',
'tarifamanipuladoList' => 'Handling rates List',

View File

@ -15,6 +15,7 @@ return [
'tarifapreimpresion' => 'Preprinting rate',
'tarifapreimpresionList' => 'Preprinting rates List',
'tarifaspreimpresion' => 'Preprinting rates',
'mostrar_en_presupuesto' => 'Show in budget',
'updatedAt' => 'Updated At',
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',

View File

@ -26,6 +26,7 @@ return [
'negro' => 'Negro',
'color' => 'Color',
'negrohq' => 'Negro HQ',
'colorhq' => 'Color HQ',
'bicolor' => 'Bicolor',
'validation' => [
'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",

View File

@ -0,0 +1,84 @@
<?php
return [
'cif' => 'CIF',
'ciudad' => 'Ciudad',
'cp' => 'Código Postal',
'createdAt' => 'Created At',
'deletedAt' => 'Deleted At',
'direccion' => 'Direccion',
'email' => 'Email',
'id' => 'ID',
'isDeleted' => 'Is Deleted',
'moduleTitle' => 'Proveedores',
'nombre' => 'Nombre',
'paisId' => 'País',
'personaContacto' => 'Persona Contacto',
'propiedades' => 'Propiedades',
'proveedor' => 'Proveedor',
'proveedorList' => 'Lista de Proveedores',
'proveedores' => 'Proveedores',
'provinciaId' => 'Provincia',
'razonSocial' => 'Razón Social',
'telefono' => 'Teléfono',
'tipoId' => 'Tipo',
'updatedAt' => 'Updated At',
'validation' => [
'cif' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'ciudad' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'cp' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'direccion' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'persona_contacto' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'razon_social' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'telefono' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
],
'email' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
'valid_email' => 'El campo {field} debe contener una dirección de correo válida.',
],
'nombre' => [
'max_length' => 'El campo {field} no puede exceder de {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'tipo' => [
'required' => 'El campo {field} es obligatorio.',
],
],
];

View File

@ -9,12 +9,12 @@ return [
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'precioUnidad' => 'Precio Unidad',
'paginasMax' => 'Páginas Max',
'paginasMin' => 'Páginas Min',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'margen' => 'Margen',
'validation' => [
'error_paginas_overlap' => 'El rango [Páginas Min, Páginas Max] se solapa con otro existente para el tipo seleccionado.',
'error_paginas_range' => 'El campo Páginas Min debe ser menor que el campo Páginas Max',
'error_tirada_overlap' => 'El rango [Tirada Min, Tirada Max] se solapa con otro existente para el tipo seleccionado.',
'error_tirada_range' => 'El campo Tirada Min debe ser menor que el campo Tirada Max',
'precio_max' => [
'decimal' => 'El campo debe contener un número decimal.',
'required' => 'El campo es obligatorio.',
@ -27,13 +27,13 @@ return [
],
'paginas_max' => [
'tirada_max' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',
],
'paginas_min' => [
'tirada_min' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',

View File

@ -11,8 +11,10 @@ return [
'precioUnidad' => 'Precio Unidad',
'paginasMax' => 'Páginas Max',
'paginasMin' => 'Páginas Min',
'moduleExplanation' => 'El número de páginas reflejado en este apartado se refiere por ejemplar, no al total del pedido',
'margen' => 'Margen',
'validation' => [
'error_seleccion_tiradas' => 'Debe seleccionar una línea de la tabla tiradas antes de crear un registro nuevo.',
'error_paginas_overlap' => 'El rango [Páginas Min, Páginas Max] se solapa con otro existente para el tipo seleccionado.',
'error_paginas_range' => 'El campo Páginas Min debe ser menor que el campo Páginas Max',
'precio_max' => [

View File

@ -0,0 +1,26 @@
<?php
return [
'id' => 'ID',
'moduleTitle' => 'Tiradas Tarifa Encuadernación',
'deleteLine' => 'el registro seleccionado',
'proveedor' => 'Proveedor',
'seleccion' => 'Selección',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'validation' => [
'error_tirada_overlap' => 'El rango [Tirada Min, Tirada Max] se solapa con otro existente para el tipo seleccionado.',
'error_tirada_range' => 'El campo Tirada Min debe ser menor que el campo Tirada Max',
'tirada_max' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',
],
'tirada_min' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',
],
],
];

View File

@ -9,12 +9,12 @@ return [
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'precioUnidad' => 'Precio Unidad',
'paginasMax' => 'Páginas Max',
'paginasMin' => 'Páginas Min',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'margen' => 'Margen',
'validation' => [
'error_paginas_overlap' => 'El rango [Páginas Min, Páginas Max] se solapa con otro existente para el tipo seleccionado.',
'error_paginas_range' => 'El campo Páginas Min debe ser menor que el campo Páginas Max',
'error_tirada_overlap' => 'El rango [Tirada Min, Tirada Max] se solapa con otro existente para el tipo seleccionado.',
'error_tirada_range' => 'El campo Tirada Min debe ser menor que el campo Tirada Max',
'precio_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',
@ -27,13 +27,13 @@ return [
],
'paginas_max' => [
'tirada_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',
],
'paginas_min' => [
'tirada_min' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',

View File

@ -11,6 +11,7 @@ return [
'nombre' => 'Nombre',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'tarifaacabado' => 'Tarifas Acabado',
'tarifaacabadoList' => 'Lista Tarifas Acabado',
'tarifasacabado' => 'Tarifas Acabado',

View File

@ -18,6 +18,7 @@ return [
'tarifasencuadernacion' => 'Tarifas Encuadernación',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'updatedAt' => 'Actualizado en',
'userCreatedId' => 'ID Usuario \"Creado en\"',
'userUpdateId' => 'ID Usuario \"Actualizado en\"',

View File

@ -13,6 +13,7 @@ return [
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'tarifamanipulado' => 'Tarifa Manipulado',
'tarifamanipuladoList' => 'Lista Tarifas Manipulado',
'tarifasmanipulado' => 'Tarifas Manipulado',

View File

@ -10,6 +10,7 @@ return [
'precio' => 'Precio/página',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'margen' => 'Margen',
'tarifapreimpresion' => 'Tarifa Preimpresión',
'tarifapreimpresionList' => 'Lista Tarifas Preimpresión',

View File

@ -0,0 +1,213 @@
<?php
namespace App\Models\Compras;
class ProveedorModel extends \App\Models\GoBaseModel
{
protected $table = "lg_proveedores";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.nombre",
1 => "t2.nombre",
];
protected $allowedFields = [
"nombre",
"tipo_id",
"razon_social",
"cif",
"direccion",
"cp",
"ciudad",
"provincia_id",
"pais_id",
"persona_contacto",
"email",
"telefono",
"is_deleted",
"deleted_at"
];
protected $returnType = "App\Entities\Compras\ProveedorEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"cif" => [
"label" => "Proveedores.cif",
"rules" => "trim|max_length[15]",
],
"tipo_id" => [
"label" => "Proveedores.tipoId",
"rules" => "required",
],
"ciudad" => [
"label" => "Proveedores.ciudad",
"rules" => "trim|max_length[255]",
],
"cp" => [
"label" => "Proveedores.cp",
"rules" => "trim|max_length[10]",
],
"direccion" => [
"label" => "Proveedores.direccion",
"rules" => "trim|max_length[255]",
],
"email" => [
"label" => "Proveedores.email",
"rules" => "trim|max_length[255]|valid_email|permit_empty",
],
"nombre" => [
"label" => "Proveedores.nombre",
"rules" => "trim|required|max_length[255]",
],
"persona_contacto" => [
"label" => "Proveedores.personaContacto",
"rules" => "trim|max_length[255]",
],
"razon_social" => [
"label" => "Proveedores.razonSocial",
"rules" => "trim|max_length[255]",
],
"telefono" => [
"label" => "Proveedores.telefono",
"rules" => "trim|max_length[60]",
],
];
protected $validationMessages = [
"cif" => [
"max_length" => "Proveedores.validation.cif.max_length",
],
"ciudad" => [
"max_length" => "Proveedores.validation.ciudad.max_length",
],
"cp" => [
"max_length" => "Proveedores.validation.cp.max_length",
],
"direccion" => [
"max_length" => "Proveedores.validation.direccion.max_length",
],
"email" => [
"max_length" => "Proveedores.validation.email.max_length",
"valid_email" => "Proveedores.validation.email.valid_email",
],
"nombre" => [
"max_length" => "Proveedores.validation.nombre.max_length",
"required" => "Proveedores.validation.nombre.required",
],
"tipo_id" => [
"required" => "Proveedores.validation.tipo.required",
],
"persona_contacto" => [
"max_length" => "Proveedores.validation.persona_contacto.max_length",
],
"razon_social" => [
"max_length" => "Proveedores.validation.razon_social.max_length",
],
"telefono" => [
"max_length" => "Proveedores.validation.telefono.max_length",
],
];
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
{
$sql =
"SELECT t1." .
$selcols .
", t2.nombre AS tipo, t3.nombre AS provincia, t4.nombre AS pais FROM " .
$this->table .
" t1 LEFT JOIN lg_proveedores_tipos t2 ON t1.tipo_id = t2.id LEFT JOIN lg_provincias t3 ON t1.provincia_id = t3.id LEFT JOIN lg_paises t4 ON t1.pais_id = t4.id";
if (!is_null($limit) && intval($limit) > 0) {
$sql .= " LIMIT " . intval($limit);
}
if (!is_null($offset) && intval($offset) > 0) {
$sql .= " OFFSET " . intval($offset);
}
$query = $this->db->query($sql);
$result = $query->getResultObject();
return $result;
}
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "")
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.razon_social AS razon_social, t1.cif AS cif, t1.direccion AS direccion, t1.cp AS cp, t1.ciudad AS ciudad, t1.persona_contacto AS persona_contacto, t1.email AS email, t1.telefono AS telefono, t2.nombre AS tipo, t3.nombre AS provincia, t4.nombre AS pais"
);
$builder->join("lg_proveedores_tipos t2", "t1.tipo_id = t2.id", "left");
$builder->join("lg_provincias t3", "t1.provincia_id = t3.id", "left");
$builder->join("lg_paises t4", "t1.pais_id = t4.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.razon_social", $search)
->orLike("t1.cif", $search)
->orLike("t1.direccion", $search)
->orLike("t1.cp", $search)
->orLike("t1.ciudad", $search)
->orLike("t1.persona_contacto", $search)
->orLike("t1.email", $search)
->orLike("t1.telefono", $search)
->orLike("t2.id", $search)
->orLike("t3.id", $search)
->orLike("t4.id", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo_id", $search)
->orLike("t1.razon_social", $search)
->orLike("t1.cif", $search)
->orLike("t1.direccion", $search)
->orLike("t1.cp", $search)
->orLike("t1.ciudad", $search)
->orLike("t1.provincia_id", $search)
->orLike("t1.pais_id", $search)
->orLike("t1.persona_contacto", $search)
->orLike("t1.email", $search)
->orLike("t1.telefono", $search)
->orLike("t2.nombre", $search)
->orLike("t3.nombre", $search)
->orLike("t4.nombre", $search)
->groupEnd();
}
public function getProvList(int $tipoId = -1){
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS value, t1.nombre AS label")
->where("tipo_id", $tipoId);
return $builder->get()->getResultObject();
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Models\Compras;
class ProveedorTipoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_proveedores_tipos";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "t1.id",
2 => "t1.nombre",
3 => "t1.created_at",
4 => "t1.updated_at",
];
protected $allowedFields = ["nombre"];
protected $returnType = "App\Entities\Compras\ProveedorTipoEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"nombre" => [
"label" => "LgProveedoresTipos.nombre",
"rules" => "trim|required|max_length[255]",
],
];
protected $validationMessages = [
"nombre" => [
"max_length" => "LgProveedoresTipos.validation.nombre.max_length",
"required" => "LgProveedoresTipos.validation.nombre.required",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "")
{
$builder = $this->db
->table($this->table . " t1")
->select("t1.id AS id, t1.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at");
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->groupEnd();
}
public function getTipoId(string $tipo = ""){
$builder = $this->db
->table($this->table . " t1")
->select("t1.id AS id")
->where("t1.nombre", $tipo);
$rows = $builder->get()->getResultObject();
if(sizeof($rows)>0)
return intval($rows[0]->id);
else
return -1;
}
}

View File

@ -37,7 +37,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
],
"tipo" => [
"label" => "MaquinasTarifasImpresions.tipo",
"rules" => "permit_empty|in_list[negro,color,negrohq,bicolor]",
"rules" => "permit_empty|in_list[negro,color,negrohq,bicolor,colorhq]",
],
"uso" => [
"label" => "MaquinasTarifasImpresions.uso",

View File

@ -13,16 +13,16 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.paginas_min",
1 => "t1.paginas_max",
0 => "t1.tirada_min",
1 => "t1.tirada_max",
2 => "t1.precio_min",
3 => "t1.precio_max",
4 => "t1.margen",
];
protected $allowedFields = [
"paginas_min",
"paginas_max",
"tirada_min",
"tirada_max",
"precio_min",
"precio_max",
"margen",
@ -53,11 +53,11 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
"label" => "TarifaAcabadoLineas.precioMin",
"rules" => "required|decimal",
],
"paginas_max" => [
"tirada_max" => [
"label" => "TarifaAcabadoLineas.tiradaMax",
"rules" => "required|integer",
],
"paginas_min" => [
"tirada_min" => [
"label" => "TarifaAcabadoLineas.tiradaMin",
"rules" => "required|integer",
],
@ -80,13 +80,13 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
"decimal" => "TarifaAcabadoLineas.validation.precio_min.decimal",
"required" => "TarifaAcabadoLineas.validation.precio_min.required",
],
"paginas_max" => [
"integer" => "TarifaAcabadoLineas.validation.paginas_max.integer",
"required" => "TarifaAcabadoLineas.validation.paginas_max.required",
"tirada_max" => [
"integer" => "TarifaAcabadoLineas.validation.tirada_max.integer",
"required" => "TarifaAcabadoLineas.validation.tirada_max.required",
],
"paginas_min" => [
"integer" => "TarifaAcabadoLineas.validation.paginas_min.integer",
"required" => "TarifaAcabadoLineas.validation.paginas_min.required",
"tirada_min" => [
"integer" => "TarifaAcabadoLineas.validation.tirada_min.integer",
"required" => "TarifaAcabadoLineas.validation.tirada_min.required",
],
"margen" => [
"integer" => "TarifaAcabadoLineas.validation.margen.integer",
@ -131,7 +131,7 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.paginas_min AS paginas_min, t1.paginas_max AS paginas_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.margen AS margen, t2.id AS tarifa_acabado"
"t1.id AS 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.margen AS margen, t2.id AS tarifa_acabado"
);
//JJO
@ -145,12 +145,12 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
? $builder
: $builder
->groupStart()
->like("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->like("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->groupEnd();
@ -172,13 +172,13 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
helper('general');
if(floatval($data["paginas_min"])>= floatval($data["paginas_max"])){
return lang('TarifaAcabadoLineas.validation.error_paginas_range');
if(floatval($data["tirada_min"])>= floatval($data["tirada_max"])){
return lang('TarifaAcabadoLineas.validation.error_tirada_range');
}
$rows = $this->db
->table($this->table)
->select("id, paginas_min, paginas_max")
->select("id, tirada_min, tirada_max")
->where("is_deleted", 0)
->where("tarifa_acabado_id", $id_tarifa_acabado)
->get()->getResultObject();
@ -190,9 +190,9 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
continue;
}
}
if(check_overlap(floatval($data["paginas_min"]), floatval($data["paginas_max"]),
$row->paginas_min, $row->paginas_max)){
return lang('TarifaAcabadoLineas.validation.error_paginas_overlap');
if(check_overlap(floatval($data["tirada_min"]), floatval($data["tirada_max"]),
$row->tirada_min, $row->tirada_max)){
return lang('TarifaAcabadoLineas.validation.error_tirada_overlap');
}
}

View File

@ -20,7 +20,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
];
protected $allowedFields = [
"tarifa_encuadernacion_id",
"tirada_encuadernacion_id",
"paginas_min",
"paginas_max",
"precio_min",
@ -29,7 +29,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
"is_deleted",
];
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoLinea";
protected $returnType = "App\Entities\Tarifas\TarifaEncuadernacionLinea";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
@ -38,51 +38,51 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
protected $updatedField = "updated_at";
public static $labelField = "tarifa_encuadernacion_id";
public static $labelField = "tirada_encuadernacion_id";
protected $validationRules = [
"precio_max" => [
"label" => "TarifaManipuladoLineas.precioMax",
"label" => "TarifaEncuadernacionLineas.precioMax",
"rules" => "required|decimal",
],
"precio_min" => [
"label" => "TarifaManipuladoLineas.precioMin",
"label" => "TarifaEncuadernacionLineas.precioMin",
"rules" => "required|decimal",
],
"paginas_max" => [
"label" => "TarifaManipuladoLineas.paginasMax",
"label" => "TarifaEncuadernacionLineas.paginasMax",
"rules" => "required|decimal",
],
"paginas_min" => [
"label" => "TarifaManipuladoLineas.paginasMin",
"label" => "TarifaEncuadernacionLineas.paginasMin",
"rules" => "required|decimal",
],
"margen" => [
"label" => "TarifaManipuladoLineas.margen",
"label" => "TarifaEncuadernacionLineas.margen",
"rules" => "required|decimal",
],
];
protected $validationMessages = [
"precio_max" => [
"decimal" => "TarifaManipuladoLineas.validation.precio_max.decimal",
"required" => "TarifaManipuladoLineas.validation.precio_max.required",
"decimal" => "TarifaEncuadernacionLineas.validation.precio_max.decimal",
"required" => "TarifaEncuadernacionLineas.validation.precio_max.required",
],
"precio_min" => [
"decimal" => "TarifaManipuladoLineas.validation.precio_min.decimal",
"required" => "TarifaManipuladoLineas.validation.precio_min.required",
"decimal" => "TarifaEncuadernacionLineas.validation.precio_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.precio_min.required",
],
"paginas_max" => [
"decimal" => "TarifaManipuladoLineas.validation.paginas_max.decimal",
"required" => "TarifaManipuladoLineas.validation.paginas_max.required",
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_max.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_max.required",
],
"paginas_min" => [
"decimal" => "TarifaManipuladoLineas.validation.paginas_min.decimal",
"required" => "TarifaManipuladoLineas.validation.paginas_min.required",
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_min.required",
],
"margen" => [
"decimal" => "TarifaManipuladoLineas.validation.margen.decimal",
"required" => "TarifaManipuladoLineas.validation.margen.required",
"decimal" => "TarifaEncuadernacionLineas.validation.margen.decimal",
"required" => "TarifaEncuadernacionLineas.validation.margen.required",
],
];
@ -93,18 +93,18 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "", $tarifa_encuadernacion_id = -1)
public function getResource(string $search = "", $tirada_encuadernacion_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id, t1.paginas_min AS paginas_min, t1.paginas_max AS paginas_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.margen AS margen, t2.id AS tarifa_encuadernacion"
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.paginas_min AS paginas_min, t1.paginas_max AS paginas_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.margen AS margen, t2.id AS tarifa_encuadernacion"
);
//JJO
$builder->where('tarifa_encuadernacion_id', $tarifa_encuadernacion_id);
$builder->where('tirada_encuadernacion_id', $tirada_encuadernacion_id);
$builder->where("t1.is_deleted", 0);
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernacion_id = t2.id", "left");
$builder->join("tarifa_encuadernacion_tiradas t2", "t1.tirada_encuadernacion_id = t2.id", "left");
return empty($search)
@ -112,13 +112,13 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.tarifa_encuadernacion_id", $search)
->orLike("t1.tirada_encuadernacion_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.id", $search)
->orLike("t1.tarifa_encuadernacion_id", $search)
->orLike("t1.tirada_encuadernacion_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.precio_min", $search)
@ -126,19 +126,19 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
->groupEnd();
}
public function checkIntervals($data = [], $id_linea = null, $id_tarifa_encuadernacion = null){
public function checkIntervals($data = [], $id_linea = null, $tirada_encuadernacion_id = null){
helper('general');
if(floatval($data["paginas_min"])>= floatval($data["paginas_max"])){
return lang('TarifaManipuladoLineas.validation.error_paginas_range');
return lang('TarifaEncuadernacionLineas.validation.error_paginas_range');
}
$rows = $this->db
->table($this->table)
->select("id, paginas_min, paginas_max")
->where("is_deleted", 0)
->where("tarifa_encuadernacion_id", $id_tarifa_encuadernacion)
->where("tirada_encuadernacion_id", $tirada_encuadernacion_id)
->get()->getResultObject();
@ -150,10 +150,22 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
}
if(check_overlap(floatval($data["paginas_min"]), floatval($data["paginas_max"]),
$row->paginas_min, $row->paginas_max)){
return lang('TarifaManipuladoLineas.validation.error_paginas_overlap');
return lang('TarifaEncuadernacionLineas.validation.error_paginas_overlap');
}
}
return "";
}
public function removeAllEncuadernacionLineas($tiradaId = -1, $datetime = null, $delete_flag=1){
$builder = $this->db
->table($this->table)
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
'is_deleted' => $delete_flag])
->where('tirada_encuadernacion_id',$tiradaId)
->update();
return $builder;
}
}

View File

@ -14,12 +14,17 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
const SORTABLE = [
0 => "t1.nombre",
1 => "t1.precio_min",
2 => "t1.importe_fijo",
3 => "t1.mostrar_en_presupuesto",
];
protected $allowedFields = [
"nombre",
"precio_min",
"importe_fijo",
"mostrar_en_presupuesto",
"deleted_at",
"is_deleted",
"user_created_id",
@ -76,7 +81,8 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo");
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre,
t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo, t1.mostrar_en_presupuesto AS mostrar_en_presupuesto");
//JJO
$builder->where("t1.is_deleted", 0);

View File

@ -0,0 +1,133 @@
<?php
namespace App\Models\Tarifas;
class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
{
protected $table = "tarifa_encuadernacion_tiradas";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "t3.nombre",
2 => "t1.tirada_min",
3 => "t1.tirada_max",
];
protected $allowedFields = [
"tarifa_encuadernacion_id",
"tirada_min",
"tirada_max",
"proveedor_id",
"user_created_id",
"user_updated_id",
"is_deleted",
"deleted_at",
];
protected $returnType = "App\Entities\Tarifas\TarifaEncuadernacionTirada";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "tarifa_encuadernacion_id";
protected $validationRules = [
"tirada_max" => [
"label" => "TarifaEncuadernacionTiradas.tiradaMax",
"rules" => "required|integer",
],
"tirada_min" => [
"label" => "TarifaEncuadernacionTiradas.tiradaMin",
"rules" => "required|integer",
]
];
protected $validationMessages = [
"tirada_max" => [
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_max.integer",
"required" => "TarifaEncuadernacionTiradas.validation.tirada_max.required",
],
"tirada_min" => [
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_min.integer",
"required" => "TarifaEncuadernacionTiradas.validation.tirada_min.required",
]
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "", $tarifa_encuadernacion_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id, t1.tirada_min AS tirada_min,
t1.tirada_max AS tirada_max, t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
);
//JJO
$builder->where('tarifa_encuadernacion_id', $tarifa_encuadernacion_id);
$builder->where("t1.is_deleted", 0);
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernacion_id = t2.id", "left");
$builder->join("lg_proveedores t3", "t1.proveedor_id = t3.id", "left");
return empty($search)
? $builder
: $builder
->groupStart()
->Like("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t3.nombre", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t3.nombre", $search)
->groupEnd();
}
public function checkIntervals($data = [], $id_tirada = null, $tarifa_encuadernacion_id = null){
helper('general');
if(floatval($data["tirada_min"])>= floatval($data["tirada_max"])){
return lang('TarifaEncuadernacionTiradas.validation.error_tirada_range');
}
$rows = $this->db
->table($this->table)
->select("id, tirada_min, tirada_max")
->where("is_deleted", 0)
->where("tarifa_encuadernacion_id", $tarifa_encuadernacion_id)
->where("proveedor_id", $data["proveedor_id"])
->get()->getResultObject();
foreach ($rows as $row) {
if (!is_null($id_tirada)){
if($row->id == $id_tirada){
continue;
}
}
if(check_overlap(floatval($data["tirada_min"]), floatval($data["tirada_max"]),
$row->tirada_min, $row->tirada_max)){
return lang('TarifaEncuadernacionTiradas.validation.error_tirada_overlap');
}
}
return "";
}
}

View File

@ -13,16 +13,16 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.paginas_min",
1 => "t1.paginas_max",
0 => "t1.tirada_min",
1 => "t1.tirada_max",
2 => "t1.precio_min",
3 => "t1.precio_max",
];
protected $allowedFields = [
"tarifa_manipulado_id",
"paginas_min",
"paginas_max",
"tirada_min",
"tirada_max",
"precio_min",
"precio_max",
"user_created_id",
@ -49,12 +49,12 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
"label" => "TarifaManipuladoLineas.precioMin",
"rules" => "required|decimal",
],
"paginas_max" => [
"label" => "TarifaManipuladoLineas.paginasMax",
"tirada_max" => [
"label" => "TarifaManipuladoLineas.tiradaMax",
"rules" => "required|decimal",
],
"paginas_min" => [
"label" => "TarifaManipuladoLineas.paginasMin",
"tirada_min" => [
"label" => "TarifaManipuladoLineas.tiradaMin",
"rules" => "required|decimal",
],
"margen" => [
@ -72,13 +72,13 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
"decimal" => "TarifaManipuladoLineas.validation.precio_min.decimal",
"required" => "TarifaManipuladoLineas.validation.precio_min.required",
],
"paginas_max" => [
"decimal" => "TarifaManipuladoLineas.validation.paginas_max.decimal",
"required" => "TarifaManipuladoLineas.validation.paginas_max.required",
"tirada_max" => [
"decimal" => "TarifaManipuladoLineas.validation.tirada_max.decimal",
"required" => "TarifaManipuladoLineas.validation.tirada_max.required",
],
"paginas_min" => [
"decimal" => "TarifaManipuladoLineas.validation.paginas_min.decimal",
"required" => "TarifaManipuladoLineas.validation.paginas_min.required",
"tirada_min" => [
"decimal" => "TarifaManipuladoLineas.validation.tirada_min.decimal",
"required" => "TarifaManipuladoLineas.validation.tirada_min.required",
],
"margen" => [
"decimal" => "TarifaManipuladoLineas.validation.margen.decimal",
@ -98,7 +98,7 @@ 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.paginas_min AS paginas_min, t1.paginas_max AS paginas_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.margen AS margen, t2.id AS tarifa_manipulado"
"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.margen AS margen, t2.id AS tarifa_manipulado"
);
//JJO
$builder->where('tarifa_manipulado_id', $tarifa_manipulado_id);
@ -113,14 +113,14 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
->groupStart()
->like("t1.id", $search)
->orLike("t1.tarifa_manipulado_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.id", $search)
->orLike("t1.tarifa_manipulado_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->groupEnd();
@ -130,13 +130,13 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
helper('general');
if(floatval($data["paginas_min"])>= floatval($data["paginas_max"])){
return lang('TarifaManipuladoLineas.validation.error_paginas_range');
if(floatval($data["tirada_min"])>= floatval($data["tirada_max"])){
return lang('TarifaManipuladoLineas.validation.error_tirada_range');
}
$rows = $this->db
->table($this->table)
->select("id, paginas_min, paginas_max")
->select("id, tirada_min, tirada_max")
->where("is_deleted", 0)
->where("tarifa_manipulado_id", $id_tarifa_manipulado)
->get()->getResultObject();
@ -148,9 +148,9 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel
continue;
}
}
if(check_overlap(floatval($data["paginas_min"]), floatval($data["paginas_max"]),
$row->paginas_min, $row->paginas_max)){
return lang('TarifaManipuladoLineas.validation.error_paginas_overlap');
if(check_overlap(floatval($data["tirada_min"]), floatval($data["tirada_max"]),
$row->tirada_min, $row->tirada_max)){
return lang('TarifaManipuladoLineas.validation.error_tirada_overlap');
}
}

View File

@ -14,12 +14,16 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
const SORTABLE = [
0 => "t1.nombre",
1 => "precio_min",
2 => "importe_fijo",
3 => "t1.mostrar_en_presupuesto",
];
protected $allowedFields = [
"nombre",
"precio_min",
"importe_fijo",
"mostrar_en_presupuesto",
"deleted_at",
"is_deleted",
"user_created_id",
@ -76,7 +80,8 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo");
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo
,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto");
//JJO
$builder->where("t1.is_deleted", 0);

View File

@ -16,12 +16,14 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
0 => "t1.nombre",
1 => "precio_min",
2 => "importe_fijo",
3 => "t1.mostrar_en_presupuesto",
];
protected $allowedFields = [
"nombre",
"precio_min",
"importe_fijo",
"mostrar_en_presupuesto",
"deleted_at",
"is_deleted",
"user_created_id",
@ -79,7 +81,7 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select(
"t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo"
"t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo, t1.mostrar_en_presupuesto AS mostrar_en_presupuesto"
);
//JJO

View File

@ -18,6 +18,7 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
"precio_min",
"importe_fijo",
"margen",
"mostrar_en_presupuesto",
"deleted_at",
"is_deleted",
"user_created_id",
@ -38,7 +39,7 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
"label" => "Tarifapreimpresion.nombre",
"rules" => "trim|required|max_length[255]",
],
"precio" => [
"precio_pagina" => [
"label" => "Tarifapreimpresion.precio",
"rules" => "required|decimal",
],
@ -61,7 +62,7 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
"max_length" => "Tarifapreimpresion.validation.nombre.max_length",
"required" => "Tarifapreimpresion.validation.nombre.required",
],
"precio" => [
"precio_pagina" => [
"decimal" => "Tarifapreimpresion.validation.precio.decimal",
"required" => "Tarifapreimpresion.validation.precio.required",
],

View File

@ -24,9 +24,7 @@ if (session()->has('error')) {
<?= $this->section('additionalInlineJs') ?>
function popAlert(message, alertType){
var alertClass = "alert-" + alertType;
var alertIcon = alertType == "success" ? "ti-check" : "ti-" + alertType;
function popAlert(message, alertClass, alertIcon){
var htmlString = `
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
<span class="alert-icon alert-icon-lg text-primary me-2">
@ -45,15 +43,15 @@ function popAlert(message, alertType){
}
function popSuccessAlert(successMsg){
popAlert(successMsg, "success");
popAlert(successMsg, "alert-success", "ti-check");
}
function popWarningAlert(warningMsg){
popAlert(warningMsg, "warning");
popAlert(warningMsg, "alert-warning", "ti-bell");
}
function popErrorAlert(errorMsg){
popAlert(errorMsg, "error");
popAlert(errorMsg, "alert-danger", "ti-ban");
}
<?php if (isset($successMessage) && $successMessage){ ?>

View File

@ -0,0 +1,117 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Proveedores.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" tabindex="1" maxLength="255" class="form-control" value="<?=old('nombre', $proveedorEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="razonSocial" class="form-label">
<?=lang('Proveedores.razonSocial') ?>
</label>
<input type="text" id="razonSocial" name="razon_social" tabindex="3" maxLength="255" class="form-control" value="<?=old('razon_social', $proveedorEntity->razon_social) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="direccion" class="form-label">
<?=lang('Proveedores.direccion') ?>
</label>
<input type="text" id="direccion" name="direccion" tabindex="5" maxLength="255" class="form-control" value="<?=old('direccion', $proveedorEntity->direccion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ciudad" class="form-label">
<?=lang('Proveedores.ciudad') ?>
</label>
<input type="text" id="ciudad" name="ciudad" tabindex="7" maxLength="255" class="form-control" value="<?=old('ciudad', $proveedorEntity->ciudad) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('Proveedores.paisId') ?>
</label>
<select id="paisId" name="pais_id" tabindex="9" class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('Proveedores.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$proveedorEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="email" class="form-label">
<?=lang('Proveedores.email') ?>
</label>
<input type="email" id="email" name="email" tabindex="11" maxLength="255" class="form-control" value="<?=old('email', $proveedorEntity->email) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="tipoId" class="form-label">
<?=lang('Proveedores.tipoId') ?>*
</label>
<select id="tipoId" name="tipo_id" tabindex="2" class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($proveedorTipoList) && is_array($proveedorTipoList) && !empty($proveedorTipoList) ) :
foreach ($proveedorTipoList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$proveedorEntity->tipo_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cif" class="form-label">
<?=lang('Proveedores.cif') ?>
</label>
<input type="text" id="cif" name="cif" tabindex="4" maxLength="15" class="form-control" value="<?=old('cif', $proveedorEntity->cif) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cp" class="form-label">
<?=lang('Proveedores.cp') ?>
</label>
<input type="text" id="cp" name="cp" tabindex="6" maxLength="10" class="form-control" value="<?=old('cp', $proveedorEntity->cp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="provinciaId" class="form-label">
<?=lang('Proveedores.provinciaId') ?>
</label>
<select id="provinciaId" name="provincia_id" tabindex="8" class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($provinciaList) && is_array($provinciaList) && !empty($provinciaList) ) :
foreach ($provinciaList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$proveedorEntity->provincia_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="personaContacto" class="form-label">
<?=lang('Proveedores.personaContacto') ?>
</label>
<input type="text" id="personaContacto" name="persona_contacto" tabindex="10" maxLength="255" class="form-control" value="<?=old('persona_contacto', $proveedorEntity->persona_contacto) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="telefono" class="form-label">
<?=lang('Proveedores.telefono') ?>
</label>
<input type="text" id="telefono" name="telefono" tabindex="12" maxLength="60" class="form-control" value="<?=old('telefono', $proveedorEntity->telefono) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,12 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('LgProveedoresTipos.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $proveedorTipoEntity->nombre) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,97 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="proveedorForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/compras/proveedores/_proveedorFormItems") ?>
</div><!-- /.card-body -->
<div class="pt-4">
<input type="submit"
class="btn btn-primary float-start me-sm-3 me-1"
name="save"
value="<?= lang("Basic.global.Save") ?>"
/>
<?= anchor(route_to("proveedorList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#tipoId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfProveedoresTipos") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#provinciaId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfProvincias") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,142 @@
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/backend/vuexy/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('Proveedores.proveedorList') ?></h3>
<?=anchor(route_to('newProveedor'), lang('Basic.global.addNew').' '.lang('Proveedores.proveedor'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfProveedores" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Proveedores.nombre') ?></th>
<th><?= lang('Proveedores.tipoId') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfProveedores').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
</div>
</td>`;
};
theTable = $('#tableOfProveedores').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 25,
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[0, 'asc']],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfProveedores') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'tipo' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/compras/proveedores/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/compras/proveedores/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

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

View File

@ -243,7 +243,8 @@
{label:'<?= lang('MaquinasTarifasImpresions.negro') ?>', value:'negro'},
{label:'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', value: 'negrohq'},
{label:'<?= lang('MaquinasTarifasImpresions.bicolor') ?>', value: 'bicolor'},
{label:'<?= lang('MaquinasTarifasImpresions.color') ?>', value: 'color'}
{label:'<?= lang('MaquinasTarifasImpresions.color') ?>', value: 'color'},
{label:'<?= lang('MaquinasTarifasImpresions.colorhq') ?>', value: 'colorhq'},
];
editor = new $.fn.dataTable.Editor( {
@ -405,6 +406,8 @@
return '<?= lang('MaquinasTarifasImpresions.bicolor') ?>';
else if (data=='color')
return '<?= lang('MaquinasTarifasImpresions.color') ?>';
else if (data=='colorhq')
return '<?= lang('MaquinasTarifasImpresions.colorhq') ?>';
}
},
{ 'data': 'precio' },

View File

@ -231,16 +231,9 @@
]
} );
editor.on( 'initCreate', function () {
if ($('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3){
Swal.fire({
title: '<?= lang('Basic.global.sweet.maxRowsReached') ?>',
icon: 'info',
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.Close') ?>',
});
popErrorAlert(<?= lang('Basic.global.sweet.maxRowsReached') ?>);
}
} );
@ -495,11 +488,7 @@
yeniden(json.<?= csrf_token() ?>);
if(json.error){
document.getElementById("check_" + json.data.papel_impresion_id).checked = false;
Swal.fire({
icon: 'error',
title: '<?= lang('Basic.global.sweet.error_tittle') ?>',
text: json.error,
});
popErrorAlert(json.error);
}
});
@ -511,8 +500,7 @@
.submit();
} );
// Para los calculos del precio
// Calculos del precio
$("#ancho").on('input', function () {
updateValue();
});
@ -546,22 +534,14 @@
$('#precioPliego').val(value2);
}
<?= $this->endSection() ?>
<?=$this->section('css') ?>
<?php /*
<link rel="stylesheet" href="<?= site_url('themes/vuexy/ccs/datatables-editor/editor.dataTables.min.css') ?>">
-*/ ?>
<link rel="stylesheet" href="https://editor.datatables.net/extensions/Editor/css/editor.dataTables.min.css">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
@ -570,8 +550,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.js') ?>"></script>
<?=$this->endSection() ?>

View File

@ -66,8 +66,7 @@
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfBrtip', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',

View File

@ -4,7 +4,7 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control"
value="<?= old('nombre', $tarifaacabadoEntity->nombre) ?>">
</div><!--//.mb-3 -->
@ -12,7 +12,7 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control"
<input type="text" id="precio_min" name="precio_min" class="form-control"
value="<?= old('precio_min', $tarifaacabadoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
@ -20,10 +20,20 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control"
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control"
value="<?= old('importe_fijo', $tarifaacabadoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaacabadoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifaacabado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,6 +1,7 @@
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
@ -44,12 +45,12 @@
<table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaAcabadoLineas.paginasMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.paginasMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.margen') ?></th>
<th></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
@ -79,10 +80,10 @@
const actionBtns = function(data) {
return `
<span class="edit"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></span>
<span class="cancel"></span>
<span class="remove"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></span>
`;
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
@ -96,11 +97,11 @@
table : "#tableOfTarifaacabadolineas",
idSrc: 'id',
fields: [ {
name: "paginas_min"
name: "tirada_min"
}, {
name: "precio_max"
}, {
name: "paginas_max"
name: "tirada_max"
}, {
name: "precio_min"
},{
@ -165,9 +166,9 @@
async: true,
}),
columns: [
{ 'data': 'paginas_min' },
{ 'data': 'tirada_min' },
{ 'data': 'precio_max' },
{ 'data': 'paginas_max' },
{ 'data': 'tirada_max' },
{ 'data': 'precio_min' },
{ 'data': 'margen' },
{
@ -193,7 +194,7 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
@ -205,9 +206,9 @@
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
@ -216,32 +217,29 @@
// Delete row
$('#tableOfTarifaacabadolineas').on( 'click', 'tbody span.remove', function (e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
editor
.create( false )
.edit( this.parentNode, false)
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
.set( 'is_deleted', 1 )
.submit();
}
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/tarifas/tarifaacabadolineas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
<?= $this->endSection() ?>
<?=$this->section('css') ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifaacabado.nombre') ?></th>
<th><?= lang('Tarifaacabado.precioMin') ?></th>
<th><?= lang('Tarifaacabado.importeFijo') ?></th>
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -89,10 +90,19 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [3];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifaacabado/edit/${$(this).attr('data-id')}`;
@ -115,7 +125,7 @@
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
popErrorAlert(jqXHR.responseJSON.messages.error);
})
}
});

View File

@ -1,26 +1,36 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control" value="<?=old('precio_min', $tarifaEncuadernacionEntity->precio_min) ?>">
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaEncuadernacionEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control" value="<?=old('importe_fijo', $tarifaEncuadernacionEntity->importe_fijo) ?>">
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaEncuadernacionEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaEncuadernacionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,6 +1,7 @@
<?= $this->include("themes/_commonPartialsBs/datatables") ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
@ -28,49 +29,80 @@
</div><!-- //.card -->
</div><!--//.col -->
<?php if($formAction == site_url('tarifas/tarifasencuadernacion/add')): ?>
<div class="accordion mt-3" id="accordionEncuadernacionLineas" style="visibility:hidden" >
<?php else: ?>
<div class="accordion mt-3" id="accordionEncuadernacionLineas" 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">
<h3><?= lang("TarifaEncuadernacionLineas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionLineas">
<div class="accordion-body">
<table id="tableOfTarifaencuadernacionlineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionLineas.paginasMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php if(str_contains($formAction, 'edit')): ?>
<div class="accordion mt-3" id="accordionEncuadernacionTiradas" style="visibility:visible" >
<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="#accordionTip2" aria-expanded="false" aria-controls="accordionTip2">
<h3><?= lang("TarifaEncuadernacionTiradas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionTiradas">
<div class="accordion-body">
<table id="tableOfTarifaencuadernaciontiradas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<div class="accordion mt-3" id="accordionEncuadernacionLineas" style="visibility:visible" >
<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">
<h3><?= lang("TarifaEncuadernacionLineas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionLineas">
<div class="accordion-body">
<p><?= lang("TarifaEncuadernacionLineas.moduleExplanation") ?></p>
<table id="tableOfTarifaencuadernacionlineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionLineas.paginasMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
</div><!--//.row -->
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS para general -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
const url = window.location.href;
const url_parts = url.split('/');
var id = -1;
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
@ -78,16 +110,59 @@
id = -1;
}
<?php if(str_contains($formAction, 'edit')): ?>
const actionBtns = function(data) {
return `
<span class="edit"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></span>
<span class="cancel"></span>
<span class="remove"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></span>
`;
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
if($(this).closest('table').attr('id').includes('tiradas')){
$(".btn-remove").attr('table', "tiradas");
}
else if($(this).closest('table').attr('id').includes('lineas')){
$(".btn-remove").attr('table', "lineas");
}
else{
$(".btn-remove").attr('table', );
}
});
editor = new $.fn.dataTable.Editor( {
var selected_tirada_id = -1;
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
if($(this).attr('table').includes('tiradas')){
remove_tiradas(dataId, row);
}
else if ($(this).attr('table').includes('lineas')){
remove_lineas(dataId, row);
}
}
});
<?php endif; ?>
<?= $this->endSection() ?>
<?php if(str_contains($formAction, 'edit')): ?>
<!------------------------------------------->
<!-- Código JS para tableOfTarifaencuadernacionlineas -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
var editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
headers: {
@ -107,7 +182,7 @@
}, {
name: "margen"
}, {
"name": "tarifa_encuadernacion_id",
"name": "tirada_encuadernacion_id",
"type": "hidden"
},{
"name": "deleted_at",
@ -119,13 +194,14 @@
]
} );
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['tarifa_encuadernacion_id'] = id;
d.data[0]['tirada_encuadernacion_id'] = selected_tirada_id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['tarifa_encuadernacion_id'] = id;
d.data[v]['tirada_encuadernacion_id'] = selected_tirada_id;
}
}
});
@ -136,6 +212,7 @@
yeniden(json.<?= csrf_token() ?>);
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {
theTable.clearPipeline();
@ -143,7 +220,7 @@
});
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable( {
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
@ -158,8 +235,8 @@
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
data: {
id_tarifaencuadernacion: id,
data: function ( d ) {
d.tirada_id = selected_tirada_id;
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@ -194,21 +271,223 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
},
action: function ( e, dt, node, config ) {
if(selected_tirada_id == -1){
popErrorAlert("<?= lang('TarifaEncuadernacionLineas.validation.error_seleccion_tiradas') ?>");
}
else{
formOptions= {
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
};
editor.inlineCreate(config.position, formOptions);
}
},
} ]
} );
// Activate an inline edit on click of a table cell
$('#tableOfTarifaencuadernacionlineas').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
function remove_lineas(dataId, row){
$.ajax({
url: `/tarifas/tarifaencuadernacionlineas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
});
}
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS para tableOfTarifaencuadernaciontiradas -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
// Definicion de la ultima columna de la tabla
const lastColNr2 = $('#tableOfTarifaencuadernaciontiradas').find("tr:first th").length - 1;
// Datatables Editor
var editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfTarifaencuadernaciontiradas",
idSrc: 'id',
fields: [ {
name: "proveedor_id",
"type": "select"
}, {
name: "tirada_min"
}, {
name: "tirada_max"
}, {
"name": "tarifa_encuadernacion_id",
"type": "hidden"
},{
name: "proveedor",
"type": "hidden"
}, {
"name": "deleted_at",
"type": "hidden"
},{
"name": "is_deleted",
"type": "hidden"
},
]
} );
// Generación de la lista de proveedores (id, nombre) para encuadernación
const suppliersList = <?php echo json_encode($proveedores); ?>;
editor2.field( 'proveedor_id' ).update( suppliersList );
editor2.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['tarifa_encuadernacion_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['tarifa_encuadernacion_id'] = id;
}
}
});
editor2.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor2.on( 'submitSuccess', function ( e, json, data, action ) {
theTable2.clearPipeline();
theTable2.draw();
});
// Tabla de tiradas
var theTable2 = $('#tableOfTarifaencuadernaciontiradas').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [ 0, "asc" ],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
select: true,
info: false,
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifaEncuadernacionTiradas') ?>',
data: {
id_tarifaencuadernacion: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ 'data': 'proveedor_id',
render: function(data, type, row, meta) {
var value = suppliersList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'tirada_min' },
{ 'data': 'tirada_max' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr2]
},
{"orderData": [ 0, 1 ], "targets": 1 },
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor2,
formOptions: {
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
// Obtener la id de la fila seleccionada o ponerla a -1 cuando no haya ninguna seleccionada
var selected_tirada_id = -1;
theTable2.on( 'select', function ( e, dt, type, indexes ) {
if ( type === 'row' ) {
selected_tirada_id = parseInt(theTable2.rows( indexes ).data().pluck( 'id' )[0]);
theTable.clearPipeline();
theTable.draw();
}
} );
theTable2.on( 'deselect', function ( e, dt, type, indexes ) {
if ( theTable2.rows( '.selected' ).count() == 0 ) {
selected_tirada_id = -1;
theTable.clearPipeline();
theTable.draw();
}
} );
// Activate an inline edit on click of a table cell
$('#tableOfTarifaencuadernaciontiradas').on( 'click', 'tbody span.edit', function (e) {
editor2.inline(
theTable2.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
@ -217,47 +496,44 @@
// Delete row
$('#tableOfTarifaencuadernacionlineas').on( 'click', 'tbody span.remove', function (e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
editor
.create( false )
.edit( this.parentNode, false)
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
.set( 'is_deleted', 1 )
.submit();
}
function remove_tiradas(dataId, row){
$.ajax({
url: `/tarifas/tarifaencuadernaciontiradas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable2.clearPipeline();
theTable2.row($(row)).invalidate().draw();
theTable.clearPipeline();
theTable.draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.statusText)
});
});
}
<?= $this->endSection() ?>
<?php endif; ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.js') ?>"></script>
<?=$this->endSection() ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifaencuadernacion.nombre') ?></th>
<th><?= lang('Tarifaencuadernacion.precioMin') ?></th>
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -89,10 +90,20 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [3];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifasencuadernacion/edit/${$(this).attr('data-id')}`;

View File

@ -4,23 +4,33 @@
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaManipuladoEntity->nombre) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaManipuladoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control" value="<?=old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -47,12 +47,12 @@
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaManipuladoLineas.paginasMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.paginasMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.margen') ?></th>
<th></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
@ -80,10 +80,10 @@
const actionBtns = function(data) {
return `
<span class="edit"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></span>
<span class="cancel"></span>
<span class="remove"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></span>
`;
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
@ -97,11 +97,11 @@
table : "#tableOfTarifamanipuladolineas",
idSrc: 'id',
fields: [ {
name: "paginas_min"
name: "tirada_min"
}, {
name: "precio_max"
}, {
name: "paginas_max"
name: "tirada_max"
}, {
name: "precio_min"
}, {
@ -166,9 +166,9 @@
async: true,
}),
columns: [
{ 'data': 'paginas_min' },
{ 'data': 'tirada_min' },
{ 'data': 'precio_max' },
{ 'data': 'paginas_max' },
{ 'data': 'tirada_max' },
{ 'data': 'precio_min' },
{ 'data': 'margen' },
{
@ -194,7 +194,7 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
@ -206,9 +206,9 @@
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
@ -243,6 +243,30 @@
}
});
});
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/tarifas/tarifamanipuladolineas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
<?= $this->endSection() ?>
<?=$this->section('css') ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifamanipulado.nombre') ?></th>
<th><?= lang('Tarifamanipulado.precioMin') ?></th>
<th><?= lang('Tarifamanipulado.importeFijo') ?></th>
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -88,15 +89,27 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [3];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifasmanipulado/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});

View File

@ -21,13 +21,13 @@
</label>
<input
type="number"
id="precio"
name="precio"
id="precio_pagina"
name="precio_pagina"
required
maxLength="31"
step="0.01"
class="form-control"
value="<?= old('precio', $tarifapreimpresionEntity->precio) ?>"
value="<?= old('precio', $tarifapreimpresionEntity->precio_pagina) ?>"
>
</div><!--//.mb-3 -->
@ -72,6 +72,22 @@
value="<?= old('margen', $tarifapreimpresionEntity->margen) ?>"
>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"
id="mostrar_en_presupuesto"
name="mostrar_en_presupuesto"
value="1"
class="form-check-input"<?= $tarifapreimpresionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>
>
<label for="mostrar_en_presupuesto" class="form-check-label">
<?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?>
</label>
</div>
</div>
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,4 +1,5 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">

View File

@ -20,6 +20,7 @@
<th><?= lang('Tarifapreimpresion.precioMin') ?></th>
<th><?= lang('Tarifapreimpresion.importeFijo') ?></th>
<th><?= lang('Tarifapreimpresion.margen') ?></th>
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -41,6 +42,9 @@
<td class="align-middle">
<?= esc($item->margen) ?>
</td>
<td class="align-middle">
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifapreimpresion', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>

View File

@ -73,7 +73,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-default-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.css') ?>"/>

View File

@ -77,7 +77,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->

View File

@ -77,7 +77,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.css') ?>"/>

View File

@ -77,7 +77,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->
@ -86,6 +86,8 @@ if (!empty($token) && $tfa == false) {
<!-- Page CSS -->
<?= $this->renderSection('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Helpers -->
<script src="<?= site_url('themes/vuexy/vendor/js/helpers.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/js/config.js') ?>"></script>

View File

@ -76,7 +76,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.css') ?>"/>

View File

@ -77,7 +77,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->

View File

@ -79,7 +79,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-default-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.css') ?>"/>

View File

@ -388,10 +388,10 @@
/**
* MENU PROVEEDORES
*/
if (count(getArrayItem($menus, 'name', 'Proveedor')) > 0): ?>
<!-- Providers -->
if (count(getArrayItem($menus, 'name', 'Proveedores')) > 0): ?>
<!-- Providers -->
<li class="menu-item">
<a href="<?= site_url("proveedores/proveedor") ?>" class="menu-link">
<a href="<?= site_url("compras/proveedores") ?>" class="menu-link">
<i class="menu-icon tf-icons ti ti-file-dollar"></i>
<div data-i18n="<?= lang("App.menu_proveedores") ?>"><?= lang("App.menu_proveedores") ?></div>
</a>

View File

@ -407,7 +407,7 @@
* MENU COMPRAS
*/
if (allowMenuSection($menus,
['Compras', 'Productos', 'Proveedor'], 'index')): ?>
['Compras', 'Productos', 'Proveedores'], 'index')): ?>
<!-- BUY -->
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
@ -436,7 +436,7 @@
<?php if (count($temp = getArrayItem($menus, 'name', 'Proveedor')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("servicios/proveedor") ?>" class="menu-link">
<a href="<?= site_url("compras/proveedores") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_proveedores") ?>"><?= lang("App.menu_proveedores") ?></div>
</a>
</li>

View File

@ -77,7 +77,7 @@ if (!empty($token) && $tfa == false) {
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/demo.css') ?>"/>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>"/>
<!-- Vendors CSS -->

View File

@ -1,5 +1,5 @@
/*
* demo.css
* safekat.css
* File include item demo only specific css only
******************************************************************************/

View File

@ -0,0 +1,15 @@
/* Overwrite datatables styles */
table.dataTable.table-striped > tbody > tr.odd.selected > * {
box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.5);
}
table.dataTable > tbody > tr.selected > * {
box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.5);
color: white;
}
table.dataTable.table-hover > tbody > tr.selected:hover > * {
box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.65);
}