var uniqueEmployeesDetailsArray_GlobalVar={};
var AllEmpIdBelong_loggedUser;


    
    AllEmpIdBelong_loggedUser = getEmployeeDetails();
    function getEmployeeDetails(){
        if(checkWheatherLogoutOrNot_InternetConnection()){
            return fetch_emp_id(); //function call
        }else{
            alertNoInternet_connection();
        }
    }
 /*---------------------------------------------------*/
 /*search  unique Empid to download excel individually*/
 /*---------------------------------------------------*/
    
    function fetch_emp_id() {
        return new Promise(function(resolve, failure) {// return two objts 'resolve' and 'failure'
            $.ajax({
                // async:false,
                url: BASE_URL+"php/fetchEmpId.php",
                method: "POST",
                dataType: "JSON",
                success: function (data)
                {
                    //setTimeout(function(){ resolve(data);},2000)
                    resolve(data);
                    uniqueEmployeesDetailsArray_GlobalVar["response"]=true;
                    uniqueEmployeesDetailsArray_GlobalVar["empIds"]=[];//declaire array
                    uniqueEmployeesDetailsArray_GlobalVar["empNames"]=[];
                    var resltArrayLength = data.length;
                    if (resltArrayLength > 0) {
                        for (var i = 0; i < resltArrayLength; i++) {
                            var uniqEmpId = data[i].empId;
                            var strngarray = "<option>" + uniqEmpId + "</option>";
                            $('#unique_emp_ids').append(strngarray);
                            $('#search_unique_emp_ids').append(strngarray);// excel
    						
    						uniqueEmployeesDetailsArray_GlobalVar["empIds"].push(data[i].empId);
    						uniqueEmployeesDetailsArray_GlobalVar["empNames"].push(data[i].empName);
                        }
                    }
                },
    			statusCode: {
        		    404: function(){
        		        alert("requesting file(fetchEmpId.php) does not exists! in server");
        		    }
        		},
        		error: function (err) {
        		    failure(err);
        		     uniqueEmployeesDetailsArray_GlobalVar["response"]=false;
        		    console.log("ajax error on requesting fetchEmpId file");
        		}
            });
        });
    }
 /*---------------------------------------------------*/


// ;;