copiada la rama presu_cliente_v2 en esta para poder hacer el merge al main

This commit is contained in:
2024-11-07 19:20:12 +01:00
parent aeb5f9106f
commit a880355012
84 changed files with 2983 additions and 1785 deletions

View File

@ -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 = [];
}
@ -330,6 +331,28 @@ class Cliente extends \App\Controllers\BaseResourceController
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$query = $this->model->builder()->select(
[
"id",
"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());
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getPaisListItems($selId = null)
{
$paisModel = model('App\Models\Configuracion\PaisModel');
@ -423,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
);
}
}
}