mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
guardando direcciones ferro en presupuesto cliente
This commit is contained in:
@ -215,13 +215,13 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
try {
|
||||
$resourceData = $this->model->getDireccion($id);
|
||||
$response = (object)[
|
||||
$response = (object) [
|
||||
'error' => false,
|
||||
'data' => $resourceData
|
||||
];
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $e) {
|
||||
$response = (object)[
|
||||
$response = (object) [
|
||||
'error' => true,
|
||||
'message' => $e->getMessage()
|
||||
];
|
||||
@ -229,22 +229,61 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getDireccionIdFromData()
|
||||
{
|
||||
$data = $this->request->getGet('data') ?? [];
|
||||
$cliente_id = $this->request->getGet('cliente_id') ?? -1;
|
||||
$att = $data['att'] ?? "";
|
||||
$direccion = $data['direccion'] ?? "";
|
||||
$cp = $data['cp'] ?? "";
|
||||
$municipio = $data['municipio'] ?? "";
|
||||
$provincia = $data['provincia'] ?? "";
|
||||
$pais_id = $data['pais_id'] ?? -1;
|
||||
$email = $data['email'] ?? "";
|
||||
$telefono = $data['telefono'] ?? "";
|
||||
try {
|
||||
$model = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||
$id = $model->select('id')
|
||||
->where('att', $att)
|
||||
->where('direccion', $direccion)
|
||||
->where('cp', $cp)
|
||||
->where('municipio', $municipio)
|
||||
->where('provincia', $provincia)
|
||||
->where('pais_id', $pais_id)
|
||||
->where('email', $email)
|
||||
->where('telefono', $telefono)
|
||||
->where('cliente_id', $cliente_id)
|
||||
->get()
|
||||
->getResultObject();
|
||||
|
||||
if (count($id) > 0) {
|
||||
$id = $id[0]->id;
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
return $id;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new \RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getDireccionPresupuesto($id)
|
||||
{
|
||||
try {
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$resourceData = $model->getDireccion($id);
|
||||
if(count($resourceData) > 0){
|
||||
if (count($resourceData) > 0) {
|
||||
$resourceData[0]->direccionId = $id;
|
||||
}
|
||||
|
||||
$response = (object)[
|
||||
|
||||
$response = (object) [
|
||||
'error' => false,
|
||||
'data' => $resourceData
|
||||
];
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $e) {
|
||||
$response = (object)[
|
||||
$response = (object) [
|
||||
'error' => true,
|
||||
'message' => $e->getMessage()
|
||||
];
|
||||
@ -400,11 +439,11 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
protected function getComunidadAutonomaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])];
|
||||
if (!is_null($selId)) :
|
||||
if (!is_null($selId)):
|
||||
$comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
|
||||
|
||||
$selOption = $comunidadAutonomaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
@ -414,11 +453,11 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
protected function getProvinciaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
|
||||
if (!empty($selId)) :
|
||||
if (!empty($selId)):
|
||||
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel');
|
||||
|
||||
$selOption = $provinciaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user