migrates createAnrechnung to bootstrap 5 and tabulator 5

This commit is contained in:
SimonGschnell
2024-03-15 15:01:55 +01:00
parent 183cb1ac17
commit 5ecac3cb99
3 changed files with 76 additions and 50 deletions
@@ -5,11 +5,13 @@ $this->load->view(
'title' => $this->p->t('anrechnung', 'neueAnrechnung'),
'jquery3' => true,
'jqueryui1' => true,
'bootstrap3' => true,
'bootstrap5' => true,
'fontawesome4' => true,
'ajaxlib' => true,
'dialoglib' => true,
'tabulator4' => true,
'tabulator5' => true,
'tabulator5JQuery' => true,
'cis'=>true,
'tablewidget' => true,
'phrases' => array(
'global' => array(
@@ -42,20 +44,20 @@ $this->load->view(
<div class="container-fluid">
<!-- Title -->
<div class="row">
<div class="col-lg-12 page-header">
<h3>
<div class="row my-4">
<div class="col-12 border-bottom">
<h3 class="fw-normal">
<?php echo $this->p->t('anrechnung', 'neueAnrechnung'); ?>
<small>| <?php echo $this->p->t('global', 'antragAnlegen'); ?></small>
<small class="text-secondary fs-6">| <?php echo $this->p->t('global', 'antragAnlegen'); ?></small>
</h3>
</div>
</div>
<!-- Studiensemester Dropdown -->
<div class="row">
<div class="col-xs-12">
<form class="form-inline" action="" method="get">
<div class="form-group">
<div class="row my-4">
<div class="col-12">
<form class="row align-items-center" action="" method="get">
<div class="col-auto">
<?php
echo $this->widgetlib->widget(
'Studiensemester_widget',
@@ -64,13 +66,14 @@ $this->load->view(
),
array(
'name' => 'studiensemester',
'id' => 'studiensemester'
'id' => 'studiensemester',
'class'=>'form-select w-auto ',
)
);
?>
</div>
<button type="submit"
class="btn btn-default form-group">
class="btn btn-outline-secondary col-auto">
<?php echo ucfirst($this->p->t('ui', 'anzeigen')); ?>
</button>
</form>
@@ -78,29 +81,28 @@ $this->load->view(
</div>
<!-- StudentInnen Table -->
<div class="row">
<div class="col-lg-10">
<div class="row my-4">
<div class="col-10">
<?php $this->load->view('lehre/anrechnung/createAnrechnungData.php'); ?>
</div>
</div>
<br><br>
<!-- FORM START ------------------------------------------------------------------------------------------------------->
<form id="createAnrechnung-form">
<input name="prestudent_id" id="prestudent_id" type="hidden" value="" data-prestudent_id = "" >
<input name="studiensemester_kurzbz" id="studiensemester_kurzbz" type="hidden" value="<?php echo $studiensemester_selected ?>">
<div class="row">
<div class="col-lg-10">
<table class="table table-condensed table-bordered">
<div class="row my-4">
<div class="col-10">
<table class="table table-condensed table-bordered mb-0">
<!-- StudentIn -->
<tr>
<th class="col-xs-5 col-lg-2"><label><?php echo $this->p->t('person', 'studentIn'); ?></label></th>
<td><span id="student" class="pl-15"></span></td>
<th class="col-5 col-lg-2"><label><?php echo $this->p->t('person', 'studentIn'); ?></label></th>
<td><span id="student" class="ps-3"></span></td>
</tr>
<!-- Selectmenu Lehrveranstaltungen -->
<tr>
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?> *</th>
<th class="col-5 col-lg-2"><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?> *</th>
<td>
<select name="lehrveranstaltung_id" id="select-lehrveranstaltung" class="form-control select-w500">
<select name="lehrveranstaltung_id" id="select-lehrveranstaltung" class="form-select select-w500">
<option value="" <?php echo set_select('lehrveranstaltung', '', true); ?> >
<?php echo $this->p->t('ui', 'bitteWaehlen'); ?>
</option>
@@ -109,9 +111,9 @@ $this->load->view(
</tr>
<!-- Select Anrechnungbegruendungen -->
<tr>
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('global', 'begruendung'); ?> *</th>
<th class="col-5 col-lg-2"><?php echo $this->p->t('global', 'begruendung'); ?> *</th>
<td>
<select name="begruendung_id" id="select-begruendung" class="form-control select-w500">
<select name="begruendung_id" id="select-begruendung" class="form-select select-w500">
<option value="" <?php echo set_select('begruendung', '', true); ?> >
<?php echo $this->p->t('ui', 'bitteWaehlen'); ?>
</option>
@@ -126,7 +128,7 @@ $this->load->view(
</tr>
<!-- Submit Herkunft der Kenntnisse -->
<tr>
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></th>
<th class="col-5 col-lg-2"><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></th>
<td>
<?php echo form_textarea(array(
'name' => 'herkunftKenntnisse',
@@ -136,31 +138,27 @@ $this->load->view(
</tr>
<!-- Submit Upload Nachweisdokumente -->
<tr>
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?> *</th>
<td>
<div><?php echo form_upload(array(
'name' => 'uploadfile',
'accept' => '.pdf',
'size' => '50',
'required' => 'required',
'enctype' => "multipart/form-data"
)); ?>
</div>
<a class="pull-right" id="download-nachweisdokumente"></a>
<th class="col-5 col-lg-2 "><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?> *</th>
<td class="d-flex input-group align-items-center">
<input class="form-control flex-fill" type="file" id="requestAnrechnung-uploadfile"
name="uploadfile" accept=".pdf" size="50" data-maxsize="<?php echo (int)ini_get('upload_max_filesize') * 1024 * 1024 ?>"
required>
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-10">
<div class="row my-4">
<div class="col-10">
<!-- Submit Button -->
<button class="btn btn-primary btn-w200 pull-right" id="createAnrechnung-submit" type="submit" value="submit">
<button class="btn btn-primary btn-w200 float-end" id="createAnrechnung-submit" type="submit" value="submit">
<?php echo $this->p->t('global', 'antragAnlegen'); ?>
</button>
<!-- Open new Anrechnung Button (hidden by default) -->
<a type="button" class="btn btn-default btn-mr10 pull-right hidden" id="createAnrechnung-openAnrechnung" target="_blank"></a>
<a type="button" class="btn btn-outline-secondary me-1 float-end visually-hidden" id="createAnrechnung-openAnrechnung" target="_blank"></a>
</div>
</div>
@@ -56,17 +56,13 @@ $filterWidgetArray = array(
layout: "fitColumns", // fit columns to width of table
persistentLayout:true,
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
headerFilterPlaceholder: " ",
index: "prestudent_id", // assign specific column as unique id (important for row indexing)
selectable: 1, // allow row selection
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
rowSelected: function(row) {
func_rowSelected(row);
},
rowSelectionChanged:function(data, rows){
func_rowSelectionChanged(data, rows);
},
tableWidgetHeader: false
tableWidgetHeader: false,
columnDefaults:{
headerFilterPlaceholder: " ",
}
}',
'datasetRepFieldsDefs' => '{
prestudent_id: {visible: false, headerFilter:"input"},
+34 -2
View File
@@ -1,5 +1,16 @@
$(function () {
// tableInit is called in the jquery_wrapper when the tableBuilt event was finished
$(document).on("tableInit", function(event,tabulatorInstance) {
// event rowSelected needs to be attached as a callback to the tableBuilt event in tabulator5
$("#tableWidgetTabulator").tabulator("on","rowSelected",(row)=>{func_rowSelected(row)});
// event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
$("#tableWidgetTabulator").tabulator("on","rowSelectionChanged",(data,rows)=>{func_rowSelectionChanged(data,rows)});
});
// Disable all form fields by default
createAnrechnung.disableFormFields();
@@ -8,6 +19,13 @@ $(function () {
e.preventDefault();
var fileInput = $('#requestAnrechnung-uploadfile');
const uploadMaxFilesize = $('#requestAnrechnung-uploadfile').data('maxsize') ; // in byte
if (!createAnrechnung.fileSizeOk(fileInput, uploadMaxFilesize)) // in byte
{
return FHC_DialogLib.alertWarning(FHC_PhrasesLib.t("ui", "errorDokumentZuGross"));
}
FHC_AjaxClient.ajaxCallPost(
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/create",
{
@@ -93,6 +111,20 @@ function func_rowSelectionChanged(data, rows){
// ---------------------------------------------------------------------------------------------------------------------
var createAnrechnung = {
fileSizeOk: function(fileInput, maxSize){
if (fileInput.get(0).files.length){
var fileSize = fileInput.get(0).files[0].size; // in bytes
if (fileSize > maxSize)
{
return false;
}
return true;
}
},
emptyFormFields: function(){
// Empty field StudentIn
@@ -102,7 +134,7 @@ var createAnrechnung = {
$('#createAnrechnung-form :input:not([type=hidden])').val('');
// Hide eventually displayed button to open Anrechnung
$('#createAnrechnung-openAnrechnung').addClass('hidden');
$('#createAnrechnung-openAnrechnung').addClass('visually-hidden');
},
disableFormFields: function(){
let prestudent_id = $('#prestudent_id').data('prestudent_id');
@@ -152,7 +184,7 @@ var createAnrechnung = {
displayButtonToOpenAnrechnung: function(anrechnung_id){
// Display button to open Anrechnung in new tab
$('#createAnrechnung-openAnrechnung')
.removeClass('hidden')
.removeClass('visually-hidden')
.attr('href', 'ApproveAnrechnungDetail/?anrechnung_id=' + anrechnung_id)
.html('<i class="fa fa-external-link" aria-hidden="true"></i> ' + FHC_PhrasesLib.t("global", "antragBearbeiten"));
}