Merge remote-tracking branch 'origin/feature-5883/DigitalerLehrauftrag_ColumnPicker' into feature-5405/DigitalerLehrauftrag_ExternePersonen_ausBestellungExkludieren

# Conflicts:
#	public/js/lehre/lehrauftrag/acceptLehrauftrag.js
#	public/js/lehre/lehrauftrag/orderLehrauftrag.js
This commit is contained in:
Cris
2020-03-31 09:57:24 +02:00
13 changed files with 571 additions and 387 deletions
@@ -81,28 +81,6 @@ $this->load->view(
</div>
</div>
<br>
<h4>Auswahl</h4>
<div class="panel panel-body">
<ul>
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
<li>Alle auswählen: Button 'Alle auswählen'</li>
</ul>
</div>
<br>
<h4>Ansicht</h4>
<div class="panel panel-body">
<b>Spaltenbreite verändern</b>
<p>
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
den rechten Rand der entprechenden Spalte. <br>
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
</p>
</div>
<br>
</div>
</div>
</div>
@@ -9,19 +9,19 @@ $query = '
SELECT
/* provide extra row index for tabulator, because no other column has unique ids */
ROW_NUMBER() OVER () AS "row_index",
auftrag,
stg_typ_kurzbz,
gruppe,
typ,
lehreinheit_id,
lehrveranstaltung_id,
projektarbeit_id,
studiensemester_kurzbz,
studiengang_kz,
stg_typ_kurzbz,
semester,
orgform_kurzbz,
person_id,
typ,
auftrag,
lv_oe_kurzbz,
gruppe,
stunden,
betrag,
vertrag_id,
@@ -299,19 +299,19 @@ $filterWidgetArray = array(
'datasetRepresentation' => 'tabulator',
'columnsAliases' => array( // TODO: use phrasen
'Status', // alias for row_index, because row_index is formatted to display the status icons
'LV- / Projektbezeichnung',
'Studiengang',
'Gruppe',
'Typ',
'LV-Teil',
'LV-ID',
'PA-ID',
'Studiensemester',
'Studiengang-KZ',
'Studiengang',
'Semester',
'OrgForm',
'Person-ID',
'Typ',
'LV- / Projektbezeichnung',
'Organisationseinheit',
'Gruppe',
'Stunden',
'Betrag',
'Vertrag-ID',
@@ -326,11 +326,9 @@ $filterWidgetArray = array(
'Angenommen von'
),
'datasetRepOptions' => '{
height: 550,
layout: "fitColumns", // fit columns to width of table
responsiveLayout: "hide", // hide columns that dont fit on the table
movableColumns: true, // allows changing column
placeholder: func_placeholder(),
height: func_height(this),
layout: "fitColumns", // fit columns to width of table
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
headerFilterPlaceholder: " ",
index: "row_index", // assign specific column as unique id (important for row indexing)
selectable: true, // allow row selection
@@ -339,7 +337,6 @@ $filterWidgetArray = array(
selectableCheck: function(row){
return func_selectableCheck(row);
},
footerElement: func_footerElement(),
rowUpdated:function(row){
func_rowUpdated(row);
},
@@ -357,40 +354,47 @@ $filterWidgetArray = array(
},
renderStarted:function(){
func_renderStarted(this);
}
},
tableWidgetFooter: {
selectButtons: true
}
}', // tabulator properties
'datasetRepFieldsDefs' => '{
row_index: {visible:false}, // necessary for row indexing
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}, width: "7%"},
lehrveranstaltung_id: {headerFilter:"input", width: "5%"},
projektarbeit_id: {visible: false},
studiensemester_kurzbz: {visible: false},
studiengang_kz: {visible: false},
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
auftrag: {
headerFilter:"input", widthGrow: 3,
bottomCalc:"count", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}
},
stg_typ_kurzbz: {headerFilter:"input"},
gruppe: {headerFilter:"input"},
typ: {headerFilter:"input"},
lehreinheit_id: {visible: false, headerFilter:"input"},
lehrveranstaltung_id: {visible: false, headerFilter:"input"},
projektarbeit_id: {visible: false, headerFilter:"input"},
studiensemester_kurzbz: {visible: false, headerFilter:"input"},
studiengang_kz: {visible: false, headerFilter:"input"},
semester: {headerFilter:"input"},
orgform_kurzbz: {headerFilter:"input"},
person_id: {visible: false},
typ: {headerFilter:"input", width: "7%"},
auftrag: {headerFilter:"input", width: "15%"},
lv_oe_kurzbz: {headerFilter:"input", width: "8%"},
gruppe: {headerFilter:"input", width: "5%"},
orgform_kurzbz: {visible: false, headerFilter:"input"},
person_id: {visible: false, headerFilter:"input"},
lv_oe_kurzbz: {visible: false, headerFilter:"input"},
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}, width: "5%"},
betrag: {align:"right", width: "6%", formatter: form_formatNulltoStringNumber,
bottomCalc:"sum", bottomCalcParams:{precision:1}
},
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"},
width: "8%"},
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}
},
vertrag_id: {visible: false},
vertrag_stunden: {visible: false},
vertrag_betrag: {visible: false},
mitarbeiter_uid: {visible: false},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
bestellt_von: {visible: false},
erteilt_von: {visible: false},
akzeptiert_von: {visible: false}
mitarbeiter_uid: {visible: false, headerFilter:"input"},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip},
bestellt_von: {visible: false, headerFilter:"input"},
erteilt_von: {visible: false, headerFilter:"input"},
akzeptiert_von: {visible: false, headerFilter:"input"}
}', // col properties
);
@@ -123,28 +123,6 @@ $this->load->view(
</div>
<br>
<h4>Auswahl</h4>
<div class="panel panel-body">
<ul>
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
<li>Alle auswählen: Button 'Alle auswählen'</li>
</ul>
</div>
<br>
<h4>Ansicht</h4>
<div class="panel panel-body">
<b>Spaltenbreite verändern</b>
<p>
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
den rechten Rand der entprechenden Spalte. <br>
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
</p>
</div>
<br>
</div>
</div>
</div>
@@ -9,20 +9,20 @@ SELECT
/* provide extra row index for tabulator, because no other column has unique ids */
ROW_NUMBER() OVER () AS "row_index",
personalnummer,
auftrag,
stg_typ_kurzbz,
gruppe,
typ,
lehreinheit_id,
lehrveranstaltung_id,
lv_bezeichnung,
projektarbeit_id,
studiensemester_kurzbz,
studiengang_kz,
stg_typ_kurzbz,
semester,
orgform_kurzbz,
person_id,
typ,
auftrag,
lv_oe_kurzbz,
gruppe,
lektor,
stunden,
betrag,
@@ -308,20 +308,20 @@ $filterWidgetArray = array(
'columnsAliases' => array( // TODO: use phrasen
'Status', // alias for row_index, because row_index is formatted to display the status icons
'Personalnummer',
'LV- / Projektbezeichnung',
'Studiengang',
'Gruppe',
'Typ',
'LV-Teil',
'LV-ID',
'LV',
'PA-ID',
'Studiensemester',
'Studiengang-KZ',
'Studiengang',
'Semester',
'OrgForm',
'Person-ID',
'Typ',
'LV- / Projektbezeichnung',
'Organisationseinheit',
'Gruppe',
'Lektor',
'Stunden',
'Betrag',
@@ -337,14 +337,13 @@ $filterWidgetArray = array(
'Angenommen von'
),
'datasetRepOptions' => '{
height: 700,
layout: "fitColumns", // fit columns to width of table
responsiveLayout: "hide", // hide columns that dont fit on the table
movableColumns: true, // allows changing column
placeholder: func_placeholder(),
height: func_height(this),
layout: "fitColumns", // fit columns to width of table
layoutColumnsOnNewData: true, // ajust column widths to the data each time TableWidget is loaded
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
headerFilterPlaceholder: " ",
groupBy:"lehrveranstaltung_id",
groupToggleElement:"header", //toggle group on click anywhere in the group header
groupToggleElement:"header", //toggle group on click anywhere in the group header
groupHeader: function(value, count, data, group){
return func_groupHeader(data);
},
@@ -357,7 +356,6 @@ $filterWidgetArray = array(
return func_selectableCheck(row);
},
initialFilter: func_initialFilter(),
footerElement: func_footerElement(),
rowUpdated:function(row){
func_rowUpdated(row);
},
@@ -373,44 +371,49 @@ $filterWidgetArray = array(
},
tableBuilt: function(){
func_tableBuilt(this);
}
},
tableWidgetFooter: {
selectButtons: true
}
}', // tabulator properties
'datasetRepFieldsDefs' => '{
// column status is built dynamically in funcTableBuilt(),
row_index: {visible:false}, // necessary for row indexing
personalnummer: {visible: false},
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", width: "7%",
bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();},},
lehrveranstaltung_id: {headerFilter:"input"},
lv_bezeichnung: {visible: false},
projektarbeit_id: {visible: false},
studiensemester_kurzbz: {headerFilter:"input"},
studiengang_kz: {visible: false},
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
personalnummer: {visible: false, headerFilter:"input"},
auftrag: {
headerFilter:"input", widthGrow: 2,
bottomCalc:"count", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}
},
stg_typ_kurzbz: {headerFilter:"input"},
gruppe: {headerFilter:"input"},
typ: {headerFilter:"input"},
lehreinheit_id: {visible: false, headerFilter:"input"},
lehrveranstaltung_id: {visible: false, headerFilter:"input"},
lv_bezeichnung: {visible: false, headerFilter:"input"},
projektarbeit_id: {visible: false, headerFilter:"input"},
studiensemester_kurzbz: {visible: false, headerFilter:"input"},
studiengang_kz: {visible: false, headerFilter:"input"},
semester: {headerFilter:"input"},
orgform_kurzbz: {headerFilter:"input"},
person_id: {visible: false},
typ: {headerFilter:"input"},
auftrag: {headerFilter:"input", width:"20%"},
lv_oe_kurzbz: {headerFilter:"input"},
gruppe: {headerFilter:"input"},
lektor: {headerFilter:"input", widthGrow: 3},
orgform_kurzbz: {visible: false, headerFilter:"input"},
person_id: {visible: false, headerFilter:"input"},
lv_oe_kurzbz: {visible: false, headerFilter:"input"},
lektor: {headerFilter:"input", widthGrow: 2},
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}},
betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber,
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},
vertrag_id: {visible: false},
vertrag_stunden: {visible: false},
vertrag_betrag: {visible: false},
mitarbeiter_uid: {visible: false},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
bestellt_von: {visible: false},
erteilt_von: {visible: false},
akzeptiert_von: {visible: false},
mitarbeiter_uid: {visible: false, headerFilter:"input"},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip},
bestellt_von: {visible: false, headerFilter:"input"},
erteilt_von: {visible: false, headerFilter:"input"},
akzeptiert_von: {visible: false, headerFilter:"input"},
}', // col properties
);
@@ -63,10 +63,6 @@ $tableWidgetArray = array(
'Storniert am'
),
'datasetRepOptions' => '{
layout: "fitColumns", // fit columns to width of table
responsiveLayout: "hide", // hide columns that dont fit on the table
movableColumns: true, // allows changing column
placeholder: func_placeholder(),
rowFormatter:function(row){
func_rowFormatter(row);
},
@@ -78,22 +74,24 @@ $tableWidgetArray = array(
},
tableBuilt: function(){
func_tableBuilt(this);
}
},
}', // tabulator properties
'datasetRepFieldsDefs' => '{
vertrag_id: {visible: false},
vertragsstunden_studiensemester_kurzbz: {visible: false},
vertragstyp_kurzbz: {widthGrow: 2},
bezeichnung: {widthGrow: 2},
vertragsstunden_studiensemester_kurzbz: {visible: false, widthShrink:1},
vertragstyp_kurzbz: {minWidth: 200},
bezeichnung: {minWidth: 200},
vertragsstunden: {
align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
bottomCalc:"sum", bottomCalcParams:{precision:1}
bottomCalc:"sum", bottomCalcParams:{precision:1},
minWidth: 200
},
betrag: {
align:"right", formatter: form_formatNulltoStringNumber,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"},
minWidth: 200
},
storniert: {align:"center", mutator: mut_formatStringDate, tooltip: storniert_tooltip},
storniert: {align:"center", mutator: mut_formatStringDate, tooltip: storniert_tooltip, minWidth: 200},
storniert_von: {visible: false},
letzterStatus_vorStorniert: {visible: false}
}', // col properties
@@ -35,7 +35,7 @@ $this->load->view(
<!-- title & helper link -->
<div class="row">
<div class="col-lg-12 page-header">
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseExample">
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseHelp">
Hilfe zu dieser Seite
</a>
<h3>
@@ -124,29 +124,6 @@ $this->load->view(
</table>
</div>
<br>
<h4>Auswahl</h4>
<div class="panel panel-body">
<ul>
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
<li>Alle auswählen: Button 'Alle auswählen'</li>
</ul>
</div>
<br>
<h4>Ansicht</h4>
<div class="panel panel-body">
<b>Spaltenbreite verändern</b>
<p>
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
den rechten Rand der entprechenden Spalte. <br>
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
</p>
</div>
<br>
</div>
</div>
</div>
@@ -205,12 +182,7 @@ $this->load->view(
</div>
<!-- tabulator data table -->
<div class="row">
<div class="col-lg-12">
<?php $this->load->view('lehre/lehrauftrag/orderLehrauftragData.php'); ?>
</div>
</div>
<br>
<?php $this->load->view('lehre/lehrauftrag/orderLehrauftragData.php'); ?>
<!-- filter buttons & bestell-button -->
<div class="row">
@@ -9,13 +9,16 @@ SELECT
/* provide extra row index for tabulator, because no other column has unique ids */
ROW_NUMBER() OVER () AS "row_index",
personalnummer,
auftrag,
stg_typ_kurzbz,
gruppe,
typ,
lehreinheit_id,
lehrveranstaltung_id,
lv_bezeichnung,
projektarbeit_id,
studiensemester_kurzbz,
studiengang_kz,
stg_typ_kurzbz,
semester,
/* get valid STPL(s), to which the lehrveranstaltung is assigned to (can be more) */
/* therefore join over lv, studiensemester and semester */
@@ -49,10 +52,7 @@ SELECT
) AS "studienplan_bezeichnung",
orgform_kurzbz,
person_id,
typ,
auftrag,
lv_oe_kurzbz,
gruppe,
lektor,
stunden,
stundensatz,
@@ -340,21 +340,22 @@ $filterWidgetArray = array(
'columnsAliases' => array( // TODO: use phrasen
'Status', // alias for row_index, because row_index is formatted to display the status icons
'Personalnummer',
'LV- / Projektbezeichnung',
'Studiengang',
'Gruppe',
'Typ',
'LV-Teil',
'LV-ID',
'LV',
'PA-ID',
'Studiensemester',
'Studiengang-KZ',
'Studiengang',
'Semester',
'Studienplan',
'OrgForm',
'Person-ID',
'Typ',
'LV- / Projektbezeichnung',
'Organisationseinheit',
'Gruppe',
'Lektor',
'Stunden',
'Stundensatz',
@@ -371,20 +372,18 @@ $filterWidgetArray = array(
'Angenommen von'
),
'datasetRepOptions' => '{
height: 700,
layout:"fitColumns", // fit columns to width of table
responsiveLayout:"hide", // hide columns that dont fit on the table
movableColumns: true, // allows changing column
placeholder: func_placeholder(),
headerFilterPlaceholder: " ",
groupBy:"lehrveranstaltung_id",
groupToggleElement:"header", //toggle group on click anywhere in the group header
groupHeader: function(value, count, data, group){
return func_groupHeader(data);
},
footerElement: func_footerElement(),
columnCalcs:"both", // show column calculations at top and bottom of table and in groups
index: "row_index", // assign specific column as unique id (important for row indexing)
height: func_height(this),
layout:"fitColumns", // fit columns to width of table
layoutColumnsOnNewData: true, // ajust column widths to the data each time TableWidget is loaded
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
headerFilterPlaceholder: " ",
groupBy:"lehrveranstaltung_id",
groupToggleElement:"header", //toggle group on click anywhere in the group header
groupHeader: function(value, count, data, group){
return func_groupHeader(data);
},
columnCalcs:"both", // show column calculations at top and bottom of table and in groups
index: "row_index", // assign specific column as unique id (important for row indexing)
selectable: true, // allows row selection
selectableRangeMode: "click", // allows range selection using shift end click on end of range
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
@@ -409,46 +408,52 @@ $filterWidgetArray = array(
dataLoaded: function(data){
func_dataLoaded(data, this);
},
tableWidgetFooter: {
selectButtons: true
}
}', // tabulator properties
'datasetRepFieldsDefs' => '{
// column status is built dynamically in funcTableBuilt()
row_index: {visible: false},
personalnummer: {visible: false},
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", width: "7%",
bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}},
lehrveranstaltung_id: {headerFilter:"input"},
lv_bezeichnung: {visible: false},
projektarbeit_id: {visible: false},
studiensemester_kurzbz: {headerFilter:"input"},
studiengang_kz: {visible: false},
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
personalnummer: {visible: false, headerFilter:"input"},
auftrag: {
headerFilter:"input", widthGrow: 2,
bottomCalc:"count", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}
},
stg_typ_kurzbz: {headerFilter:"input"},
gruppe: {headerFilter:"input"},
typ: {headerFilter:"input"},
lehreinheit_id: {visible: false, headerFilter:"input"},
lehrveranstaltung_id: {visible: false, headerFilter:"input"},
lv_bezeichnung: {visible: false, headerFilter:"input"},
projektarbeit_id: {visible: false, headerFilter:"input"},
studiensemester_kurzbz: {visible: false, headerFilter:"input"},
studiengang_kz: {visible: false, headerFilter:"input"},
semester: {headerFilter:"input"},
studienplan_bezeichnung: {headerFilter:"input", width: "7%"},
orgform_kurzbz: {headerFilter:"input"},
person_id: {visible: false},
typ: {headerFilter:"input"},
auftrag: {headerFilter:"input", width:"15%"},
studienplan_bezeichnung: {visible: false, headerFilter:"input"},
orgform_kurzbz: {visible: false, headerFilter:"input", widthGrow: 2},
person_id: {visible: false, headerFilter:"input"},
lv_oe_kurzbz: {headerFilter:"input"},
gruppe: {headerFilter:"input"},
lektor: {headerFilter:"input", widthGrow: 3},
lektor: {headerFilter:"input", widthGrow: 2},
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}},
stundensatz: {visible: false},
betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber,
stundensatz: {visible: false, align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator},
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money",
bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},
vertrag_id: {visible: false},
vertrag_id: {visible: false, headerFilter:"input"},
vertrag_stunden: {visible: false},
vertrag_betrag: {visible: false},
mitarbeiter_uid: {visible: false},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
bestellt_von: {visible: false},
erteilt_von: {visible: false},
akzeptiert_von: {visible: false}
mitarbeiter_uid: {visible: false, headerFilter:"input"},
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip},
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip},
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip},
bestellt_von: {visible: false, headerFilter:"input"},
erteilt_von: {visible: false, headerFilter:"input"},
akzeptiert_von: {visible: false, headerFilter:"input"}
}', // col properties
);
+8 -4
View File
@@ -1,17 +1,21 @@
<br>
<div class="row" id="divTableWidgetDataset" tableUniqueId="<?php echo $tableUniqueId; ?>">
<div class="col-lg-12">
<!-- Table widget header -->
<div id="tableWidgetHeader"></div>
<!-- Table info top -->
<div id="tableDatasetActionsTop"></div>
<!-- TableWidget table -->
<div>
<?php TableWidget::loadViewDataset(); ?>
</div>
<?php TableWidget::loadViewDataset(); ?>
<!-- Table info bottom -->
<div id="tableDatasetActionsBottom"></div>
<!-- Table widget footer -->
<div id="tableWidgetFooter"></div>
</div>
</div>
+23
View File
@@ -12,3 +12,26 @@
.tabulator-page.active {
color: #337ab7 !important;
}
/* Avoid confusing color change when hovering over selected rows */
.tabulator-row.tabulator-selected:hover {
background-color: #769bcc !important;
}
/* Frame the table */
.tabulator {
border: 1px solid lightgrey;
border-bottom: none;
border-top-left-radius: 0.5em;
border-top-right-radius: 0.5em;
}
/* Frame the header cells */
.tabulator-col:not(:first-of-type) {
border-left: 0.5px solid lightgrey;
}
/* More space for header title (avoids triple points at the end) */
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
overflow: initial;
}
+305 -1
View File
@@ -182,11 +182,105 @@ var FHC_TableWidget = {
*/
_turnOnEvents: function(tableWidgetDiv) {
var tableUniqueId = tableWidgetDiv.attr('tableUniqueId');
// If the choosen dataset representation is tablesorter
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_TableWidget._enableTableSorter(tableWidgetDiv); // enable the tablesorter
}
// If the choosen dataset representation is tabulator
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABULATOR)
{
// ---------------------------------------------------------------------------------------------------------
// Add events to the elements
// ---------------------------------------------------------------------------------------------------------
// Click-Event to download csv
tableWidgetDiv.find('#download-csv').on('click', function()
{
// BOM for correct UTF-8 char output
tableWidgetDiv.find("#tableWidgetTabulator").tabulator("download", "csv", "data.csv", {bom:true});
})
// Click-Event to toggle the collapsable help panel
tableWidgetDiv.find('#help').on('click', function()
{
// Hide the collapsable settings panel, if it actually shown
$('#tabulatorSettings-' + tableUniqueId).collapse('hide');
// Toggle the collapsable help panel
$('#tabulatorHelp-' + tableUniqueId).collapse('toggle');
})
// Click-Event to toggle the collapsable settings panel
tableWidgetDiv.find('#settings').on('click', function()
{
// Hide the collapsable help panel, if it actually shown
$('#tabulatorHelp-' + tableUniqueId).collapse('hide');
// Toggle the collapsable settings panel
$('#tabulatorSettings-' + tableUniqueId).collapse('toggle');
})
/* Beautify button group behaviour
* Let buttons stay active even until they are clicked again to close the collapsable help- oder setting panels
* Also remove the disturbing button focus behaviour
*/
$(".btn-group > .btn").click(function(){
if ($(this).hasClass("active"))
{
$(this).removeClass('active').css('outline', 'none');
}
else
{
$(this).addClass("active").css('outline', 'none').siblings().removeClass("active");
}
});
/**
* Click-Event to select all rows
* Default is ALL rows. This can be modified via hook tableWidgetHook_selectAllButton.
*/
if (typeof tableWidgetHook_selectAllButton == 'function')
{
tableWidgetDiv.find('#select-all').on('click', function() {
tableWidgetHook_selectAllButton(tableWidgetDiv);
});
}
else
{
tableWidgetDiv.find('#select-all').on('click', function() {
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', true);
});
}
// Click-Event to deselect all rows
tableWidgetDiv.find('#deselect-all').on('click', function()
{
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('deselectRow');
})
// Click-Event to toggle column-picker columns
tableWidgetDiv.find('.btn-select-col').on('click', function()
{
var selected = this.value;
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('toggleColumn', selected);
$(this).toggleClass('active');
if(!$(this).hasClass('active'))
{
$(this).css('background-color', 'white');
}
else
{
$(this).css('background-color', '#e6e6e6');
}
})
}
},
_renderDataset: function(tableWidgetDiv, data) {
@@ -443,11 +537,48 @@ var FHC_TableWidget = {
options.columns = arrayTabulatorColumns;
options.data = data.dataset;
options.persistentLayout = true; // enables persistence (default store in localStorage if available, else in cookie)
options.persistenceID = data.tableUniqueId; // TableWidget unique id to store persistence data seperately for multiple tables
options.movableColumns = true; // allows changing column order
options.tooltipsHeader = true; // set header tooltip with column title
options.placeholder = _func_placeholder(); // display text when table is empty
options.rowSelectionChanged = function(data, rows){
_func_rowSelectionChanged(data, rows);
};
options.columnVisibilityChanged = function(column, visible) {
_func_columnVisibilityChanged(column, visible);
};
// Renders the tabulator
tableWidgetDiv.find("#tableWidgetTabulator").tabulator(options);
}
}
// -------------------------------------------------------------------------------------------------------------
// Render TableWidget Header and -Footer
// -------------------------------------------------------------------------------------------------------------
// Render tableWidgetHeader
var tabulatorHeaderHTML = _renderTabulatorHeaderHTML(tableWidgetDiv);
tableWidgetDiv.find('#tableWidgetHeader').append(tabulatorHeaderHTML);
// Render the collapsable div triggered by button in tableWidgetHeader
var tabulatorHeaderCollapseHTML = _renderTabulatorHeaderCollapseHTML(tableWidgetDiv);
tableWidgetDiv.find('#tableWidgetHeader').after(tabulatorHeaderCollapseHTML);
/**
* tableWidgetFooter is NOT rendered by default.
* tableWidgetFooter is rendered, if tableWidgetFooter is set in tabulators datasetRepOptions.
* Setup options like this:
* tableWidgetFooter: {
* selectButtons: true // tableWidgetFooter properties are checked in _renderTabulatorFooterHTML function
* }
*/
if (options.tableWidgetFooter != 'undefined' && options.tableWidgetFooter != null)
{
var tabulatorFooterHTML = _renderTabulatorFooterHTML(options.tableWidgetFooter);
tableWidgetDiv.find('#tableWidgetFooter').append(tabulatorFooterHTML);
}
},
/**
@@ -584,6 +715,179 @@ var FHC_TableWidget = {
}
};
//**********************************************************************************************************************
// Render functions
//**********************************************************************************************************************
/*
* Processed when row selection changed.
* Displays number of selected rows on row selection change.
*/
function _func_rowSelectionChanged (data, rows){
$('#number-selected').html("Ausgewählte Zeilen: <strong>" + rows.length + "</strong>");
}
/* Processed when columns visibility changed (e.g. using the column picker).
* Redraws the table to expand columns to table width.
*/
function _func_columnVisibilityChanged(column, visible){
var table = column.getTable();
table.redraw();
}
/*
* Displays text when table is empty
*/
function _func_placeholder(){
return "<h4>Keine Daten vorhanden.</h4>";
}
// Returns TableWidget Header HTML (download-, setting button...)
function _renderTabulatorHeaderHTML(tableWidgetDiv){
var tableUniqueId = tableWidgetDiv.attr('tableUniqueId');
var tabulatorHeaderHTML = '';
tabulatorHeaderHTML += '<div class="btn-toolbar pull-right" role="toolbar">';
tabulatorHeaderHTML += '<div class="btn-group" role="group">';
tabulatorHeaderHTML += '<button id="download-csv" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="left" title="Download CSV"><small>CSV&nbsp;&nbsp;</small><i class="fa fa-arrow-down"></i></button>';
tabulatorHeaderHTML += '<button id="help" class="btn btn-default" type="button" data-toggle="collapse tooltip" data-target="tabulatorHelp-'+ tableUniqueId + '" data-placement="left" title="Hilfe zu Tabelleneinstellungen"><i class="fa fa-question"></i></button>';
tabulatorHeaderHTML += '<button id="settings" class="btn btn-default" type="button" data-toggle="collapse tooltip" data-target="tabulatorSettings-'+ tableUniqueId + '" data-placement="left" title="Tabelleneinstellungen" aria-expanded="false" aria-controls="tabulatorSettings-'+ tableUniqueId + '"><i class="fa fa-cog"></i></button>';
tabulatorHeaderHTML += '</div>';
tabulatorHeaderHTML += '</div>';
tabulatorHeaderHTML += '<br><br><br>';
return tabulatorHeaderHTML;
}
// Returns collapsable HTML element for TableWidget header buttons
function _renderTabulatorHeaderCollapseHTML(tableWidgetDiv){
var tableUniqueId = tableWidgetDiv.attr('tableUniqueId');
var tabulatorHeaderCollapseHTML = '';
// CollapseHTML 'Settings'
tabulatorHeaderCollapseHTML += '<div class="row">';
tabulatorHeaderCollapseHTML += '<div class="col-lg-12 collapse" id="tabulatorSettings-'+ tableUniqueId + '">';
tabulatorHeaderCollapseHTML += '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">';
tabulatorHeaderCollapseHTML += '<div class="panel panel-default">';
tabulatorHeaderCollapseHTML += '<div class="panel-heading" role="tab" id="headingOne">';
tabulatorHeaderCollapseHTML += '<h5 class="panel-title">';
tabulatorHeaderCollapseHTML += '<a role="button" data-toggle="collapse" data-parent="#accordion" ' +
'href="#selectColumns-' + tableUniqueId + '" ' +
'aria-expanded="false" aria-controls="selectColumns">Spalten einstellen</a>';
tabulatorHeaderCollapseHTML += '</h5>';
tabulatorHeaderCollapseHTML += '</div>'; // end panel-heading
tabulatorHeaderCollapseHTML += '<div id="selectColumns-' + tableUniqueId + '" class="panel-collapse collapse" ' +
'role="tabpanel" aria-labelledby="headingOne">';
tabulatorHeaderCollapseHTML += '<div class="panel-body">';
tabulatorHeaderCollapseHTML += '<div class="btn-group" role="group">';
// Create column picker (Spalten einstellen)
tableWidgetDiv.find('#tableWidgetTabulator').tabulator('getColumns').forEach(function(column)
{
var field = column.getField();
var title = column.getDefinition().title;
var active_status = column.getVisibility() ? 'active' : '';
// If certain columns should be excluded from the column picker (define them in a blacklist array)
if (typeof tableWidgetBlacklistArray_columnUnselectable != 'undefined' &&
Array.isArray(tableWidgetBlacklistArray_columnUnselectable) &&
tableWidgetBlacklistArray_columnUnselectable.length)
{
if ($.inArray(field, tableWidgetBlacklistArray_columnUnselectable) < 0)
{
tabulatorHeaderCollapseHTML += '<button type="button" class="btn btn-default btn-sm btn-select-col ' + active_status +'" aria-pressed="true" id="btn-' + field + '" value="' + field + '">' + title + '</button>';
}
}
// Else provide all tabulator fields as pickable columns
else
{
tabulatorHeaderCollapseHTML += '<button type="button" class="btn btn-default btn-sm btn-select-col ' + active_status +'" aria-pressed="true" id="btn-' + field + '" value="' + field + '">' + title + '</button>';
}
});
tabulatorHeaderCollapseHTML += '</div>'; // end btn-group
tabulatorHeaderCollapseHTML += '</div>'; // end panel-body
tabulatorHeaderCollapseHTML += '</div>'; // end panel-collapse
tabulatorHeaderCollapseHTML += '</div>'; // end panel
tabulatorHeaderCollapseHTML += '</div>'; // end panel-group
tabulatorHeaderCollapseHTML += ' </div>'; // end col
tabulatorHeaderCollapseHTML += ' </div>'; // end row
// CollapseHTML 'Help'
tabulatorHeaderCollapseHTML += '<div class="row">';
tabulatorHeaderCollapseHTML += '<div class="col-lg-12 collapse" id="tabulatorHelp-'+ tableUniqueId + '">';
tabulatorHeaderCollapseHTML += '<div class="well">';
tabulatorHeaderCollapseHTML += '<h4>Tabelleneinstellungen</h4>';
tabulatorHeaderCollapseHTML += '<div class="panel panel-body">';
tabulatorHeaderCollapseHTML += '<b>Spalten ein- und ausblenden</b>';
tabulatorHeaderCollapseHTML += '<p>';
tabulatorHeaderCollapseHTML += '<ul>';
tabulatorHeaderCollapseHTML += '<li>Mit einem Klick auf <button><i class="fa fa-cog"></i></button> ' +
'werden die Einstellungen geöffnet.</li>';
tabulatorHeaderCollapseHTML += '<li>Auf Spalteneinstellungen klicken</li>';
tabulatorHeaderCollapseHTML += '<li>Durch (wiederholtes) Klicken auf die einzelnen Spaltennamen können ' +
'diese in der Tabelle beliebig oft aktiviert / deaktiviert werden.</li>';
tabulatorHeaderCollapseHTML += '<li>Mit einem Klick auf <button><i class="fa fa-cog"></i></button> ' +
'werden die Einstellungen wieder geschlossen.</li>';
tabulatorHeaderCollapseHTML += '</ul>';
tabulatorHeaderCollapseHTML += '</p>';
tabulatorHeaderCollapseHTML += '<b>Spaltenbreite verändern</b>';
tabulatorHeaderCollapseHTML += '<p>Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam ' +
'mit dem Mauszeiger auf den rechten Rand der entprechenden Spalte. <br>' +
'Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und ' +
'mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.';
tabulatorHeaderCollapseHTML += '</p>';
tabulatorHeaderCollapseHTML += '<div class="alert alert-info"><strong>INFO: </strong>Alle individuellen Tabelleneinstellungen werden in ' +
'Ihrem Browser Cache gespeichert. Wenn Sie Ihren Browser Cache löschen, werden Ihre Einstellungen zurückgesetzt und ' +
'müssen gegebenenfalls neu eingestellt werden.';
tabulatorHeaderCollapseHTML += '</div>';
tabulatorHeaderCollapseHTML += '</div><br>'; // end panel-body
tabulatorHeaderCollapseHTML += '<h4>Zeilen auswählen</h4>';
tabulatorHeaderCollapseHTML += '<div class="panel panel-body">';
tabulatorHeaderCollapseHTML += '<ul>';
tabulatorHeaderCollapseHTML += '<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>';
tabulatorHeaderCollapseHTML += '<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>';
tabulatorHeaderCollapseHTML += '<li>Alle auswählen: Button \'Alle auswählen\'</li>';
tabulatorHeaderCollapseHTML += '</ul>';
tabulatorHeaderCollapseHTML += '</div><br>'; // end panel-body
tabulatorHeaderCollapseHTML += '</div>'; // end well
tabulatorHeaderCollapseHTML += ' </div>'; // end col collapse
tabulatorHeaderCollapseHTML += ' </div>'; // end row
return tabulatorHeaderCollapseHTML;
}
// Returns TableWidget Footer HTML (de-/select buttons,...)
function _renderTabulatorFooterHTML(tableWidgetFooterOptions){
var tabulatorFooterHTML = '';
// If property selectButtons is true, render 'Alle auswaehlen / Alle abwaehlen' buttons
if (tableWidgetFooterOptions.selectButtons != 'undefined' && tableWidgetFooterOptions.selectButtons == true)
{
tabulatorFooterHTML += '<div class="btn-toolbar" role="toolbar">';
tabulatorFooterHTML += '<div class="btn-group" role="group">';
tabulatorFooterHTML += '<button id="select-all" class="btn btn-default pull-left" type="button">Alle auswählen</button>';
tabulatorFooterHTML += '<button id="deselect-all" class="btn btn-default pull-left" type="button">Alle abwählen</button>';
tabulatorFooterHTML += '<span id="number-selected" style="margin-left: 20px; line-height: 2; font-weight: normal">Ausgewählte Zeilen: <strong>0</strong></span>';
tabulatorFooterHTML += '</div>';
tabulatorFooterHTML += '</div>';
tabulatorFooterHTML += '</br></br>';
}
return tabulatorFooterHTML;
}
/**
* When JQuery is up
*/
@@ -19,6 +19,18 @@ const ICON_LEHRAUFTRAG_APPROVED = '<img src="../../../public/images/icons/fa-use
const ICON_LEHRAUFTRAG_CHANGED = '<img src="../../../public/images/icons/fa-user-edit.png" style="height: 30px; width: 30px; margin: -6px;">';
const ICON_LEHRAUFTRAG_CANCELLED = '<img src="../../../public/images/icons/fa-user-times.png" style="height: 30px; width: 30px; margin: -6px;">';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
'status',
'row_index',
'betrag',
'vertrag_id',
'vertrag_stunden',
'vertrag_betrag',
'storniert_von', // fields from cancelledLehrauftragData
'letzterStatus_vorStorniert' // fields from cancelledLehrauftragData
];
// -----------------------------------------------------------------------------------------------------------------
// Mutators - setter methods to manipulate table data when entering the tabulator
// -----------------------------------------------------------------------------------------------------------------
@@ -81,10 +93,9 @@ function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
// Tabulator table format functions
// -----------------------------------------------------------------------------------------------------------------
// Displays text when table is empty
function func_placeholder()
{
return "<h4>Keine Daten vorhanden.</h4>";
// Returns relative height (depending on screen size)
function func_height(table){
return $(window).height() * 0.50;
}
// Formats the rows
@@ -254,65 +265,20 @@ function func_renderComplete(table){
);
}
// Tabulator footer element
// TableWidget Footer element
// -----------------------------------------------------------------------------------------------------------------
// Adds a footer with buttons select all / deselect all / download
function func_footerElement(){
var footer_html = '<div class="row">';
footer_html += '<div class="col-lg-12" style="padding: 5px;">';
footer_html += '<div class="btn-toolbar pull-right" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="download-csv" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="left" title="Download CSV" onclick="footer_downloadCSV()"><small>CSV&nbsp;&nbsp;</small><i class="fa fa-arrow-down"></i></button>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '<div class="btn-toolbar" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="select-all" class="btn btn-default pull-left" type="button" onclick="footer_selectAll()">Alle auswählen</button>';
footer_html += '<button id="deselect-all" class="btn btn-default pull-left" type="button" onclick="footer_deselectAll()">Alle abwählen</button>';
footer_html += '<span id="number-selected" style="margin-left: 20px; line-height: 2; font-weight: normal"></span>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
return footer_html;
}
// Performs download CSV
function footer_downloadCSV(){
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
* Performs select all
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows and ignore rows that are bestellt and erteilt
*/
function footer_selectAll(){
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(function(row){ return row.getData().bestellt != null && // bestellt
row.getData().erteilt != null && // AND erteilt
row.getData().akzeptiert == null && // AND NOT akzeptiert
row.getData().status != 'Geändert'
;}) // AND NOT geändert
.forEach((function(row){ return row.select();}));
}
/*
* Performs deselect all
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
function func_rowSelectionChanged(data, rows){
$('#number-selected').html("Für Annehmen ausgewählt: <strong>" + rows.length + "</strong>");
function tableWidgetHook_selectAllButton(tableWidgetDiv){
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
.filter(row => row.getData().bestellt != null && // bestellt
row.getData().erteilt != null && // AND erteilt
row.getData().akzeptiert == null && // AND NOT akzeptiert
row.getData().status != 'Geändert') // AND NOT geändert
.forEach((row => row.select()));
}
// -----------------------------------------------------------------------------------------------------------------
@@ -476,6 +442,12 @@ $(function() {
return;
}
// Redraw table on resize to fit tabulators height to windows height
window.addEventListener('resize', function(){
$('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
$('#tableWidgetTabulator').tabulator('redraw', true);
});
// Show all rows
$("#show-all").click(function(){
$('#tableWidgetTabulator').tabulator('clearFilter');
@@ -594,7 +566,7 @@ $(function() {
// Print error message
FHC_DialogLib.alertWarning(data.retval);
}
if (!data.error && data.retval != null)
{
// Update status 'Erteilt'
@@ -19,6 +19,17 @@ const ICON_LEHRAUFTRAG_ORDERED = '<img src="../../../public/images/icons/fa-user
const ICON_LEHRAUFTRAG_APPROVED = '<img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px; margin: -6px;">';
const ICON_LEHRAUFTRAG_CHANGED = '<img src="../../../public/images/icons/fa-user-edit.png" style="height: 30px; width: 30px; margin: -6px;">';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
'status',
'row_index',
'personalnummer',
'betrag',
'vertrag_id',
'vertrag_stunden',
'vertrag_betrag'
];
// -----------------------------------------------------------------------------------------------------------------
// Mutators - setter methods to manipulate table data when entering the tabulator
// -----------------------------------------------------------------------------------------------------------------
@@ -95,10 +106,9 @@ function func_initialFilter(){
// Tabulator table format functions
// -----------------------------------------------------------------------------------------------------------------
// Displays text when table is empty
function func_placeholder()
{
return "<h4>Keine Daten vorhanden.</h4>";
// Returns relative height (depending on screen size)
function func_height(table){
return $(window).height() * 0.50;
}
// Formats the group header
@@ -301,65 +311,20 @@ function func_rowUpdated(row){
row.getElement().style["pointerEvents"] = "none";
}
// Tabulator footer element
// TableWidget Footer element
// -----------------------------------------------------------------------------------------------------------------
// Adds a footer with buttons select all / deselect all / download
function func_footerElement(){
var footer_html = '<div class="row">';
footer_html += '<div class="col-lg-12" style="padding: 5px;">';
footer_html += '<div class="btn-toolbar pull-right" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="download-csv" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="left" title="Download CSV" onclick="footer_downloadCSV()"><small>CSV&nbsp;&nbsp;</small><i class="fa fa-arrow-down"></i></button>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '<div class="btn-toolbar" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="select-all" class="btn btn-default pull-left" type="button" onclick="footer_selectAll()">Alle auswählen</button>';
footer_html += '<button id="deselect-all" class="btn btn-default pull-left" type="button" onclick="footer_deselectAll()">Alle abwählen</button>';
footer_html += '<span id="number-selected" style="margin-left: 20px; line-height: 2; font-weight: normal"></span>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
return footer_html;
}
// Performs download CSV
function footer_downloadCSV(){
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
* Performs select all
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows that are bestellt
*/
function footer_selectAll(){
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(row => row.getData().personalnummer >= 0 && // NOT dummies
row.getData().bestellt != null && // AND bestellt
row.getData().erteilt == null && // AND NOT erteilt
row.getData().status != 'Geändert') // AND NOT geaendert
.forEach((row => row.select()));
}
/*
* Performs deselect all
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
function func_rowSelectionChanged(data, rows){
$('#number-selected').html("Für Erteilung ausgewählt: <strong>" + rows.length + "</strong>");
function tableWidgetHook_selectAllButton(tableWidgetDiv){
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
.filter(row => row.getData().personalnummer >= 0 && // NOT dummies
row.getData().bestellt != null && // AND bestellt
row.getData().erteilt == null && // AND NOT erteilt
row.getData().status != 'Geändert') // AND NOT geaendert
.forEach((row => row.select()));
}
// -----------------------------------------------------------------------------------------------------------------
@@ -526,6 +491,12 @@ akzeptiert_tooltip = function(cell){
}
$(function() {
// Redraw table on resize to fit tabulators height to windows height
window.addEventListener('resize', function(){
$('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
$('#tableWidgetTabulator').tabulator('redraw', true);
});
// Show all rows
$("#show-all").click(function(){
$('#tableWidgetTabulator').tabulator('clearFilter');
+26 -54
View File
@@ -18,6 +18,17 @@ const ICON_LEHRAUFTRAG_ORDERED = '<img src="../../../public/images/icons/fa-user
const ICON_LEHRAUFTRAG_APPROVED = '<img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px; margin: -6px;">';
const ICON_LEHRAUFTRAG_CHANGED = '<img src="../../../public/images/icons/fa-user-edit.png" style="height: 30px; width: 30px; margin: -6px;">';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
'status',
'row_index',
'personalnummer',
'betrag',
'vertrag_id',
'vertrag_stunden',
'vertrag_betrag'
];
// -----------------------------------------------------------------------------------------------------------------
// Mutators - setter methods to manipulate table data when entering the tabulator
// -----------------------------------------------------------------------------------------------------------------
@@ -106,10 +117,9 @@ function func_dataLoaded(data, table){
// Tabulator table format functions
// -----------------------------------------------------------------------------------------------------------------
// Displays text when table is empty
function func_placeholder()
{
return "<h4>Keine Daten vorhanden.</h4>";
// Returns relative height (depending on screen size)
function func_height(table){
return $(window).height() * 0.50;
}
// Formats the group header
@@ -325,47 +335,16 @@ function func_rowUpdated(row){
row.getElement().style["pointerEvents"] = "none";
}
// Tabulator footer element
// TableWidget Footer element
// -----------------------------------------------------------------------------------------------------------------
// Adds a footer with buttons select all / deselect all / download
function func_footerElement(){
var footer_html = '<div class="row">';
footer_html += '<div class="col-lg-12" style="padding: 5px;">';
footer_html += '<div class="btn-toolbar pull-right" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="download-csv" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="left" title="Download CSV" onclick="footer_downloadCSV()"><small>CSV&nbsp;&nbsp;</small><i class="fa fa-arrow-down"></i></button>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '<div class="btn-toolbar" role="toolbar">';
footer_html += '<div class="btn-group" role="group">';
footer_html += '<button id="select-all" class="btn btn-default pull-left" type="button" onclick="footer_selectAll()">Alle auswählen</button>';
footer_html += '<button id="deselect-all" class="btn btn-default pull-left" type="button" onclick="footer_deselectAll()">Alle abwählen</button>';
footer_html += '<span id="number-selected" style="margin-left: 20px; line-height: 2; font-weight: normal"></span>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
footer_html += '</div>';
return footer_html;
}
// Performs download CSV
function footer_downloadCSV(){
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
* Performs select all
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows and ignore rows which have status bestellt
*/
function footer_selectAll(){
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(row => (
function tableWidgetHook_selectAllButton(tableWidgetDiv){
tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
.filter(row => (
row.getData().personalnummer > 0 || // not dummies
row.getData().personalnummer == null) && // include Projektbetreuer
row.getData().mitarbeiter_uid != null && // AND is Mitarbeiter
@@ -377,20 +356,7 @@ function footer_selectAll(){
row.getData().status == 'Geändert' // AND geaendert)
)
)
.forEach((row => row.select()));
}
/*
* Performs deselect all
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
function func_rowSelectionChanged(data, rows){
$('#number-selected').html("Für Bestellung ausgewählt: <strong>" + rows.length + "</strong>");
.forEach((row => row.select()));
}
// -----------------------------------------------------------------------------------------------------------------
@@ -576,6 +542,12 @@ akzeptiert_tooltip = function(cell){
$(function() {
// Redraw table on resize to fit tabulators height to windows height
window.addEventListener('resize', function(){
$('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
$('#tableWidgetTabulator').tabulator('redraw', true);
});
// Show all rows
$("#show-all").click(function(){
$('#tableWidgetTabulator').tabulator('clearFilter');