function loadUser(callback) {
            // require mustache class
            require(["mustache"], function(Mustache) {
                $.ajax({
                    type: "GET",
                    url: "./landing/getUserDetails/",
                    // async: false,
                    success: function(data, textStatus, jqXHR) {
                        // get user date for controls
                        
                        if (data.success) {
                            userData = data;
                            current_user = data.user;
                            if (current_user[0].clock_in == null || current_user[0].clock_in == "0000-00-00 00:00:00") {
                                isWorking = false;
                            } else if (current_user[0].clock_out == null || current_user[0].clock_out == "0000-00-00 00:00:00") {
                                isWorking = true;
                            } else {
                                isWorking = false;
                            }

                            // if (current_user[0].clock_out == null || current_user[0].clock_out == "0000-00-00 00:00:00") {
                            //     isClockout = false;
                            // } else isClockout = true;
                        }
                        
                        if (callback != undefined) {
                            callback();
                        }
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.error("The following error occured: " + textStatus, errorThrown);
                        return false;
                    },
                    dataType: "json"
                });
            });
        }
// method that loads user control for every page
method that loads user control for every page
method that loads user control for every page
function loadUser(callback) {
            require(["mustache"], function(Mustache) {
                $.ajax({
                    type: "GET",
                    url: "./landing/getUserDetails/",
                    success: function(data, textStatus, jqXHR) {
                        if (data.success) {
                            userData = data;
                            current_user = data.user;
                            if (current_user[0].clock_in == null || current_user[0].clock_in == "0000-00-00 00:00:00") {
                                isWorking = false;
                            } else if (current_user[0].clock_out == null || current_user[0].clock_out == "0000-00-00 00:00:00") {
                                isWorking = true;
                            } else {
                                isWorking = false;
                            }
                        }
                        if (callback != undefined) {
                            callback();
                        }
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.error("The following error occured: " + textStatus, errorThrown);
                        return false;
                    },
                    dataType: "json"
                });
            });
        }
function loadUser ( callback ) { require ( [ "mustache" ] , function ( Mustache ) { $ . ajax ( { type : "GET" , url : "./landing/getUserDetails/" , success : function ( data , textStatus , jqXHR ) { if ( data . success ) { userData = data ; current_user = data . user ; if ( current_user [ 0 ] . clock_in == null || current_user [ 0 ] . clock_in == "0000-00-00 00:00:00" ) { isWorking = false ; } else if ( current_user [ 0 ] . clock_out == null || current_user [ 0 ] . clock_out == "0000-00-00 00:00:00" ) { isWorking = true ; } else { isWorking = false ; } } if ( callback != undefined ) { callback ( ) ; } } , error : function ( jqXHR , textStatus , errorThrown ) { console . error ( "The following error occured: " + textStatus , errorThrown ) ; return false ; } , dataType : "json" } ) ; } ) ; }
method that loads user control for every page
method that loads user control for every page
// require mustache class // async: false, // get user date for controls // if (current_user[0].clock_out == null || current_user[0].clock_out == "0000-00-00 00:00:00") { //     isClockout = false; // } else isClockout = true;