little style changes and adds name field to the public.tbl_cis_profil_update table

This commit is contained in:
SimonGschnell
2024-01-24 12:18:21 +01:00
parent 5f55834ccf
commit 20d6a34506
7 changed files with 39 additions and 22 deletions
+7 -2
View File
@@ -97,8 +97,13 @@ class Profil extends Auth_Controller
$payload = $json->payload;
$type = property_exists($json->payload,"kontakt_id")? "kontakt_id" : "adresse_id";
$data = ["topic"=>$json->topic,"uid" => $this->uid, "requested_change" => json_encode($payload), "change_timestamp" => "NOW()","status"=>"pending" ];
$name = $this->PersonModel->getFullName($this->uid);
if(isError($name)){
// error handling
var_dump($name);
return;
}
$data = ["topic"=>$json->topic,"uid" => $this->uid, "name"=>getData($name), "requested_change" => json_encode($payload), "change_timestamp" => "NOW()","status"=>"pending" ];
//? loops over all updateRequests from a user to validate if the new request is valid
$res = $this->ProfilChangeModel->loadWhere(["uid"=>$this->uid]);
@@ -51,6 +51,7 @@ class Profil_change_model extends DB_Model
$update->requested_change = json_decode($update->requested_change);
$update->change_timestamp = !is_null($update->change_timestamp)?date_create($update->change_timestamp)->format('d.m.Y'):null;
$update->status_timestamp = !is_null($update->status_timestamp)?date_create($update->status_timestamp)->format('d.m.Y'):null;
}
}
}
+4 -2
View File
@@ -18,12 +18,14 @@
height:22px;
width:21px;
background-color:white;
position:absolute;
top:0;
position:absolute;
/* top: 1px is important, otherwise it goes over the border of the thumbnail*/
top:1px;
right:12px;
display:flex;
align-items:center;
justify-content:center;
border-radius:3px;
}
.tabulator-collapsed-row{
+17 -10
View File
@@ -16,18 +16,10 @@ const app = Vue.createApp({
profil_updates_table_options:{
ajaxURL:FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/Cis/ProfilUpdate/getAllRequests',
height:300,
height:600,
layout:'fitColumns',
columns: [
{
title: "Topic",
field: "topic",
resizable: true,
minWidth: 200,
headerFilter: true,
//responsive:0,
},
{
title: "UID",
field: "uid",
@@ -36,7 +28,22 @@ const app = Vue.createApp({
headerFilter: true,
//responsive:0,
},
{
title: "Name",
field: "name",
minWidth: 200,
resizable:true,
headerFilter: true,
//responsive:0,
},
{
title: "Topic",
field: "topic",
resizable: true,
minWidth: 200,
headerFilter: true,
//responsive:0,
},
{
title: "Date",
field: "change_timestamp",
@@ -104,14 +104,14 @@ export default {
},
template:`
<div class="card">
<div class="card text-nowrap" >
<div class="card-header">
Profil Updates
</div>
<div class="card-body" >
<div class="table-responsive">
<table class="m-0 table table-hover">
<thead>
<thead >
<tr >
<th scope="col">Topic</th>
<th scope="col">Status</th>
@@ -125,7 +125,7 @@ export default {
<tbody>
<!-- :class="{'bg-success':item.status === 'accepted', 'bg-danger':item.status === 'rejected', 'text-white':item.status =='rejected' || item.status=='accepted'}" -->
<tr v-for="item in data" :style="item.status=='accepted'?'background-color:lightgreen':item.status==='rejected'?'background-color:lightcoral':''">
<td class="align-middle">{{item.topic}}</td>
<td class="align-middle text-wrap">{{item.topic}}</td>
<td class="align-middle text-center" >{{item.status}}</td>
<td class="align-middle">{{item.change_timestamp}}</td>
@@ -135,7 +135,7 @@ export default {
<td>
<template v-if="item.topic.toLowerCase().includes('delete')">
<div class="align-middle text-center"><i style="color:gray" role="button" @click="openModal(item)" class="fa fa-eye"></i></div>
<div class="align-middle text-center"><i role="button" @click="openModal(item)" class="fa fa-eye"></i></div>
</template>
<template v-else >
<div class="align-middle text-center" ><i style="color:#00639c" @click="openModal(item)" role="button" class="fa fa-edit"></i></div>
@@ -146,10 +146,10 @@ export default {
</td>
</template>
<template v-else-if="item.status === 'accepted'">
<td class="align-middle text-center"><i style="color:gray" role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
<td class="align-middle text-center"><i role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
</template>
<template v-else-if="item.status === 'rejected'">
<td class="align-middle text-center"><i style="color:gray" role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
<td class="align-middle text-center"><i role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
</template>
@@ -202,7 +202,7 @@ export default {
<div class="d-flex flex-row gap-2">
<input class="form-control " v-model="data.status_message" >
<button @click="acceptRequest" class="text-nowrap btn btn-primary">Accept <i class="fa fa-check"></i></button>
<button @click="acceptRequest" class="text-nowrap btn btn-success">Accept <i class="fa fa-check"></i></button>
<button @click="denyRequest" class="text-nowrap btn btn-danger">Deny <i class="fa fa-xmark"></i></button>
</div>
</div>
+3 -1
View File
@@ -4,8 +4,9 @@
{
$qry = "CREATE TABLE public.tbl_cis_profil_update (
profil_update_id INTEGER NOT NULL,
topic VARCHAR(32) NOT NULL,
uid VARCHAR(32) NOT NULL,
name TEXT NOT NULL,
topic VARCHAR(32) NOT NULL,
requested_change jsonb NOT NULL,
change_timestamp TIMESTAMP NOT NULL,
status VARCHAR(32) NOT NULL,
@@ -22,6 +23,7 @@
CACHE 1;
ALTER TABLE public.tbl_cis_profil_update ALTER COLUMN profil_update_id SET DEFAULT nextval('public.tbl_cis_profil_update_id_seq');
ALTER SEQUENCE public.tbl_cis_profil_update_id_seq OWNED BY public.tbl_cis_profil_update.profil_update_id;
ALTER TABLE public.tbl_cis_profil_update ADD CONSTRAINT tbl_cis_profil_update_restricted_status CHECK (status IN ('pending','accepted','rejected'));
--ALTER TABLE public.tbl_cis_profil_update ADD CONSTRAINT cis_profil_udpate_topic_uid_unique UNIQUE (uid,topic);