mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
feat:errores presupuesto
This commit is contained in:
@ -23,8 +23,6 @@ class ConfigErrores extends BaseResourceController
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->errorPresupuestoModel = model(ErrorPresupuestoModel::class);
|
||||
}
|
||||
@ -32,11 +30,13 @@ class ConfigErrores extends BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||
}
|
||||
public function viewForm(int $error_presupuesto_id)
|
||||
{
|
||||
$this->errorPresupuestoModel->update($error_presupuesto_id, [
|
||||
"last_user_id" => auth()->user()->id
|
||||
]);
|
||||
return view(static::$viewPath . 'viewErrorPresupuestoForm', ["error_presupuesto_id" => $error_presupuesto_id]);
|
||||
}
|
||||
public function store()
|
||||
@ -60,10 +60,9 @@ class ConfigErrores extends BaseResourceController
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
$query = $this->errorPresupuestoModel->getQueryDatatable();
|
||||
return DataTable::of($query)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class ErrorPresupuesto extends Model
|
||||
"presupuesto_id" => $presupuesto_id,
|
||||
"presupuesto_user_id" => $presupuesto_user_id,
|
||||
"error" => $error,
|
||||
"datos" => json_encode($datos)
|
||||
"datos_presupuesto" => json_encode($datos)
|
||||
]);
|
||||
}
|
||||
public function updateComment(int $error_presupuesto_id, string $comment): bool
|
||||
@ -81,7 +81,8 @@ class ErrorPresupuesto extends Model
|
||||
"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_errores.datos_presupuesto",
|
||||
"presupuesto_errores.error",
|
||||
"presupuesto_errores.visto",
|
||||
"presupuesto_errores.comment",
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</div>
|
||||
<div class="col-md-2 overflow-hidden w-20">
|
||||
<label class="switch switch-square switch-lg">
|
||||
<input type="checkbox" class="switch-input" disabled>
|
||||
<input type="checkbox" class="switch-input" id="error-presupuesto-visto" name="visto" disabled>
|
||||
<span class="switch-toggle-slider">
|
||||
<span class="switch-on">
|
||||
<i class="ti ti-eye"></i>
|
||||
@ -44,15 +44,22 @@
|
||||
<textarea rows="10" class="form-control" id="datos-presupuesto"
|
||||
placeholder="Datos presupuesto" disabled></textarea>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3 overflow-hidden">
|
||||
<label for="error-presupuesto">Error</label>
|
||||
<textarea rows="10" class="form-control" id="error-presupuesto"
|
||||
placeholder="Error" disabled></textarea>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3 overflow-hidden">
|
||||
<label for="comments-presupuesto">Comentarios</label>
|
||||
<div class="input-group mb-3">
|
||||
<textarea rows="10" class="form-control" id="comments-presupuesto"
|
||||
placeholder="Comentarios"></textarea>
|
||||
<button class="btn btn-primary button-update-comment" type="button"><span
|
||||
class="ti ti-md ti-send" id="update-button-icon"></span></button>
|
||||
</div>
|
||||
<textarea rows="10" class="form-control" id="comments-presupuesto"
|
||||
placeholder="Comentarios"></textarea>
|
||||
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary button-update-comment w-100" type="button">
|
||||
<span class="ti ti-sm ti-send me-1" id="update-button-icon"></span>
|
||||
<span class="spinner-border me-1" role="status" aria-hidden="true" id="update-button-loader" hidden></span>
|
||||
<?= lang("App.global_save") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -11,7 +11,11 @@ class ErrorPresupuestoForm {
|
||||
this.inputDatos = this.item.find("#datos-presupuesto")
|
||||
this.inputComments = this.item.find("#comments-presupuesto")
|
||||
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
|
||||
this.updateBtnIcon = this.item.find("#update-button-icon")
|
||||
this.updateBtnIcon = this.item.find(".button-update-comment")
|
||||
this.checkVisto = this.item.find("#error-presupuesto-visto")
|
||||
this.loader = this.item.find("#update-button-loader")
|
||||
this.btnIcon = this.item.find("#update-button-icon")
|
||||
|
||||
}
|
||||
init() {
|
||||
this.item.on("click",".button-update-comment",this.handlePostErrorPresupuesto.bind(this))
|
||||
@ -32,10 +36,15 @@ class ErrorPresupuestoForm {
|
||||
this.inputPresupuestoUserId.val(data.data.presupuestoUser)
|
||||
this.inputDatos.val(data.data.datos)
|
||||
this.inputComments.val(data.data.comment)
|
||||
this.updateBtnIcon.removeClass()
|
||||
this.updateBtnIcon.addClass("ti ti-md ti-send")
|
||||
this.updateBtnIcon.prop("disabled",false)
|
||||
this.checkVisto.prop("checked",parseInt(data.data.visto) == 1 ? true : false)
|
||||
this.setLoader(false)
|
||||
|
||||
}
|
||||
setLoader(state = true){
|
||||
this.loader.prop("hidden",!state)
|
||||
this.btnIcon.prop("hidden",state)
|
||||
}
|
||||
handleGetErrorPresupuestoError(){}
|
||||
handlePostErrorPresupuesto()
|
||||
{
|
||||
@ -43,8 +52,8 @@ class ErrorPresupuestoForm {
|
||||
{
|
||||
"comments" : this.inputComments.val()
|
||||
}
|
||||
this.updateBtnIcon.removeClass()
|
||||
this.updateBtnIcon.addClass("spinner-border spinner-border-lg text-secondary")
|
||||
this.updateBtnIcon.prop("disabled",true)
|
||||
this.setLoader()
|
||||
const ajax = new Ajax(
|
||||
`/configuracion/errores-presupuesto/edit/${this.errorPresupuestoId}`,
|
||||
data,
|
||||
@ -55,8 +64,6 @@ class ErrorPresupuestoForm {
|
||||
ajax.post()
|
||||
}
|
||||
handlePostErrorPresupuestoSuccess(){
|
||||
this.updateBtnIcon.removeClass()
|
||||
this.updateBtnIcon.addClass("ti ti-md ti-check")
|
||||
|
||||
this.handleGetErrorPresupuesto()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user