?
Current Path : /home1/savoy/public_html/savoyglobal.net/hr/application/views/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/hr/application/views/commonfunctions.php |
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ ?> <script type="text/javascript"> /* Common function for viewing and adding data. Loaded via onclick function. */ function viewdata(controller,controllerfunction,modelfunction,page,pagenum) { if(arguments[5]) { var divid=arguments[5]; } else { var divid="entrydiv"; } //alert("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum); $("#"+divid).empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#"+divid).load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum); } function addformdisplay(page,directory) { //alert("<?= site_url('master/addformdisplay/') ?>/" +page+'/'+directory); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url('master/addformdisplay/') ?>/" +page+'/'+directory); } function addformdata(formid) { if(arguments[1]) { var divid=arguments[1]; } else { var divid="entrydiv"; } if(callvalidate(formid)) { $('.customForm').ajaxForm({ beforeSubmit: showPreloader(divid), success: function(data) { $("#"+divid).html(data); $('html, body, #'+divid).animate({scrollTop:0}, 'slow'); } }); } } function callvalidate(formid) { $("#"+formid).validate(); return $("#"+formid).valid(); } function addeditformdata(formid) { if($("#"+formid).validate()) { $('.customForm').ajaxForm(function(data) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").html(data); }); } } function editformdata(controller,controllerfunction,id,table,field,page,alert_id) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page+'/'+alert_id); } function displayformdata(controller,controllerfunction,id,table,field,page) { //alert("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function viewformdata(controller,controllerfunction,id) { //alert("<?= site_url('master/viewform/') ?>/" +controller+'/'+controllerfunction+'/'+id); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url()?>/" +controller+'/'+controllerfunction+'/'+id); } function deletedata(deltable,id,delfield,controller,controllerfunction,modelfunction,page,table,field,value) { if(confirmDelete()) { if(value) { var val=value; } else { var val= id; } if(table != "" && field != "") { $("#success-panel").load("<?= site_url('master/checkexistencearray/') ?>/" +table+'/'+field+'/'+val,function(data){ if(data==1) { $('html, body').animate({scrollTop:0}, 'slow'); // for scrolling to the top of the page $("#success-panel").fadeIn(900,0); $("#success-panel").html("Records with relation exist. Cannot be deleted."); $("#success-panel").fadeOut(2000,0); } else { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } }); } else { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } } else { viewdata(controller,controllerfunction,modelfunction,page,'1'); } } function checkexistence(table,field,value) { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/checkexistence/') ?>/" +table+'/'+field+'/'+value,function(data){ if(data==1) { $("input#"+field).val(""); $("select#"+field).val(""); $("#"+field).css('border','solid 1px red'); $("#"+field).focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("Duplicate Entry Recorded"); $("#success-panel").fadeOut(2000,0); } }); } function confirmDelete() { if (confirm("Are you sure you want to delete")) return 1; else return 0; } function validateform(formid) { if($("#"+formid).validate()) { return true; } else { return false; } } function showPreloader(divid) { $("#"+divid).empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); } function showDiv(divname) { var divstyle = new String(); divstyle = document.getElementById(divname).style.display; if(divstyle.toLowerCase()=="none" || divstyle == "") { document.getElementById(divname).style.display="block"; } else { document.getElementById(divname).style.display="none"; } } function add_employees_batch(batch_id,batch_date,page) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url('onboarding/newaddpage/') ?>/" +batch_id+'/'+batch_date+'/'+page); } function view_alerts(alert_master_id,page_no) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/settings/view_alerts/"+alert_master_id+"/"+page_no); } function view_my_alert(menu_id,module_id) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); document.location.href="<?= site_url() ?>/master/index/"+menu_id+"/"+module_id; } function view_my_alert_employee(page,directory,employee_name,alert_id) { employee_name = encodeURIComponent(employee_name); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url('master/addformdisplayalert/') ?>/" +page+'/'+directory+'/'+employee_name+'/'+alert_id); } function employee_camp_site_allotment(employee_id,controllerfunction,alert_id) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url('onboarding/') ?>/" +controllerfunction+'/'+employee_id+'/'+alert_id); } function suggestcustomer(id) { $("#"+id).autocomplete("<?= site_url() ?>/master/autosuggestcustomer/", { width: 320, selectFirst: false }); } </script>