mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
first profil info edit template
This commit is contained in:
@@ -19,6 +19,7 @@ class Profil extends Auth_Controller
|
||||
'View' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
'foto_sperre_function' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
'getView' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
'editProfil' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
|
||||
]);
|
||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||
@@ -30,7 +31,7 @@ class Profil extends Auth_Controller
|
||||
$this->load->model('person/Benutzergruppe_model', 'BenutzergruppeModel');
|
||||
$this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel');
|
||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
||||
|
||||
$this->load->model('crm/Profil_change_model', 'ChangeModel');
|
||||
|
||||
//? put the uid and pid inside the controller for further usage in views
|
||||
$this->uid = getAuthUID();
|
||||
@@ -62,6 +63,23 @@ class Profil extends Auth_Controller
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editProfil(){
|
||||
|
||||
$json = $this->input->raw_input_stream;
|
||||
$data = ["uid"=>"karpenko", "profil_changes"=>$json, "change_timestamp"=>"NOW()"];
|
||||
//? gets the data inside the public.tbl_cis_profil_update
|
||||
//$res = json_encode($this->ChangeModel->load([$this->uid]));
|
||||
|
||||
//? inserts new row inside the public.tbl_cis_profil_update table
|
||||
$insert_res = json_encode($this->ChangeModel->insert($data));
|
||||
|
||||
echo $insert_res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function viewMitarbeiterProfil($uid){
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class Profil_change_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_cis_profil_update';
|
||||
$this->pk = ['uid'];
|
||||
$this->hasSequence = false;
|
||||
|
||||
//? loading other models to query them
|
||||
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* getLastStatuses
|
||||
*/
|
||||
public function getData($uid){
|
||||
|
||||
$res = $this->load($uid);
|
||||
$res = hasData($res) ? getData($res)[0] : null;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function insertData($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
//$res = hasData($res) ? getData($res)[0] : null;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
.image-lock{
|
||||
height:22px;
|
||||
width:21px;
|
||||
background-color:white;
|
||||
position:absolute;
|
||||
top:0;
|
||||
right:12px;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
}
|
||||
|
||||
.tabulator-collapsed-row{
|
||||
padding:15px;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
@@ -41,10 +53,10 @@
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
.fhc-form .form-control:focus{
|
||||
/* .fhc-form .form-control:focus{
|
||||
border-color:white;
|
||||
box-shadow:none;
|
||||
}
|
||||
} */
|
||||
|
||||
.fhc-form .form-floating > .form-control:focus ~ .floating-title, .form-floating > .form-control:not(:placeholder-shown) ~ .floating-title, .form-floating > .form-select ~ .floating-title{
|
||||
opacity: .65;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export default {
|
||||
|
||||
|
||||
editProfil: function(payload) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
`/Cis/Profil/editProfil`;
|
||||
return axios.post(url,payload);
|
||||
},
|
||||
|
||||
isMitarbeiterOrStudent: function(uid) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
|
||||
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
|
||||
import BsModal from "../../Bootstrap/Modal.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
BsModal,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
collapseIconFunktionen: true,
|
||||
collapseIconBetriebsmittel: true,
|
||||
//? this reactive object contains all the field the user is able to edit and keep track of which fields he has edited
|
||||
editData:null,
|
||||
funktionen_table_options: {
|
||||
height: 300,
|
||||
layout: "fitColumns",
|
||||
@@ -114,8 +118,64 @@ export default {
|
||||
},
|
||||
|
||||
//? this is the prop passed to the dynamic component with the custom data of the view
|
||||
props: ["data"],
|
||||
|
||||
props: {
|
||||
data: Object,
|
||||
|
||||
/*
|
||||
* NOTE(chris):
|
||||
* Hack to expose in "emits" declared events to $props which we use
|
||||
* in the v-bind directive to forward all events.
|
||||
* @see: https://github.com/vuejs/core/issues/3432
|
||||
|
||||
onHideBsModal: Function,
|
||||
onHiddenBsModal: Function,
|
||||
onHidePreventedBsModal: Function,
|
||||
onShowBsModal: Function,
|
||||
onShownBsModal: Function
|
||||
*/
|
||||
},
|
||||
/* mixins: [
|
||||
BsModal,
|
||||
|
||||
], */
|
||||
popup(options) {
|
||||
return BsModal.popup.bind(this)(null, options);
|
||||
},
|
||||
methods: {
|
||||
showModal() {
|
||||
this.$refs.bsmodal.show()
|
||||
},
|
||||
|
||||
hideModal() {
|
||||
// You can call the hide method of the modal component if needed
|
||||
this.$refs.bsmodal.hide();
|
||||
},
|
||||
|
||||
|
||||
insertEditData(){
|
||||
|
||||
|
||||
let editDataKeys = Object.keys(this.editData);
|
||||
let this_data = Object.entries(this.data).filter(([key,value])=>{
|
||||
return editDataKeys.includes(key);
|
||||
})
|
||||
|
||||
if(JSON.stringify(this_data) == JSON.stringify(Object.entries(this.editData))){
|
||||
|
||||
console.log("the editData contains the same information",JSON.stringify(this_data),"editData values:", JSON.stringify(Object.entries(this.editData)));
|
||||
}else{
|
||||
console.log("the editData HAS DIFFERENT INFORMATION");
|
||||
}
|
||||
|
||||
/* if(somethingChanged){
|
||||
console.log("the editData contains changed information");
|
||||
}else{
|
||||
console.log("the editData does not contain changed information");
|
||||
} */
|
||||
//? insert editData into a new row inside the public.tbl_cis_profil_update table
|
||||
//Vue.$fhcapi.UserData.editProfil(this.editData);
|
||||
},
|
||||
sperre_foto_function() {
|
||||
if (!this.data) {
|
||||
return;
|
||||
@@ -191,7 +251,7 @@ export default {
|
||||
return {
|
||||
Username: this.data.username,
|
||||
Anrede: this.data.anrede,
|
||||
Titel: this.data.titelpre,
|
||||
Titel: this.data.titel,
|
||||
Postnomen: this.data.postnomen,
|
||||
};
|
||||
},
|
||||
@@ -253,8 +313,26 @@ export default {
|
||||
};
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
this.editData = JSON.parse(
|
||||
JSON.stringify(
|
||||
{
|
||||
emails:this.data.emails,
|
||||
kontakte: this.data.kontakte,
|
||||
|
||||
personData : {...this.personData, vorname: this.data.vorname, nachname: this.data.nachname}
|
||||
}));
|
||||
|
||||
console.log(this.data.titelpre);
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
|
||||
this.$refs.betriebsmittelTable.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.betriebsmittelTable.tabulator.setData(this.data.mittel);
|
||||
});
|
||||
@@ -262,12 +340,18 @@ export default {
|
||||
this.$refs.funktionenTable.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.funktionenTable.tabulator.setData(this.data.funktionen);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
template: `
|
||||
|
||||
<div class="row"><div class="col"><pre>{{JSON.stringify(editData,null,2)}}</pre></div><div class="col"><pre>{{JSON.stringify(data.emails,null,2)}}</pre></div></div>
|
||||
|
||||
<div class="container-fluid text-break fhc-form" >
|
||||
<!-- ROW -->
|
||||
<div class="row">
|
||||
@@ -362,11 +446,11 @@ export default {
|
||||
<!-- LOCKING IMAGE FUNCTIONALITY -->
|
||||
|
||||
|
||||
<div role="button" @click.prevent="sperre_foto_function" style="height:22px; width:21px; background-color:white; position:absolute; top:0; right:12px; display:flex; align-items:center; justify-content:center;" >
|
||||
<div role="button" @click.prevent="sperre_foto_function" class="image-lock" >
|
||||
<i :class="{'fa':true, ...(data.foto_sperre?{'fa-lock':true}:{'fa-lock-open':true})} " ></i>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- END OF THE ROW WITH THE IMAGE -->
|
||||
@@ -461,7 +545,87 @@ export default {
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Bearbeiten Button -->
|
||||
<div class="col-md-6 col-sm-12 ">
|
||||
<button @click="showModal" type="button" class="text-start w-100 btn btn-outline-primary" >
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<i class="fa fa-edit"></i>
|
||||
</div>
|
||||
<div class="col-10">Bearbeiten</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<bs-modal ref="bsmodal" >
|
||||
<template v-slot:title>
|
||||
{{"Profil bearbeiten" }}
|
||||
</template>
|
||||
<template v-slot:default>
|
||||
|
||||
<!-- START OF THE ACCORDION -->
|
||||
|
||||
<!-- ACCORDEON 1 -->
|
||||
|
||||
|
||||
<div class="accordion accordion-flush" id="accordionFlushExample" v-for="ele in editData ">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="flush-headingOne">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
|
||||
Personen Daten
|
||||
</button>
|
||||
</h2>
|
||||
<!-- SHOWING ALL MAILS IN THE FIRST PART OF THE ACCORDION -->
|
||||
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
|
||||
<div class="accordion-body">
|
||||
|
||||
<div class="row gy-3">
|
||||
<div v-for="(wert,bez) in ele" class="col-12">
|
||||
<div class="form-underline ">
|
||||
<div class="form-underline-titel">
|
||||
<label :for="bez+'input'" >{{bez}}</label>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<input type="email" class="form-control" :id="bez+'input'" v-model="editData.personData[bez]" :placeholder="wert">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- -->
|
||||
|
||||
<!-- ACCORDEON 2 -->
|
||||
|
||||
<!-- -->
|
||||
|
||||
|
||||
<!-- END OF THE ACCORDION -->
|
||||
|
||||
</template>
|
||||
<!-- optional footer
|
||||
<template v-slot:footer>
|
||||
{{""}}
|
||||
</template>
|
||||
-->
|
||||
</bs-modal>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
props: ["editData"],
|
||||
methods: {
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
mounted() {
|
||||
console.log(this.editData);
|
||||
|
||||
|
||||
},
|
||||
|
||||
template: `
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="editProfil" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="editProfilLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="editProfilLabel">Edit Profil</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" @click="insertEditData" class="btn btn-primary">Understood</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- end of trying the modal -->
|
||||
|
||||
`,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -293,11 +293,11 @@ export default {
|
||||
<!-- LOCKING IMAGE FUNCTIONALITY -->
|
||||
|
||||
|
||||
<div role="button" @click.prevent="sperre_foto_function" style="height:22px; width:21px; background-color:white; position:absolute; top:0; right:12px; display:flex; align-items:center; justify-content:center;" >
|
||||
<div role="button" @click.prevent="sperre_foto_function" class="image-lock" >
|
||||
<i :class="{'fa':true, ...(data.foto_sperre?{'fa-lock':true}:{'fa-lock-open':true})} " ></i>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- END OF THE ROW WITH THE IMAGE -->
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once('dbupdate_3.4/30181_tabelle_anrechnung_neue_attribute_fuer_begruend
|
||||
require_once('dbupdate_3.4/29529_infocenter_anpassungen.php');
|
||||
require_once('dbupdate_3.4/29835_uhstat1_erfassung_der_uhstat1_daten_ueber_das_bewerbungstool.php');
|
||||
require_once('dbupdate_3.4/33714_erhoehter_studienbeitrag_fuer_drittsaatenangehoerig.php');
|
||||
|
||||
require_once('dbupdate_3.4/25999_C4_ma0594.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
@@ -221,6 +221,7 @@ $tabellen=array(
|
||||
"public.tbl_benutzerfunktion" => array("benutzerfunktion_id","fachbereich_kurzbz","uid","oe_kurzbz","funktion_kurzbz","semester", "datum_von","datum_bis", "updateamum","updatevon","insertamum","insertvon","ext_id","bezeichnung","wochenstunden"),
|
||||
"public.tbl_benutzergruppe" => array("uid","gruppe_kurzbz","studiensemester_kurzbz","updateamum","updatevon","insertamum","insertvon","ext_id"),
|
||||
"public.tbl_bewerbungstermine" => array("bewerbungstermin_id","studiengang_kz","studiensemester_kurzbz","beginn","ende","nachfrist","nachfrist_ende","anmerkung", "insertamum", "insertvon", "updateamum", "updatevon","studienplan_id","nationengruppe_kurzbz"),
|
||||
"public.tbl_cis_profil_update" => array("uid","profil_changes","change_timestamp"),
|
||||
"public.tbl_buchungstyp" => array("buchungstyp_kurzbz","beschreibung","standardbetrag","standardtext","aktiv","credit_points"),
|
||||
"public.tbl_dokument" => array("dokument_kurzbz","bezeichnung","ext_id","bezeichnung_mehrsprachig","dokumentbeschreibung_mehrsprachig","ausstellungsdetails"),
|
||||
"public.tbl_dokumentprestudent" => array("dokument_kurzbz","prestudent_id","mitarbeiter_uid","datum","updateamum","updatevon","insertamum","insertvon","ext_id"),
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
if(!$result = @$db->db_query("SELECT 1 FROM public.tbl_cis_profil_update LIMIT 1"))
|
||||
{
|
||||
$qry = "CREATE TABLE public.tbl_cis_profil_update (
|
||||
uid VARCHAR(32) NOT NULL,
|
||||
profil_changes jsonb NOT NULL,
|
||||
change_timestamp TIMESTAMP NOT NULL,
|
||||
CONSTRAINT tbl_cis_profil_update_pk PRIMARY KEY(uid),
|
||||
CONSTRAINT tbl_cis_profil_update_fk FOREIGN KEY(uid) REFERENCES public.tbl_benutzer(uid)
|
||||
);
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_cis_profil_update TO vilesci;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_cis_profil_update TO web;";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.tbl_cis_profil_update: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>public.tbl_cis_profil_update: table created';
|
||||
}
|
||||
|
||||
|
||||
if($db->db_num_rows($result)==0)
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_cis_profil_update(uid, profil_changes, change_timestamp) VALUES('ma0594', '{\"test\":\"data\"}', NOW());";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>Prüfungstyp: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>test eintrag in public.tbl_cis_profil_update hinzugefügt';
|
||||
}
|
||||
Reference in New Issue
Block a user