// JavaScript Document // ************** Make the URL ********************** function getRedirectUrlJs(cont,page,param) { //getRedirectUrlJs('MAIN_CONSOLE_ROOT','index','id@2@@name@chanchal'); if (param === undefined) { param = ''; } var result = ""; var dataArr = '&cont='+cont+'&page='+page+'¶m='+param; $.ajax({ type : "GET", global: false, url : main_console_root+"ajax/pageQuerySave.php?mod=GetUrlPath"+dataArr, async : false, success:function(msg) { result = msg; } }); return result; } // ************** Display Alret Msg *************** function getDisplayAlertMsg(displayMsg) { console.log(displayMsg); var dataArr = displayMsg.split('@@@@'); var msg_color = dataArr[0]; var msg_content = dataArr[1]; $.gritter.add({ title : msg_color, text : msg_content, sticky: false }); } // Display the Browse Images function displayBrowseImage(divBrowseId,fieldName) { var input = document.getElementById(fieldName); var dvPreview = $("#"+divBrowseId); dvPreview.html(""); // Constant Define In constantJavascriptDefine File var regex = new RegExp(IMAGE_REGEX); for (var i=0; i"); img.attr("style", "height:100px;width: 100px;padding: 5px;"); img.attr("src", e.target.result); dvPreview.append(img); } reader.readAsDataURL(input.files[i]); } else { var alertMSG = "warning@@@@"+name + " is not a valid image file."; getDisplayAlertMsg(alertMSG); dvPreview.html(""); } } } // Display the Browse Images function displayBrowseXlsImage() { var input = document.getElementById('uploadFile'); var dvPreview = $("#browseImages"); dvPreview.html(""); var regex = /^([a-zA-Z0-9 \s_\\.\-\(\):])+(.xls|.xlsx|.csv)$/; var iconArr = {'xls':'icon_xls.png','xlsx':'icon_xlsx.png','csv':'icon_csv.png'}; for (var i=0; i"); img.attr("style", "height:100px;width: 100px;padding: 5px;"); img.attr("src", iconPath); dvPreview.append(img); } reader.readAsDataURL(input.files[i]); } else { var alertMSG = "warning@@@@"+name + " is not a valid file."; getDisplayAlertMsg(alertMSG); dvPreview.html(""); } } } function permissionDeniedMsg() { var alertMSG = "warning@@@@Permission Denied"; getDisplayAlertMsg(alertMSG); } // ************** Remove Page Query *************** function removePageQuery(pageName) { console.log(main_console_root+"ajax/pageQuerySave.php?mod=RemoveQuery&page="+pageName); if(pageName !='') { $.ajax({ type : "GET", url : main_console_root+"ajax/pageQuerySave.php?mod=RemoveQuery&page="+pageName, async : true, success:function(){} }); window.setTimeout(function(){ location.reload();}); } } // Displaye Large Image function viewLargeImage(title,imagePath) { var message = ''; message += ""; message += '
'; message += ''; message += '
'; eModal.alert(message, title); } // Enable/ Active the Records // 1 For Enable/ Active Records function enableRecords(mod_action) { var listArr = new Array(); var i=0; $.each($("input[name='chk']:checked"), function() { listArr[i] = $(this).val(); i++; }); if(listArr.length >0 ) { $.ajax({ type : "GET", url : main_console_root+"ajax/disable_records.php?status=1&mod="+mod_action+'&listArr='+listArr, async : false, success:function(result) { console.log(result); if(result > 0) { var alertMSG = "success@@@@Record Enable Successfully"; getDisplayAlertMsg(alertMSG); } else { var alertMSG = "warning@@@@"+result; getDisplayAlertMsg(alertMSG); } } }); window.setTimeout(function(){ location.reload(); }, 1000); } else { var alertMSG = "warning@@@@"+"Please Select the Checkbox"; getDisplayAlertMsg(alertMSG); } } // Disable/ Deactive the Records // 0 For Disable/ Deactive Records function disableRecords(mod_action) { var listArr = new Array(); var i=0; $.each($("input[name='chk']:checked"), function() { listArr[i] = $(this).val(); i++; }); if(listArr.length >0 ) { var confirmMSG = 'Are you confirm to Disable'; if(mod_action == 'ProductMaster') { confirmMSG = 'Are you confirm to disable, Store Product Also disable'; } return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message') .then(function () { $.ajax({ type : "GET", url : main_console_root+"ajax/disable_records.php?status=0&mod="+mod_action+'&listArr='+listArr, async : false, success:function(result) { //console.log(result); if(result > 0) { var alertMSG = "success@@@@Record Disable Successfully"; getDisplayAlertMsg(alertMSG); } else { var alertMSG = "warning@@@@"+result; getDisplayAlertMsg(alertMSG); } } }); window.setTimeout(function(){ location.reload(); }, 1000); }); } else { var alertMSG = "warning@@@@"+"Please Select the Checkbox"; getDisplayAlertMsg(alertMSG); } } // Delete the Records function deleteRecords(mod_action) { var listArr = new Array(); var i=0; $.each($("input[name='chk']:checked"), function() { listArr[i] = $(this).val(); i++; }); if(listArr.length >0 ) { var confirmMSG = 'Are you confirm to delete'; return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message') .then(function () { $.ajax({ type : "GET", url : main_console_root+"ajax/delete_records.php?mod="+mod_action+'&listArr='+listArr, async : false, success:function(result) { if(result > 0) { var alertMSG = "success@@@@Record Delete Successfully"; getDisplayAlertMsg(alertMSG); } else { var alertMSG = "warning@@@@"+result; getDisplayAlertMsg(alertMSG); } } }); window.setTimeout(function(){ location.reload(); }, 1000); }); } else { var alertMSG = "warning@@@@"+"Please Select the Checkbox"; getDisplayAlertMsg(alertMSG); } } // Delete the Records function approvedRecords(mod_action) { var listArr = new Array(); var i=0; $.each($("input[name='chk']:checked"), function() { listArr[i] = $(this).val(); i++; }); if(listArr.length >0 ) { var confirmMSG = 'Are you confirm to Approved'; return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message') .then(function () { $.ajax({ type : "GET", url : main_console_root+"ajax/disable_records.php?mod="+mod_action+'&listArr='+listArr, async : false, success:function(result) { if(result > 0) { var alertMSG = "success@@@@Request Approved Successfully"; getDisplayAlertMsg(alertMSG); } else { var alertMSG = "warning@@@@"+result; getDisplayAlertMsg(alertMSG); } } }); window.setTimeout(function(){ location.reload(); }, 1000); }); } else { var alertMSG = "warning@@@@"+"Please Select the Checkbox"; getDisplayAlertMsg(alertMSG); } } // Delete the Records function cancelRecords(mod_action) { var listArr = new Array(); var i=0; $.each($("input[name='chk']:checked"), function() { listArr[i] = $(this).val(); i++; }); if(listArr.length >0 ) { var confirmMSG = 'Are you confirm to delete'; return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message') .then(function () { $.ajax({ type : "GET", url : main_console_root+"ajax/delete_records.php?mod="+mod_action+'&listArr='+listArr, async : false, success:function(result) { if(result > 0) { var alertMSG = "success@@@@Request Cancel Successfully"; getDisplayAlertMsg(alertMSG); } else { var alertMSG = "warning@@@@"+result; getDisplayAlertMsg(alertMSG); } } }); window.setTimeout(function(){ location.reload(); }, 1000); }); } else { var alertMSG = "warning@@@@"+"Please Select the Checkbox"; getDisplayAlertMsg(alertMSG); } } // Check Mobile Format function checkMobileFormat(mobile) { var msg = true; var mobileRegex = /^[0-9]+$/; if(!mobileRegex.test(mobile)) { msg = "Please enter a valid Mobile Number"; } else if(isNaN(mobile)) { msg = "Please enter only digits. ";} else if(CONST_MOBILE_LENGTH !=0 && mobile.length != CONST_MOBILE_LENGTH){ msg = "Mobile must have 10 digits "; } return msg; } // Check Email Format function checkEmailFormat(email) { var msg = true; var emailRegex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/; if(!emailRegex.test(email)) { msg = "Please enter a valid Email-ID"; } return msg; } function checkPasswordFormat(password) { var msg = true; var digitRegex = /^(?=.*\d)/; var lowercaseRegex = /^(?=.*[a-z])/; var specialcaseRegex = /^(?=.*[!@#$%^&*])/; if(password == '') { msg = "Please enter a valid Mobile Number"; } else if(password.length < '7' ) { msg = 'Password length must be 7 characters'; } else if(!digitRegex.test(password)) { msg = 'Password must contain at least one digit';} else if(!lowercaseRegex.test(password)) { msg = 'Password must contain at least one lowercase letter';} else if(!specialcaseRegex.test(password)) { msg = 'Password must contain at least one Special character';} return msg; } // Get the Parameter New Row for the Tempalte function getAdditionalPersonNewRow(personCount) { if(isNaN(personCount)){ personCount = '0'; } var additionalPersonNameArr = document.getElementsByName("additionalPersonNameArr[]"); var personNameArr = new Array(); for(var i= 0; i< additionalPersonNameArr.length; i++) { var j = i+1; var personName = $("#additionalPersonName_"+j).val(); personName = encodeURIComponent(personName); personNameArr[i] = personName; } var dataArr = '&personCount='+personCount+'&personNameArr='+personNameArr; console.log(main_console_root+"ajax/visitor_detail.php?mod=additionalPersonDivContent"+dataArr); $.ajax({ type: "GET", url : main_console_root+"ajax/visitor_detail.php?mod=additionalPersonDivContent"+dataArr, async : false, success : function(response){ $('#additionalPersonDivContent').html(response); } }); return msg; } // User Details Modal function viewAdminUserDetail(user_id) { var options = { url: main_console_root+"modal/admin_detail_modal.php?modeType=UserDetails&user_id="+user_id, title :'User Information', size: eModal.size.lgs, buttons: [ {text: 'Close', style: 'default ', close: true } ], }; return eModal.ajax(options); } // User Details Modal function viewVisitorRequestDetail(visitor_id) { var options = { url: main_console_root+"modal/visitor_detail_modal.php?modeType=VisitorDetails&visitor_id="+visitor_id, title :'Visitor Information', size: eModal.size.lgs, buttons: [ {text: 'Close', style: 'default ', close: true } ], }; return eModal.ajax(options); } // User Details Modal function viewSecurityVisitorDetail(visitor_id) { var options = { url: main_console_root+"modal/visitor_detail_modal.php?modeType=SecurityVisitorDetail&visitor_id="+visitor_id, title :'Visitor Information', size: eModal.size.lgs, buttons: [ {text: 'Close', style: 'default ', close: true } ], }; return eModal.ajax(options); } // User Details Modal function visitorRequestOtpReset(visitor_id) { eModal.close(); var dataArr = '&visitor_id='+visitor_id; console.log(main_console_root+"ajax/visitor_detail.php?mod=visitorRequestOtpReset"+dataArr); $.ajax({ type: "GET", url : main_console_root+"ajax/visitor_detail.php?mod=visitorRequestOtpReset"+dataArr, async : false, success : function() { var alertMSG = "success@@@@OTP Resend Successfully"; getDisplayAlertMsg(alertMSG); } }); }