mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 00:54:27 +00:00
Added GUI for adding Bismeldestichtag
This commit is contained in:
@@ -14,19 +14,23 @@ class Bismeldestichtag extends Auth_Controller
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'admin:r'
|
||||
'index' => 'admin:r',
|
||||
'addBismeldestichtag' => 'admin:rw',
|
||||
'getStudiensemester' => 'admin:r'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads WidgetLib
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Load models
|
||||
$this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
// Loads phrases system
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'filter'
|
||||
'bismeldestichtag'
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -41,4 +45,64 @@ class Bismeldestichtag extends Auth_Controller
|
||||
{
|
||||
$this->load->view('codex/bismeldestichtag.php');
|
||||
}
|
||||
|
||||
public function getStudiensemester()
|
||||
{
|
||||
// load semester list
|
||||
$semList = array();
|
||||
$this->StudiensemesterModel->addSelect('studiensemester_kurzbz');
|
||||
$this->StudiensemesterModel->addOrder('start', 'DESC');
|
||||
$semRes = $this->StudiensemesterModel->load();
|
||||
|
||||
if (hasData($semRes))
|
||||
{
|
||||
$semList = getData($semRes);
|
||||
}
|
||||
|
||||
// load current semester
|
||||
$currSem = null;
|
||||
$semRes = $this->StudiensemesterModel->getAkt();
|
||||
|
||||
if (hasData($semRes))
|
||||
{
|
||||
$currSem = getData($semRes)[0]->studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
// output data
|
||||
$this->outputJsonSuccess(
|
||||
array('semList' => $semList, 'currSem' => $currSem)
|
||||
);
|
||||
}
|
||||
|
||||
public function addBismeldestichtag()
|
||||
{
|
||||
// get request data
|
||||
$request = $this->getPostJSON();
|
||||
|
||||
// check request data
|
||||
if (!property_exists($request, 'meldestichtag') || isEmptyString($request->meldestichtag))
|
||||
$this->terminateWithJsonError('Error occured: Meldestichtag missing');
|
||||
if (!property_exists($request, 'studiensemester_kurzbz') || isEmptyString($request->studiensemester_kurzbz))
|
||||
$this->terminateWithJsonError('Error occured: Studiensemester missing');
|
||||
|
||||
$meldestichtag = $request->meldestichtag;
|
||||
$studiensemester_kurzbz = $request->studiensemester_kurzbz;
|
||||
|
||||
// check if Bismeldestichtag already exists
|
||||
$this->BismeldestichtagModel->addSelect('1');
|
||||
$bismeldestichtagRes = $this->BismeldestichtagModel->loadWhere(
|
||||
array('meldestichtag' => $meldestichtag, 'studiensemester_kurzbz' => $studiensemester_kurzbz)
|
||||
);
|
||||
|
||||
// return success if already exists
|
||||
if (hasData($bismeldestichtagRes))
|
||||
$this->outputJsonSuccess('Bismeldestichtag already exists');
|
||||
else
|
||||
{
|
||||
// insert new if Stichtag does not exist
|
||||
$this->outputJson($this->BismeldestichtagModel->insert(
|
||||
array('meldestichtag' => $request->meldestichtag, 'studiensemester_kurzbz' => $request->studiensemester_kurzbz)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Bismeldestichtag_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'bis.tbl_bismeldestichtag';
|
||||
$this->pk = 'meldestichtag_id';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'Logs Viewer',
|
||||
'title' => 'Bismeldestichtage',
|
||||
'axios027' => true,
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true,
|
||||
@@ -8,34 +8,60 @@
|
||||
'filtercomponent' => true,
|
||||
'navigationcomponent' => true,
|
||||
'tabulator5' => true,
|
||||
'phrases' => array(
|
||||
'global' => array('mailAnXversandt'),
|
||||
'ui' => array('bitteEintragWaehlen')
|
||||
'customCSSs' => array(
|
||||
'public/css/components/verticalsplit.css'
|
||||
),
|
||||
'customJSModules' => array('public/js/apps/Bismeldestichtag/Bismeldestichtag.js')
|
||||
);
|
||||
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<!-- Load Studiensemester -->
|
||||
<div id="main">
|
||||
|
||||
<!-- Navigation component -->
|
||||
<core-navigation-cmpt v-bind:add-side-menu-entries="appSideMenuEntries"></core-navigation-cmpt>
|
||||
|
||||
<!-- fetch component -->
|
||||
<core-fetch-cmpt
|
||||
v-bind:api-function="fetchCmptApiFunction"
|
||||
v-bind:api-function-parameters="fetchCmptApiFunctionParams"
|
||||
v-bind:refresh="fetchCmptRefresh"
|
||||
@data-fetched="fetchCmptDataFetched">
|
||||
</core-fetch-cmpt>
|
||||
|
||||
<div id="content">
|
||||
<div>
|
||||
<!-- Filter component -->
|
||||
<core-filter-cmpt
|
||||
title="Bismeldestichtage verwalten"
|
||||
filter-type="Bismeldestichtag"
|
||||
:tabulator-options="bismeldestichtagTabulatorOptions"
|
||||
:tabulator-events="bismeldestichtagTabulatorEventHandlers"
|
||||
@nw-new-entry="newSideMenuEntryHandler">
|
||||
</core-filter-cmpt>
|
||||
<verticalsplit>
|
||||
<template #top>
|
||||
<!-- input fields -->
|
||||
<div class="input-group">
|
||||
<input type="date" class="form-control" name="meldestichtag" v-model="meldestichtag">
|
||||
<select class="form-control" name="studiensemester_kurzbz" v-model="currSem">
|
||||
<option v-for="sem in semList" :value="sem.studiensemester_kurzbz">
|
||||
{{ sem.studiensemester_kurzbz }}
|
||||
</option>
|
||||
</select>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-secondary" @click="handlerAddBismeldestichtag">
|
||||
<?php echo $this->p->t('bismeldestichtag', 'stichtagHinzufuegen') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #bottom>
|
||||
<!-- Filter component -->
|
||||
<core-filter-cmpt
|
||||
title="<?php echo $this->p->t('bismeldestichtag', 'stichtageVerwalten') ?>"
|
||||
filter-type="Bismeldestichtag"
|
||||
:tabulator-options="bismeldestichtagTabulatorOptions"
|
||||
:tabulator-events="bismeldestichtagTabulatorEventHandlers"
|
||||
@nw-new-entry="newSideMenuEntryHandler">
|
||||
</core-filter-cmpt>
|
||||
</template>
|
||||
</verticalsplit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user