<div class="breadcrumbs">
            <div class="breadcrumbs-inner">
                <div class="row m-0">
                    <div class="col-sm-4">
                        <div class="page-header float-left">
                            <div class="page-title">
                                <h1>Profile Management</h1>
                            </div>
                        </div>
                    </div>
                    <!--div class="col-sm-8">
                        <div class="page-header float-right">
                            <div class="page-title">
                                <ol class="breadcrumb text-right">
                                    <li><a href="#">Dashboard</a></li>
                                    <li><a href="#">Forms</a></li>
                                    <li class="active">Basic</li>
                                </ol>
                            </div>
                        </div>
                    </div-->
                </div>
            </div>
        </div>
        
  
                <div class="content">
            <div class="animated fadeIn">
              

                <div class="row">
                    

                    
                    
    
            
              <div class="col-lg-8">
                        <div class="card">
                            <form id="company_pro" name="company_pro">
                           
                            <div class="card-body card-block">
                                <div class="form-group"><label for="company" class=" form-control-label">Company Name</label>
                                <input type="text" id="cname" name="cname" placeholder="" value = "<?php echo $pro[0]->pro_name;   ?>"class="form-control"></div>
                                
                                <div class="form-group"><label for="vat" class=" form-control-label">Address</label>
                                <textarea id="madd" name="madd"placeholder="" class="form-control"><?php echo $pro[0]->pro_add;   ?></textarea></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Contact Numbers</label>
                                <input type="text" id="connum"  name="connum" placeholder="" value = "<?php echo $pro[0]->pro_num;   ?>" class="form-control"></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Web</label>
                                <input type="text" id="web" name="web" placeholder=""  value = "<?php echo $pro[0]->pro_web;   ?>" class="form-control"></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Email</label>
                                <input type="text" id="email" name="email"  placeholder="" value = "<?php echo $pro[0]->pro_email;   ?>" class="form-control"></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Reg. Number</label>
                                <input type="text" id="rnum" name="rnum" placeholder="" value = "<?php echo $pro[0]->pro_reg;   ?>" class="form-control"></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Delivery Address</label>
                                <textarea id="dadd" name="dadd" placeholder="" class="form-control"><?php echo $pro[0]->pro_deladd;   ?></textarea></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Bank Details</label>
                                <textarea id="bank" name="bank" placeholder="" class="form-control"><?php echo $pro[0]->pro_bank;   ?></textarea></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Header Slogans</label>
                                <textarea id="hsolg" name="hsolg" placeholder="" class="form-control"><?php echo $pro[0]->pro_heslogans;   ?></textarea></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Footer Slogans</label>
                                <textarea id="fslog" name="fslog" placeholder="" class="form-control"><?php echo $pro[0]->pro_fslogans;   ?></textarea></div>
                                
                                <div class="form-group"><label for="street" class=" form-control-label">Sub Footer</label>
                                <textarea id="sfslog" name="sfslog" placeholder="" class="form-control"><?php echo $pro[0]->pro_sfslogans;   ?></textarea></div>
                                
                                
                                
                                
                                <div class="form-actions form-group"><button type="button" id="prosave" name="prosave" class="btn btn-outline-secondary" onclick="pro_save()">Save</button></div>
                                
                          
                            </div>
                            </form>
                        </div>
                        
                        
                    </div>
                    
                    <div class="col-lg-8">
                        <div class="card">
                            <div class="card-body card-block">
                             <div class="form-group">
                                 <form method="post" id="upload_form" align="center" enctype="multipart/form-data">  
                                        <label for="file-multiple-input" class=" form-control-label">Authorized Signature</label>
                                        <input type="file" id="sign" name="sign" multiple="" class="form-control-file">
                                        <div id="uploaded_image"> </div>
                                        <input type="submit" name="upload" id="upload" value="Upload" class="btn btn-info" />  
                                        
                                        </form>
                                    </div>
                            </div>
                             </div>
                    </div>
                
            </div>
            </div>
            </div>
          
            
           
            
            <div class="clearfix"></div>
            
             <!--MODAL add-->
          <form id="frm_add_data">
              <div class="modal fade" id="addmodel" tabindex="-1" role="dialog" aria-labelledby="scrollmodalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="scrollmodalLabel">Add</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body" id="Modal_Add">
                            
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                            <button type="button" class="btn btn-primary" id="save_data">Confirm</button>
                        </div>
                    </div>
                </div>
            </div>
          </form>
            <!--END MODAL add-->
            
            
            <!--MODAL edit-->
          <form id="frm_edit_data">
              <div class="modal fade" id="editmodel" tabindex="-1" role="dialog" aria-labelledby="scrollmodalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="scrollmodalLabel">Edit</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body" id="modal_edit">
                            
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                            <button type="button" class="btn btn-primary" id="update_data">Confirm</button>
                        </div>
                    </div>
                </div>
            </div>
          </form>
            <!--END MODAL edit-->
            
            
<script src="<?php echo base_url(); ?>assets/js/jquery.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery-ui.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/lib/chosen/chosen.jquery.min.js"></script>
            <script>
$(document).ready(function(){
   //$("#addmodel").modal('show');
   //('test');
  // show_data("showalluser");
  
  $('#upload_form').on('submit', function(e){  
           e.preventDefault();  
           if($('#sign').val() == '')  
           {  
                alert("Please Select the File");  
           }  
           else  
           {  
                $.ajax({  
                     url:"<?php echo base_url(); ?>savesign",   
                     //base_url() = http://localhost/tutorial/codeigniter  
                     method:"POST",  
                     data:new FormData(this),  
                     contentType: false,  
                     cache: false,  
                     processData:false,  
                     success:function(arr)  
                     {  
                         alert(arr[0]);
                         //swal(arr[0]);
                          $('#uploaded_image').html(arr[0]); 
                          
                         
                     }  
                });  
           }  
      });  
});

 //get pro data
 
 function pro_save(){
     
  
     
           swal({
                  title: "Are you sure?",
                  text: "Save, Entered Details will be Saved",
                  icon: "warning",
                  buttons: true,
                  dangerMode: true,
                })
                .then((willDelete) => {
                  if (willDelete) {
                               $.ajax({
                                type  : 'ajax',
                                method : "POST",
                                url   : "<?php echo site_url('saveprofile')?>",
                                async : true,
                                dataType : 'json',
                                data: $("#company_pro").serialize(),
                                success : function(ret){
                                    swal("Details Updated");
                                    //$("#addmodel").modal('hide');
                                   // $('#tb_bdy').html("");
                                    //show_data(data[1]);
                                    location.reload();
                                }
                 
                            });
                  } else {
                    swal("No Changes");
                   // document.getElementById("load").style.display = "none";
                  }
                });
                
 };
 
 function showpro(){
     
     $.ajax({
                type  : 'ajax',
                method : "POST",
                url   : "<?php echo site_url('viewprofile')?>",
                async : true,
                dataType : 'json',
                success : function(data){
                   swal("Details Updated");
                }
 
            });
            return false;
 }
     


    //get data
    function show_data(clickedID){
     var rt = clickedID;
     $.ajax({
                type  : 'ajax',
                method : "POST",
                url   : "<?php echo site_url()?>"+rt,
                async : true,
                dataType : 'json',
                success : function(data){
                    $('#btn').html(data[0]);
                    $('#thed').html(data[1]);
                    $('#tb_bdy').html(data[2]);
                }
 
            });
            return false;
     
    }

   //show add new
    function add_data(clickedID){
     var rt = clickedID;
     
           $.ajax({
                        type  : 'ajax',
                        method : "POST",
                        url   : '<?php echo site_url('')?>'+rt,
                        async : true,
                        dataType : 'json',
                        success : function(data){
                            $('#Modal_Add').html(data);
                            $('#tb_bdy').html("");
                            show_data(data[1]);
                            
                        }
         
                    });
           
     
    }
    
    // save new data
    $('#save_data').on('click',function(){
     
             var rt = document.getElementById('table').value;
            
            swal({
                  title: "Are you sure?",
                  text: "Save, Entered Details will be Saved",
                  icon: "warning",
                  buttons: true,
                  dangerMode: true,
                })
                .then((willDelete) => {
                  if (willDelete) {
                               $.ajax({
                                type  : 'ajax',
                                method : "POST",
                                url   : "<?php echo site_url('')?>"+rt,
                                async : true,
                                dataType : 'json',
                                data: $("#frm_add_data").serialize(),
                                success : function(data){
                                    swal(data[0]);
                                    $("#addmodel").modal('hide');
                                    $('#tb_bdy').html("");
                                    show_data(data[1]);
                                }
                 
                            });
                  } else {
                    swal("No Changes");
                    document.getElementById("load").style.display = "none";
                  }
                });
            
           
            
        });
        
    //show edit data    
    function  edit_view(clickedID){
        $('#modal_edit').html("");
        var rout = clickedID;
          var res = rout.split("/");
          var rt = res[0];
            var id = res[1];
             $.ajax({
                        type  : 'ajax',
                        method : "POST",
                        url   : '<?php echo site_url('')?>'+rt,
                        async : true,
                        dataType : 'json',
                        data : {id:id },
                        success : function(data){
                            
                            $('#modal_edit').html(data);
                        }
         
                    });
            $('#editmodel').modal('show');
      
            return false;
     
    }    
        
        
        
    //show edit data
    $('#show_data').on('click','.item_edit',function(){
      var id = $(this).data('product_code');
      
      $.ajax({
                type  : 'ajax',
                method : "POST",
                url   : '<?php echo site_url('Costsetting_controller/edit_data')?>',
                async : true,
                dataType : 'json',
                data : {p_id:id },
                success : function(data){
                    
                    $('#modal_edit').html(data);
                }
 
            });
      $('#Modal_vali').modal('show');
    })    
        
    
     //save edited data
    $('#update_data').on('click',function(){
             var rt = document.getElementById('edit_table').value;
             
              swal({
                  title: "Are you sure?",
                  text: "Update, Your Edited details will be Updated",
                  icon: "warning",
                  buttons: true,
                  dangerMode: true,
                })
                .then((willDelete) => {
                  if (willDelete) {
                                 $.ajax({
                                    type  : 'ajax',
                                    method : "POST",
                                    url   : "<?php echo site_url('')?>"+rt,
                                    async : true,
                                    dataType : 'json',
                                    data: $("#frm_edit_data").serialize(),
                                    success : function(data){
                                         swal(data[0]);
                                        $('#editmodel').modal('hide');
                                        $('#tb_bdy').html("");
                                        show_data(data[1]);
                                    }
             
                                });
                  } else {
                    swal("No Changes");
                    $('#editmodel').modal('hide');
                  }
                });
            
        });
      
      
</script>