@ -6,7 +6,8 @@
var panel = this ;
var panel = this ;
var theForm = this . getForm ( ) ;
var theForm = this . getForm ( ) ;
var startInput = Ext . getCmp ( 'user_logs_add_form_start' ) ;
var startInput = Ext . getCmp ( 'user_logs_add_form_start' ) ;
var hoursInput = Ext . getCmp ( 'user_logs_add_form_hours' ) ;
var timeInput = Ext . getCmp ( 'user_logs_add_form_time' ) ;
var unitsInput = Ext . getCmp ( 'user_logs_add_form_units' ) ;
var endInput = Ext . getCmp ( 'user_logs_add_form_end' ) ;
var endInput = Ext . getCmp ( 'user_logs_add_form_end' ) ;
var startdate = startInput . items . items [ 0 ] ;
var startdate = startInput . items . items [ 0 ] ;
var starttime = startInput . items . items [ 1 ] ;
var starttime = startInput . items . items [ 1 ] ;
@ -14,27 +15,57 @@
var endtime = endInput . items . items [ 1 ] ;
var endtime = endInput . items . items [ 1 ] ;
startdate . on ( 'change' , function ( e ) {
startdate . on ( 'change' , function ( e ) {
var hours = hours Input. getValue ( ) ;
var hours = time Input. getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
if ( 'Mins' === unitsInput . getValue ( ) ) {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . MINUTE , parseInt ( hours ) ) ;
} else {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
}
endtime . setValue ( calculatedEndTime ) ;
endtime . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
} ) ;
} ) ;
starttime . on ( 'change' , function ( e ) {
starttime . on ( 'change' , function ( e ) {
var hours = hours Input. getValue ( ) ;
var hours = time Input. getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
if ( 'Mins' === unitsInput . getValue ( ) ) {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . MINUTE , parseInt ( hours ) ) ;
} else {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
}
endtime . setValue ( calculatedEndTime ) ;
endtime . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
} ) ;
} ) ;
hoursInput . on ( 'change' , function ( e ) {
time Input. on ( 'change' , function ( e ) {
var hours = hours Input. getValue ( ) ;
var hours = time Input. getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var startTime = starttime . getValue ( ) ;
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
if ( 'Mins' === unitsInput . getValue ( ) ) {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . MINUTE , parseInt ( hours ) ) ;
} else {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
}
endtime . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
} ) ;
unitsInput . on ( 'change' , function ( e ) {
var hours = timeInput . getValue ( ) ;
var startTime = starttime . getValue ( ) ;
if ( 'Mins' === unitsInput . getValue ( ) ) {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . MINUTE , parseInt ( hours ) ) ;
} else {
var calculatedEndTime = Ext . Date . add ( new Date ( startTime ) , Ext . Date . HOUR , parseInt ( hours ) ) ;
}
endtime . setValue ( calculatedEndTime ) ;
endtime . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;
enddate . setValue ( calculatedEndTime ) ;