Merge branch 'master' into feature-3716/Messaging_inbox_outbox_user
@@ -113,3 +113,24 @@
|
||||
#applyFilter, #saveCustomFilterButton {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.text-red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.text-orange {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.text-blue {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.text-green {
|
||||
color: green;
|
||||
}
|
||||
|
||||
#dragAndDropFieldsArea
|
||||
{
|
||||
display: inline-table !important;
|
||||
}
|
||||
|
||||
@@ -2,22 +2,36 @@
|
||||
margin: 10px 0 5px;
|
||||
}
|
||||
h1 {
|
||||
margin-top: 0px;
|
||||
font-size: 2rem;
|
||||
}
|
||||
h2 {
|
||||
margin-top: 0px;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
h3 {
|
||||
margin-top: 0px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin-top: 0px;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
h5 {
|
||||
margin-top: 0px;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
h6 {
|
||||
margin-top: 0px;
|
||||
font-size: 1rem;
|
||||
|
||||
}
|
||||
body
|
||||
{
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
@@ -65,4 +65,31 @@
|
||||
|
||||
#scrollToTop:hover{
|
||||
background-color: lightgrey;
|
||||
}
|
||||
}
|
||||
|
||||
#postponedate{
|
||||
height: 25px;
|
||||
width: 99px
|
||||
}
|
||||
|
||||
#postponedatelabel{
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1510px)
|
||||
{
|
||||
#postponing{
|
||||
text-align: center;
|
||||
}
|
||||
#postponedatelabel{
|
||||
display: block;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px)
|
||||
{
|
||||
#postponedate {
|
||||
display: inline-block
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/* styles for infocenter overview page */
|
||||
|
||||
/* horizontal line after Studiensemester in dataset table header */
|
||||
hr.studiensemesterline
|
||||
{
|
||||
margin: 6px 6px;
|
||||
}
|
||||
|
||||
.onhold
|
||||
{
|
||||
color: #CDAD00
|
||||
}
|
||||
@@ -42,7 +42,7 @@ table.tablesort-hover tr:hover, .tablesort-active {
|
||||
}
|
||||
|
||||
/* Remove background color from filter row */
|
||||
.tablesorter-default .tablesorter-filter-row td {
|
||||
.tablesorter-default .tablesorter-filter-row td, .tablesorter-default .tablesorter-filter-row:hover td {
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 18 KiB |
@@ -55,7 +55,12 @@ var FHC_DialogLib = {
|
||||
*/
|
||||
alertDefault: function(title, html, width)
|
||||
{
|
||||
var strDivDialog = "<div id=\"fhc-dialoglib-dialog\">";
|
||||
var dialogdiv = $("#fhc-dialoglib-dialog");
|
||||
|
||||
if (dialogdiv.length)
|
||||
dialogdiv.remove();
|
||||
|
||||
var strDivDialog = "<div id='fhc-dialoglib-dialog'>";
|
||||
strDivDialog += html;
|
||||
strDivDialog += "</div>";
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
* Global function used by FilterWidget JS to refresh the side menu
|
||||
* NOTE: it is called from the FilterWidget JS therefore must be a global function
|
||||
* It may be overwritten by a custom refreshSideMenuHook included in a javascript which will be loaded after this one
|
||||
* The given parameters, filter_page and navigation_page, are required
|
||||
* The given parameters, filterUniqueId and navigation_page, are required
|
||||
*/
|
||||
function refreshSideMenuHook()
|
||||
{
|
||||
FHC_NavigationWidget.refreshSideMenuHook(
|
||||
'system/Filters/setNavigationMenu',
|
||||
'widgets/Filters/setNavigationMenu',
|
||||
{
|
||||
filter_page: FHC_FilterWidget.getFilterPage(),
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix(),
|
||||
navigation_page: FHC_NavigationWidget.getNavigationPage()
|
||||
}
|
||||
);
|
||||
@@ -33,34 +33,37 @@ function refreshSideMenuHook()
|
||||
*/
|
||||
function sideMenuHook()
|
||||
{
|
||||
$(".remove-custom-filter").click(function() {
|
||||
// If menu is present
|
||||
if (FHC_FilterWidget._hideMenu != true)
|
||||
{
|
||||
$(".remove-custom-filter").click(function() {
|
||||
|
||||
// Ajax call to remove a custom filter
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/removeCustomFilter",
|
||||
{
|
||||
filter_id: $(this).attr("value"), // filter_id of the filter to be removed
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
// Ajax call to remove a custom filter
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"widgets/Filters/removeCustomFilter",
|
||||
{
|
||||
filter_id: $(this).attr("value"), // filter_id of the filter to be removed
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
|
||||
if (FHC_AjaxClient.isError(data))
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
// If a success and refreshSideMenuHook is a valid function then call it to refresh the side menu
|
||||
if (typeof refreshSideMenuHook == "function")
|
||||
if (FHC_AjaxClient.isError(data))
|
||||
{
|
||||
refreshSideMenuHook();
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeof refreshSideMenuHook == "function")
|
||||
{
|
||||
refreshSideMenuHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
@@ -69,6 +72,7 @@ function sideMenuHook()
|
||||
// Success
|
||||
const DATASET_REP_TABLESORTER = "tablesorter";
|
||||
const DATASET_REP_PIVOTUI = "pivotUI";
|
||||
const DATASET_REP_TABULATOR = "tabulator";
|
||||
|
||||
/**
|
||||
* FHC_FilterWidget this object is used to render the GUI of a filter widget and to operate with it
|
||||
@@ -78,13 +82,15 @@ var FHC_FilterWidget = {
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Properties
|
||||
|
||||
_datasetRepresentation: null, //
|
||||
_datasetRepresentation: null, // contains the current data representation
|
||||
_hideMenu: false, //
|
||||
_hideOptions: false, //
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* To display the FilterWidget using the loaded data prenset in the session
|
||||
* To display the FilterWidget using the loaded data present in the session
|
||||
*/
|
||||
display: function() {
|
||||
|
||||
@@ -92,7 +98,7 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Alias call to method display only to inprove the readability of the code
|
||||
* Alias call to method display only to improve the readability of the code
|
||||
*/
|
||||
refresh: function() {
|
||||
|
||||
@@ -100,13 +106,30 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* To retrive the page where the FilterWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
|
||||
* To retrieve the page where the FilterWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
|
||||
*/
|
||||
getFilterPage: function() {
|
||||
getFilterUniqueIdPrefix: function() {
|
||||
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reload of dataset, also reloads page to show changes
|
||||
*/
|
||||
reloadDataset: function() {
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"widgets/Filters/reloadDataset",
|
||||
{
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._failOrReload(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
@@ -164,6 +187,12 @@ var FHC_FilterWidget = {
|
||||
{
|
||||
$("#filterPivotUI").html("");
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is tabulator
|
||||
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABULATOR)
|
||||
{
|
||||
$("#filterTabulator").html("");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -173,9 +202,9 @@ var FHC_FilterWidget = {
|
||||
_getFilter: function(renderFunction) {
|
||||
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
"system/Filters/getFilter",
|
||||
"widgets/Filters/getFilter",
|
||||
{
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
@@ -197,7 +226,7 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* This method calls all the other methods needed to rendere the GUI for a FilterWidget
|
||||
* This method calls all the other methods needed to render the GUI for a FilterWidget
|
||||
* The parameter data contains all the data about the FilterWidget and it is given as parameter
|
||||
* to all the methods that here are called
|
||||
* NOTE: think very carefully before changing the order of the calls
|
||||
@@ -207,16 +236,23 @@ var FHC_FilterWidget = {
|
||||
FHC_FilterWidget._initSessionStorage(); // initialize the session storage
|
||||
|
||||
FHC_FilterWidget._setDatasetRepresentation(data); // set what type of dataset representation was choosen
|
||||
FHC_FilterWidget._setHideMenu(data); // sets the _hideMenu property
|
||||
FHC_FilterWidget._setHideOptions(data);
|
||||
|
||||
FHC_FilterWidget._turnOffEvents(); // turns all the events off
|
||||
FHC_FilterWidget._resetGUI(); // Reset the entire GUI
|
||||
|
||||
// Render the GUI for this FilterWidget
|
||||
FHC_FilterWidget._setFilterName(data); // set the name in the GUI
|
||||
FHC_FilterWidget._renderDragAndDropFields(data); // render the fields drag and drop GUI
|
||||
FHC_FilterWidget._renderDropDownFields(data); // render the fields drop-down
|
||||
FHC_FilterWidget._renderAppliedFilters(data); // render the GUI for the applied filters
|
||||
FHC_FilterWidget._renderDropDownFilters(data); // render the filters drop-down
|
||||
|
||||
if (FHC_FilterWidget._hideOptions != true)
|
||||
{
|
||||
FHC_FilterWidget._renderDragAndDropFields(data); // render the fields drag and drop GUI
|
||||
FHC_FilterWidget._renderDropDownFields(data); // render the fields drop-down
|
||||
FHC_FilterWidget._renderAppliedFilters(data); // render the GUI for the applied filters
|
||||
FHC_FilterWidget._renderDropDownFilters(data); // render the filters drop-down
|
||||
}
|
||||
|
||||
FHC_FilterWidget._renderDataset(data);
|
||||
|
||||
FHC_FilterWidget._turnOnEvents(); // turns all the events off
|
||||
@@ -248,7 +284,7 @@ var FHC_FilterWidget = {
|
||||
*/
|
||||
_turnOffEvents: function() {
|
||||
|
||||
$("[data-toggle='collapse']").off("click");
|
||||
$('[data-toggle="collapse"]').off("click");
|
||||
$(".drag-and-drop-fields-span").off("draggable");
|
||||
$(".drag-and-drop-fields-span").off("droppable");
|
||||
$(".remove-selected-field").off("click");
|
||||
@@ -262,7 +298,7 @@ var FHC_FilterWidget = {
|
||||
// If the choosen dataset representation is tablesorter
|
||||
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
|
||||
{
|
||||
FHC_FilterWidget._disableTableSorter(); // disable the tablesorter
|
||||
FHC_FilterWidget._disableTablesorter(); // disable the tablesorter
|
||||
}
|
||||
},
|
||||
|
||||
@@ -272,7 +308,7 @@ var FHC_FilterWidget = {
|
||||
*/
|
||||
_turnOnEvents: function() {
|
||||
|
||||
$("[data-toggle='collapse']").click(FHC_FilterWidget._dataToggleCollapseEvent); // Click event to collapse or to open the filter options panel
|
||||
$('[data-toggle="collapse"]').click(FHC_FilterWidget._dataToggleCollapseEvent); // Click event to collapse or to open the filter options panel
|
||||
$(".drag-and-drop-fields-span").draggable(FHC_FilterWidget._draggableConf); // draggable event on selected fields
|
||||
$(".drag-and-drop-fields-span").droppable(FHC_FilterWidget._droppableConf); // droppable event on selected fields
|
||||
$(".remove-selected-field").click(FHC_FilterWidget._revomeSelectedFieldsEvent); // Click event on the "X" link
|
||||
@@ -368,14 +404,13 @@ var FHC_FilterWidget = {
|
||||
});
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/sortSelectedFields",
|
||||
"widgets/Filters/sortSelectedFields",
|
||||
{
|
||||
selectedFields: arrayDndId,
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._cleanTablesorterLocalStorage();
|
||||
FHC_FilterWidget._failOrRefresh(data, textStatus, jqXHR);
|
||||
}
|
||||
}
|
||||
@@ -389,10 +424,10 @@ var FHC_FilterWidget = {
|
||||
_revomeSelectedFieldsEvent: function(event) {
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/removeSelectedField",
|
||||
"widgets/Filters/removeSelectedField",
|
||||
{
|
||||
selectedField: $(this).attr("fieldToRemove"),
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
@@ -429,14 +464,13 @@ var FHC_FilterWidget = {
|
||||
_addFieldEvent: function(event) {
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/addSelectedField",
|
||||
"widgets/Filters/addSelectedField",
|
||||
{
|
||||
selectedField: $(this).val(),
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._cleanTablesorterLocalStorage();
|
||||
FHC_FilterWidget._failOrRefresh(data, textStatus, jqXHR);
|
||||
}
|
||||
}
|
||||
@@ -445,8 +479,9 @@ var FHC_FilterWidget = {
|
||||
|
||||
/**
|
||||
* Event function used by the apply filter button
|
||||
* The given parameter is used to decide if the page is going to be reloaded
|
||||
*/
|
||||
_applyFilterEvent: function() {
|
||||
_applyFilterEvent: function(reload = true) {
|
||||
|
||||
var appliedFilters = [];
|
||||
var appliedFiltersOperations = [];
|
||||
@@ -461,17 +496,25 @@ var FHC_FilterWidget = {
|
||||
});
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/applyFilters",
|
||||
"widgets/Filters/applyFilters",
|
||||
{
|
||||
appliedFilters: appliedFilters,
|
||||
appliedFiltersOperations: appliedFiltersOperations,
|
||||
appliedFiltersConditions: appliedFiltersConditions,
|
||||
appliedFiltersOptions: appliedFiltersOptions,
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._failOrReload(data, textStatus, jqXHR);
|
||||
|
||||
if (reload === true)
|
||||
{
|
||||
FHC_FilterWidget._failOrReload(data, textStatus, jqXHR);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -483,10 +526,10 @@ var FHC_FilterWidget = {
|
||||
_removeAppliedFiltersEvent: function(event) {
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/removeAppliedFilter",
|
||||
"widgets/Filters/removeAppliedFilter",
|
||||
{
|
||||
appliedFilter: $(this).attr("filterToRemove"),
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
@@ -502,10 +545,10 @@ var FHC_FilterWidget = {
|
||||
_addFilterEvent: function(event) {
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/addFilter",
|
||||
"widgets/Filters/addFilter",
|
||||
{
|
||||
filter: $(this).val(),
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
@@ -543,19 +586,18 @@ var FHC_FilterWidget = {
|
||||
|
||||
if ($("#customFilterDescription").val() != "")
|
||||
{
|
||||
// Apply the filter before saving it, without reloading the page
|
||||
FHC_FilterWidget._applyFilterEvent(false);
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/saveCustomFilter",
|
||||
"widgets/Filters/saveCustomFilter",
|
||||
{
|
||||
customFilterDescription: $("#customFilterDescription").val(),
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
// If a success and refreshSideMenuHook is a valid function then call it to refresh the side menu
|
||||
if (typeof refreshSideMenuHook == "function")
|
||||
{
|
||||
refreshSideMenuHook();
|
||||
}
|
||||
FHC_FilterWidget._failOrReload(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -812,6 +854,12 @@ var FHC_FilterWidget = {
|
||||
{
|
||||
FHC_FilterWidget._renderDatasetPivotUI(data); // ...render the pivotUI GUI
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is tabulator then...
|
||||
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABULATOR)
|
||||
{
|
||||
FHC_FilterWidget._renderDatasetTabulator(data); // ...render the tabulator GUI
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -820,7 +868,15 @@ var FHC_FilterWidget = {
|
||||
*/
|
||||
_renderDatasetTablesorter: function(data) {
|
||||
|
||||
if (data.hasOwnProperty("checkboxes") && data.checkboxes!=null && data.checkboxes.trim() != "")
|
||||
//clear tablesorter filter storage
|
||||
var keepTsFilter = FHC_AjaxClient.getUrlParameter("keepTsFilter");
|
||||
|
||||
if (typeof keepTsFilter === "undefined" || keepTsFilter !== "true")
|
||||
{
|
||||
FHC_FilterWidget._clearTablesorterLocalStorage();
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty("checkboxes") && data.checkboxes != null && data.checkboxes.trim() != "")
|
||||
{
|
||||
$("#filterTableDataset > thead > tr").append("<th data-filter='false' title='Select'>Select</th>");
|
||||
}
|
||||
@@ -905,12 +961,14 @@ var FHC_FilterWidget = {
|
||||
*/
|
||||
_enableTableSorter: function() {
|
||||
|
||||
var filterWidgetTablesorter = $("#filterTableDataset");
|
||||
|
||||
// Checks if the table contains data (rows)
|
||||
if ($("#filterTableDataset").find("tbody:empty").length == 0
|
||||
&& $("#filterTableDataset").find("tr:empty").length == 0
|
||||
&& $("#filterTableDataset").hasClass("table-condensed"))
|
||||
if (filterWidgetTablesorter.find("tbody:empty").length == 0
|
||||
&& filterWidgetTablesorter.find("tr:empty").length == 0
|
||||
&& filterWidgetTablesorter.hasClass("table-condensed"))
|
||||
{
|
||||
$("#filterTableDataset").tablesorter({
|
||||
filterWidgetTablesorter.tablesorter({
|
||||
dateFormat: "ddmmyyyy",
|
||||
widgets: ["zebra", "filter"],
|
||||
widgetOptions: {
|
||||
@@ -918,41 +976,34 @@ var FHC_FilterWidget = {
|
||||
}
|
||||
});
|
||||
|
||||
// Reset filter storage if there is a filter id in url TODO: find better solution
|
||||
var filter_id = FHC_AjaxClient.getUrlParameter("filter_id");
|
||||
if (typeof filter_id !== "undefined") FHC_FilterWidget._cleanTablesorterLocalStorage();
|
||||
|
||||
$.tablesorter.updateAll($("#filterTableDataset")[0].config, true, null);
|
||||
$.tablesorter.updateAll(filterWidgetTablesorter[0].config, true, null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Disable the tablesorter
|
||||
*/
|
||||
_disableTableSorter: function() {
|
||||
_disableTablesorter: function() {
|
||||
|
||||
$("#filterTableDataset").trigger("disable");
|
||||
},
|
||||
|
||||
/**
|
||||
* Tablesorter filter local storage clean
|
||||
*/
|
||||
_cleanTablesorterLocalStorage: function() {
|
||||
|
||||
$("#filterTableDataset").trigger("filterResetSaved");
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders the pivotUI for the FilterWidget
|
||||
* The data to be displayed are retrived from the parameter data
|
||||
*/
|
||||
_renderDatasetPivotUI: function(data) {
|
||||
|
||||
var options = {}; // eventually contains options fot the pivotUI
|
||||
|
||||
// Checks if options were given
|
||||
if (data.hasOwnProperty("datasetRepresentationOptions") && data.datasetRepresentationOptions != "")
|
||||
{
|
||||
var tmpOptions = eval("(" + data.datasetRepresentationOptions + ")"); // and converts them from string to javascript code
|
||||
|
||||
// If it is an object then can be used
|
||||
if (typeof tmpOptions == "object")
|
||||
{
|
||||
options = tmpOptions;
|
||||
}
|
||||
}
|
||||
// Checks if options were given and returns them
|
||||
var options = FHC_FilterWidget._getRepresentationOptions(data);
|
||||
|
||||
// Manipulation for the representation!
|
||||
var arrayFieldsToDisplay = FHC_FilterWidget._getFieldsToDisplay(data);
|
||||
@@ -1038,11 +1089,147 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Tablesorter filter local storage clean
|
||||
* Renders the tabulator for the FilterWidget
|
||||
* The data to be displayed are retrived from the parameter data
|
||||
*/
|
||||
_cleanTablesorterLocalStorage: function() {
|
||||
_renderDatasetTabulator: function(data) {
|
||||
|
||||
$("#filterTableDataset").trigger("filterResetSaved");
|
||||
// Checks if options were given and returns them
|
||||
var options = FHC_FilterWidget._getRepresentationOptions(data);
|
||||
// Checks if record fields definitions were given and returns them
|
||||
var recordFieldsDefinitions = FHC_FilterWidget._getRepresentationFieldsDefinitions(data);
|
||||
|
||||
// Manipulation for the representation!
|
||||
var arrayTabulatorColumns = FHC_FilterWidget._getTabulatorColumns(data, recordFieldsDefinitions);
|
||||
|
||||
if (arrayTabulatorColumns.length > 0)
|
||||
{
|
||||
// ...if there are data to be displayed...
|
||||
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
|
||||
{
|
||||
if (options == null) options = {};
|
||||
|
||||
options.columns = arrayTabulatorColumns;
|
||||
options.data = data.dataset;
|
||||
|
||||
// Renders the tabulator
|
||||
$("#filterTabulator").tabulator(options);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrives the fields to be displayed from the data parameter, if aliases are present then they are used
|
||||
*/
|
||||
_getTabulatorColumns: function(data, recordFieldsDefinitions) {
|
||||
|
||||
var fieldsToDisplayTabulator = [];
|
||||
|
||||
if (data.hasOwnProperty("selectedFields") && $.isArray(data.selectedFields))
|
||||
{
|
||||
for (var sfc = 0; sfc < data.selectedFields.length; sfc++)
|
||||
{
|
||||
for (var fc = 0; fc < data.fields.length; fc++)
|
||||
{
|
||||
if (data.selectedFields[sfc] == data.fields[fc])
|
||||
{
|
||||
// Build the array of objects (columns) used by tabulator and store it in tabulatorColumns
|
||||
var tmpColumnObj = {}; // New object that represents a column
|
||||
|
||||
// If was given a definition for this field then use it!
|
||||
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(data.selectedFields[sfc]))
|
||||
{
|
||||
tmpColumnObj = recordFieldsDefinitions[data.selectedFields[sfc]];
|
||||
}
|
||||
|
||||
tmpColumnObj.field = data.selectedFields[sfc]; // Field name to be linked with dataset field name
|
||||
|
||||
// If there is an alias for this field use it to give a title to this field (header)
|
||||
if (data.hasOwnProperty("columnsAliases") && $.isArray(data.columnsAliases))
|
||||
{
|
||||
tmpColumnObj.title = data.columnsAliases[fc];
|
||||
}
|
||||
else // otherwise use the field name itself
|
||||
{
|
||||
tmpColumnObj.title = data.selectedFields[sfc];
|
||||
}
|
||||
|
||||
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If additional columns are present...
|
||||
if (data.hasOwnProperty("additionalColumns") && data.additionalColumns != null && $.isArray(data.additionalColumns))
|
||||
{
|
||||
// ...loops through them
|
||||
$.each(data.additionalColumns, function(i, additionalColumn) {
|
||||
|
||||
var tmpColumnObj = {}; // New object that represents a column
|
||||
|
||||
// If was given a definition for this field then use it!
|
||||
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(additionalColumn))
|
||||
{
|
||||
tmpColumnObj = recordFieldsDefinitions[additionalColumn];
|
||||
}
|
||||
|
||||
tmpColumnObj.title = additionalColumn; // Give a title to this field (header)
|
||||
tmpColumnObj.field = additionalColumn; // Field name to be linked with dataset field name
|
||||
|
||||
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
|
||||
});
|
||||
}
|
||||
|
||||
return fieldsToDisplayTabulator;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets options for the representation
|
||||
*/
|
||||
_getRepresentationOptions: function(data) {
|
||||
|
||||
var options = {}; // eventually contains options fot the representation
|
||||
|
||||
// Checks if options were given
|
||||
if (data.hasOwnProperty("datasetRepresentationOptions") && data.datasetRepresentationOptions != "")
|
||||
{
|
||||
var tmpOptions = eval("(" + data.datasetRepresentationOptions + ")"); // and converts them from string to javascript code
|
||||
|
||||
// If it is an object then can be used
|
||||
if (typeof tmpOptions == "object")
|
||||
{
|
||||
options = tmpOptions;
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets record fields definitions to represent the dataset
|
||||
*/
|
||||
_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 != "")
|
||||
{
|
||||
var tmpFDefs = eval("(" + data.datasetRepresentationFieldsDefinitions + ")"); // and converts them from string to javascript code
|
||||
|
||||
// If it is an object then can be used
|
||||
if (typeof tmpFDefs == "object")
|
||||
{
|
||||
fieldsDefinitions = tmpFDefs;
|
||||
}
|
||||
}
|
||||
|
||||
return fieldsDefinitions;
|
||||
},
|
||||
|
||||
_clearTablesorterLocalStorage: function() {
|
||||
localStorage.removeItem("tablesorter-filters");
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1054,8 +1241,29 @@ var FHC_FilterWidget = {
|
||||
{
|
||||
FHC_FilterWidget._datasetRepresentation = data.datasetRepresentation;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set what type of dataset representation was choosen
|
||||
*/
|
||||
_setHideMenu: function(data) {
|
||||
|
||||
if (data.hasOwnProperty("hideMenu"))
|
||||
{
|
||||
FHC_FilterWidget._hideMenu = data.hideMenu;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set what type of dataset representation was choosen
|
||||
*/
|
||||
_setHideOptions: function(data) {
|
||||
|
||||
if (data.hasOwnProperty("hideOptions"))
|
||||
{
|
||||
FHC_FilterWidget._hideOptions = data.hideOptions;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,594 @@
|
||||
/**
|
||||
* TableWidget JS magic
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
// Constants
|
||||
|
||||
//
|
||||
const DATASET_REP_TABLESORTER = "tablesorter";
|
||||
const DATASET_REP_PIVOTUI = "pivotUI";
|
||||
const DATASET_REP_TABULATOR = "tabulator";
|
||||
|
||||
/**
|
||||
* FHC_TableWidget this object is used to render the GUI of a table widget and to operate with it
|
||||
*/
|
||||
var FHC_TableWidget = {
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Properties
|
||||
|
||||
_datasetRepresentation: null, // contains the current data representation
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* To display the TableWidget using the loaded data prenset in the session
|
||||
*/
|
||||
display: function() {
|
||||
|
||||
FHC_TableWidget._getTables(FHC_TableWidget._renderTableWidget);
|
||||
},
|
||||
|
||||
/**
|
||||
* Alias call to method display only to inprove the readability of the code
|
||||
*/
|
||||
refresh: function() {
|
||||
|
||||
FHC_TableWidget.display();
|
||||
},
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* To retrive the page where the TableWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
|
||||
*/
|
||||
_getTableUniqueIdPrefix: function() {
|
||||
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility method that checks if data contains an error and print that to the console
|
||||
* otherwise the TableWidget GUI is refreshed
|
||||
*/
|
||||
_failOrRefresh: function(data, textStatus, jqXHR) {
|
||||
|
||||
if (FHC_AjaxClient.isError(data))
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
FHC_TableWidget.refresh();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility method that checks if data contains an error and print that to the console
|
||||
* otherwise the page is reloaded
|
||||
*/
|
||||
_failOrReload: function(data, textStatus, jqXHR) {
|
||||
|
||||
if (FHC_AjaxClient.isError(data))
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* To reset the Table Widget GUI
|
||||
*/
|
||||
_resetGUI: function(tableWidgetDiv) {
|
||||
|
||||
// If the choosen dataset representation is tablesorter
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
|
||||
{
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").html("");
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > tbody").html("");
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is pivotUI
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
|
||||
{
|
||||
tableWidgetDiv.find("#tableWidgetPivotUI").html("");
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is tabulator
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABULATOR)
|
||||
{
|
||||
tableWidgetDiv.find("#tableWidgetTabulator").html("");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* To get via Ajax all the data related to the TableWidget present in the given page
|
||||
* If the parameter renderFunction is a valid function, is called on success
|
||||
*/
|
||||
_getTables: function(renderFunction) {
|
||||
|
||||
var tableWidgetUniqueIdArray = FHC_TableWidget._getTableWidgetUniqueIdArray();
|
||||
|
||||
for (var tableWidgetsCounter = 0; tableWidgetsCounter < tableWidgetUniqueIdArray.length; tableWidgetsCounter++)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
"widgets/Tables/getTable",
|
||||
{
|
||||
tableUniqueId: FHC_TableWidget._getTableUniqueIdPrefix() + "/" + tableWidgetUniqueIdArray[tableWidgetsCounter]
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
if (typeof renderFunction == "function")
|
||||
{
|
||||
renderFunction(FHC_AjaxClient.getData(data));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method calls all the other methods needed to rendere the GUI for a TableWidget
|
||||
* The parameter data contains all the data about the TableWidget and it is given as parameter
|
||||
* to all the methods that here are called
|
||||
* NOTE: think very carefully before changing the order of the calls
|
||||
*/
|
||||
_renderTableWidget: function(data) {
|
||||
|
||||
FHC_TableWidget._setDatasetRepresentation(data); // set what type of dataset representation was choosen
|
||||
|
||||
var tableWidgetDiv = $('div[tableUniqueId="' + data.tableUniqueId + '"]');
|
||||
|
||||
FHC_TableWidget._turnOffEvents(tableWidgetDiv); // turns all the events off
|
||||
|
||||
FHC_TableWidget._resetGUI(tableWidgetDiv); // Reset the entire GUI
|
||||
|
||||
FHC_TableWidget._renderDataset(tableWidgetDiv, data);
|
||||
|
||||
FHC_TableWidget._turnOnEvents(tableWidgetDiv); // turns all the events off
|
||||
},
|
||||
|
||||
/**
|
||||
* Turns all the events off
|
||||
* NOTE: must be aligned to _turnOnEvents
|
||||
*/
|
||||
_turnOffEvents: function(tableWidgetDiv) {
|
||||
|
||||
// If the choosen dataset representation is tablesorter
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
|
||||
{
|
||||
FHC_TableWidget._disableTablesorter(tableWidgetDiv); // disable the tablesorter
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Turns all the events on
|
||||
* NOTE: must be aligned to _turnOffEvents
|
||||
*/
|
||||
_turnOnEvents: function(tableWidgetDiv) {
|
||||
|
||||
// If the choosen dataset representation is tablesorter
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
|
||||
{
|
||||
FHC_TableWidget._enableTableSorter(tableWidgetDiv); // enable the tablesorter
|
||||
}
|
||||
},
|
||||
|
||||
_renderDataset: function(tableWidgetDiv, data) {
|
||||
|
||||
// If the choosen dataset representation is tablesorter then...
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
|
||||
{
|
||||
FHC_TableWidget._renderDatasetTablesorter(tableWidgetDiv, data); // ...render the tablesorter GUI
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is pivotUI then...
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
|
||||
{
|
||||
FHC_TableWidget._renderDatasetPivotUI(tableWidgetDiv, data); // ...render the pivotUI GUI
|
||||
}
|
||||
|
||||
// If the choosen dataset representation is tabulator then...
|
||||
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABULATOR)
|
||||
{
|
||||
FHC_TableWidget._renderDatasetTabulator(tableWidgetDiv, data); // ...render the tabulator GUI
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders the tablesorter for the TableWidget
|
||||
* The data to be displayed are retrived from the parameter data
|
||||
*/
|
||||
_renderDatasetTablesorter: function(tableWidgetDiv, data) {
|
||||
|
||||
if (data.hasOwnProperty("checkboxes") && data.checkboxes != null && data.checkboxes.trim() != "")
|
||||
{
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th data-filter='false' title='Select'>Select</th>");
|
||||
}
|
||||
|
||||
var arrayFieldsToDisplay = FHC_TableWidget._getFieldsToDisplay(data);
|
||||
|
||||
for (var i = 0; i < arrayFieldsToDisplay.length; i++)
|
||||
{
|
||||
var columnName = arrayFieldsToDisplay[i];
|
||||
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty("additionalColumns") && $.isArray(data.additionalColumns))
|
||||
{
|
||||
for (var i = 0; i < data.additionalColumns.length; i++)
|
||||
{
|
||||
var columnName = data.additionalColumns[i];
|
||||
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
|
||||
}
|
||||
}
|
||||
|
||||
if (arrayFieldsToDisplay.length > 0)
|
||||
{
|
||||
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
|
||||
{
|
||||
if (data.checkboxes != null && data.checkboxes != "")
|
||||
{
|
||||
// select checkbox range with shift key
|
||||
if (typeof tableWidgetDiv.find("#tableWidgetTableDataset").checkboxes === 'function')
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset").checkboxes("range", true);
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.dataset.length; i++)
|
||||
{
|
||||
var record = data.dataset[i];
|
||||
|
||||
if ($.isEmptyObject(record))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var strHtml = "<tr class='" + record.MARK_ROW_CLASS + "'>";
|
||||
|
||||
if (data.checkboxes != null && data.checkboxes != "")
|
||||
{
|
||||
strHtml += "<td>";
|
||||
strHtml += "<input type='checkbox' name='" + data.checkboxes + "[]' value='" + record[data.checkboxes] + "'>";
|
||||
strHtml += "</td>";
|
||||
}
|
||||
|
||||
$.each(arrayFieldsToDisplay, function(i, fieldToDisplay) {
|
||||
|
||||
if (record.hasOwnProperty(data.fields[i]))
|
||||
{
|
||||
strHtml += "<td>" + record[data.fields[i]] + "</td>";
|
||||
}
|
||||
});
|
||||
|
||||
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
|
||||
{
|
||||
$.each(data.additionalColumns, function(i, additionalColumn) {
|
||||
|
||||
if (record.hasOwnProperty(additionalColumn))
|
||||
{
|
||||
strHtml += "<td>" + record[additionalColumn] + "</td>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
strHtml += "</tr>";
|
||||
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset > tbody").append(strHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable the tablesorter libs to render the dataset table with sorting features
|
||||
*/
|
||||
_enableTableSorter: function(tableWidgetDiv) {
|
||||
|
||||
var tableWidgetTablesorter = tableWidgetDiv.find("#tableWidgetTableDataset");
|
||||
|
||||
// Checks if the table contains data (rows)
|
||||
if (tableWidgetTablesorter.find("tbody:empty").length == 0
|
||||
&& tableWidgetTablesorter.find("tr:empty").length == 0
|
||||
&& tableWidgetTablesorter.hasClass("table-condensed"))
|
||||
{
|
||||
tableWidgetTablesorter.tablesorter({
|
||||
dateFormat: "ddmmyyyy",
|
||||
widgets: ["zebra", "filter"],
|
||||
widgetOptions: {
|
||||
filter_saveFilters : true
|
||||
}
|
||||
});
|
||||
|
||||
$.tablesorter.updateAll(tableWidgetTablesorter[0].config, true, null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Disable the tablesorter
|
||||
*/
|
||||
_disableTablesorter: function(tableWidgetDiv) {
|
||||
|
||||
tableWidgetDiv.find("#tableWidgetTableDataset").trigger("disable");
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders the pivotUI for the TableWidget
|
||||
* The data to be displayed are retrived from the parameter data
|
||||
*/
|
||||
_renderDatasetPivotUI: function(tableWidgetDiv, data) {
|
||||
|
||||
// Checks if options were given and returns them
|
||||
var options = FHC_TableWidget._getRepresentationOptions(data);
|
||||
|
||||
// Manipulation for the representation!
|
||||
var arrayFieldsToDisplay = FHC_TableWidget._getFieldsToDisplay(data);
|
||||
|
||||
// If there are fields to be displayed...
|
||||
if (arrayFieldsToDisplay.length > 0)
|
||||
{
|
||||
// ...if there are data to be displayed...
|
||||
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
|
||||
{
|
||||
// Build the array of objects used by pivotUI and store it in pivotUIData
|
||||
var pivotUIData = [];
|
||||
|
||||
// Loops through data
|
||||
for (var i = 0; i < data.dataset.length; i++)
|
||||
{
|
||||
var record = data.dataset[i]; // Single record
|
||||
var tmpObj = {}; // New object that represents a record
|
||||
|
||||
// Loops through columns of a record
|
||||
$.each(arrayFieldsToDisplay, function(i, fieldToDisplay) {
|
||||
|
||||
if (record.hasOwnProperty(data.fields[i]))
|
||||
{
|
||||
tmpObj[fieldToDisplay] = record[data.fields[i]]; // Add data with the column alias
|
||||
}
|
||||
});
|
||||
|
||||
// If additional columns are present...
|
||||
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
|
||||
{
|
||||
// ...loops through them
|
||||
$.each(data.additionalColumns, function(i, additionalColumn) {
|
||||
|
||||
if (record.hasOwnProperty(additionalColumn))
|
||||
{
|
||||
tmpObj[additionalColumn] = record[additionalColumn]; // Add the additional column
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pivotUIData.push(tmpObj); // Add tmpObj to pivotUIData
|
||||
}
|
||||
|
||||
// Renders the pivotUI
|
||||
tableWidgetDiv.find("#tableWidgetPivotUI").pivotUI(
|
||||
pivotUIData,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrives the fields to be displayed from the data parameter, if aliases are present then they are used
|
||||
*/
|
||||
_getFieldsToDisplay: function(data) {
|
||||
|
||||
var arrayFieldsToDisplay = [];
|
||||
|
||||
if (data.hasOwnProperty("fields") && $.isArray(data.fields))
|
||||
{
|
||||
if (data.hasOwnProperty("columnsAliases") && $.isArray(data.columnsAliases))
|
||||
{
|
||||
for (var sfc = 0; sfc < data.fields.length; sfc++)
|
||||
{
|
||||
for (var fc = 0; fc < data.fields.length; fc++)
|
||||
{
|
||||
if (data.fields[sfc] == data.fields[fc])
|
||||
{
|
||||
arrayFieldsToDisplay[sfc] = data.columnsAliases[fc];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arrayFieldsToDisplay = data.fields;
|
||||
}
|
||||
}
|
||||
|
||||
return arrayFieldsToDisplay;
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders the tabulator for the TableWidget
|
||||
* The data to be displayed are retrived from the parameter data
|
||||
*/
|
||||
_renderDatasetTabulator: function(tableWidgetDiv, data) {
|
||||
|
||||
// Checks if options were given and returns them
|
||||
var options = FHC_TableWidget._getRepresentationOptions(data);
|
||||
// Checks if record fields definitions were given and returns them
|
||||
var recordFieldsDefinitions = FHC_TableWidget._getRepresentationFieldsDefinitions(data);
|
||||
|
||||
// Manipulation for the representation!
|
||||
var arrayTabulatorColumns = FHC_TableWidget._getTabulatorColumns(data, recordFieldsDefinitions);
|
||||
|
||||
if (arrayTabulatorColumns.length > 0)
|
||||
{
|
||||
// ...if there are data to be displayed...
|
||||
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
|
||||
{
|
||||
if (options == null) options = {};
|
||||
|
||||
options.columns = arrayTabulatorColumns;
|
||||
options.data = data.dataset;
|
||||
|
||||
// Renders the tabulator
|
||||
tableWidgetDiv.find("#tableWidgetTabulator").tabulator(options);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrives the fields to be displayed from the data parameter, if aliases are present then they are used
|
||||
*/
|
||||
_getTabulatorColumns: function(data, recordFieldsDefinitions) {
|
||||
|
||||
var fieldsToDisplayTabulator = [];
|
||||
|
||||
if (data.hasOwnProperty("fields") && $.isArray(data.fields))
|
||||
{
|
||||
for (var sfc = 0; sfc < data.fields.length; sfc++)
|
||||
{
|
||||
for (var fc = 0; fc < data.fields.length; fc++)
|
||||
{
|
||||
if (data.fields[sfc] == data.fields[fc])
|
||||
{
|
||||
// Build the array of objects (columns) used by tabulator and store it in tabulatorColumns
|
||||
var tmpColumnObj = {}; // New object that represents a column
|
||||
|
||||
// If was given a definition for this field then use it!
|
||||
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(data.fields[sfc]))
|
||||
{
|
||||
tmpColumnObj = recordFieldsDefinitions[data.fields[sfc]];
|
||||
}
|
||||
|
||||
tmpColumnObj.field = data.fields[sfc]; // Field name to be linked with dataset field name
|
||||
|
||||
// If there is an alias for this field use it to give a title to this field (header)
|
||||
if (data.hasOwnProperty("columnsAliases") && $.isArray(data.columnsAliases))
|
||||
{
|
||||
tmpColumnObj.title = data.columnsAliases[fc];
|
||||
}
|
||||
else // otherwise use the field name itself
|
||||
{
|
||||
tmpColumnObj.title = data.fields[sfc];
|
||||
}
|
||||
|
||||
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If additional columns are present...
|
||||
if (data.hasOwnProperty("additionalColumns") && data.additionalColumns != null && $.isArray(data.additionalColumns))
|
||||
{
|
||||
// ...loops through them
|
||||
$.each(data.additionalColumns, function(i, additionalColumn) {
|
||||
|
||||
var tmpColumnObj = {}; // New object that represents a column
|
||||
|
||||
// If was given a definition for this field then use it!
|
||||
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(additionalColumn))
|
||||
{
|
||||
tmpColumnObj = recordFieldsDefinitions[additionalColumn];
|
||||
}
|
||||
|
||||
tmpColumnObj.title = additionalColumn; // Give a title to this field (header)
|
||||
tmpColumnObj.field = additionalColumn; // Field name to be linked with dataset field name
|
||||
|
||||
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
|
||||
});
|
||||
}
|
||||
|
||||
return fieldsToDisplayTabulator;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets options for the representation
|
||||
*/
|
||||
_getRepresentationOptions: function(data) {
|
||||
|
||||
var options = {}; // eventually contains options fot the representation
|
||||
|
||||
// Checks if options were given
|
||||
if (data.hasOwnProperty("datasetRepresentationOptions") && data.datasetRepresentationOptions != "")
|
||||
{
|
||||
var tmpOptions = eval("(" + data.datasetRepresentationOptions + ")"); // and converts them from string to javascript code
|
||||
|
||||
// If it is an object then can be used
|
||||
if (typeof tmpOptions == "object")
|
||||
{
|
||||
options = tmpOptions;
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets record fields definitions to represent the dataset
|
||||
*/
|
||||
_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 != "")
|
||||
{
|
||||
var tmpFDefs = eval("(" + data.datasetRepresentationFieldsDefinitions + ")"); // and converts them from string to javascript code
|
||||
|
||||
// If it is an object then can be used
|
||||
if (typeof tmpFDefs == "object")
|
||||
{
|
||||
fieldsDefinitions = tmpFDefs;
|
||||
}
|
||||
}
|
||||
|
||||
return fieldsDefinitions;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set what type of dataset representation was choosen
|
||||
*/
|
||||
_setDatasetRepresentation: function(data) {
|
||||
|
||||
if (data.hasOwnProperty("datasetRepresentation"))
|
||||
{
|
||||
FHC_TableWidget._datasetRepresentation = data.datasetRepresentation;
|
||||
}
|
||||
},
|
||||
|
||||
_getTableWidgetUniqueIdArray: function() {
|
||||
|
||||
var tableWidgetUniqueIdArray = [];
|
||||
|
||||
$("div[id*='divTableWidgetDataset']").each(function(i, e) {
|
||||
|
||||
tableWidgetUniqueIdArray.push(e.attributes["tableUniqueId"].nodeValue);
|
||||
});
|
||||
|
||||
return tableWidgetUniqueIdArray;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* When JQuery is up
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
FHC_TableWidget.display();
|
||||
|
||||
});
|
||||
@@ -10,111 +10,113 @@ const STGFREIGABE_MESSAGE_VORLAGE = "InfocenterSTGfreigegeben";
|
||||
//Statusgründe for which no Studiengang Freigabe Message should be sent
|
||||
const FIT_PROGRAMM_STUDIENGAENGE = [10021, 10027];
|
||||
|
||||
const PARKEDNAME = 'parked';
|
||||
const ONHOLDNAME = 'onhold';
|
||||
|
||||
/**
|
||||
* javascript file for infocenterDetails page
|
||||
*/
|
||||
$(document).ready(function ()
|
||||
{
|
||||
//initialise table sorter
|
||||
Tablesort.addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
|
||||
Tablesort.addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
|
||||
//initialise table sorter
|
||||
Tablesort.addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
|
||||
Tablesort.addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
|
||||
|
||||
InfocenterDetails._formatMessageTable();
|
||||
InfocenterDetails._formatNotizTable();
|
||||
InfocenterDetails._formatLogTable();
|
||||
InfocenterDetails._formatMessageTable();
|
||||
InfocenterDetails._formatNotizTable();
|
||||
InfocenterDetails._formatLogTable();
|
||||
|
||||
var personid = $("#hiddenpersonid").val();
|
||||
|
||||
//add submit event to message send link
|
||||
$("#sendmsglink").click(function ()
|
||||
{
|
||||
$("#sendmsgform").submit();
|
||||
});
|
||||
|
||||
//add click events to "formal geprüft" checkboxes
|
||||
$(".prchbox").click(function ()
|
||||
{
|
||||
var boxid = this.id;
|
||||
var akteid = boxid.substr(boxid.indexOf("_") + 1);
|
||||
var checked = this.checked;
|
||||
InfocenterDetails.saveFormalGeprueft(personid, akteid, checked)
|
||||
});
|
||||
|
||||
//add click events to zgv Prüfung section
|
||||
InfocenterDetails._addZgvPruefungEvents(personid);
|
||||
|
||||
MessageList.initMessageList();
|
||||
|
||||
//save notiz
|
||||
$("#notizform").on("submit", function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var notizid = $("#notizform :input[name='hiddenNotizId']").val();
|
||||
var formdata = $(this).serializeArray();
|
||||
var data = {};
|
||||
|
||||
data.person_id = personid;
|
||||
|
||||
for (var i = 0; i < formdata.length; i++)
|
||||
{
|
||||
data[formdata[i].name] = formdata[i].value;
|
||||
}
|
||||
|
||||
$("#notizmsg").empty();
|
||||
|
||||
if (notizid !== '')
|
||||
{
|
||||
InfocenterDetails.updateNotiz(notizid, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
InfocenterDetails.saveNotiz(personid, data);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//update notiz - autofill notizform
|
||||
$(document).on("click", "#notiztable tbody tr", function ()
|
||||
{
|
||||
$("#notizmsg").empty();
|
||||
|
||||
var notizid = $(this).find("td.hiddennotizid").html();
|
||||
|
||||
InfocenterDetails.getNotiz(notizid);
|
||||
}
|
||||
);
|
||||
|
||||
//update notiz - abbrechen-button: reset styles
|
||||
$("#notizform :input[type='reset']").click(function ()
|
||||
{
|
||||
InfocenterDetails._resetNotizFields();
|
||||
}
|
||||
);
|
||||
|
||||
//check if person is parked and display it
|
||||
InfocenterDetails.getParkedDate(personid);
|
||||
|
||||
if ($(document).scrollTop() > 20)
|
||||
$("#scrollToTop").show();
|
||||
|
||||
//scroll to top button
|
||||
$(window).scroll(function()
|
||||
{
|
||||
if ($(document).scrollTop() > 20)
|
||||
$("#scrollToTop").show();
|
||||
else
|
||||
$("#scrollToTop").hide();
|
||||
}
|
||||
);
|
||||
|
||||
$("#scrollToTop").click(function()
|
||||
{
|
||||
$('html,body').animate({scrollTop:0},250,'linear');
|
||||
}
|
||||
)
|
||||
var personid = $("#hiddenpersonid").val();
|
||||
|
||||
//add submit event to message send link
|
||||
$("#sendmsglink").click(function ()
|
||||
{
|
||||
$("#sendmsgform").submit();
|
||||
});
|
||||
|
||||
//add click events to "formal geprüft" checkboxes
|
||||
$(".prchbox").click(function ()
|
||||
{
|
||||
var boxid = this.id;
|
||||
var akteid = boxid.substr(boxid.indexOf("_") + 1);
|
||||
var checked = this.checked;
|
||||
InfocenterDetails.saveFormalGeprueft(personid, akteid, checked)
|
||||
});
|
||||
|
||||
//add click events to zgv Prüfung section
|
||||
InfocenterDetails._addZgvPruefungEvents(personid);
|
||||
|
||||
MessageList.initMessageList();
|
||||
|
||||
//save notiz
|
||||
$("#notizform").on("submit", function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var notizid = $("#notizform :input[name='hiddenNotizId']").val();
|
||||
var formdata = $(this).serializeArray();
|
||||
var data = {};
|
||||
|
||||
data.person_id = personid;
|
||||
|
||||
for (var i = 0; i < formdata.length; i++)
|
||||
{
|
||||
data[formdata[i].name] = formdata[i].value;
|
||||
}
|
||||
|
||||
$("#notizmsg").empty();
|
||||
|
||||
if (notizid !== '')
|
||||
{
|
||||
InfocenterDetails.updateNotiz(notizid, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
InfocenterDetails.saveNotiz(personid, data);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//update notiz - autofill notizform
|
||||
$(document).on("click", "#notiztable tbody tr", function ()
|
||||
{
|
||||
$("#notizmsg").empty();
|
||||
|
||||
var notizid = $(this).find("td.hiddennotizid").html();
|
||||
|
||||
InfocenterDetails.getNotiz(notizid);
|
||||
}
|
||||
);
|
||||
|
||||
//update notiz - abbrechen-button: reset styles
|
||||
$("#notizform :input[type='reset']").click(function ()
|
||||
{
|
||||
InfocenterDetails._resetNotizFields();
|
||||
}
|
||||
);
|
||||
|
||||
//check if person is postponed (parked, on hold...) and display it
|
||||
InfocenterDetails.getPostponeDate(personid);
|
||||
|
||||
if ($(document).scrollTop() > 20)
|
||||
$("#scrollToTop").show();
|
||||
|
||||
//scroll to top button
|
||||
$(window).scroll(function()
|
||||
{
|
||||
if ($(document).scrollTop() > 20)
|
||||
$("#scrollToTop").show();
|
||||
else
|
||||
$("#scrollToTop").hide();
|
||||
}
|
||||
);
|
||||
|
||||
$("#scrollToTop").click(function()
|
||||
{
|
||||
$('html,body').animate({scrollTop:0},250,'linear');
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
var InfocenterDetails = {
|
||||
|
||||
openZgvInfoForPrestudent: function(prestudent_id)
|
||||
@@ -397,7 +399,7 @@ var InfocenterDetails = {
|
||||
{
|
||||
var engdate = $.datepicker.parseDate("yy-mm-dd", FHC_AjaxClient.getData(data)[0]);
|
||||
var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate);
|
||||
$("#parkdate").val(gerdate);
|
||||
$("#postponedate").val(gerdate);
|
||||
}
|
||||
},
|
||||
errorCallback: function()
|
||||
@@ -408,19 +410,19 @@ var InfocenterDetails = {
|
||||
}
|
||||
);
|
||||
},
|
||||
getParkedDate: function(personid)
|
||||
getPostponeDate: function(personid)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
CALLED_PATH + "/getParkedDate/"+encodeURIComponent(personid),
|
||||
CALLED_PATH + "/getPostponeDate/"+encodeURIComponent(personid),
|
||||
null,
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
var parkedDate = FHC_AjaxClient.getData(data)[0];
|
||||
InfocenterDetails._refreshParking(parkedDate);
|
||||
var postponeobj = FHC_AjaxClient.getData(data);
|
||||
InfocenterDetails._refreshPostpone(postponeobj);
|
||||
InfocenterDetails._refreshLog();
|
||||
if (parkedDate === null)
|
||||
if (postponeobj === null || postponeobj.type === null)
|
||||
InfocenterDetails.getStudienjahrEnd();
|
||||
}
|
||||
},
|
||||
@@ -435,7 +437,7 @@ var InfocenterDetails = {
|
||||
parkPerson: function(personid, date)
|
||||
{
|
||||
var parkError = function(){
|
||||
$("#parkmsg").text(" Fehler beim Parken!");
|
||||
$("#postponemsg").text(" Fehler beim Parken!");
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
@@ -447,7 +449,7 @@ var InfocenterDetails = {
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
InfocenterDetails.getParkedDate(personid);
|
||||
InfocenterDetails.getPostponeDate(personid);
|
||||
else
|
||||
{
|
||||
parkError();
|
||||
@@ -469,13 +471,62 @@ var InfocenterDetails = {
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
InfocenterDetails.getParkedDate(personid);
|
||||
InfocenterDetails.getPostponeDate(personid);
|
||||
}
|
||||
else
|
||||
$("#unparkmsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken'));
|
||||
$("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken'));
|
||||
},
|
||||
errorCallback: function(){
|
||||
$("#unparkmsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken'));
|
||||
$("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken'));
|
||||
},
|
||||
veilTimeout: 0
|
||||
}
|
||||
);
|
||||
},
|
||||
setPersonOnHold: function(personid, date)
|
||||
{
|
||||
var onHoldError = function(){
|
||||
$("#postponemsg").text(" Fehler beim Setzen auf On Hold!");
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
CALLED_PATH + '/setOnHold',
|
||||
{
|
||||
"person_id": personid,
|
||||
"onholddate": date
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
InfocenterDetails.getPostponeDate(personid);
|
||||
else
|
||||
{
|
||||
onHoldError();
|
||||
}
|
||||
},
|
||||
errorCallback: onHoldError,
|
||||
veilTimeout: 0
|
||||
}
|
||||
);
|
||||
},
|
||||
removePersonOnHold: function(personid)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
CALLED_PATH + '/removeOnHold',
|
||||
{
|
||||
"person_id": personid
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
InfocenterDetails.getPostponeDate(personid);
|
||||
}
|
||||
else
|
||||
$("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumEntfernen'));
|
||||
},
|
||||
errorCallback: function(){
|
||||
$("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimEntfernen'));
|
||||
},
|
||||
veilTimeout: 0
|
||||
}
|
||||
@@ -864,50 +915,94 @@ var InfocenterDetails = {
|
||||
}
|
||||
);
|
||||
},
|
||||
_refreshParking: function(date)
|
||||
_refreshPostpone: function(postponeobj)
|
||||
{
|
||||
if (date === null)
|
||||
var personid = $("#hiddenpersonid").val();
|
||||
if (postponeobj === null || postponeobj.date === null || postponeobj.type === null)
|
||||
{
|
||||
$("#parking").html(
|
||||
//show both park and on hold buttons if not parked and not on hold
|
||||
$("#postponing").html(
|
||||
'<div class="form-group form-inline">'+
|
||||
'<button class="btn btn-default" id="parklink" type="button""><i class="fa fa-clock-o"></i> ' + FHC_PhrasesLib.t('infocenter', 'bewerberParken') + '</button> '+
|
||||
FHC_PhrasesLib.t('global', 'bis') + ' '+
|
||||
'<input id="parkdate" type="text" class="form-control" placeholder="Parkdatum" style="height: 25px; width: 99px"> '+
|
||||
'<span class="text-danger" id="parkmsg"></span>'+
|
||||
'<button class="btn btn-default" id="onholdlink" type="button""><i class="fa fa-anchor"></i> ' + FHC_PhrasesLib.t('infocenter', 'bewerberOnHold') + '</button> '+
|
||||
'<label id="postponedatelabel">'+FHC_PhrasesLib.t('global', 'bis') + ' '+
|
||||
'<input id="postponedate" type="text" class="form-control" placeholder="Parkdatum"> '+
|
||||
'<i class="fa fa-info-circle" data-toggle="tooltip" title="'+FHC_PhrasesLib.t('infocenter', 'parkenZurueckstellenInfo')+'"></i></label>'+
|
||||
'<span class="text-danger" id="postponemsg"></span>'+
|
||||
'</div>');
|
||||
|
||||
$("#parkdate").datepicker({
|
||||
$("#postponedate").datepicker({
|
||||
"dateFormat": "dd.mm.yy",
|
||||
"minDate": 0
|
||||
"minDate": 1
|
||||
});
|
||||
|
||||
$("#parklink").click(
|
||||
|
||||
function ()
|
||||
{
|
||||
var personid = $("#hiddenpersonid").val();
|
||||
var date = $("#parkdate").val();
|
||||
|
||||
var date = $("#postponedate").val();
|
||||
InfocenterDetails.parkPerson(personid, date);
|
||||
}
|
||||
);
|
||||
|
||||
$("#onholdlink").click(
|
||||
|
||||
function ()
|
||||
{
|
||||
var date = $("#postponedate").val();
|
||||
InfocenterDetails.setPersonOnHold(personid, date);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var parkdate = $.datepicker.parseDate("yy-mm-dd", date);
|
||||
var gerparkdate = $.datepicker.formatDate("dd.mm.yy", parkdate);
|
||||
$("#parking").html(
|
||||
FHC_PhrasesLib.t('infocenter', 'bewerberGeparktBis')+' '+gerparkdate+' '+
|
||||
'<button class="btn btn-default" id="unparklink"><i class="fa fa-sign-out"></i> '+FHC_PhrasesLib.t('infocenter', 'bewerberAusparken')+'</button> '+
|
||||
'<span id="unparkmsg"></span>'
|
||||
//info if parked/on hold and possibility to undo parking/on hold
|
||||
var postponedate = $.datepicker.parseDate("yy-mm-dd", postponeobj.date);
|
||||
var gerpostponedate = $.datepicker.formatDate("dd.mm.yy", postponedate);
|
||||
|
||||
//var postponehtml = "";
|
||||
var callbackforundo = null;
|
||||
var removePhrase = "";
|
||||
var postponedPhrase = "";
|
||||
var postponedtext = "";
|
||||
|
||||
if (postponeobj.type === PARKEDNAME)
|
||||
{
|
||||
removePhrase = 'bewerberAusparken';
|
||||
postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberGeparktBis')+' '+gerpostponedate;
|
||||
|
||||
callbackforundo = function ()
|
||||
{
|
||||
InfocenterDetails.unparkPerson(personid);
|
||||
}
|
||||
}
|
||||
else if (postponeobj.type === ONHOLDNAME)
|
||||
{
|
||||
removePhrase = 'bewerberOnHoldEntfernen';
|
||||
postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberOnHoldBis')+' '+gerpostponedate;
|
||||
|
||||
var currdate = new Date();
|
||||
|
||||
if (currdate > postponedate)
|
||||
postponedtext = "<span class='alert-danger' data-toggle='tooltip' title='"+FHC_PhrasesLib.t('infocenter', 'rueckstelldatumUeberschritten')+"'>"+postponedtext+"</span>";
|
||||
|
||||
callbackforundo = function ()
|
||||
{
|
||||
InfocenterDetails.removePersonOnHold(personid);
|
||||
}
|
||||
}
|
||||
|
||||
var postponehtml = postponedtext+' '+
|
||||
'<button class="btn btn-default" id="unpostponelink"><i class="fa fa-sign-out"></i> '+FHC_PhrasesLib.t('infocenter', removePhrase)+'</button> '+
|
||||
'<span id="unpostponemsg"></span>';
|
||||
|
||||
|
||||
$("#postponing").html(
|
||||
postponehtml
|
||||
);
|
||||
|
||||
$("#unparklink").click(
|
||||
function ()
|
||||
{
|
||||
var personid = $("#hiddenpersonid").val();
|
||||
InfocenterDetails.unparkPerson(personid, date);
|
||||
}
|
||||
$("#unpostponelink").click(
|
||||
callbackforundo
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -19,18 +19,26 @@ if (FHC_JS_DATA_STORAGE_OBJECT.called_method == 'index')
|
||||
*
|
||||
*/
|
||||
var InfocenterPersonDataset = {
|
||||
infocenter_studiensemester_variablename: 'infocenter_studiensemester',
|
||||
|
||||
/**
|
||||
* adds person table additional actions html (above and beneath it)
|
||||
*/
|
||||
appendTableActionsHtml: function()
|
||||
appendTableActionsHtml: function(infocenter_studiensemester)
|
||||
{
|
||||
var currurl = window.location.href;
|
||||
var url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/system/messages/Messages/writeTemplate";
|
||||
|
||||
var formHtml = '<form id="sendMsgsForm" method="post" action="'+ url +'" target="_blank"></form>';
|
||||
$("#datasetActionsTop").before(formHtml);
|
||||
|
||||
var studienSemesterHtml = '<button class="btn btn-default btn-xs decStudiensemester">' +
|
||||
'<i class="fa fa-chevron-left"></i>' +
|
||||
'</button> ' +
|
||||
infocenter_studiensemester +
|
||||
' <button class="btn btn-default btn-xs incStudiensemester">' +
|
||||
'<i class="fa fa-chevron-right"></i>' +
|
||||
'</button>';
|
||||
|
||||
var selectAllHtml =
|
||||
'<a href="javascript:void(0)" class="selectAll">' +
|
||||
'<i class="fa fa-check"></i> Alle</a> ' +
|
||||
@@ -42,14 +50,30 @@ var InfocenterPersonDataset = {
|
||||
'<i class="fa fa-envelope"></i> Nachricht senden</a>';
|
||||
|
||||
var legendHtml = '<i class="fa fa-circle text-danger"></i> Gesperrt ' +
|
||||
'<i class="fa fa-circle text-info"></i> Geparkt';
|
||||
'<i class="fa fa-circle text-info"></i> Geparkt ' +
|
||||
'<i class="fa fa-circle onhold"></i> Zurückgestellt';
|
||||
|
||||
// userdefined Semestervariable shown independently of personcount,
|
||||
// it is possible to change the semester
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='row'>"+
|
||||
"<div class='col-xs-12 text-center'>"+studienSemesterHtml+"</div>"+
|
||||
"</div><div class='h-divider'></div><hr class='studiensemesterline'>");
|
||||
|
||||
$("button.incStudiensemester").click(function() {
|
||||
InfocenterPersonDataset.changeStudiensemesterUservar(1);
|
||||
});
|
||||
|
||||
$("button.decStudiensemester").click(function() {
|
||||
InfocenterPersonDataset.changeStudiensemesterUservar(-1);
|
||||
});
|
||||
|
||||
var personcount = 0;
|
||||
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
'system/Filters/rowNumber',
|
||||
'widgets/Filters/rowNumber',
|
||||
{
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
@@ -70,9 +94,9 @@ var InfocenterPersonDataset = {
|
||||
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='row'>"+
|
||||
"<div class='col-xs-6'>" + selectAllHtml + " " + actionHtml + "</div>"+
|
||||
"<div class='col-xs-4'>" + legendHtml + "</div>"+
|
||||
"<div class='col-xs-2 text-right'>" +
|
||||
"<div class='col-xs-4'>" + selectAllHtml + " " + actionHtml + "</div>"+
|
||||
"<div class='col-xs-4 text-center'>" + legendHtml + "</div>"+
|
||||
"<div class='col-xs-4 text-right'>" +
|
||||
"<span class='filterTableDatasetCntFiltered'></span>" +
|
||||
countHtml + "</div>"+
|
||||
"<div class='clearfix'></div>"+
|
||||
@@ -125,8 +149,87 @@ var InfocenterPersonDataset = {
|
||||
trs.find("input[name=PersonId\\[\\]]").prop("checked", false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//make sure tablesorter local storage for homepage url with and without "/index" shares same values
|
||||
$("#filterTableDataset").bind('filterEnd', function()
|
||||
{
|
||||
if (FHC_JS_DATA_STORAGE_OBJECT.called_method === 'index')
|
||||
{
|
||||
var pathname = window.location.pathname;
|
||||
var storageobj = localStorage.getItem("tablesorter-filters");
|
||||
var parsed = JSON.parse(storageobj);
|
||||
var regex = new RegExp(/\/index(?!\.ci\.php)/);
|
||||
if (regex.test(pathname))
|
||||
{
|
||||
parsed[pathname.replace(regex, "")] = parsed[pathname];
|
||||
}
|
||||
else
|
||||
{
|
||||
parsed[pathname + "/index"] = parsed[pathname];
|
||||
}
|
||||
storageobj = JSON.stringify(parsed);
|
||||
localStorage.setItem("tablesorter-filters", storageobj);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* initializes change of the uservariable infocenter_studiensemesster, either
|
||||
* to next semester (change > 0) or previous semester (change < 0)
|
||||
*/
|
||||
changeStudiensemesterUservar: function(change)
|
||||
{
|
||||
FHC_AjaxClient.showVeil();
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
'system/Variables/changeStudiensemesterVar',
|
||||
{
|
||||
'name': InfocenterPersonDataset.infocenter_studiensemester_variablename,
|
||||
'change': change
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
// refresh filterwidget with page reload
|
||||
FHC_FilterWidget.reloadDataset();
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_AjaxClient.hideVeil();
|
||||
alert(textStatus);//TODO dialoglib
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* initializes call to get the Studiensemester user variable
|
||||
*/
|
||||
getStudiensemesterUservar: function(callback)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
'system/Variables/getVar',
|
||||
{
|
||||
'name': InfocenterPersonDataset.infocenter_studiensemester_variablename
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
if (typeof callback === "function")
|
||||
{
|
||||
var infocenter_studiensemester = FHC_AjaxClient.getData(data);
|
||||
callback(infocenter_studiensemester[InfocenterPersonDataset.infocenter_studiensemester_variablename]);
|
||||
}
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -134,6 +237,6 @@ var InfocenterPersonDataset = {
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
InfocenterPersonDataset.appendTableActionsHtml();
|
||||
InfocenterPersonDataset.getStudiensemesterUservar(InfocenterPersonDataset.appendTableActionsHtml);
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,607 @@
|
||||
/**
|
||||
* Javascript file for Lehrauftraege annehmen view and tabulator
|
||||
* Lehrauftraege annehmen: acceptLehrauftrag.php
|
||||
* Lehrauftraege annehmen - Tabulator: acceptLehrauftragData.php
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Global vars
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const COLOR_LIGHTGREY = "#f5f5f5";
|
||||
|
||||
/**
|
||||
* PNG icons used in status- and filter buttons
|
||||
* Setting png icons is a workaround to use font-awsome 5.9.0 icons until system can be updated to newer font awsome version.
|
||||
* */
|
||||
const ICON_LEHRAUFTRAG_ORDERED = '<img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px; margin: -6px;">';
|
||||
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;">';
|
||||
const ICON_LEHRAUFTRAG_CANCELLED = '<img src="../../../public/images/icons/fa-user-times.png" style="height: 30px; width: 30px; margin: -6px;">';
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Mutators - setter methods to manipulate table data when entering the tabulator
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Converts string date postgre style to string DD.MM.YYYY.
|
||||
// This will allow correct filtering.
|
||||
var mut_formatStringDate = function(value, data, type, params, component) {
|
||||
if (value != null)
|
||||
{
|
||||
var d = new Date(value);
|
||||
return ("0" + (d.getDate())).slice(-2) + "." + ("0"+(d.getMonth()+1)).slice(-2) + "." + d.getFullYear();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Formatters - changes display information, not the data itself
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Formats null values to a string number '0.00'
|
||||
var form_formatNulltoStringNumber = function(cell, formatterParams){
|
||||
if (cell.getValue() == null){
|
||||
if (formatterParams.precision == 1)
|
||||
{
|
||||
return '0.0';
|
||||
}
|
||||
return '0.00';
|
||||
}
|
||||
else {
|
||||
return cell.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Header filter
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters values using comparison operator or just by string comparison
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
|
||||
|
||||
// If string starts with <, <=, >, >=, !=, ==, compare values with that operator
|
||||
var operator = '';
|
||||
if (headerValue.match(/([<=>!]{1,2})/g)) {
|
||||
var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
|
||||
operator = operator_arr[0];
|
||||
|
||||
headerValue = headerValue
|
||||
.replace(operator, '')
|
||||
.trim()
|
||||
;
|
||||
|
||||
// return if value comparison is true
|
||||
return eval(rowValue + operator + headerValue);
|
||||
}
|
||||
|
||||
// If just a stringnumber, return if exact match found
|
||||
return parseFloat(rowValue) == headerValue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator table format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Displays text when table is empty
|
||||
function func_placeholder()
|
||||
{
|
||||
return "<h4>Keine Daten vorhanden.</h4>";
|
||||
}
|
||||
|
||||
// Formats the rows
|
||||
function func_rowFormatter(row){
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Formats the color of the rows depending on their status
|
||||
- orange: geaendert
|
||||
- default: bestellte und erteilte (= zu akzeptierende)
|
||||
- green: akzeptierte
|
||||
- grey: all other (marks unselectable)
|
||||
*/
|
||||
row.getCells().forEach(function(cell){
|
||||
if (bestellt != null && (betrag != vertrag_betrag) ||
|
||||
bestellt != null && stunden != vertrag_stunden)
|
||||
{
|
||||
cell.getElement().classList.add('bg-warning'); // geaenderte
|
||||
}
|
||||
else if(bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
return; // bestellte + erteilte
|
||||
}
|
||||
else if(bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
cell.getElement().classList.add('bg-success') // akzeptierte
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Formats row selectable/unselectable
|
||||
function func_selectableCheck(row){
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
var is_storniert = row.getData().storniert != undefined;
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
// only allow to select bestellte && erteilte && nicht geaenderte Lehraufträge
|
||||
return row.getData().bestellt != null && // bestellt
|
||||
row.getData().erteilt != null && // AND erteilt
|
||||
row.getData().akzeptiert == null && // AND nicht akzeptiert
|
||||
betrag == vertrag_betrag &&
|
||||
stunden == vertrag_stunden && // AND nicht geaendert
|
||||
!is_storniert; // AND nicht storniert
|
||||
}
|
||||
|
||||
// Adds column status
|
||||
function func_tableBuilt(table) {
|
||||
// Add status column to table
|
||||
table.addColumn(
|
||||
{
|
||||
title: "<i class='fa fa-user-o'></i>",
|
||||
field: "status",
|
||||
width:40,
|
||||
align:"center",
|
||||
downloadTitle: 'Status',
|
||||
formatter: status_formatter,
|
||||
tooltip: status_tooltip
|
||||
}, true
|
||||
);
|
||||
}
|
||||
|
||||
// Sets status values into column status
|
||||
function func_renderStarted(table){
|
||||
// Set literally status to each row - this enables sorting by status despite using icons
|
||||
table.getRows().forEach(function(row){
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if ((bestellt != null && betrag != vertrag_betrag) ||
|
||||
(bestellt != null && stunden != vertrag_stunden))
|
||||
{
|
||||
row.getData().status = 'Geändert'; // geaendert
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Neu'; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Bestellt'; // bestellt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Erteilt'; // erteilt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
row.getData().status = 'Akzeptiert'; // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getData().status = null; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Performes after row was updated
|
||||
function func_rowUpdated(row){
|
||||
|
||||
// Refresh status icon and row color
|
||||
row.reformat(); // retriggers cell formatters and rowFormatter callback
|
||||
|
||||
// Deselect and disable new selection of updated rows
|
||||
row.deselect();
|
||||
row.getElement().style["pointerEvents"] = "none";
|
||||
}
|
||||
|
||||
// Hide betrag, if lector has inkludierte Lehre
|
||||
function func_renderComplete(table){
|
||||
|
||||
// Check if the lectors actual Verwendung has inkludierte Lehre
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/checkInkludierteLehre",
|
||||
null,
|
||||
{
|
||||
successCallback: function (data, textStatus, jqXHR)
|
||||
{
|
||||
// If lector has inkludierte Lehre, hide the column betrag
|
||||
if (data.retval)
|
||||
{
|
||||
table.hideColumn("betrag");
|
||||
}
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
FHC_DialogLib.alertError("Systemfehler<br>Bitte kontaktieren Sie Ihren Administrator.");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Tabulator 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 </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
|
||||
* Select all (filtered) rows and ignore rows that are bestellt and erteilt
|
||||
*/
|
||||
function footer_selectAll(){
|
||||
$('#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()));
|
||||
}
|
||||
|
||||
/*
|
||||
* 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>");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator columns format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Generates status icons
|
||||
status_formatter = function(cell, formatterParams, onRendered){
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
var is_storniert = cell.getRow().getData().storniert != undefined;
|
||||
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
// commented icons would be so nice to have with fontawsome 5.11...
|
||||
if (bestellt != null && isNaN(vertrag_betrag))
|
||||
{
|
||||
return "<i class='fas fa-user-minus'></i>"; // kein Vertrag
|
||||
}
|
||||
else if (bestellt != null && (betrag != vertrag_betrag) ||
|
||||
bestellt != null && stunden != vertrag_stunden)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_CHANGED; // geaendert
|
||||
// return "<i class='fas fa-user-edit'></i>";
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null && !is_storniert)
|
||||
{
|
||||
return "<i class='fa fa-user-plus'></i>"; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_ORDERED; // bestellt
|
||||
// return "<i class='fa fa-user-tag'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_APPROVED; // erteilt
|
||||
// return "<i class='fas fa-user-check'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
return "<i class='fa fa-handshake-o'></i>"; // akzeptiert
|
||||
// return "<i class='fas fa-user-graduate'></i>";
|
||||
}
|
||||
else if (is_storniert)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_CANCELLED; // storniert
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<i class='fa fa-user'></i>"; // default
|
||||
}
|
||||
};
|
||||
|
||||
// Generates status tooltip
|
||||
status_tooltip = function(cell){
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
var is_storniert = cell.getRow().getData().storniert != undefined;
|
||||
var letzterStatus_vorStorniert = cell.getRow().getData().letzterStatus_vorStorniert;
|
||||
|
||||
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (letzterStatus_vorStorniert != undefined && letzterStatus_vorStorniert == 'akzeptiert')
|
||||
{
|
||||
letzterStatus_vorStorniert = 'angenommen';
|
||||
}
|
||||
|
||||
var text = 'Lehrauftrag in Bearbeitung. ';
|
||||
|
||||
if (bestellt != null && erteilt == null && akzeptiert == null
|
||||
&& (betrag != vertrag_betrag || stunden != vertrag_stunden)) // geaendert (when never erteilt before)
|
||||
{
|
||||
text += 'Wartet auf Erteilung.';
|
||||
return text;
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null
|
||||
&& (betrag != vertrag_betrag || stunden != vertrag_stunden)) // geaendert (when has been erteilt once)
|
||||
{
|
||||
text += 'Wartet auf erneute Erteilung.';
|
||||
return text;
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
|
||||
{
|
||||
return 'Letzter Status: Bestellt. Wartet auf Erteilung.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
|
||||
{
|
||||
return 'Letzter Status: Erteilt. Wartet auf Annahme durch Lektor.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
|
||||
{
|
||||
return 'Letzter Status: Angenommen. Vertrag wurde beidseitig abgeschlossen.';
|
||||
}
|
||||
else if (is_storniert)
|
||||
{
|
||||
return 'Dieser Vertrag wurde storniert. Letzter Status vor Stornierung war: '
|
||||
+ letzterStatus_vorStorniert; // storniert
|
||||
}
|
||||
}
|
||||
|
||||
// Generates bestellt tooltip
|
||||
bestellt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().bestellt_von != null)
|
||||
{
|
||||
return 'Bestellt von: ' + cell.getRow().getData().bestellt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates erteilt tooltip
|
||||
erteilt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().erteilt_von != null) {
|
||||
return 'Erteilt von: ' + cell.getRow().getData().erteilt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates akzeptiert tooltip
|
||||
akzeptiert_tooltip = function(cell){
|
||||
if (cell.getRow().getData().akzeptiert_von != null) {
|
||||
return 'Angenommen von: ' + cell.getRow().getData().akzeptiert_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates storniert tooltip
|
||||
storniert_tooltip = function(cell){
|
||||
if (cell.getRow().getData().storniert_von != null) {
|
||||
return 'Storniert von: ' + cell.getRow().getData().storniert_von;
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// Show all rows
|
||||
$("#show-all").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('clearFilter');
|
||||
});
|
||||
|
||||
// Show only rows with ordered lehrauftraege
|
||||
$("#show-ordered").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with erteilte lehrauftraege
|
||||
$("#show-approved").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter', [
|
||||
{field: 'bestellt', type: '!=', value: null}, // filter when is bestellt
|
||||
{field: 'erteilt', type: '!=', value: null}, // and is erteilt
|
||||
{field: 'akzeptiert', type: '=', value: null} // and is not akzeptiert
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with akzeptierte lehrauftraege
|
||||
$("#show-accepted").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '!=', value: null},
|
||||
{field: 'akzeptiert', type: '!=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Set png-icons into filter-buttons
|
||||
$(".btn-lehrauftrag").each(function(){
|
||||
switch(this.id) {
|
||||
case 'show-ordered':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
|
||||
break;
|
||||
case 'show-approved':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
|
||||
break;
|
||||
case 'show-cancelled':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_CANCELLED;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// De/activate and un/focus on clicked button
|
||||
$(".btn-lehrauftrag").click(function() {
|
||||
|
||||
// De/activate and un/focus on clicked button
|
||||
$(".btn-lehrauftrag").removeClass('focus').removeClass('active');
|
||||
$(this).addClass('focus').addClass('active');
|
||||
});
|
||||
|
||||
// Redraw table stornierte lehrauftraege on button click
|
||||
$('#collapseCancelledLehrauftraege').on('shown.bs.collapse', function () {
|
||||
$('[tableuniqueid = cancelledLehrauftrag] #tableWidgetTabulator').tabulator('redraw', true);
|
||||
});
|
||||
|
||||
// Approve Lehrauftraege
|
||||
$("#accept-lehrauftraege").click(function(){
|
||||
|
||||
// Get selected rows data
|
||||
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
|
||||
.map(function(data){
|
||||
// reduce to necessary fields
|
||||
return {
|
||||
'row_index' : data.row_index,
|
||||
'vertrag_id' : data.vertrag_id
|
||||
}
|
||||
});
|
||||
|
||||
// Alert and exit if no lehraufgang is selected
|
||||
if (selected_data.length == 0)
|
||||
{
|
||||
FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag');
|
||||
|
||||
// Emtpy password field
|
||||
$("#password").val('');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get password for verification
|
||||
var password = $("#password").val();
|
||||
if (password == '')
|
||||
{
|
||||
FHC_DialogLib.alertInfo('Bitte verifizieren Sie sich mit Ihrem Login Passwort.');
|
||||
|
||||
// Focus on password field
|
||||
$("#password").focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare data object for ajax call
|
||||
var data = {
|
||||
'password': password,
|
||||
'selected_data': selected_data
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/acceptLehrauftrag",
|
||||
data,
|
||||
{
|
||||
successCallback: function (data, textStatus, jqXHR)
|
||||
{
|
||||
if (data.error && data.retval != null)
|
||||
{
|
||||
// Print error message
|
||||
FHC_DialogLib.alertWarning(data.retval);
|
||||
}
|
||||
|
||||
if (!data.error && data.retval != null)
|
||||
{
|
||||
// Update status 'Erteilt'
|
||||
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
|
||||
|
||||
// Print success message
|
||||
FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden akzeptiert.");
|
||||
}
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
FHC_DialogLib.alertError("Systemfehler<br>Bitte kontaktieren Sie Ihren Administrator.");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Empty password field
|
||||
$("#password").val('');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,696 @@
|
||||
/**
|
||||
* Javascript file for Lehrauftraege erteilen view and tabulator
|
||||
* Lehrauftraege erteilen: approveLehrauftrag.php
|
||||
* Lehrauftraege erteilen - Tabulator: approveLehrauftragData.php
|
||||
*/
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Global vars
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const COLOR_LIGHTGREY = "#f5f5f5";
|
||||
|
||||
/**
|
||||
* PNG icons used in status- and filter buttons
|
||||
* Setting png icons is a workaround to use font-awsome 5.9.0 icons until system can be updated to newer font awsome version.
|
||||
* */
|
||||
const ICON_LEHRAUFTRAG_ORDERED = '<img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px; margin: -6px;">';
|
||||
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;">';
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Mutators - setter methods to manipulate table data when entering the tabulator
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Converts string date postgre style to string DD.MM.YYYY.
|
||||
// This will allow correct filtering.
|
||||
var mut_formatStringDate = function(value, data, type, params, component) {
|
||||
if (value != null)
|
||||
{
|
||||
var d = new Date(value);
|
||||
return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Formatters - changes display information, not the data itself
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Formats null values to a string number '0.00'
|
||||
var form_formatNulltoStringNumber = function(cell, formatterParams){
|
||||
if (cell.getValue() == null){
|
||||
if (formatterParams.precision == 1)
|
||||
{
|
||||
return '0.0';
|
||||
}
|
||||
return '0.00';
|
||||
}
|
||||
else {
|
||||
return cell.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Header filter
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters values using comparison operator or just by string comparison
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
|
||||
|
||||
// If string starts with <, <=, >, >=, !=, ==, compare values with that operator
|
||||
var operator = '';
|
||||
if (headerValue.match(/([<=>!]{1,2})/g)) {
|
||||
var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
|
||||
operator = operator_arr[0];
|
||||
|
||||
headerValue = headerValue
|
||||
.replace(operator, '')
|
||||
.trim()
|
||||
;
|
||||
|
||||
// return if value comparison is true
|
||||
return eval(rowValue + operator + headerValue);
|
||||
}
|
||||
|
||||
// If just a stringnumber, return if exact match found
|
||||
return parseFloat(rowValue) == headerValue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Custom filters
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters bestellte initially
|
||||
function func_initialFilter(){
|
||||
return [
|
||||
{field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector
|
||||
{field: 'bestellt', type: '!=', value: null}, // AND bestellt
|
||||
{field: 'erteilt', type: '=', value: null}, // AND NOT erteilt
|
||||
{field: 'akzeptiert', type: '=', value: null} // AND NOT akzeptiert
|
||||
]
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator table format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Displays text when table is empty
|
||||
function func_placeholder()
|
||||
{
|
||||
return "<h4>Keine Daten vorhanden.</h4>";
|
||||
}
|
||||
|
||||
// Formats the group header
|
||||
function func_groupHeader(data){
|
||||
return data[0].lv_bezeichnung + " " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung;
|
||||
};
|
||||
|
||||
// Formats the rows
|
||||
function func_rowFormatter(row){
|
||||
var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
|
||||
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Formats the color of the rows depending on their status
|
||||
- blue: dummy lectors
|
||||
- orange: geaendert
|
||||
- default (white) : bestellte
|
||||
- green: akzeptiert
|
||||
- grey: all other (marks unselectable)
|
||||
*/
|
||||
row.getCells().forEach(function(cell){
|
||||
if(is_dummy)
|
||||
{
|
||||
cell.getElement().classList.add('bg-info'); // dummy lectors
|
||||
}
|
||||
else if (bestellt != null && (betrag != vertrag_betrag) ||
|
||||
bestellt != null && stunden != vertrag_stunden &&
|
||||
!row._row.element.classList.contains('tabulator-calcs')) // exclude calculation rows
|
||||
{
|
||||
cell.getElement().classList.add('bg-warning'); // geaenderte
|
||||
}
|
||||
else if(bestellt != null && erteilt == null)
|
||||
{
|
||||
return; // bestellt
|
||||
}
|
||||
else if(bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
cell.getElement().classList.add('bg-success') // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Formats row selectable/unselectable
|
||||
function func_selectableCheck(row){
|
||||
var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
// only allow to select bestellte Lehraufträge
|
||||
return !is_dummy && // NOT dummy lector
|
||||
row.getData().bestellt != null && // AND NOT neue
|
||||
row.getData().erteilt == null && // AND bestellt
|
||||
betrag == vertrag_betrag &&
|
||||
stunden == vertrag_stunden; // AND nicht geändert
|
||||
}
|
||||
|
||||
// Adds column status
|
||||
function func_tableBuilt(table) {
|
||||
// Add status column to table
|
||||
table.addColumn(
|
||||
{
|
||||
title: "<i class='fa fa-user-o'></i>",
|
||||
field: "status",
|
||||
width:40,
|
||||
align:"center",
|
||||
downloadTitle: 'Status',
|
||||
formatter: status_formatter,
|
||||
tooltip: status_tooltip
|
||||
}, true
|
||||
);
|
||||
}
|
||||
|
||||
// Sets status values into column status
|
||||
function func_renderStarted(table){
|
||||
// set literally status to each row - this enables sorting by status despite using icons
|
||||
table.getRows().forEach(function(row){
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
if ((bestellt != null && betrag != vertrag_betrag) ||
|
||||
(bestellt != null && stunden != vertrag_stunden))
|
||||
{
|
||||
row.getData().status = 'Geändert'; // geaendert
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Neu'; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Bestellt'; // bestellt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Erteilt'; // erteilt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
row.getData().status = 'Akzeptiert'; // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getData().status = null; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Performes after row was updated
|
||||
function func_rowUpdated(row){
|
||||
|
||||
// Refresh status icon and row color
|
||||
row.reformat(); // retriggers cell formatters and rowFormatter callback
|
||||
|
||||
// Deselect and disable new selection of updated rows
|
||||
row.deselect();
|
||||
row.getElement().style["pointerEvents"] = "none";
|
||||
}
|
||||
|
||||
|
||||
// Tabulator 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 </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
|
||||
* 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>");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator columns format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Generates status icons
|
||||
status_formatter = function(cell, formatterParams, onRendered){
|
||||
var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
// commented icons would be so nice to have with fontawsome 5.11...
|
||||
if (is_dummy)
|
||||
{
|
||||
return "<i class='fa fa-user-secret'></i>"; // dummy lector
|
||||
}
|
||||
else if (bestellt != null && (betrag != vertrag_betrag) || // geaendert
|
||||
bestellt != null && stunden != vertrag_stunden) // geaendert ((if betrag is 0 or null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_CHANGED; // geaendert
|
||||
// return "<i class='fas fa-user-edit'></i>";
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
return "<i class='fa fa-user-plus'></i>"; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_ORDERED; // bestellt
|
||||
// return "<i class='fa fa-user-tag'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_APPROVED; // erteilt
|
||||
// return "<i class='fas fa-user-check'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
return "<i class='fa fa-handshake-o'></i>"; // akzeptiert
|
||||
// return "<i class='fas fa-user-graduate'></i>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<i class='fa fa-user'></i>"; // default
|
||||
}
|
||||
};
|
||||
|
||||
// Generates status tooltip
|
||||
status_tooltip = function(cell){
|
||||
var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden)){
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
var text = 'Lehrauftragstunden/-stundensatz geändert.';
|
||||
text += "\n";
|
||||
|
||||
if (is_dummy) // dummy (no lector)
|
||||
{
|
||||
return 'Neuer Lehrauftrag. Ohne Lektor verplant.'
|
||||
}
|
||||
else if ((bestellt != null && erteilt == null && betrag != vertrag_betrag) ||
|
||||
(bestellt != null && erteilt == null && stunden != vertrag_stunden)) // geaendert (when never erteilt before)
|
||||
{
|
||||
return text += 'Wartet auf Bestellung, danach Erteilen möglich.';
|
||||
}
|
||||
else if ((bestellt != null && erteilt != null && betrag != vertrag_betrag) ||
|
||||
(bestellt != null && erteilt != null && stunden != vertrag_stunden)) // geaendert (when has been erteilt once)
|
||||
{
|
||||
return text += 'Wartet auf neuerliche Bestellung, danach erneut Erteilen möglich.';
|
||||
}
|
||||
else if (bestellt == null) // neu
|
||||
{
|
||||
return 'Neuer Lehrauftrag. Wartet auf Bestellung.';
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
|
||||
{
|
||||
return 'Letzter Status: Bestellt. Wartet auf Erteilung.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
|
||||
{
|
||||
return 'Letzter Status: Erteilt. Wartet auf Annahme durch Lektor.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
|
||||
{
|
||||
return 'Letzter Status: Angenommen. Vertrag wurde beidseitig abgeschlossen.';
|
||||
}
|
||||
}
|
||||
|
||||
// Generates bestellt tooltip
|
||||
bestellt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().bestellt_von != null)
|
||||
{
|
||||
return 'Bestellt von: ' + cell.getRow().getData().bestellt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates erteilt tooltip
|
||||
erteilt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().erteilt_von != null) {
|
||||
return 'Erteilt von: ' + cell.getRow().getData().erteilt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates akzeptiert tooltip
|
||||
akzeptiert_tooltip = function(cell){
|
||||
if (cell.getRow().getData().akzeptiert_von != null) {
|
||||
return 'Angenommen von: ' + cell.getRow().getData().akzeptiert_von;
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
|
||||
// Show all rows
|
||||
$("#show-all").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('clearFilter');
|
||||
});
|
||||
|
||||
// Show only rows with new lehrauftraege (not dummy lectors)
|
||||
$("#show-new").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0},
|
||||
{field: 'bestellt', type: '=', value: null},
|
||||
{field: 'erteilt', type: '=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with ordered lehrauftraege
|
||||
$("#show-ordered").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0},
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with erteilte lehrauftraege
|
||||
$("#show-approved").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '!=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with accepted lehrauftraege
|
||||
$("#show-accepted").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '!=', value: null},
|
||||
{field: 'akzeptiert', type: '!=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with dummy lectors
|
||||
$("#show-dummies").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '!=', value: null},
|
||||
{field: 'personalnummer', type: '<=', value: 0},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with dummy lectors
|
||||
$("#show-changed").click(function(){
|
||||
// needs custom filter to compare fields betrag and vertrag_betrag
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector AND
|
||||
{field: 'bestellt', type: '!=', value: null}, // bestellt AND
|
||||
{field: 'status', type: '=', value: 'Geändert'} // geaendert
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Set png-icons into filter-buttons
|
||||
$(".btn-lehrauftrag").each(function(){
|
||||
switch(this.id) {
|
||||
case 'show-ordered':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
|
||||
break;
|
||||
case 'show-approved':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
|
||||
break;
|
||||
case 'show-changed':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag erteilen'
|
||||
$(".btn-lehrauftrag").click(function() {
|
||||
|
||||
// De/activate and un/focus on clicked button
|
||||
$(".btn-lehrauftrag").removeClass('focus').removeClass('active');
|
||||
$(this).addClass('focus').addClass('active');
|
||||
|
||||
// Enable button 'Lehrauftrag bestellen' by default
|
||||
$('#approve-lehrauftraege').attr('disabled', false).attr('title', '');
|
||||
|
||||
// Disable button Lehrauftrag bestellen for dummies
|
||||
if (this.id == 'show-dummies')
|
||||
{
|
||||
$('#approve-lehrauftraege').attr('disabled', true).attr('title', 'Lehraufträge ohne Lektorzuteilung können nicht bestellt werden.');
|
||||
}
|
||||
});
|
||||
|
||||
// Approve Lehrauftraege
|
||||
$("#approve-lehrauftraege").click(function(){
|
||||
|
||||
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
|
||||
.filter(function(val){
|
||||
// filter pseudo lines of groupBy (e.g. the bottom calculations lines)
|
||||
return val.row_index != null || typeof(val.row_index) !== 'undefined';
|
||||
})
|
||||
.map(function(data){
|
||||
// reduce to necessary fields
|
||||
return {
|
||||
'row_index': data.row_index,
|
||||
'mitarbeiter_uid' : data.mitarbeiter_uid,
|
||||
'vertrag_id' : data.vertrag_id
|
||||
}
|
||||
});
|
||||
|
||||
// Alert and exit if no lehraufgang is selected
|
||||
if (selected_data.length == 0)
|
||||
{
|
||||
FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag');
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare data object for ajax call
|
||||
* NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
|
||||
* This avoids issues with POST param limitation.
|
||||
*/
|
||||
var data = {
|
||||
'selected_data': JSON.stringify(selected_data)
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/approveLehrauftrag",
|
||||
data,
|
||||
{
|
||||
successCallback: function (data, textStatus, jqXHR)
|
||||
{
|
||||
if (!data.error && data.retval != null)
|
||||
{
|
||||
// Update status 'Erteilt'
|
||||
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
|
||||
|
||||
// Print success message
|
||||
FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden erteilt.");
|
||||
}
|
||||
|
||||
if (data.error && data.retval != null)
|
||||
{
|
||||
// Print error message
|
||||
FHC_DialogLib.alertError(data.retval);
|
||||
}
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
FHC_DialogLib.alertError("Systemfehler<br>Bitte kontaktieren Sie Ihren Administrator.");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,720 @@
|
||||
/**
|
||||
* Javascript file for Lehrauftraege bestellen view and tabulator
|
||||
* Lehrauftraege bestellen: orderLehrauftrag.php
|
||||
* Lehrauftraege bestellen - Tabulator: orderLehrauftragData.php
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Global vars
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const COLOR_LIGHTGREY = "#f5f5f5";
|
||||
|
||||
/**
|
||||
* PNG icons used in status- and filter buttons
|
||||
* Setting png icons is a workaround to use font-awsome 5.9.0 icons until system can be updated to newer font awsome version.
|
||||
* */
|
||||
const ICON_LEHRAUFTRAG_ORDERED = '<img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px; margin: -6px;">';
|
||||
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;">';
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Mutators - setter methods to manipulate table data when entering the tabulator
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Converts string date postgre style to string DD.MM.YYYY.
|
||||
// This will allow correct filtering.
|
||||
var mut_formatStringDate = function(value, data, type, params, component) {
|
||||
if (value != null)
|
||||
{
|
||||
var d = new Date(value);
|
||||
return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Formatters - changes display information, not the data itself
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Formats null values to a string number '0.00'
|
||||
var form_formatNulltoStringNumber = function(cell, formatterParams){
|
||||
if (cell.getValue() == null){
|
||||
if (formatterParams.precision == 1)
|
||||
{
|
||||
return '0.0';
|
||||
}
|
||||
return '0.00';
|
||||
}
|
||||
else {
|
||||
return cell.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Header filter
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Filters values using comparison operator or just by string comparison
|
||||
function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
|
||||
|
||||
// If string starts with <, <=, >, >=, !=, ==, compare values with that operator
|
||||
var operator = '';
|
||||
if (headerValue.match(/([<=>!]{1,2})/g)) {
|
||||
var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
|
||||
operator = operator_arr[0];
|
||||
|
||||
headerValue = headerValue
|
||||
.replace(operator, '')
|
||||
.trim()
|
||||
;
|
||||
|
||||
// return if value comparison is true
|
||||
return eval(rowValue + operator + headerValue);
|
||||
}
|
||||
|
||||
// If just a stringnumber, return if exact match found
|
||||
return parseFloat(rowValue) == headerValue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Custom filters
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Filters neue AND geaenderte initially
|
||||
* NOTE: This is a workaround. The tabulators callback initialFilter is not used here because
|
||||
* it is processed before the callback tableBuilt, where the status is going to be built.
|
||||
* The callback dataLoaded is processed after tableBuild and provides the status.
|
||||
*/
|
||||
function func_dataLoaded(data, table){
|
||||
table.setFilter([
|
||||
{field: 'personalnummer', type: '>=', value: 0}, // not dummy lector AND
|
||||
[
|
||||
{field: 'status', type: '=', value: 'Neu'}, // neu OR
|
||||
{field: 'status', type: '=', value: 'Geändert'} // geaendert
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator table format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Displays text when table is empty
|
||||
function func_placeholder()
|
||||
{
|
||||
return "<h4>Keine Daten vorhanden.</h4>";
|
||||
}
|
||||
|
||||
// Formats the group header
|
||||
function func_groupHeader(data) {
|
||||
return data[0].lv_bezeichnung + " " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung;
|
||||
}
|
||||
|
||||
// Formats the rows
|
||||
function func_rowFormatter(row){
|
||||
var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
|
||||
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Formats the color of the rows depending on their status
|
||||
- blue: dummy lectors
|
||||
- bold: geaendert
|
||||
- default (white): neu und erteilt
|
||||
- green: akzeptiert
|
||||
- grey: all other (marks unselectable)
|
||||
*/
|
||||
row.getCells().forEach(function(cell){
|
||||
if(is_dummy)
|
||||
{
|
||||
cell.getElement().classList.add('bg-info'); // dummy lectors
|
||||
}
|
||||
else if (bestellt != null && (betrag != vertrag_betrag) ||
|
||||
bestellt != null && stunden != vertrag_stunden &&
|
||||
!row._row.element.classList.contains('tabulator-calcs')) // exclude calculation rows
|
||||
{
|
||||
row.getElement().style['font-weight'] = 'bold'; // geaendert
|
||||
}
|
||||
else if(bestellt == null)
|
||||
{
|
||||
return; // neu und erteilt
|
||||
}
|
||||
else if(bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
cell.getElement().classList.add('bg-success') // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Formats row selectable/unselectable
|
||||
function func_selectableCheck(row){
|
||||
var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
|
||||
// Only allow to select neue and geaenderte
|
||||
return !is_dummy && // NOT dummy lector
|
||||
row.getData().bestellt == null || // AND neue
|
||||
row.getData().bestellt != null && betrag != vertrag_betrag || // OR geaenderte
|
||||
row.getData().bestellt != null && stunden != vertrag_stunden // OR geanderte (if betrag is 0 or null)
|
||||
}
|
||||
|
||||
// Adds column status
|
||||
function func_tableBuilt(table) {
|
||||
// Add status column to table
|
||||
table.addColumn(
|
||||
{
|
||||
title: "<i class='fa fa-user-o'></i>",
|
||||
field: "status",
|
||||
width:40,
|
||||
align:"center",
|
||||
downloadTitle: 'Status',
|
||||
formatter: status_formatter,
|
||||
tooltip: status_tooltip
|
||||
}, true
|
||||
);
|
||||
}
|
||||
|
||||
// Sets status values into column status
|
||||
function func_renderStarted(table){
|
||||
// set literally status to each row - this enables sorting by status despite using icons
|
||||
table.getRows().forEach(function(row){
|
||||
var bestellt = row.getData().bestellt;
|
||||
var erteilt = row.getData().erteilt;
|
||||
var akzeptiert = row.getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(row.getData().stunden);
|
||||
var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(row.getData().betrag);
|
||||
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
if ((bestellt != null && betrag != vertrag_betrag) ||
|
||||
(bestellt != null && stunden != vertrag_stunden))
|
||||
{
|
||||
row.getData().status = 'Geändert'; // geaendert
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Neu'; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Bestellt'; // bestellt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
row.getData().status = 'Erteilt'; // erteilt
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
row.getData().status = 'Akzeptiert'; // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
row.getData().status = null; // default
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Performes after row was updated
|
||||
function func_rowUpdated(row){
|
||||
|
||||
// Refresh status icon and row color
|
||||
row.reformat(); // retriggers cell formatters and rowFormatter callback
|
||||
|
||||
// Format font-weight normal (needed after geaenderte were bestellt)
|
||||
row.getElement().style['font-weight'] = 'normal';
|
||||
|
||||
// Deselect and disable new selection of updated rows (ordering done)
|
||||
row.deselect();
|
||||
row.getElement().style["pointerEvents"] = "none";
|
||||
}
|
||||
|
||||
// Tabulator 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 </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
|
||||
* Select all (filtered) rows and ignore rows which have status bestellt
|
||||
*/
|
||||
function footer_selectAll(){
|
||||
$('#tableWidgetTabulator').tabulator('getRows', true)
|
||||
.filter(row => row.getData().personalnummer >= 0 && // NOT dummies
|
||||
row.getData().bestellt == null || // AND neu
|
||||
row.getData().bestellt != null && // OR (bestellt
|
||||
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>");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Tabulator columns format functions
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Generates status icons
|
||||
status_formatter = function(cell, formatterParams, onRendered){
|
||||
var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
// commented icons would be so nice to have with fontawsome 5.11...
|
||||
if (is_dummy)
|
||||
{
|
||||
return "<i class='fa fa-user-secret'></i>"; // dummy lector
|
||||
}
|
||||
else if (bestellt != null && isNaN(vertrag_betrag))
|
||||
{
|
||||
return "<i class='fa fa-user-minus'></i>"; // kein Vertrag
|
||||
}
|
||||
else if (bestellt != null && (betrag != vertrag_betrag) || // geaendert
|
||||
bestellt != null && stunden != vertrag_stunden) // geaendert ((if betrag is 0 or null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_CHANGED; // geaendert
|
||||
// return "<i class='fas fa-user-edit'></i>";
|
||||
}
|
||||
else if (bestellt == null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
return "<i class='fa fa-user-plus'></i>"; // neu
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_ORDERED; // bestellt
|
||||
// return "<i class='fa fa-user-tag'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null)
|
||||
{
|
||||
return ICON_LEHRAUFTRAG_APPROVED; // erteilt
|
||||
// return "<i class='fas fa-user-check'></i>";
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null)
|
||||
{
|
||||
return "<i class='fa fa-handshake-o'></i>"; // akzeptiert
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<i class='fa fa-user'></i>"; // default
|
||||
}
|
||||
};
|
||||
|
||||
// Generates status tooltip
|
||||
status_tooltip = function(cell){
|
||||
var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
|
||||
|
||||
var bestellt = cell.getRow().getData().bestellt;
|
||||
var erteilt = cell.getRow().getData().erteilt;
|
||||
var akzeptiert = cell.getRow().getData().akzeptiert;
|
||||
|
||||
var betrag = parseFloat(cell.getRow().getData().betrag);
|
||||
var stunden = parseFloat(cell.getRow().getData().stunden);
|
||||
var stundensatz = parseFloat(cell.getRow().getData().stundensatz);
|
||||
|
||||
var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
|
||||
var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
|
||||
var vertrag_stundensatz = 0;
|
||||
|
||||
if (isNaN(betrag))
|
||||
{
|
||||
betrag = 0;
|
||||
}
|
||||
|
||||
if (isNaN(stunden))
|
||||
{
|
||||
stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_stunden))
|
||||
{
|
||||
vertrag_stunden = 0;
|
||||
}
|
||||
|
||||
if (isNaN(vertrag_betrag))
|
||||
{
|
||||
vertrag_betrag = 0;
|
||||
}
|
||||
|
||||
// Calculate vertrag stundensatz
|
||||
if (vertrag_stunden != 0)
|
||||
{
|
||||
vertrag_stundensatz = vertrag_betrag/vertrag_stunden;
|
||||
}
|
||||
|
||||
// Return tooltip message
|
||||
if (is_dummy) // dummy (no lector)
|
||||
{
|
||||
return 'Neuer Lehrauftrag. Ohne Lektor verplant.'
|
||||
}
|
||||
else if (isNaN(vertrag_betrag)) // neu
|
||||
{
|
||||
return 'Neuer Lehrauftrag. Wartet auf Bestellung.'
|
||||
}
|
||||
else if (betrag != vertrag_betrag || // geaendert
|
||||
bestellt != null && stunden != vertrag_stunden) // geaendert (if betrag is 0 or null)
|
||||
{
|
||||
var text = 'NACH Änderung: Stundensatz: ' + stundensatz + ' Stunden: ' + stunden;
|
||||
text += "\n";
|
||||
text += 'VOR Änderung:' + '\xa0\xa0\xa0' + 'Stundensatz: ' + vertrag_stundensatz + ' Stunden: ' + vertrag_stunden;
|
||||
return text;
|
||||
}
|
||||
else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
|
||||
{
|
||||
return 'Letzter Status: Bestellt. Wartet auf Erteilung.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
|
||||
{
|
||||
return 'Letzter Status: Erteilt. Wartet auf Annahme durch Lektor.';
|
||||
}
|
||||
else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
|
||||
{
|
||||
return 'Letzter Status: Angenommen. Vertrag wurde beidseitig abgeschlossen.';
|
||||
}
|
||||
}
|
||||
|
||||
// Generates bestellt tooltip
|
||||
bestellt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().bestellt_von != null)
|
||||
{
|
||||
return 'Bestellt von: ' + cell.getRow().getData().bestellt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates erteilt tooltip
|
||||
erteilt_tooltip = function(cell){
|
||||
if (cell.getRow().getData().erteilt_von != null) {
|
||||
return 'Erteilt von: ' + cell.getRow().getData().erteilt_von;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates akzeptiert tooltip
|
||||
akzeptiert_tooltip = function(cell){
|
||||
if (cell.getRow().getData().akzeptiert_von != null) {
|
||||
return 'Angenommen von: ' + cell.getRow().getData().akzeptiert_von;
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
// Show all rows
|
||||
$("#show-all").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('clearFilter');
|
||||
});
|
||||
|
||||
// Show only rows with new lehrauftraege (not dummy lectors)
|
||||
$("#show-new").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0},
|
||||
{field: 'bestellt', type: '=', value: null},
|
||||
{field: 'erteilt', type: '=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with ordered lehrauftraege
|
||||
$("#show-ordered").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0},
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with erteilte lehrauftraege
|
||||
$("#show-approved").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '!=', value: null},
|
||||
{field: 'akzeptiert', type: '=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with akzeptierte lehrauftraege
|
||||
$("#show-accepted").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'bestellt', type: '!=', value: null},
|
||||
{field: 'erteilt', type: '!=', value: null},
|
||||
{field: 'akzeptiert', type: '!=', value: null}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with geaenderte lectors
|
||||
$("#show-changed").click(function(){
|
||||
// needs custom filter to compare fields betrag and vertrag_betrag
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector AND
|
||||
{field: 'bestellt', type: '!=', value: null}, // bestellt AND
|
||||
{field: 'status', type: '=', value: 'Geändert'} // geaendert
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Show only rows with dummy lectors
|
||||
$("#show-dummies").click(function(){
|
||||
$('#tableWidgetTabulator').tabulator('setFilter',
|
||||
[
|
||||
{field: 'personalnummer', type: '!=', value: null},
|
||||
{field: 'personalnummer', type: '<=', value: 0},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Set png-icons into filter-buttons
|
||||
$(".btn-lehrauftrag").each(function(){
|
||||
switch(this.id) {
|
||||
case 'show-ordered':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
|
||||
break;
|
||||
case 'show-approved':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
|
||||
break;
|
||||
case 'show-changed':
|
||||
this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag bestellen'
|
||||
$(".btn-lehrauftrag").click(function() {
|
||||
|
||||
// De/activate and un/focus on clicked button
|
||||
$(".btn-lehrauftrag").removeClass('focus').removeClass('active');
|
||||
$(this).addClass('focus').addClass('active');
|
||||
|
||||
//Enable button 'Lehrauftrag bestellen' by default
|
||||
$('#order-lehrauftraege').attr('disabled', false).attr('title', '');
|
||||
|
||||
// Disable button Lehrauftrag bestellen for dummies
|
||||
if (this.id == 'show-dummies')
|
||||
{
|
||||
$('#order-lehrauftraege').attr('disabled', true).attr('title', 'Lehraufträge ohne Lektorzuteilung können nicht bestellt werden.');
|
||||
}
|
||||
});
|
||||
|
||||
// Order Lehrauftraege
|
||||
$("#order-lehrauftraege").click(function(){
|
||||
|
||||
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
|
||||
.filter(function(val){
|
||||
// filter pseudo lines of groupBy (e.g. the bottom calculations lines)
|
||||
return val.row_index != null || typeof(val.row_index) !== 'undefined';
|
||||
})
|
||||
.map(function(data){
|
||||
// reduce to necessary fields
|
||||
return {
|
||||
'row_index' : data.row_index,
|
||||
'lehreinheit_id' : data.lehreinheit_id,
|
||||
'lehrveranstaltung_id' : data.lehrveranstaltung_id,
|
||||
'person_id' : data.person_id,
|
||||
'mitarbeiter_uid' : data.mitarbeiter_uid,
|
||||
'vertrag_id' : data.vertrag_id,
|
||||
'projektarbeit_id' : data.projektarbeit_id,
|
||||
'stunden' : data.stunden,
|
||||
'betrag' : data.betrag,
|
||||
'studiensemester_kurzbz' : data.studiensemester_kurzbz,
|
||||
'studiengang_kz' : data.studiengang_kz,
|
||||
'lv_oe_kurzbz' : data.lv_oe_kurzbz
|
||||
}
|
||||
});
|
||||
|
||||
// Alert and exit if no lehraufgang is selected
|
||||
if (selected_data.length == 0)
|
||||
{
|
||||
FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag');
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare data object for ajax call
|
||||
* NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
|
||||
* This avoids issues with POST param limitation.
|
||||
*/
|
||||
var data = {
|
||||
'selected_data': JSON.stringify(selected_data)
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/orderLehrauftrag",
|
||||
data,
|
||||
{
|
||||
successCallback: function (data, textStatus, jqXHR)
|
||||
{
|
||||
if (!data.error && data.retval != null)
|
||||
{
|
||||
// Update status 'Bestellt'
|
||||
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
|
||||
|
||||
// Print success message
|
||||
FHC_DialogLib.alertSuccess("Alle " + data.retval.length + " Lehraufträge wurden bestellt.")
|
||||
}
|
||||
|
||||
if (data.error && data.retval != null)
|
||||
{
|
||||
// Print error message
|
||||
FHC_DialogLib.alertError(data.retval);
|
||||
}
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
FHC_DialogLib.alertError("Sytemfehler<br>Bitte kontaktieren Sie Ihren Administrator.");
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
(function() {
|
||||
var callWithJQuery;
|
||||
|
||||
callWithJQuery = function(pivotModule) {
|
||||
if (typeof exports === "object" && typeof module === "object") {
|
||||
return pivotModule(require("jquery"));
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
return define(["jquery"], pivotModule);
|
||||
} else {
|
||||
return pivotModule(jQuery);
|
||||
}
|
||||
};
|
||||
callWithJQuery(function($) {
|
||||
var deFmt, deFmtInt, deFmtPct, nf, tpl;
|
||||
nf = $.pivotUtilities.numberFormat;
|
||||
tpl = $.pivotUtilities.aggregatorTemplates;
|
||||
deFmt = nf({
|
||||
thousandsSep: ".",
|
||||
decimalSep: ","
|
||||
});
|
||||
deFmtInt = nf({
|
||||
digitsAfterDecimal: 0,
|
||||
thousandsSep: ".",
|
||||
decimalSep: ","
|
||||
});
|
||||
deFmtPct = nf({
|
||||
digitsAfterDecimal: 1,
|
||||
scaler: 100,
|
||||
suffix: "%",
|
||||
thousandsSep: ".",
|
||||
decimalSep: ","
|
||||
});
|
||||
return $.pivotUtilities.locales.de = {
|
||||
localeStrings: {
|
||||
renderError: "Bei dem Zeichnen der Pivot Ergebnisse ist ein Fehler aufgetreten.",
|
||||
computeError: "Bei dem berechnen der Pivot Ergebnisse ist ein Fehler aufgetreten.",
|
||||
uiRenderError: "Bei dem Zeichnen des Pivot Interfaces ist ein Fehler aufgetreten.",
|
||||
selectAll: "Wähle alle",
|
||||
selectNone: "Wähle keine",
|
||||
tooMany: "(zu viele Ergebnisse)",
|
||||
filterResults: "Ergebnisse filtern",
|
||||
totals: "Total",
|
||||
vs: "vs",
|
||||
by: "von"
|
||||
},
|
||||
aggregators: {
|
||||
"Anzahl": tpl.count(deFmtInt),
|
||||
"Anzahl einzigartiger Werte": tpl.countUnique(deFmtInt),
|
||||
"Liste einzigartiger Werte": tpl.listUnique(", "),
|
||||
"Summe": tpl.sum(deFmt),
|
||||
"Summe in ganzen Zahlen": tpl.sum(deFmtInt),
|
||||
"Durchschnitt": tpl.average(deFmt),
|
||||
"Summe über Summe": tpl.sumOverSum(deFmt),
|
||||
"80% obere Grenze": tpl.sumOverSumBound80(true, deFmt),
|
||||
"80% untere Grenze": tpl.sumOverSumBound80(false, deFmt),
|
||||
"Prozent": tpl.fractionOf(tpl.sum(), "total", deFmtPct),
|
||||
"Prozent pro Reihe": tpl.fractionOf(tpl.sum(), "row", deFmtPct),
|
||||
"Prozent pro Spalte": tpl.fractionOf(tpl.sum(), "col", deFmtPct),
|
||||
"Anzahl als Teil des Ganzen": tpl.fractionOf(tpl.count(), "total", deFmtPct),
|
||||
"Anzahl als Teil der Reihe": tpl.fractionOf(tpl.count(), "row", deFmtPct),
|
||||
"Anzahl als Teil der Spalte": tpl.fractionOf(tpl.count(), "col", deFmtPct)
|
||||
},
|
||||
renderers: {
|
||||
"Tabelle": $.pivotUtilities.renderers["Table"],
|
||||
"Tabelle mit Balken": $.pivotUtilities.renderers["Table Barchart"],
|
||||
"Heatmap": $.pivotUtilities.renderers["Heatmap"],
|
||||
"Heatmap für Reihen": $.pivotUtilities.renderers["Row Heatmap"],
|
||||
"Heatmap für Spalten": $.pivotUtilities.renderers["Col Heatmap"]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
|
||||
//# sourceMappingURL=pivot.de.js.map
|
||||