diff --git a/modules/time_sheets/lib.js b/modules/time_sheets/lib.js
index a85f0d71..aec8c25a 100644
--- a/modules/time_sheets/lib.js
+++ b/modules/time_sheets/lib.js
@@ -16,7 +16,7 @@ along with iCE Hrm. If not, see .
------------------------------------------------------------------
-Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
+Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
@@ -79,9 +79,9 @@ EmployeeTimeSheetAdapter.method('renderForm', function(object) {
$('.timesheet_start').html(Date.parse(object.date_start).toString('MMM d, yyyy (dddd)'));
$('.timesheet_end').html(Date.parse(object.date_end).toString('MMM d, yyyy (dddd)'));
-
+
this.currentTimesheet = object;
-
+
this.getTimeEntries();
var st = Date.parse(object.date_start);
@@ -127,9 +127,9 @@ EmployeeTimeSheetAdapter.method('renderForm', function(object) {
});
$('#EmployeeTimesheetBlock').fullCalendar('gotoDate', st);
-
+
$('.fc-toolbar').hide();
-
+
});
@@ -219,7 +219,7 @@ EmployeeTimeSheetAdapter.method('openTimeEntryDialog', function(object) {
obj.currentTimesheet = this.currentTimesheet;
obj.renderForm(object);
obj.timesheetId = this.currentId;
-
+
});
EmployeeTimeSheetAdapter.method('closeTimeEntryDialog', function() {
@@ -231,14 +231,14 @@ EmployeeTimeSheetAdapter.method('getTimeEntries', function() {
timesheetId = this.currentId;
var sourceMappingJson = JSON.stringify(modJsList['tabEmployeeTimeEntry'].getSourceMapping());
object = {"id":timesheetId,"sm":sourceMappingJson};
-
+
var reqJson = JSON.stringify(object);
-
+
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'getTimeEntriesSuccessCallBack';
callBackData['callBackFail'] = 'getTimeEntriesFailCallBack';
-
+
this.customAction('getTimeEntries','modules=time_sheets',reqJson,callBackData);
});
@@ -246,18 +246,18 @@ EmployeeTimeSheetAdapter.method('getTimeEntriesSuccessCallBack', function(callBa
var entries = callBackData;
var html = "";
var temp = '
 | _start_ | _end_ | _duration_ | _project_ | _details_ | ';
-
+
for(var i=0;i';
}
-
+
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
html = html.replace(/_sdate_/g,data[1]);
@@ -534,7 +534,7 @@ SubEmployeeTimeSheetAdapter.method('getActionButtonsHtml', function(id,data) {
SubEmployeeTimeSheetAdapter.method('getCustomTableParams', function() {
var that = this;
var dataTableParams = {
- "aoColumnDefs": [
+ "aoColumnDefs": [
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 2)
@@ -615,7 +615,7 @@ EmployeeTimeEntryAdapter.method('getFormFields', function() {
EmployeeTimeEntryAdapter.method('getDates', function(startDate, stopDate) {
-
+
var dateArray = new Array();
var currentDate = startDate;
while (currentDate <= stopDate) {
@@ -631,7 +631,7 @@ EmployeeTimeEntryAdapter.method('renderForm', function(object) {
formHtml = formHtml.replace(/modJs/g,"modJsList['tabEmployeeTimeEntry']");
var html = "";
var fields = this.getFormFields();
-
+
for(var i=0;i'+k.toUTCString().slice(0, -13)+'';
optionList += '';
}
-
-
-
+
+
+
formHtml = formHtml.replace(/_id_/g,this.getTableName()+"_submit");
formHtml = formHtml.replace(/_fields_/g,html);
$("#"+this.getTableName()+'Form').html(formHtml);
$("#"+this.getTableName()+'Form').show();
$("#"+this.getTableName()).hide();
-
+
$("#"+this.getTableName()+'Form .datefield').datepicker({'viewMode':2});
$("#"+this.getTableName()+'Form .datetimefield').datetimepicker({
language: 'en'
@@ -678,9 +678,9 @@ EmployeeTimeEntryAdapter.method('renderForm', function(object) {
language: 'en',
pickDate: false
});
-
+
$("#"+this.getTableName()+'Form .select2Field').select2();
-
+
$("#date_select").html(optionList);
@@ -726,20 +726,20 @@ EmployeeTimeEntryAdapter.method('setEmployeeProjects', function(employeeProjects
EmployeeTimeEntryAdapter.method('save', function() {
var validator = new FormValidation(this.getTableName()+"_submit",true,{'ShowPopup':false,"LabelErrorClass":"error"});
-
+
if(validator.checkValues()){
var params = validator.getFormParameters();
$(params).attr('timesheet',this.timesheetId);
-
+
params.time_start = params.date_start;
params.time_end = params.date_end;
-
+
params.date_start = params.date_select+" "+params.date_start;
params.date_end = params.date_select+" "+params.date_end;
-
-
+
+
var msg = this.doCustomValidation(params);
-
+
if(msg == null){
var id = $('#'+this.getTableName()+"_submit #id").val();
if(id != null && id != undefined && id != ""){
@@ -751,7 +751,7 @@ EmployeeTimeEntryAdapter.method('save', function() {
$("#"+this.getTableName()+'Form .label').html(msg);
$("#"+this.getTableName()+'Form .label').show();
}
-
+
}
});
@@ -764,7 +764,7 @@ EmployeeTimeEntryAdapter.method('doCustomValidation', function(params) {
/*
var sd = Date.parse(this.currentTimesheet.date_start);
var ed = Date.parse(this.currentTimesheet.date_end).addDays(1);
-
+
if(sd.compareTo(et) != -1 || sd.compareTo(st) > 0 || st.compareTo(ed) != -1 || et.compareTo(ed) != -1){
return "Start time and end time shoud be with in " + sd.toString('MMM d, yyyy (dddd)') + " and " + ed.toString('MMM d, yyyy (dddd)');
}
@@ -779,7 +779,7 @@ EmployeeTimeEntryAdapter.method('addSuccessCallBack', function(callBackData,serv
EmployeeTimeEntryAdapter.method('deleteRow', function(id) {
this.deleteObj(id,[]);
-
+
});
EmployeeTimeEntryAdapter.method('deleteSuccessCallBack', function(callBackData,serverData) {
@@ -807,10 +807,10 @@ QtsheetAdapter.method('validateCellValue', function(element, evt, newValue) {
return false;
}
var val = parseFloat(newValue);
- if(val <= 0 || val > 24){
+ if(val < 0 || val > 24){
return false;
}
-
+
//Update total
//Find current column number
//Adding 2 because nth child is based on 1 and we are adding a virtual column for row names
@@ -845,7 +845,7 @@ QtsheetAdapter.method('validateCellValue', function(element, evt, newValue) {
if(columnTotal > 24){
return false;
}
-
+
modJs.addCellDataUpdate(element.data('colId'),element.data('rowId'),newValue);
return true;
});