Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
tweak(HR): add status icons to freeTime Planning
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed Mar 14, 2022
1 parent 9ec8dca commit b7b7077
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tine20/HumanResources/js/FreeTimePlanningPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Tine.HumanResources.FreeTimePlanningPanel = Ext.extend(Tine.widgets.grid.GridPan
this.defaultFilters = [{
field: 'employment_end', operator: 'after', value: new Date().clearTime().getLastDateOfMonth().add(Date.DAY, 1)
}];

// this.detailsPanel = {
// recordClass: Tine.HumanResources.Model.FreeTime,
// xtype: 'widget-detailspanel'
// };

Tine.HumanResources.FreeTimePlanningPanel.superclass.initComponent.call(me);

me.grid.on('cellmousedown', _.bind(me.onCellMouseDown, me));
Expand Down Expand Up @@ -85,6 +91,11 @@ Tine.HumanResources.FreeTimePlanningPanel = Ext.extend(Tine.widgets.grid.GridPan
me.selectionModel = new Ext.ux.grid.MultiCellSelectionModel({
// getCount: function() {return 0},
// getSelections: function() { return []},
// getSelected: () => { // needed for detailsPanel
// const selections = me.getSelectedFreeTimes();
// // @TODO filter for freeTimes (skip empty cells)
// return selections.length ? Tine.Tinebase.data.Record.setFromJson(selections[0], Tine.HumanResources.Model.FreeTime) : null;
// },
selectRow: function() {},
listeners: {
'beforecellselect': _.bind(me.onBeforeCellSelect, me),
Expand Down Expand Up @@ -137,24 +148,28 @@ Tine.HumanResources.FreeTimePlanningPanel = Ext.extend(Tine.widgets.grid.GridPan
renderFreeDay: function(value, metaData, record, rowIndex, colIndex, store, day) {
let me = this;
let bgColor = '#FFFFFF';
let processStatus = '';
let img = '';
let char = '';

if (me.isExcludeDay(record, day)) {
bgColor = 'lightgrey';
char = 'X';
char = '-';
}
else {
let freeTimes = me.getFreeTimes(record, day);
if (freeTimes.length) {
// support multiple freetimes per day?
let freeTimeType = freeTimes[0].type;
const freeTimeType = freeTimes[0].type;
processStatus = _.get(freeTimes[0], 'process_status', '')
char = _.get(freeTimeType, 'abbreviation', freeTimeType[0]);
bgColor = _.get(freeTimeType, 'color', '#FFFFFF');
// @TODO color
img = Tine.Tinebase.widgets.keyfield.Renderer.get('HumanResources', 'freeTimeProcessStatus', 'icon')(processStatus)
// bgColor = _.get(freeTimeType, 'icon', 'none');
}
}

return '<div class="hr-freetimeplanning-daycell" style="background-color: ' + bgColor + ';">' + char + '</div>'
return `<div class="hr-freetimeplanning-daycell hr-freetimeplanning-daycell=${processStatus}" style="background-color: ${bgColor};">${img}${char}</div>`

},

Expand Down

0 comments on commit b7b7077

Please sign in to comment.