EVOLUTION-NINJA
Edit File: add_account_from.php
<style> .cure { width: 75px; } .modal_content_id { width: 246%; margin-left: -410px; } </style> <style> #other_charges_val { font-weight:bold; } </style> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Account Master </h3> <?php // echo $this->load->view('templates/nav_menu'); ?> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="https://swansilk.co/dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="#" > Account Master </a></li> </ul> </div> <form class="form-horizontal"> <b>To insert data click here:</b> <input type="button" name="Insert" value="Insert" onclick="open_model();" /> <br><br> </form> <!-------------- grid data ------------------------------> <input type="hidden" id="refe_ids" name="refe_ids" class="refe_ids" > <div id="table_pending_indent" style="margin-top:20px;"> <div id = "jaytab" class="jaytab"> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> </div> </div> <!-- End BEGIN CONTAINER --> <script src="<?php echo base_url(); ?>assets/js/sweetalert.min.js" type="text/javascript"></script> <link href="<?php echo base_url(); ?>assets/css/sweetalert.min.css" rel="stylesheet" type="text/css" > <!-- The link to the CSS that the grid needs --> <!-- BEGIN FOOTER --> <!------------------------------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="add_master" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Account Master</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form class="account_det"> <div class="modal-body"> <table border="1" style="width:100%;border-spacing:0;margin-top: 1%;" cellpadding="5px"> <thead> <thead> <tr> <th>Name</th> <th><input type="text" name="name" class="form-control" required="required"></th> </tr> <tr> <th>Type</th> <th><select name="type" class="form-control" required="required"> <option value="">Select</option> <option value="credit">Credit</option> <option value="debit">Debit</option> </select> </th> </tr> <tr> <th>Created Date</th> <th><input type="text" value="<?php echo(date('d-m-Y'));?>" readonly class="form-control"> </th></th> </tr> <tr> <th>Created By</th> <th><input type="text" readonly name="user_name" readonly value="<?php echo $approved_by;?>" class=" form-control"></th> </tr> </thead> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit" >Submit</button> </div> </form> </div> </div> </div> <!------------------------------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Edit Account Master</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form class="update_account_det"> <div class="modal-body"> <table border="1" style="width:100%;border-spacing:0;margin-top: 1%;" cellpadding="5px"> <thead> <tr> <th>Name</th> <th><input type="hidden" name="id" class="form-control id" required="required"><input type="text" name="name" class="form-control name" required="required"></th> </tr> <tr> <th>Type</th> <th><select name="type" class="form-control type" required="required"> <option value="">Select</option> <option value="credit">Credit</option> <option value="debit">Debit</option> </select> </th> </tr> <tr> <th>Created Date</th> <th><input type="text" readonly class="form-control created_date"> </th></th> </tr> <tr> <th>Created By</th> <th><input type="text" readonly name="user_name" readonly class=" form-control approved_by"></th> </tr> </thead> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit" >Submit</button> </div> </form> </div> </div> </div> <!----------------------------------------------------------> <script> function open_model() { $('#add_master').modal('show'); } $('.account_det').submit(function(e){ e.preventDefault(); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/add_account_master');?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.account_det')[0].reset(); $('#add_master').modal('hide'); swal({ title: "Successfully Added", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else {$('.account_det')[0].reset(); $('#add_master').modal('hide'); swal({ title: "Fail To add, Try Again", text: "", }); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); $('.update_account_det').submit(function(e){ e.preventDefault(); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/update_account_master');?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.update_account_det')[0].reset(); $('#exampleModal').modal('hide'); swal({ title: "Successfully Added", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { $('.account_det')[0].reset(); $('#add_master').modal('hide'); swal({ title: "Same data has been updated", text: "", }); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $('#exampleModal').modal('hide'); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); }); </script> <!-- BEGIN FOOTER --> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> .tablediv { width:auto !important; overflow-x:scroll; } .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.min.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap-ui.min.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> .ss{ padding-right: 0 !important; padding-left: 0 !important; } .form-control { //width:65% !important; height:27px !important; padding: 3px 12px !important; border-radius: 0px !important; //margin-bottom:15px; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } #table_approved_indent { display:none; } #refresh_list3 { display:none !important; } @media only screen and (min-width:320px) and (max-width:640px) { } #more { display:none; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script> $(document).ready(function (){ $('#more').hide(); var l=$("#ref_id").val(); jQuery("#list2").jqGrid({ url:"<?php echo base_url('packing_list/account_master_list')?>", datatype: "json", colNames:['Id','Name','Type','Created at','Action'], colModel:[ {name:'id',index:'id',hidden:true, width:100,editable:true}, {name:'name',index:'name', width:240,editable:true,editrules:{required: true}}, {name:'type',index:'type', width:100,editable:true,editrules:{required: true}}, {name:'created_date',index:'created_date', editable:true,editrules:{required: true},width:80,formatter: 'date', formatoptions: { newformat: 'd-m-Y'}, searchoptions:{sopt:['eq']}}, {name: '', index: '', width: 100, align: 'center',formatter: function (cellvalue, options, rowObject) { var retVal = ""; var retVal = '<input type="button" onclick="edit('+rowObject.id+')" value="Edit" \> <input type="button" onclick="deleted('+rowObject.id+')" value="Delete" \>'; return retVal; } }, ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", loadonce:true, caption:"Account Master", }); jQuery("#list2").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list2").jqGrid('navGrid','#pager2', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); function edit(id) { $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/get_account_det');?>', data : {'id':id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#exampleModal').modal('show'); $('.id').val(response.message.id); $('.name').val(response.message.name); $('.created_date').val(response.message.created_date); $('.approved_by').val(response.message.created_by); $('.type option[value="'+response.message.type+'"').attr('selected','selected'); } else { swal({ title: "No data, Try Again", text: "", }); } } }); } function deleted(rowId) { var id = rowId; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("packing_list/delete_account_details")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { swal({ title: "Deleted Successfully", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } </script> <style type="text/css"> .ss{ padding-right: 0 !important; padding-left: 0 !important; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } input[type=file] { display: none; } .ui-jqgrid .ui-jqgrid-caption { text-align: left; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar { padding: .1em .1em; min-height: 35px; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: -9px; } #sData { height: 27px; } #cData { height: 27px; } #dData { height: 27px; } #eData { height: 27px; } .coledit { cursor:pointer; padding-right: 22px !important; padding-left: 23px !important; margin-top: 4px !important; color:bold !important; } .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } </style> <style> #jaytab{ width:100%; overflow:auto; } #search_list2 { display:none !important; } #list2_122_t { height:0px !important; } list2_136_t { height:12px !important; } .scroll { height:12px !important; } .ui-jqgrid-btable { } .ui-common-table { height:12px !important; } #refresh_list2 { display:none !important; } #client_edit { padding-right:12px !important; } #list2 { width: 1050px; height: 0px !important; } #gbox_list2 { height: auto !important; } #gview_list2 { height: auto !important; } @media only screen and (min-width:320px) and (max-width:640px){ .ui-jqgrid { margin-left: 1px !important; } .radio-list { margin-left:7% !important; } #table_pending_indent{ overflow-x: scroll; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: scroll !important; width:600px !important; padding-left: 0 !important; } #jaytab1 { margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 300px !important; padding-left: 0 !important; } #editmodlist2 { width:90% !important; } #sData span, #cData span { margin-left: 0 !important; } } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } #sData span, #cData span { margin-left: 3px; } #sData { height: 29px; } #cData { height: 29px; } .jqgfirstrow { height: 0px !important; } </style>