mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
migrate approveLehrauftrag/acceptLehrauftrag/orderLehrauftrag to tabulator 5
This commit is contained in:
@@ -226,10 +226,13 @@ $filterWidgetArray = array(
|
||||
func_rowFormatter(row,this);
|
||||
},
|
||||
columnDefaults:{
|
||||
headerFilterPlaceholder: " ",
|
||||
|
||||
//columnDefaults tooltip did not work
|
||||
|
||||
tooltip:function(e, cell, onRendered){
|
||||
return func_tooltips(cell);
|
||||
}
|
||||
},
|
||||
headerFilterPlaceholder: " ",
|
||||
}
|
||||
|
||||
}', // tabulator properties
|
||||
|
||||
@@ -172,8 +172,13 @@ $filterWidgetArray = array(
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
columnDefaults:{
|
||||
|
||||
//columnDefaults tooltip did not work
|
||||
|
||||
tooltip:(cell)=>{tooltip:function(e, cell, onRendered){
|
||||
func_tooltips(e,cell,onRendered);
|
||||
},
|
||||
headerFilterPlaceholder: " ",
|
||||
tooltip:(cell)=>{func_tooltips(cell)},
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ $this->load->view(
|
||||
'bootstrap3' => true,
|
||||
'fontawesome4' => true,
|
||||
'sbadmintemplate' => false,
|
||||
'tabulator4' => true,
|
||||
'tabulator5' => true,
|
||||
'tabulator5JQuery' => true,
|
||||
'cis'=>true,
|
||||
'momentjs2' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
|
||||
@@ -330,7 +330,7 @@ $filterWidgetArray = array(
|
||||
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
|
||||
selectableRangeMode: "click", // allow range selection using shift end click on end of range
|
||||
@@ -338,24 +338,16 @@ $filterWidgetArray = array(
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
},
|
||||
renderComplete:function(){
|
||||
func_renderComplete(this);
|
||||
},
|
||||
renderStarted:function(){
|
||||
func_renderStarted(this);
|
||||
},
|
||||
|
||||
tableWidgetFooter: {
|
||||
selectButtons: true
|
||||
}
|
||||
},
|
||||
columnsDefaults:{
|
||||
headerFilterPlaceholder: " ",
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
row_index: {visible:false}, // necessary for row indexing
|
||||
|
||||
@@ -404,7 +404,7 @@ $filterWidgetArray = array(
|
||||
vertrag_id: {visible: false},
|
||||
vertrag_stunden: {visible: false},
|
||||
vertrag_betrag: {visible: false},
|
||||
mitarbeiter_uid: {visible: false, headerFilter:"input"},func_initialFilter
|
||||
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},
|
||||
|
||||
@@ -727,7 +727,6 @@ var FHC_TableWidget = {
|
||||
_getRepresentationFieldsDefinitions: function(data) {
|
||||
|
||||
var fieldsDefinitions = {}; // eventually contains record fields definitions
|
||||
|
||||
// Checks if record fields definitions was given as parameter
|
||||
if (data.hasOwnProperty("datasetRepresentationFieldsDefinitions") && data.datasetRepresentationFieldsDefinitions != "")
|
||||
{
|
||||
|
||||
@@ -203,16 +203,16 @@ function func_rowSelectionChanged(data, rows, tabulatorInstance){
|
||||
}
|
||||
|
||||
// Returns tooltip
|
||||
function func_tooltips(e, cell, onRendered){
|
||||
function func_tooltips(){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
console.log("TOOLTIP DEBUG",cell);
|
||||
// Return tooltip if row is unselectable
|
||||
if (true || !func_selectableCheck(cell.getRow())){
|
||||
return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status';
|
||||
}
|
||||
console.log("here");
|
||||
// console.log("TOOLTIP DEBUG",cell);
|
||||
// // Return tooltip if row is unselectable
|
||||
// if (true || !func_selectableCheck(cell.getRow())){
|
||||
// return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status';
|
||||
// }
|
||||
}
|
||||
|
||||
// Formats empfehlung_anrechnung
|
||||
|
||||
@@ -51,7 +51,7 @@ var mut_formatStringDate = function(value, data, type, params, component) {
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Formats null values to a string number '0.00'
|
||||
var form_formatNulltoStringNumber = function(cell, formatterParams){
|
||||
var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){
|
||||
if (cell.getValue() == null){
|
||||
if (formatterParams.precision == 1)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ var form_formatNulltoStringNumber = function(cell, formatterParams){
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters values using comparison operator or just by string comparison
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){
|
||||
|
||||
// If string starts with <, <=, >, >=, !=, ==, compare values with that operator
|
||||
var operator = '';
|
||||
@@ -346,7 +346,11 @@ status_formatter = function(cell, formatterParams, onRendered){
|
||||
};
|
||||
|
||||
// Generates status tooltip
|
||||
status_tooltip = function(cell){
|
||||
status_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
@@ -403,7 +407,11 @@ status_tooltip = function(cell){
|
||||
}
|
||||
|
||||
// Generates bestellt tooltip
|
||||
bestellt_tooltip = function(cell){
|
||||
bestellt_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
if (cell.getRow().getData().bestellt_von != null)
|
||||
{
|
||||
return FHC_PhrasesLib.t("ui", "bestelltVon") + cell.getRow().getData().bestellt_von;
|
||||
@@ -411,21 +419,33 @@ bestellt_tooltip = function(cell){
|
||||
}
|
||||
|
||||
// Generates erteilt tooltip
|
||||
erteilt_tooltip = function(cell){
|
||||
erteilt_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
if (cell.getRow().getData().erteilt_von != null) {
|
||||
return FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates akzeptiert tooltip
|
||||
akzeptiert_tooltip = function(cell){
|
||||
akzeptiert_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
if (cell.getRow().getData().akzeptiert_von != null) {
|
||||
return FHC_PhrasesLib.t("ui", "angenommenVon") + cell.getRow().getData().akzeptiert_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates storniert tooltip
|
||||
storniert_tooltip = function(cell){
|
||||
storniert_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
if (cell.getRow().getData().storniert_von != null) {
|
||||
return FHC_PhrasesLib.t("ui", "storniertVon") + cell.getRow().getData().storniert_von;
|
||||
}
|
||||
@@ -434,6 +454,21 @@ storniert_tooltip = function(cell){
|
||||
$(function() {
|
||||
// Pruefen ob Promise unterstuetzt wird
|
||||
// Tabulator funktioniert nicht mit IE
|
||||
|
||||
|
||||
// tableInit is called in the jquery_wrapper when the tableBuilt event was finished
|
||||
$(document).on("tableInit", function(event,tabulatorInstance) {
|
||||
|
||||
//passing the tabulator instance because the acceptLehrauftrag site loads two tabulator tables
|
||||
func_tableBuilt(tabulatorInstance)
|
||||
|
||||
// using the tabulator instance instead of the jquery object because the site loads two different tabulator tables
|
||||
tabulatorInstance.on("renderComplete",()=>{func_renderComplete(tabulatorInstance)});
|
||||
tabulatorInstance.on("renderStarted",()=>{func_renderStarted(tabulatorInstance)});
|
||||
tabulatorInstance.on("rowUpdated",(row)=>{func_rowUpdated(row)});
|
||||
|
||||
});
|
||||
|
||||
var canPromise = !! window.Promise;
|
||||
if(!canPromise)
|
||||
{
|
||||
|
||||
@@ -225,7 +225,7 @@ function func_selectableCheck(row){
|
||||
// Adds column status
|
||||
function func_tableBuilt(table) {
|
||||
// Add status column to table
|
||||
table.addColumn(
|
||||
table.tabulator("addColumn",
|
||||
{
|
||||
title: "<i class='fa fa-user-o'></i>",
|
||||
field: "status",
|
||||
@@ -402,7 +402,11 @@ status_formatter = function(cell, formatterParams, onRendered){
|
||||
};
|
||||
|
||||
// Generates status tooltip
|
||||
status_tooltip = function(cell){
|
||||
status_tooltip = function(e, cell, onRendered){
|
||||
//e - mouseover event
|
||||
//cell - cell component
|
||||
//onRendered - onRendered callback registration function
|
||||
|
||||
var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
@@ -504,6 +508,17 @@ akzeptiert_tooltip = function(e, cell, onRendered){
|
||||
}
|
||||
$(function() {
|
||||
|
||||
// tableInit is called in the jquery_wrapper when the tableBuilt event was finished
|
||||
$(document).on("tableInit", function(event,tabulatorInstance) {
|
||||
|
||||
func_tableBuilt($("#tableWidgetTabulator"))
|
||||
|
||||
// event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
|
||||
$("#tableWidgetTabulator").tabulator("on","renderStarted",()=>func_renderStarted(tabulatorInstance));
|
||||
$("#tableWidgetTabulator").tabulator("on","rowUpdated",(row)=>func_rowUpdated(row));
|
||||
|
||||
});
|
||||
|
||||
// Redraw table on resize to fit tabulators height to windows height
|
||||
window.addEventListener('resize', function(){
|
||||
$('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
|
||||
|
||||
@@ -70,7 +70,7 @@ var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters values using comparison operator or just by string comparison
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){
|
||||
|
||||
// If string starts with <, <=, >, >=, !=, ==, compare values with that operator
|
||||
var operator = '';
|
||||
|
||||
+1
@@ -47,6 +47,7 @@
|
||||
that[key] = this[key].bind(this);
|
||||
}
|
||||
}
|
||||
console.log("here the table is building")
|
||||
$(document).trigger("tableInit",[this]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user