mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2
This commit is contained in:
@ -8,6 +8,7 @@ use CodeIgniter\Router\RouteCollection;
|
||||
//service('auth')->routes($routes, ['except' => ['login', 'register']]);
|
||||
service('auth')->routes($routes);
|
||||
|
||||
|
||||
//WEB ROUTER ------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
$routes->get('/', 'Home::index', ['as' => 'home']);
|
||||
@ -730,6 +731,7 @@ $routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presu
|
||||
|
||||
$routes->group('papel-formato', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']);
|
||||
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
|
||||
}
|
||||
);
|
||||
$routes->resource('papel-formato', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelformato', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
|
||||
@ -152,7 +154,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -310,10 +312,9 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
try {
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
}
|
||||
catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$menu = [];
|
||||
}
|
||||
|
||||
@ -339,15 +340,13 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null);
|
||||
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
// return $this->respond($menu);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -447,24 +446,23 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
protected function getPrecioTemplate($cliente_id){
|
||||
protected function getPrecioTemplate($cliente_id)
|
||||
{
|
||||
|
||||
$modelPreciosCliente = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$plantilla_id = $modelPreciosCliente->get_plantilla_precios($cliente_id);
|
||||
if (is_null($plantilla_id)){
|
||||
if (is_null($plantilla_id)) {
|
||||
return null;
|
||||
}
|
||||
$modelPlantillaPreciosCliente = model('App\Models\Clientes\ClientePlantillaPreciosModel');
|
||||
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("is_deleted", 0)->first();
|
||||
if ($plantilla == false){
|
||||
if ($plantilla == false) {
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return (object)array(
|
||||
"value" => $plantilla_id,
|
||||
"label" => $plantilla->nombre
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,4 +260,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$data = $this->model->getElementsForMenu2($this->request->getGet("q"));
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,8 +98,12 @@ class PapelFormatoModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS text"
|
||||
)->where('is_deleted', 0)->orderBy('orden_select', 'asc');
|
||||
"t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS name"
|
||||
)
|
||||
->where('is_deleted', 0)
|
||||
->where('id>', 0)
|
||||
->orderBy('orden_select', 'asc');
|
||||
|
||||
|
||||
return empty($search)
|
||||
? $builder->get()->getResultObject()
|
||||
|
||||
@ -18,7 +18,11 @@ let ClassSelect = function (domItem, url, placeholder, allowClear = false, param
|
||||
return this.url;
|
||||
},
|
||||
data: (params) => {
|
||||
let d = $.trim(params.term);
|
||||
let q = $.trim(params.term);
|
||||
let d = {
|
||||
q: q,
|
||||
page: params.page || 1,
|
||||
};
|
||||
|
||||
for (let key in this.params) {
|
||||
d[key] = this.params[key];
|
||||
|
||||
@ -9,7 +9,7 @@ class DatosGenerales {
|
||||
this.wizardStep = wizardForm.querySelector('#datos-generales');
|
||||
this.validatorStepper = validatorStepper;
|
||||
|
||||
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/menuitems', window.translations["formatoLibro"]);
|
||||
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/getSelect2', window.translations["formatoLibro"]);
|
||||
this.cliente = new ClassSelect($("#clienteId"), '/clientes/cliente/getSelect2', window.translations["selectCliente"]);
|
||||
|
||||
this.titulo = this.domItem.find("#titulo");
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
class SelectorTiradaEnvio {
|
||||
|
||||
constructor(container, id, tirada, precio_u) {
|
||||
|
||||
this.container = container;
|
||||
this.card = this.#generateHTML(id, tirada, precio_u);
|
||||
}
|
||||
|
||||
#generateHTML(id, tirada, precio_u) {
|
||||
|
||||
var $div = $('<div>', {
|
||||
id: id,
|
||||
class: 'form-check custom-option custom-option-basic custom-option-tiradasDirecciones'
|
||||
}).append(
|
||||
$('<label>', {
|
||||
class: 'form-check-label custom-option-content',
|
||||
for: 'tiradaEnvios1'
|
||||
}).append(
|
||||
$('<input>', {
|
||||
class: 'form-check-input',
|
||||
type: 'radio',
|
||||
value: '',
|
||||
}),
|
||||
$('<span>', { class: 'custom-option-header' }).append(
|
||||
$('<span>', {
|
||||
class: 'h6 mb-0',
|
||||
text: tirada
|
||||
}),
|
||||
$('<span>', {
|
||||
class: 'text-muted precio-tirada-envio',
|
||||
text: 'Total: ' + parseFloat(precio_u * tirada).toFixed(2) + '€'
|
||||
})
|
||||
),
|
||||
$('<span>', { class: 'custom-option-body' }).append(
|
||||
$('<small>', {
|
||||
text: precio_u + '€/ud'
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return $div;
|
||||
}
|
||||
}
|
||||
|
||||
export default SelectorTiradaEnvio;
|
||||
Reference in New Issue
Block a user