mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Mergeado
Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2
This commit is contained in:
@ -35,7 +35,8 @@ class ConfigErrores extends BaseResourceController
|
|||||||
public function viewForm(int $error_presupuesto_id)
|
public function viewForm(int $error_presupuesto_id)
|
||||||
{
|
{
|
||||||
$this->errorPresupuestoModel->update($error_presupuesto_id, [
|
$this->errorPresupuestoModel->update($error_presupuesto_id, [
|
||||||
"last_user_id" => auth()->user()->id
|
"last_user_id" => auth()->user()->id,
|
||||||
|
"visto" => true,
|
||||||
]);
|
]);
|
||||||
return view(static::$viewPath . 'viewErrorPresupuestoForm', ["error_presupuesto_id" => $error_presupuesto_id]);
|
return view(static::$viewPath . 'viewErrorPresupuestoForm', ["error_presupuesto_id" => $error_presupuesto_id]);
|
||||||
}
|
}
|
||||||
@ -47,9 +48,12 @@ class ConfigErrores extends BaseResourceController
|
|||||||
}
|
}
|
||||||
public function get_error_presupuesto(int $error_presupuesto_id)
|
public function get_error_presupuesto(int $error_presupuesto_id)
|
||||||
{
|
{
|
||||||
$data = $this->errorPresupuestoModel->getQueryDatatable()
|
$data = $this->errorPresupuestoModel->getErrorPresupuestoForm($error_presupuesto_id);
|
||||||
->where("presupuesto_errores.id", $error_presupuesto_id)->get()->getResultObject()[0];
|
if(isset($data[0])){
|
||||||
return $this->response->setJSON(["data" => $data]);
|
return $this->response->setJSON(["data" => $data[0]]);
|
||||||
|
}else{
|
||||||
|
return $this->response->setJSON(["data" => []]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function update_error_presupuesto(int $error_presupuesto_id)
|
public function update_error_presupuesto(int $error_presupuesto_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,6 +72,25 @@ class ErrorPresupuesto extends Model
|
|||||||
]);
|
]);
|
||||||
return $updated;
|
return $updated;
|
||||||
}
|
}
|
||||||
|
public function getErrorPresupuestoForm(int $error_presupuesto_id) : array
|
||||||
|
{
|
||||||
|
$query = $this->builder()
|
||||||
|
->select([
|
||||||
|
"presupuesto_errores.id",
|
||||||
|
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
|
||||||
|
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
|
||||||
|
"presupuesto_errores.created_at",
|
||||||
|
"presupuesto_errores.datos_presupuesto",
|
||||||
|
"presupuesto_errores.error",
|
||||||
|
"presupuesto_errores.visto",
|
||||||
|
"presupuesto_errores.comment"
|
||||||
|
])
|
||||||
|
->join("users t1", "t1.id = presupuesto_errores.presupuesto_user_id", "left")
|
||||||
|
->join("users t2", "t2.id = presupuesto_errores.last_user_id", "left")
|
||||||
|
->where("presupuesto_errores.deleted_at", null)
|
||||||
|
->where("presupuesto_errores.id",$error_presupuesto_id);
|
||||||
|
return $query->get()->getResultObject();
|
||||||
|
}
|
||||||
public function getQueryDatatable(): BaseBuilder
|
public function getQueryDatatable(): BaseBuilder
|
||||||
{
|
{
|
||||||
$query = $this->builder()
|
$query = $this->builder()
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3 overflow-hidden">
|
<div class="col-md-6 mb-3 overflow-hidden">
|
||||||
<label for="error-presupuesto">Error</label>
|
<label for="error-presupuesto">Error</label>
|
||||||
<textarea rows="10" class="form-control" id="error-presupuesto"
|
<textarea rows="10" class="form-control" id="error-presupuesto-text"
|
||||||
placeholder="Error" disabled></textarea>
|
placeholder="Error" disabled></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mb-3 overflow-hidden">
|
<div class="col-md-12 mb-3 overflow-hidden">
|
||||||
|
|||||||
@ -9,6 +9,7 @@ class ErrorPresupuestoForm {
|
|||||||
this.form = this.item.find("#error-presupuesto-form")
|
this.form = this.item.find("#error-presupuesto-form")
|
||||||
this.inputPresupuestoUserId = this.item.find("#presupuesto-user-id")
|
this.inputPresupuestoUserId = this.item.find("#presupuesto-user-id")
|
||||||
this.inputDatos = this.item.find("#datos-presupuesto")
|
this.inputDatos = this.item.find("#datos-presupuesto")
|
||||||
|
this.inputError = this.item.find("#error-presupuesto-text")
|
||||||
this.inputComments = this.item.find("#comments-presupuesto")
|
this.inputComments = this.item.find("#comments-presupuesto")
|
||||||
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
|
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
|
||||||
this.updateBtnIcon = this.item.find(".button-update-comment")
|
this.updateBtnIcon = this.item.find(".button-update-comment")
|
||||||
@ -33,8 +34,11 @@ class ErrorPresupuestoForm {
|
|||||||
ajax.get()
|
ajax.get()
|
||||||
}
|
}
|
||||||
handleGetErrorPresupuestoSuccess(data){
|
handleGetErrorPresupuestoSuccess(data){
|
||||||
|
const dataJson = JSON.parse(data.data.datos_presupuesto)
|
||||||
|
const error = data.data.error
|
||||||
this.inputPresupuestoUserId.val(data.data.presupuestoUser)
|
this.inputPresupuestoUserId.val(data.data.presupuestoUser)
|
||||||
this.inputDatos.val(data.data.datos)
|
this.inputDatos.val(JSON.stringify(dataJson,null,4))
|
||||||
|
this.inputError.val(error)
|
||||||
this.inputComments.val(data.data.comment)
|
this.inputComments.val(data.data.comment)
|
||||||
this.updateBtnIcon.prop("disabled",false)
|
this.updateBtnIcon.prop("disabled",false)
|
||||||
this.checkVisto.prop("checked",parseInt(data.data.visto) == 1 ? true : false)
|
this.checkVisto.prop("checked",parseInt(data.data.visto) == 1 ? true : false)
|
||||||
|
|||||||
Reference in New Issue
Block a user