$('#myDatepicker').datetimepicker({ format: 'DD-MM-YYYY' }); $(document).on('click','.test',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetDetails/"+id, type:"GET", success:function(data){ $('#sub-value').css('display', 'block'); $('#sub-value').html(JSON.parse(data)); } }); }); $(document).on('click','.asset_value',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetValueForm/"+id, type:"GET", success:function(data){ $('#edit-form').html(JSON.parse(data)); } }); }); $(document).on('click','.asset_usage',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetUsageForm/"+id, type:"GET", success:function(data){ $('#edit-form').html(JSON.parse(data)); } }); }); $(document).on('click','.asset_amc',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetAMCForm/"+id, type:"GET", success:function(data){ $('#edit-form').html(JSON.parse(data)); } }); }); $(document).on('click','.asset_insurance',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetInsuranceForm/"+id, type:"GET", success:function(data){ $('#edit-form').html(JSON.parse(data)); } }); }); $(document).on('click','.asset_image',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; $.ajax({ url:url+"Asset/getAssetImageForm/"+id, type:"GET", success:function(data){ $('#edit-form').html(JSON.parse(data)); } }); }); $(document).on('click','#close-form',function(){ $('#edit-form').css('display', 'none'); }); // $( document ).ready(function() { // var tab_value = $("#current_tab").val(); // if(tab_value == 1) // { // $("#asset_usage-tab").tab('show'); // } // }); //fetch history start $(document).on('click','.asset_value_history',function(){ var id = $(this).attr("id"); var getUrl = window.location; var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; var url = baseUrl+"/"; var data = {id:id,table_name:"asset_value"}; $.ajax({ type: "post", url:url+"Asset/get_history", data: data, json: true, success: function(response) { alert(response); }, error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) } }); }); //fetch history end // ################################################################################################################################ // show error msg for wrong password => file name : user/change_password.php // $(document).on('click','#submit',function(){ // var data = $("#change-pass").serialize(); // $.ajax({ // type: "post", // url: "user/check_password", // data: data, // json: true, // success: function(response) { // console.log("aaaaaaa"); // response = jQuery.parseJSON(response); // if (response.status === "success") { // // location.href = "auth"; // response = jQuery.parseJSON(response); // $('input[name=csrf_test_name]').val(response.csrf_hash); // } // else { // console.log("aaaaaaa"); // $('input[name=csrf_test_name]').val(response.csrf_hash); // $('#message1').html('Worng password').css('color', 'red'); // $('#password').val(''); // $('#confirm_password').val(''); // $('#message').html(''); // } // }, // error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) } // }); // }); // hide err msg when the input is empty => file name : user/change_password.php , label name : Old Password $('#old_password').on('keyup', function () { if($('#old_password').val().length == 0){ $('#message1').html(''); } }); // match the password and confirm password equal or not => file name : user/change_password.php and user/add_user.php $('#password, #confirm_password').on('keyup', function () { $(':input[type="submit"]').prop('disabled', true); if ($('#password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) { $('#message').html('Matching').css('color', 'green'); $('button[type="submit"]').attr("disabled", false); } else if($('#password').val().length == 0 || $('#confirm_password').val().length == 0){ $('#message').html(''); } else $('#message').html('Not Matching').css('color', 'red'); }); // password eye icon => file name : user/add_user.php && user/change_password.php $("#toggle-password").click(function() { $(this).toggleClass("fa-eye fa-eye-slash"); var input = $($(this).attr("toggle")); if (input.attr("type") == "password") { input.attr("type", "text"); } else { input.attr("type", "password"); } }); // sadmin create admin onchange function select permit as all default => file name : user/add_user.php $('#role').on('change', function() { if(this.value == "admin") { $('#action_permit').html(''); $('#action_permit').attr("style", "pointer-events: none;"); } else { $('#action_permit').attr("style", "pointer-events: default;"); $('#action_permit').html(` `); } }); // file open => file name : user/profile.php // The handler is executed at most once per element per event type => one() $(".profilepic").one('click',function() { $("#file_profile").trigger("click"); }); // $(".profilepic").click(function(){ // console.log("aaaa"); // // $("#file_profile").trigger("click"); // }); // change login person profile pic => file name : user/profile.php $(document).ready(function(){ $("#file_profile").change(function(){ $(".btn-success").click(); }); });