Autocomplete Field Vertretung

Form with ISO fields for hours
Admin functionality for seeing Timelocks of uid in route
Backend with CI-Validations
Phrases
This commit is contained in:
ma0068
2026-01-21 10:59:16 +01:00
parent b5382b1bdf
commit c34ffedb42
7 changed files with 754 additions and 87 deletions
+1 -1
View File
@@ -25,6 +25,6 @@ class Zeitsperren extends Auth_Controller
'uid'=>getAuthUID(),
);
$this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'zeitsperren']);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'zeitsperren']);
}
}
@@ -24,7 +24,8 @@ class Zeitsperren extends FHCAPI_Controller
// Load language phrases
$this->loadPhrases([
'ui',
'person'
'person',
'zeitsperren'
]);
// Load models
@@ -32,10 +33,21 @@ class Zeitsperren extends FHCAPI_Controller
$this->load->model('ressource/Zeitsperretyp_model', 'ZeitsperretypModel');
$this->load->model('ressource/Erreichbarkeit_model', 'ErreichbarkeitModel');
$this->load->model('ressource/Stunde_model', 'StundeModel');
$this->load->model('ressource/Zeitaufzeichnung_model', 'ZeitaufzeichnungModel');
}
public function getZeitsperrenUser($uid)
{
//check if $uid is passedUser
$loggedInUser = getAuthUID();
if($loggedInUser != $uid) {
$this->load->library('PermissionLib');
$isAdmin = $this->permissionlib->isBerechtigt('admin');
if(!$isAdmin) {
$this->terminateWithError($this->p->t('ui', 'noAdmin'), self::ERROR_TYPE_GENERAL);
}
}
$result = $this->ZeitsperreModel->getZeitsperrenUser($uid);
if (isError($result)) {
@@ -75,7 +87,7 @@ class Zeitsperren extends FHCAPI_Controller
public function loadZeitsperre($zeitsperre_id)
{
$result = $this->ZeitsperreModel->addSelect(
$this->ZeitsperreModel->addSelect(
'campus.tbl_zeitsperre.*, typ.*,
ma.person_id AS ma_person_id, ma.vorname AS ma_vorname, ma.nachname AS ma_nachname,
ma.titelpre AS ma_titelpre, ma.titelpost AS ma_titelpost'
@@ -95,16 +107,25 @@ class Zeitsperren extends FHCAPI_Controller
public function add($mitarbeiter_uid)
{
$loggedInUser = getAuthUID();
if($mitarbeiter_uid != $loggedInUser)
$this->terminateWithError($this->p->t('ui', 'noPermission'), self::ERROR_TYPE_GENERAL);
$this->form_validation->set_rules('zeitsperretyp_kurzbz', 'Grund Zeitsperre', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Grund Zeitsperre'])
]);
$this->form_validation->set_rules('vondatum', 'VON-DATUM', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'VON-DATUM'])
$this->form_validation->set_rules('vondatum', 'VonDatum', 'required|is_valid_date', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'VonDatum']),
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum'])
]);
$this->form_validation->set_rules('bisdatum', 'BIS-DATUM', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'BIS-DATUM'])
$this->form_validation->set_rules('bisdatum', 'BisDatum', 'required|is_valid_date|callback_check_von_bis_datum|callback_check_diff_intval', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'BisDatum']),
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'BisDatum']),
'check_von_bis_datum' => $this->p->t('zeitsperre', 'error_VonDatumGroesserAlsBisDatum'),
'check_diff_intval' => $this->p->t('zeitsperre', 'error_zeitraumAuffallendHoch')
]);
if ($this->form_validation->run() == false)
@@ -123,10 +144,23 @@ class Zeitsperren extends FHCAPI_Controller
$vertretung_uid = $this->input->post('vertretung_uid');
$zeitsperretyp_kurzbz = $this->input->post('zeitsperretyp_kurzbz');
// $this->terminateWithError("for later: Stunden Timestamps: VON " . $vonIso . " BIS " . $bisIso, self::ERROR_TYPE_GENERAL);
//check if existing zeitsperre
$result = $this->ZeitsperreModel->getSperreByDate($mitarbeiter_uid, $vondatum, $vonstunde, true);
$data = $this->getDataOrTerminateWithError($result);
if(hasData($result))
{
$this->terminateWithError($this->p->t('zeitsperren', 'error_existingZeitsperre', ['typ'=> current($data)->zeitsperretyp_kurzbz]), self::ERROR_TYPE_GENERAL);
}
$uid = getAuthUID();
//check if existing zeitaufzeichnung
if(in_array($zeitsperretyp_kurzbz, Zeitsperre_model::BLOCKIERENDE_ZEITSPERREN))
{
$result = $this->ZeitsperreModel->existsZeitaufzeichnung($mitarbeiter_uid, $vondatum, $bisdatum);
if(hasData($result))
$this->terminateWithError($this->p->t('zeitsperren', 'error_existingZeitaufzeichnung'), self::ERROR_TYPE_GENERAL);
}
$result = $this->ZeitsperreModel->insert(
[
@@ -139,7 +173,7 @@ class Zeitsperren extends FHCAPI_Controller
'erreichbarkeit_kurzbz' => $erreichbarkeit_kurzbz,
'zeitsperretyp_kurzbz' => $zeitsperretyp_kurzbz,
'vertretung_uid' => $vertretung_uid,
'insertvon' => $uid,
'insertvon' => $loggedInUser,
'insertamum' => date('c'),
]
);
@@ -148,17 +182,156 @@ class Zeitsperren extends FHCAPI_Controller
$this->terminateWithSuccess($data);
}
public function update()
public function update($zeitsperre_id)
{
//check if loggedin User is owner of the zeitsperre
$loggedInUser = getAuthUID();
$result = $this->ZeitsperreModel->load($zeitsperre_id);
$data = $this->getDataOrTerminateWithError($result);
$uid = current($data)->mitarbeiter_uid;
if($uid != $loggedInUser)
$this->terminateWithError($this->p->t('ui', 'noPermission'), self::ERROR_TYPE_GENERAL);
if(!$zeitsperre_id)
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Zeitsperre_id']), self::ERROR_TYPE_GENERAL);
}
//get current params
$array_update = [
'bezeichnung',
'vondatum',
'vonstunde',
'bisdatum',
'bisstunde',
// 'vonISO', //Timestamp für Stunde
// 'bisISO', //Timestamp für Stunde
'erreichbarkeit_kurzbz',
'vertretung_uid',
'zeitsperretyp_kurzbz',
'mitarbeiter_uid',
];
$post = $this->input->post();
$update = [];
foreach ($array_update as $prop)
{
if (array_key_exists($prop, $post))
{
$update[$prop] = $post[$prop];
}
}
// Validation
$rulesDefined = false; //necessary, otherwise CI validation will always be triggered, even without rules
foreach ($update as $key => $val) {
switch ($key) {
case 'zeitsperretyp_kurzbz':
$this->form_validation->set_rules(
$key,
'Grund Zeitsperre',
'required',
['required' => $this->p->t('ui', 'error_fieldRequired', ['field'=>'Grund Zeitsperre'])]
);
$rulesDefined = true;
break;
case 'vondatum':
$this->form_validation->set_rules(
$key,
'VonDatum',
'required|is_valid_date',
[
'required' => $this->p->t('ui', 'error_fieldRequired', ['field'=>'VonDatum']),
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field'=>'VonDatum'])
]
);
$rulesDefined = true;
break;
case 'bisdatum':
$rules = 'required|is_valid_date';
if (array_key_exists('vondatum', $update)) {
$rules .= '|callback_check_von_bis_datum|callback_check_diff_intval';
}
$this->form_validation->set_rules(
$key,
'BisDatum',
$rules,
[
'required' => $this->p->t('ui', 'error_fieldRequired', ['field'=>'BisDatum']),
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field'=>'BisDatum']),
'check_von_bis_datum' => $this->p->t('zeitsperre', 'error_VonDatumGroesserAlsBisDatum'),
'check_diff_intval' => $this->p->t('zeitsperre', 'error_zeitraumAuffallendHoch')
]
);
$rulesDefined = true;
break;
}
}
if ($rulesDefined && $this->form_validation->run() == false) {
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
if(array_key_exists('vondatum', $post) || array_key_exists('bisdatum', $post))
{
$result = $this->ZeitsperreModel->load($zeitsperre_id);
$data = $this->getDataOrTerminateWithError($result);
$data = current($data);
$mitarbeiter_uid = array_key_exists('mitarbeiter_uid', $post) ? $update['mitarbeiter_uid'] : $data->mitarbeiter_uid;
$vondatum = array_key_exists('vondatum', $post) ? $update['vondatum'] : $data->vondatum;
$bisdatum = array_key_exists('bisdatum', $post) ? $update['bisdatum'] : $data->bisdatum;
$vonstunde = array_key_exists('vonstunde', $post) ? $update['vonstunde'] : $data->vonstunde;
$zeitsperretyp_kurzbz = array_key_exists('zeitsperretyp_kurzbz', $post) ? $update['zeitsperretyp_kurzbz'] : $data->zeitsperretyp_kurzbz;
$result = $this->ZeitsperreModel->getSperreByDate($mitarbeiter_uid, $vondatum, $vonstunde, true);
$data = $this->getDataOrTerminateWithError($result);
if(hasData($result))
{
$this->terminateWithError($this->p->t('zeitsperren', 'error_existingZeitsperre', ['typ'=> current($data)->zeitsperretyp_kurzbz]), self::ERROR_TYPE_GENERAL);
}
//check if existing zeitaufzeichnung
if(in_array($zeitsperretyp_kurzbz, Zeitsperre_model::BLOCKIERENDE_ZEITSPERREN))
{
$result = $this->ZeitsperreModel->existsZeitaufzeichnung($mitarbeiter_uid, $vondatum, $bisdatum);
if(hasData($result))
$this->terminateWithError($this->p->t('zeitsperren', 'error_existingZeitaufzeichnung'), self::ERROR_TYPE_GENERAL);
}
}
if (!empty($update)) {
$update['updatevon'] = $loggedInUser;
$update['updateamum'] = date('c');
$result = $this->ZeitsperreModel->update($zeitsperre_id, $update);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
else
$this->terminateWithSuccess("no update");
}
public function delete($zeitsperre_id)
{
if (!is_numeric($zeitsperre_id) || (int)$zeitsperre_id <= 0)
{
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Zeitsperre_id']), self::ERROR_TYPE_GENERAL);
}
//check if loggedin User is owner of the zeitsperre
$loggedInUser = getAuthUID();
$result = $this->ZeitsperreModel->load($zeitsperre_id);
$data = $this->getDataOrTerminateWithError($result);
$uid = current($data)->mitarbeiter_uid;
if($uid != $loggedInUser)
$this->terminateWithError($this->p->t('ui', 'noPermission'), self::ERROR_TYPE_GENERAL);
$result = $this->ZeitsperreModel->delete(
array('zeitsperre_id' => $zeitsperre_id)
);
@@ -169,4 +342,26 @@ class Zeitsperren extends FHCAPI_Controller
$this->terminateWithSuccess((getData($result) ?: []));
}
public function check_von_bis_datum($bisdatum)
{
$vondatum = $this->input->post('vondatum');
return $vondatum <= $bisdatum;
}
public function check_diff_intval($bisdatum)
{
$vondatum = $this->input->post('vondatum');
// Intervall in days
$vonTs = strtotime($vondatum);
$bisTs = strtotime($bisdatum);
$tage = ($bisTs - $vonTs) / 86400;
// if intervall > 14
return $tage <= 14;
}
}
@@ -12,6 +12,8 @@ class Zeitsperre_model extends DB_Model
$this->pk = 'zeitsperre_id';
}
const BLOCKIERENDE_ZEITSPERREN = ['Krank','Urlaub','ZA','DienstV','PflegeU','DienstF','CovidSB','CovidKS'];
/**
* Save or update Zeitsperre.
*
@@ -70,12 +72,17 @@ class Zeitsperre_model extends DB_Model
*
* @return array
*/
public function getZeitsperrenUser($uid, $bisgrenze=true)
public function getZeitsperrenUser($uid, $bisgrenze = true)
{
$qry = "
SELECT tbl_zeitsperre.*, tbl_zeitsperretyp.*, tbl_erreichbarkeit.farbe AS erreichbarkeit_farbe, tbl_erreichbarkeit.beschreibung AS erreichbarkeit_beschreibung
SELECT
tbl_zeitsperre.*, tbl_zeitsperretyp.*, tbl_erreichbarkeit.farbe AS erreichbarkeit_farbe,
tbl_erreichbarkeit.beschreibung AS erreichbarkeit_beschreibung,
CONCAT (ps.vorname, ' ', ps.nachname) as vertretung
FROM (campus.tbl_zeitsperre JOIN campus.tbl_zeitsperretyp USING (zeitsperretyp_kurzbz))
LEFT JOIN campus.tbl_erreichbarkeit USING (erreichbarkeit_kurzbz)
LEFT JOIN public.tbl_benutzer ON campus.tbl_zeitsperre.vertretung_uid = public.tbl_benutzer.uid
LEFT JOIN public.tbl_person ps USING (person_id)
WHERE mitarbeiter_uid= ?
";
@@ -91,6 +98,93 @@ class Zeitsperre_model extends DB_Model
$qry.= " ORDER BY vondatum DESC";
return $this->execQuery($qry, array('mitarbeiter_uid' => $uid));
return $this->execQuery($qry, array('mitarbeiter_uid' => $uid));
}
/**
* check a date for existing zeitsperre
*
* @param $uid mitarbeiteruid
* @param $datum datum to check
* @param $stunde stunde (default = null)
* @param bool $nurblockierend if only hr relevante zeitsperren have to be checked
*
* @return array
*/
public function getSperreByDate($uid, $datum, $stunde = null, $nurblockierend = false)
{
$parametersArray = [$datum, $datum];
$qry = "
SELECT
*
FROM
campus.tbl_zeitsperre
WHERE
vondatum <= ?
AND bisdatum>= ?";
if($nurblockierend)
{
$qry .= " AND zeitsperretyp_kurzbz IN ('"
. implode("','", self::BLOCKIERENDE_ZEITSPERREN)
. "')";
}
if(!is_null($stunde))
{
$parametersArray = array_merge(
$parametersArray,
[$datum, $stunde, $datum, $datum, $stunde, $datum]
);
$qry.=" AND
((vondatum= ? AND vonstunde<= ? OR vonstunde is null OR vondatum<> ?) AND
(bisdatum= ? AND bisstunde>= ? OR bisstunde is null OR bisdatum<> ?))";
}
array_push($parametersArray, $uid);
$qry .= "AND mitarbeiter_uid= ? ";
return $this->execQuery($qry, $parametersArray);
}
/**
* check a date for existing zeitsperre
*
* @param $uid mitarbeiteruid
* @param $vondatum datum in Format IS0
* @param $bisdatum datum in Format ISO
*
* @return array
*/
public function existsZeitaufzeichnung($uid, $vonDay, $bisDay)
{
try {
$from = new DateTime($vonDay);
$to = new DateTime($bisDay);
} catch (Exception $e) {
throw new Exception("Invalid date format");
}
//remove hour stamps
$from->setTime(0, 0, 0);
$to->setTime(0, 0, 0)->modify('+1 day');
$fromSql = $from->format('Y-m-d');
$toSql = $to->format('Y-m-d');
$params = [$uid, $fromSql, $toSql];
$qry = "
SELECT *
FROM campus.tbl_zeitaufzeichnung
WHERE uid = ?
AND start >= ?
AND ende < ? ";
$result = $this->execQuery($qry, $params);
return $result;
}
}
+10
View File
@@ -27,3 +27,13 @@
padding-left: 36px !important;
padding-right: 36px !important;
}
.info-feedback {
display: block;
font-size: 0.875em;
color: #0d6efd; /* Bootstrap primary */
}
.is-info {
border-color: #0d6efd;
}
+7 -1
View File
@@ -47,6 +47,13 @@ export default {
params
};
},
editZeitsperre(zeitsperre_id, params) {
return {
method: 'post',
url: '/api/frontend/v1/Zeitsperren/update/' + zeitsperre_id,
params
};
},
loadZeitsperre(zeitsperre_id) {
return {
method: 'get',
@@ -54,7 +61,6 @@ export default {
};
},
deleteZeitsperre(zeitsperre_id) {
console.log("zeitsperre_id " + zeitsperre_id);
return {
method: 'post',
url: '/api/frontend/v1/Zeitsperren/delete/' + zeitsperre_id
@@ -18,6 +18,7 @@ export default {
data(){
return {
uid: null,
statusNew: true,
timeRecordingLockedUntil: '2015-08-31', //TODO(Manu) check if needed
typesTimeLocks: ["Urlaub", "PflegeU", "ZA", "Krank", "DienstF", "DienstV", "CovidSB", "CovidKS"],
typesHideStunden: ["Urlaub", "ZA", "Krank", "DienstF", "DienstV", "CovidSB", "CovidKS"],
@@ -26,6 +27,7 @@ export default {
listStunden: [],
tabulatorOptions: null,
tabulatorEvents: [],
originalData: {},
zeitsperreData: {
vondatum : new Date(),
bisdatum: new Date(),
@@ -36,6 +38,7 @@ export default {
vonstunde: null,
bisstunde: null
},
changedData: {},
selectedVertretung: null,
filteredMitarbeiter: [],
abortController: {
@@ -57,20 +60,18 @@ export default {
"Bundesheer": "i) " + this.$p.t('zeitsperren', 'bundesheer'),
"Volksschultag": "j) " + this.$p.t('zeitsperren', 'volksschultag')};
},
showInfo(){
return this.zeitsperreData.zeitsperretyp_kurzbz === 'DienstF';
},
},
methods: {
actionNewZeitsperre(){
console.log("actionNewZeitsperre ");
},
actionEditZeitsperre(zeitsperre_id){
console.log("actionEditZeitsperre " + zeitsperre_id);
this.statusNew = false;
return this.$api
.call(ApiTimelocks.loadZeitsperre(zeitsperre_id))
.then(response => {
console.log(response);
this.zeitsperreData = response.data;
//this.getMaData(this.zeitsperreData.mitarbeiter);
this.originalData = structuredClone(response.data);
this.zeitsperreData = structuredClone(response.data);
this.selectedVertretung = {
label: this.getPersonLabel(this.zeitsperreData.ma_titelpre, this.zeitsperreData.ma_nachname, this.zeitsperreData.ma_vorname, this.zeitsperreData.ma_titelpost, this.zeitsperreData.vertretung_uid),
@@ -90,16 +91,31 @@ export default {
.then(() => this.deleteZeitsperre(zeitsperre_id))
.catch(this.$fhcAlert.handleSystemError);
},
addZeitsperre(){
saveZeitsperre(zeitsperreId = null) {
const isNew = !zeitsperreId;
let payload = isNew
? { ...this.zeitsperreData } // add
: this.getChangedFields(this.originalData, // edit
this.zeitsperreData);
if (!isNew && Object.keys(payload).length === 0) {
return Promise.resolve();
}
const request = isNew
? ApiTimelocks.addZeitsperre(this.uid, payload)
: ApiTimelocks.editZeitsperre(zeitsperreId, payload);
return this.$refs.dataZeitsperre
.call(ApiTimelocks.addZeitsperre(this.uid, this.zeitsperreData))
.then(response => {
.call(request)
.then(() => {
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
})
.catch(this.$fhcAlert.handleSystemError)
.finally(() => {
this.reset();
this.reload();
});
})
.catch(this.$fhcAlert.handleSystemError);
},
deleteZeitsperre(zeitsperre_id){
return this.$api
@@ -149,6 +165,21 @@ export default {
if (this.$refs.table)
this.$refs.table.reloadTable();
},
reset(){
this.statusNew = true;
this.selectedVertretung = null;
this.zeitsperreData = {
vondatum : new Date(),
bisdatum: new Date(),
vonISO : "00:00:00", //later
bisISO: "23:59:59", //later
erreichbarkeit_kurzbz: 'n',
zeitsperretyp_kurzbz: 'Arzt',
vonstunde: null,
bisstunde: null
};
this.originalData = {};
},
handleChangeVonStunde(){
let stunde = this.zeitsperreData.vonstunde;
const result = this.listStunden.find(item => item.stunde === stunde);
@@ -162,21 +193,56 @@ export default {
let stunde = this.zeitsperreData.bisstunde;
const result = this.listStunden.find(item => item.stunde === stunde);
if (!result) {
this.zeitsperreData.vonISO = '23:59:59';
this.zeitsperreData.bisISO = '23:59:59';
return;
}
this.zeitsperreData.bisISO = result.ende;
}
},
handleStunden(){
if (this.typesHideStunden.includes(this.zeitsperreData.zeitsperretyp_kurzbz)){
this.zeitsperreData.vonstunde = null;
this.zeitsperreData.bisstunde = null;
this.zeitsperreData.vonISO = '00:00:00';
this.zeitsperreData.bisISO = '23:59:59';
}
},
copyDateForBis(){
this.zeitsperreData.bisdatum = this.zeitsperreData.vondatum;
},
getChangedFields(original, current) {
const diff = {};
Object.keys(current).forEach((key) => {
if (current[key] !== original[key]) {
diff[key] = current[key];
}
});
return diff;
},
},
watch: {
selectedVertretung(newVal) {
this.zeitsperreData.vertretung_uid = newVal?.mitarbeiter_uid || 'keine Vertretung';
this.zeitsperreData.vertretung_uid = newVal?.mitarbeiter_uid || null;
},
'zeitsperreData.zeitsperretyp_kurzbz'(newVal) {
if (newVal === 'DienstV') {
// set first key as default
if (!this.zeitsperreData.bezeichnung) {
const firstKey = Object.keys(this.dienstverhinderungen)[0];
this.zeitsperreData.bezeichnung = firstKey;
}
} else {
this.zeitsperreData.bezeichnung = '';
}
}
},
created() {
this.$api.call(ApiAuthinfo.getAuthUID()).then(res => {
this.uid = res.data.uid;
//TODO(Manu) check if uid via props is better
//check if there is a user, passed via route
const urlUid = this.$route?.query?.uid;
this.uid = urlUid ? urlUid : res.data.uid;
this.tabulatorOptions = {
ajaxURL: 'dummy',
ajaxRequestFunc: () =>
@@ -213,10 +279,18 @@ export default {
},
{title:"vonstunde", field:"vonstunde", visible: false},
{title:"bisstunde", field:"bisstunde", visible: false},
{title:"Vertretung", field:"vertretung_uid"},
{title:"Vertretung", field:"vertretung"},
{title:"Erreichbarkeit", field:"erreichbarkeit_beschreibung"},
{title:"zeitsperre_id", field:"zeitsperre_id", visible: false},
{title:"mitarbeiter_uid", field:"mitarbeiter_uid", visible: false},
{title:"freigabeamum", field:"freigabeamum", visible: false,
formatter: function (cell) {
const value = cell.getValue();
return value === null
? ''
: '<i class="fa fa-check text-success"></i>';
}
},
{title: 'Aktionen', field: 'actions',
minWidth: 150, // Ensures Action-buttons will be always fully displayed
formatter: (cell, formatterParams, onRendered) => {
@@ -245,7 +319,7 @@ export default {
button.title = this.$p.t('ui', 'loeschen');
button.addEventListener('click', () =>
//this.deleteZeitsperre(cell.getData().zeitsperre_id)
this.actionDeleteZeitsperre(cell.getData().zeitsperre_id) //TODO(Manu) not working with prompt
this.actionDeleteZeitsperre(cell.getData().zeitsperre_id)
);
if(cell.getData().zeitsperretyp_kurzbz == 'Urlaub' || cell.getData().zeitsperretyp_kurzbz == 'ZVerfueg'){
button.disabled = true;
@@ -262,6 +336,50 @@ export default {
},
]
};
this.tabulatorEvents = [
{
event: 'tableBuilt',
handler: async() => {
await this.$p.loadCategory(['global', 'person', 'zeitsperren', 'ui', 'abschlusspruefung']);
let cm = this.$refs.table.tabulator.columnManager;
cm.getColumnByField('bezeichnung').component.updateDefinition({
title: this.$p.t('person', 'grund')
});
cm.getColumnByField('beschreibung').component.updateDefinition({
title: this.$p.t('global', 'bezeichnung')
});
cm.getColumnByField('vondatum').component.updateDefinition({
title: this.$p.t('ui', 'von')
});
cm.getColumnByField('bisdatum').component.updateDefinition({
title: this.$p.t('global', 'bis')
});
cm.getColumnByField('vonstunde').component.updateDefinition({
title: this.$p.t('zeitsperren', 'stunde_von')
});
cm.getColumnByField('bisstunde').component.updateDefinition({
title: this.$p.t('zeitsperren', 'stunde_bis')
});
cm.getColumnByField('vertretung').component.updateDefinition({
title: this.$p.t('person', 'vertretung')
});
cm.getColumnByField('erreichbarkeit_beschreibung').component.updateDefinition({
title: this.$p.t('person', 'erreichbarkeit')
});
cm.getColumnByField('freigabeamum').component.updateDefinition({
title: this.$p.t('abschlusspruefung', 'freigabe')
});
/* cm.getColumnByField('actions').component.updateDefinition({
title: this.$p.t('global', 'aktionen')
});*/
}
}
];
});
this.$api
@@ -286,54 +404,33 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
},
/* created(){
this.$api
.call(ApiAuthinfo.getAuthUID())
.then(res => {
this.uid = res.data.uid;
});
},*/
/*
:label="$p.t('global/name')"
:new-btn-label="this.$p.t('profil', 'zeitsperren')"
{title:"bezeichnung", field:"bezeichnung"},
{title:"updateamum", field:"updateamum"},
{title:"updatevon", field:"updatevon"},
{title:"insertamum", field:"insertamum"},
{title:"insertvon", field:"insertvon"},
{title:"freigabevon", field:"freigabevon"},
{title:"freigabeamum", field:"freigabeamum"},
{{zeitsperreData}} <hr>
{{listTypenErreichbarkeit}}person
*/
template: /* html */`
<div class="zeitsperre">
<h4>Meine Zeitsperren ({{uid}}) </h4>
<h4>{{$p.t('zeitsperren', 'header_zeitsperren')}} ({{uid}}) </h4>
<form-form class="row g-3 mt-3" ref="dataZeitsperre">
<div class= "w-50">
<div class="row mb-3">
<form-input
type="select"
:class="showInfo ? 'is-info' : ''"
name="zeitsperretyp_kurzbz"
:label="$p.t('person/grund')"
v-model="zeitsperreData.zeitsperretyp_kurzbz"
@change="handleStunden"
>
<option
v-for="typ in listTypenZeitsperren"
:key="typ.zeitsperretyp_kurzbz"
:value="typ.zeitsperretyp_kurzbz"
:disabled="typ.zeitsperretyp_kurzbz == 'Urlaub'"
>
{{typ.beschreibung}}
</option>
</form-input>
<div v-if="showInfo" class="info-feedback">
<strong> Dienstfreistellungen</strong> nur in Absprache mit HR Service eintragen!
</div>
</div>
<div v-if="zeitsperreData.zeitsperretyp_kurzbz == 'DienstV'" class="row mb-3">
@@ -363,7 +460,7 @@ export default {
<div>
<div class="row">
<div class="mb-3 col-3">
<div class="mb-3 col-2">
<form-input
type="DatePicker"
name="vondatum"
@@ -379,13 +476,22 @@ export default {
>
</form-input>
</div>
<div class="mb-3 col-1 d-flex align-items-end">
<button
class="btn btn-outline-secondary"
title="Für Bis-Datum übernehmen"
@click.prevent="copyDateForBis"
>
<i class="fa-solid fa-arrow-down"></i>
</button>
</div>
<div class="mb-3 col-3">
<form-input
v-if="!typesHideStunden.includes(zeitsperreData.zeitsperretyp_kurzbz)"
type="select"
name="vonstunde"
label="vonstunde"
:label="$p.t('zeitsperren/stunde')"
v-model="zeitsperreData.vonstunde"
@change="handleChangeVonStunde"
>
@@ -398,6 +504,7 @@ export default {
{{std.stunde}} ({{std.beginn}} - {{std.ende}})
</option>
</form-input>
</div>
<!-- Uncomment to use timestamp VON
@@ -422,7 +529,7 @@ export default {
</div>
<div class="row">
<div class="mb-3 col-3">
<div class="mb-3 col-2">
<form-input
type="DatePicker"
name="bisdatum"
@@ -438,13 +545,14 @@ export default {
>
</form-input>
</div>
<div class="mb-3 col-1"></div>
<div class="mb-3 col-3">
<form-input
v-if="!typesHideStunden.includes(zeitsperreData.zeitsperretyp_kurzbz)"
type="select"
name="bisstunde"
label="bisstunde"
:label="$p.t('zeitsperren/stunde')"
v-model="zeitsperreData.bisstunde"
@change="handleChangeBisStunde"
>
@@ -518,10 +626,18 @@ export default {
<div class="mb-3 col-3">
<button
v-if="statusNew"
type="button"
class="btn btn-primary"
@click="addZeitsperre()">
Zeitsperre hinzufügen
@click="saveZeitsperre()">
{{$p.t('zeitsperren', 'addZeitsperre')}}
</button>
<button
v-else
type="button"
class="btn btn-warning"
@click="saveZeitsperre(zeitsperreData.zeitsperre_id)">
{{$p.t('zeitsperren', 'saveZeitsperre')}}
</button>
</div>
</div>
@@ -529,22 +645,28 @@ export default {
</div>
</form-form>
<div class="d-flex align-items-start text-muted small">
<i class="fa fa-circle-info me-2 mt-1"></i>
<div>
<strong>{{$p.t('alert', 'attention')}}</strong><br>
{{$p.t('zeitsperren', 'info_zeitsperrenMoreDays')}}
</div>
</div>
<hr>
<core-filter-cmpt
v-if="tabulatorOptions"
ref="table"
:tabulator-options="tabulatorOptions"
:tabulator-events="tabulatorEvents"
table-only
:side-menu="false"
reload
:reload-btn-infotext="this.$p.t('table', 'reload')"
new-btn-show
new-btn-label="Zeitsperre"
@click:new="actionNewZeitsperre"
>
v-if="tabulatorOptions"
ref="table"
:tabulator-options="tabulatorOptions"
:tabulator-events="tabulatorEvents"
table-only
:side-menu="false"
reload
:reload-btn-infotext="this.$p.t('table', 'reload')"
>
</core-filter-cmpt>
</div>
`
+243 -3
View File
@@ -53055,18 +53055,258 @@ I have been informed that I am under no obligation to consent to the transmissio
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'geburt222',
'phrase' => 'error_VonDatumGroesserAlsBisDatum',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Eigene Eheschließung oder Verpartnerung (3 Tage)',
'text' => 'VonDatum ist größer als BisDatum',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Own marriage or civil partnership (3 days)',
'text' => 'The start date is greater than the end date.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'error_zeitraumAuffallendHoch',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Achtung, eingegebener Zeitraum ist auffallend hoch. \nWollen Sie die Daten dennoch speichern?',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Attention, the entered time period is unusually long. Do you still want to save the data?',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'stunde',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Stunde(inklusive)',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Hour(inclusive)',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'stunde_von',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Stunde(von)',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'hour(from)',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'stunde_bis',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Stunde(bis)',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'hour(to)',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'addZeitsperre',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zeitsperre hinzufügen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'add Timelock',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'saveZeitsperre',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zeitsperre speichern',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'save Timelock',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'noAdmin',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Für diese Aktion benötigen Sie Administratorenrechte',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'You need administrator rights to perform this action.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'noPermission',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Sie haben keine Berechtigung, für einen anderen User einen Datensatz anzulegen, zu bearbeiten oder zu löschen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'You do not have permission to create, edit, or delete a record for another user.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'info_zeitsperrenMoreDays',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Es werden alle eingegebenen Tage bei der Berechnung berücksichtigt. Daher müssen mehrtägige Zeitsperren an Unterbrechungen wie Wochenenden oder Feiertagen unterteilt werden!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'All entered days will be included in the calculation. Therefore, multi-day time blocks must be broken down by breaks such as weekends or holidays!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'header_zeitsperren',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Meine Zeitsperren',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'My timelocks',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'error_existingZeitaufzeichnung',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Es existiert mindestens eine Zeitaufzeichnung im angegebenen Zeitraum',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'At least one time recording exists within the specified period.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'error_existingZeitsperre',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zeitsperre vom Typ {typ} vorhanden',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Time lock of type {type} exists',
'description' => '',
'insertvon' => 'system'
)