whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
views
/
webapp
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/views/webapp/view_people.php
<?php require_once(APPPATH.'views/webapp/header.php');?> <?php require_once(APPPATH.'views/webapp/menu.php'); $cur_year = date('Y'); $cur_month = strtolower(date('F')); echo "<style>.file-tree .topyear_".$cur_year.":before{ color:#d81b60!important;}</style>"; echo "<style>.year_".$cur_year." .".$cur_month.":before{ color:#d81b60!important;}</style>"; $CI = & get_instance(); $CI->load->model('app'); ?> <style type="text/css"> .upload{ display:none!important; } .label{ padding: 0.2em 0.3em 0.2em 0.3em; } .label-ac{ color: red; font-size: 12px;} .label-purchase{background-color: #d81b60; color: #fff; font-size:75%;} .label-sales{background-color: #605ca8; color: #fff; font-size:75%;} .label-payment{background-color: #001F3F; color: #fff; font-size:75%;} .label-receipt{background-color: #ff851b; color: #fff; font-size:75%;} .label-contra{background-color: #3d9970; color: #fff; font-size:75%;} .label-journal{background-color: #3c8dbc; color: #fff; font-size:75%;} .label-credit{background-color: #DD4B39; color: #fff; font-size:75%;} .label-debit{background-color: #596D82; color: #fff; font-size:75%;} .label-bank{background-color: #f74ef5; color: #fff; font-size:75%;} .label-cheque_reg{background-color: #56afe2; color: #fff; font-size:75%;} .label-all{color: #000; font-size:75%;} .btn-sm{padding: 0px 4px;} .file-body ul li a{ width:auto!important; } .box-header{padding-bottom: 0px;} .pro-pic img{ width: 100px; margin: 0 auto; display: table; margin-top: 10px; } .month1{ background-color:#94bfac!important; } .month2{ background-color:#264d7e!important; } .month3{ background-color:#3a73a9!important; } .month4{ background-color:#96bf65!important; } .month5{ background-color:#4b5729!important; } .month6{ background-color:#3e4630!important; } .month7{ background-color:#4f5138!important; } .month8{ background-color:#7b6b4f!important; } .month9{ background-color:#dd7b00!important; } .month10{ background-color:#845b4d!important; } .month11{ background-color:#613339!important; } .month12{ background-color:#6e4a75!important; } </style> <script type="text/javascript"> $(function(){ $(".upload_link").on('click', function(e){ e.preventDefault(); $(this).prev().trigger('click'); }); }); </script> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> View People </h1> <ol class="breadcrumb"> <li><a href="<?php echo site_url('webapp/welcome')?>"><i class="fa fa-dashboard"></i> Dashboard</a></li> <li class="active">View People</li> </ol> <?php if($this->session->flashdata('msg')){ echo "<br>"; echo $this->session->flashdata('msg'); } ?> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-4"> <div class="box box-primary"> <div class="box-header ui-sortable-handle"> <i class="fa fa-user"></i> <h3 class="box-title">User Detail <span class="label label-primary"> <?php if($data[0]['type'] == 'customer'){ echo "Customer"; }elseif($data[0]['type'] == 'team_leader'){ echo "Team Leader"; }elseif($data[0]['type'] == 'office_user'){ echo "Office User"; }else{ echo "Admin"; } ?> </span></h3> <div class="box-tools pull-right"> </div> </div> <div class="pro-pic"> <?php if(!empty($data[0]['photo'])){ ?> <img src="<?php echo base_url().'webapp/profile/'.$data[0]['photo']; ?>"> <?php }else{ ?> <img src="<?php echo base_url().'webapp/profile/noPhotoAvailable.jpg'; ?>" style="width:100px;"> <?php } ?> </div> <table class="table"> <tr> <th>Name</th> <td><?php echo $data[0]['name']; ?></td> </tr> <tr> <th>Email</th> <td><?php echo $data[0]['email']; ?></td> </tr> <tr> <th>Mobile</th> <td><?php echo $data[0]['mobile']; ?></td> </tr> <?php if($data[0]['type'] == 'customer'){ ?> <tr> <th>constitution</th> <td><?php echo $data[0]['constitution']; ?></td> </tr> <tr> <th>Date of Incorporation</th> <td><?php echo date("d-m-Y", strtotime($data[0]['date_incorporation'])); ?> </td> </tr> <tr> <th>Nature of Business</th> <td><?php echo $data[0]['nob']; ?></td> </tr> <tr> <th>Unique Requiremant</th> <td><?php echo $data[0]['ur']; ?></td> </tr> <tr> <th>Report Interval</th> <td><?php echo $data[0]['ri']; ?></td> </tr> <tr> <th>GST</th> <td><?php echo $data[0]['gst']; ?></td> </tr> <tr> <th>PAN</th> <td><?php echo $data[0]['pan']; ?></td> </tr> <?php } ?> </table> </div><!-- /.box --> </div> <?php /* <div class="col-xs-12 col-sm-12 col-md-4"> <div class="box box-primary"> <div class="box-header ui-sortable-handle"> <i class="fa fa-list"></i> <h3 class="box-title">Document Upload Logs</h3> <h5 class="text-danger">Last Activity : <small class="text-lowercase label label-primary"><i class="fa fa-clock-o"></i> <?php echo date("d-m-Y, h:i", strtotime($data[0]['last_activity'])); ?> </small></h5> </div> <div class="box-body"> <table class="table"> <thead> <tr> <th>Details</th><th>Status</th> </tr> </thead> <tbody> <?php foreach($logs as $log_k=>$log_v){ ?> <tr> <td class="text-capitalize"> <span data-toggle="tooltip" title="" class="badge bg-yellow" data-original-title="Uploaded Files"> <?php echo $log_v['file_count']; ?> </span> <?php $log_month = substr($log_v['month'], strpos($log_v['month'], "_") + 1); $log_stage = str_replace('_',' ',$log_v['stage']); echo $log_v['year'].'/'.$log_month.'/'.$log_stage; ?> </td> <td> <?php if($key["status"] == 0){ $status='<span class="badge bg-yellow">Not seen</span>'; }else $status='<span class="badge bg-blue">Received</span>'; } ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> */ ?> <div class="col-xs-12 col-sm-12 col-md-2"> <div class="box box-primary"> <div class="box-header ui-sortable-handle"> <i class="fa fa-file-text"></i> <h3 class="box-title">Templates</h3> </div> <hr> <div class="box-body"> <button title="View File" type="button" class="view-btn btn btn-success pull-right view_temp_modal"> <i class="fa fa-eye" aria-hidden="true"></i> </button> <button title="Upload File" type="button" class="up-btn btn btn-info" data-toggle="modal" data-target="#up_temp"> <i class="fa fa-upload" aria-hidden="true"></i> </button> </div> <div class="box-footer"> <strong>Status:</strong> <span id="status2"></span> </div> </div><!-- /.box --> </div> <!-- Modal --> <div class="modal fade" id="up_temp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <form action="" class="browseForm" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Templates</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Select Files</label> <input required="" class="mydoc" id="doc" type="file" name="doc[]" multiple="" accept=".png, .jpg, .jpeg, .pdf, .csv, .xls, .xlsb, .xlsx"> </div> </div> <div class="modal-footer" style="text-align:left"> <div class="pull-right"> <progress id="progressBar" value="0" max="100" style="width:300px; display:none;"></progress> <p><strong id="status"></strong> <span id="loaded_n_total"></span></p> </div> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary save-btn" onclick='uploadFile()'>Save changes</button> </div> </form> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="view_temp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">View Templates</h4> </div> <div class="modal-body view_temp"> </div> </div> </div> </div> <?php if($data[0]['type'] == 'customer'){ ?> <div class="col-xs-12 col-sm-12 col-md-6"> <div class="box box-primary"> <div class="box-header ui-sortable-handle"> <i class="fa fa-file"></i> <h3 class="box-title">Documents <a href="#" data-toggle="modal" data-target="#access"> <span class="label label-primary">Click here to Give Access</span></a></h3> <ul class="list-unstyled text-capitalize"> <?php for ($j=0; $j < count($access_folder); $j++) { if(!empty($access_folder[$j]['folder'])){ ?> <li class='text-danger remUsr<?php echo $access_folder[$j]['aid']; ?>'> <h5> <button onClick="remUsr(<?php echo $access_folder[$j]['aid']; ?>)" class="btn btn-danger btn-sm"><i class='fa fa-trash'></i></button> <i class='fa fa-caret-right'></i> <span style="width: 90px; display: inline-block;"><?php echo $access_folder[$j]['name']; ?> </span> <?php $ex_fe = explode('|', $access_folder[$j]['folder']); for ($k=0; $k < count($ex_fe); $k++) { ?> <span class="label-ac label label-<?php echo $ex_fe[$k]; ?>"><?php echo $ex_fe[$k]; ?></span> <?php } ?> </h5> </li> <?php } } ?> </ul> <div class="box-tools"> </div> </div> <div class="box-body"> <div class="row"> <!-- Button trigger modal --> <button type="button" class="btn bg-maroon btn-flat margin" data-toggle="modal" data-target="#add_ser"> Add new service </button> <!-- Modal --> <div class="modal fade" id="add_ser" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <form class="serForm"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add new service</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Select Year</label> <select class="form-control" name="year" required> <option value="">Select Year</option> <?php foreach($struct as $key=>$obj){ $incr_obj=$obj['year']+1; $incr_obj = substr($incr_obj, -2); ?> <option value="<?php echo $obj['year']; ?>"><?php echo $obj['year'].'-'.$incr_obj; ?></option> <?php } ?> </select> </div> <div class="form-group"> <label>Service Name</label> <input type="text" name="ser_name" placeholder="Service Name" class="form-control" required> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Save changes</button> </div> </form> </div> </div> </div> <!------------------------------------------------------------> <!-- Button trigger modal --> <button type="button" class="btn bg-orange btn-flat margin" data-toggle="modal" data-target="#remove_ser"> Remove service </button> <!-- Modal --> <div class="modal fade" id="remove_ser" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <form class="remSerForm"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Remove service</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Select Year</label> <select class="form-control rem_ser_year" name="year" required> <option value="">Select Year</option> <?php foreach($struct as $key=>$obj){ $incr_obj=$obj['year']+1; $incr_obj = substr($incr_obj, -2); ?> <option value="<?php echo $obj['year']; ?>"><?php echo $obj['year'].'-'.$incr_obj; ?></option> <?php } ?> </select> </div> <?php foreach($struct as $key=>$obj){ ?> <div class="hide_ser form-group year_<?php echo $obj['year']; ?>"> <label>Select Service</label> <select class="form-control" name="stage"> <option value="">Select Service</option> <?php $stage = json_decode($obj['stage']); foreach($stage as $kst => $vst){ ?> <option value="<?php echo $vst; ?>"><?php echo $vst; ?></option> <?php } ?> </select> </div> <?php } ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Save changes</button> </div> </form> </div> </div> </div> <!------------------------------------------------------------> <!-- Button trigger modal --> <button type="button" class="btn bg-purple btn-flat margin" data-toggle="modal" data-target="#past_dir"> Make directories of past year </button> <!-- Modal --> <div class="modal fade" id="past_dir" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <form class="dirForm"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add past year</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Select Year</label> <select class="form-control" name="year" required> <option value="">Select Year</option> <?php for($z=2023; $z>=2015; $z--){ $incr_obj=$z+1; $incr_obj = substr($incr_obj, -2); ?> <option value="<?php echo $z; ?>"><?php echo $z.'-'.$incr_obj; ?></option> <?php } ?> </select> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Save changes</button> </div> </form> </div> </div> </div> </div> <div class="row"> <?php foreach($struct as $key=>$obj){ $incr_obj=$obj['year']+1; $incr_obj = substr($incr_obj, -2); ?> <a href="#" data-year="<?php echo $obj['year']; ?>" onclick="getMonth($(this))" class="btn bg-olive btn-flat margin"> <?php echo $obj['year'].'-'.$incr_obj; ?> </a> <?php } ?> </div> </div><!--box-body--> <?php } ?> <!-- Modal --> <div class="modal fade" id="access" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <?php echo form_open('webapp/users/access_two'); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <!--<h4 class="modal-title text-capitalize" id="myModalLabel"><?php //echo $data[0]['name']; ?></h4>--> <ul class="list-unstyled"> <?php for ($j=0; $j < count($access_folder); $j++) { if(!empty($access_folder[$j]['folder'])){ ?> <li class='text-danger'> <h5 class="text-capitalize"><i class='fa fa-caret-right'></i> <span style="width: 150px; display: inline-block;"> <?php echo $access_folder[$j]['name']; ?></span> <?php $ex_fe = explode('|', $access_folder[$j]['folder']); for ($k=0; $k < count($ex_fe); $k++) { ?> <span class="label-ac label label-<?php echo $ex_fe[$k]; ?>"><?php echo $ex_fe[$k]; ?></span> <?php } ?> </h5> </li> <?php } } ?> </ul> </div> <div class="modal-body"> <input type="hidden" name="hid" value="<?php echo $data[0]['rid']; ?>"> <?php $exp_af = ''; for ($i=0; $i < count($access_folder); $i++) { $af = $access_folder[$i]['folder']; $access_folder[$i]['ato']; $exp_af .= $af."|"; } $exp_af = rtrim($exp_af, "|"); $exp_af = explode('|', $exp_af); ?> <div class="form-group"> <label class="radio-inline"> <input onclick="showv();" class="v_wise" type="radio" name="wise" id="inlineRadio1" value="voucher" checked=""> Voucher wise </label> <label class="radio-inline"> <input onclick="showm();" class="m_wise" type="radio" name="wise" id="inlineRadio2" value="month"> Month wise </label> <label class="radio-inline"> <input onclick="showall();" class="a_wise" type="radio" name="wise" id="inlineRadio2" value="all"> All </label> </div> <input class="showall" type="hidden" name="folder[]" value="all"> <div class="form-group showv"> <label>Select Folder</label> <select class="text-capitalize form-control multiselect sv" name="folder[]" multiple required=""> <?php //$entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited']; $entries = json_decode($current_ser['stage']); foreach($entries as $k => $v){ ?> <option value="<?php echo $v; ?>"><?php echo str_replace('_',' ',$v); ?></option> <?php } ?> </select> </div> <div class="form-group showm"> <label>Select Folder</label> <select class="form-control multiselect sm" name="folder[]" multiple required=""> <?php $month = ['a_april', 'b_may', 'c_june', 'd_july', 'e_august', 'f_september', 'g_october', 'h_november', 'i_december', 'j_january', 'k_february', 'l_march']; foreach ($month as $value) { ?> <option value="<?php echo $value; ?>"><?php echo substr($value, strpos($value, "_") + 1); ?></option> <?php } ?> </select> </div> <div class="form-group"> <label>Give Access To</label> <select class="form-control multiselect" name="to[]" multiple required=""> <?php foreach($office_user as $ou){ ?> <option value="<?php echo $ou['rid']; ?>"><?php echo $ou['name']; ?></option> <?php } ?> </select> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Save changes</button> </div> <?php echo form_close(); ?> </div> </div> </div> </div> </section><!-- /.content --> </div><!-- /.content-wrapper --> <?php require_once(APPPATH.'views/webapp/footer.php');?> <!-- Modal --> <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <!-- <form class="form-horizontal contactForm_"> --> <input type="hidden" name="dash_url" value="dash_url"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">x</span></button> <h4 class="modal-title" id="myModalLabel">Select Month</h4> </div> <div class="modal-body"> <form method="POST" class="modal-month" action="<?php echo base_url().'webapp/office/listView'; ?>"> <input type="hidden" name="code" value="<?php echo $code; ?>"> <input type="hidden" name="year" class="year" value=""> <?php $month = ['april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'january', 'february', 'march']; $z=0; foreach($month as $k=>$m){ $z++; ?> <input type="submit" name="month" value="<?php echo $m; ?>" style="color:#fff; width:98%; margin:2px;" class="month<?php echo $z; ?> btn text-capitalize btn-flat"> <?php } ?> </a> </form> </div> </div> <!--</form>--> </div> </div> <script type="text/javascript"> function getMonth(obj){ var year = obj.attr('data-year'); $('.year').val(year); $('#modal').modal('show'); } $(".contactForm_").submit(function (event) { event.preventDefault(); var form_data = $(".contactForm").serialize(); $.ajax({ url: 'http://localhost/paper/webapp/users/upload', type: 'POST', data: form_data, success: function (data) { $('.contactForm')[0].reset(); $('.successLabel').show(); }, error: function () { alert("Something went wrong!"); $('.errorLabel').show(); } }); }); $(document).ready(function(){ $('.hide_ser').hide(); $('.showm').hide(); $('.sm').attr('required', false); $('.showall').hide(); $(".showall").val(""); }); function showv(){ $('.showm').hide(); $('.showv').show(); $('.showall').hide(); $('.sm').val(null).trigger('change'); $('.sm').attr('required', false); $('.sv').attr('required', true); $(".showall").val(""); } function showm(){ $('.showm').show(); $('.showv').hide(); $('.showall').hide(); $('.sv').val(null).trigger('change'); $('.sv').attr('required', false); $('.sm').attr('required', true); $(".showall").val(""); } function showall(){ $('.showm').hide(); $('.showv').hide(); $('.sv').attr('required', false); $('.sm').attr('required', false); $('.sv').val(null).trigger('change'); $('.sm').val(null).trigger('change'); $('.showall').show(); $(".showall").val("all"); } $(".serForm").submit(function (event) { event.preventDefault(); alert("This may take a few minutes, Please wait and don't do anything"); $('#loadingDiv').show(); var form_data = $(".serForm").serialize(); var base_url = '<?php echo site_url(); ?>'; $.ajax({ 'url' : base_url + 'webapp/people/makeStructure_ser', type: 'POST', data: form_data, dataType: 'json', success: function (result) { $('#loadingDiv').hide(); if(result.status == 'error'){ toastr.error(result.msg, "Error"); }else{ $('#add_ser').modal('hide'); toastr.success('New service have been inserted', "Success"); location.reload(); } }, error: function () { //alert("Something went wrong!"); //$('.errorLabel').show(); $('#loadingDiv').hide(); toastr.success('New service has have inserted', "Success"); location.reload(); } }); }); $(".remSerForm").submit(function (event) { event.preventDefault(); alert("This may take a few minutes, Please wait and don't do anything"); $('#loadingDiv').show(); var form_data = $(".remSerForm").serialize(); var base_url = '<?php echo site_url(); ?>'; $.ajax({ 'url' : base_url + 'webapp/people/remService', type: 'POST', data: form_data, dataType: 'json', success: function (result) { $('#loadingDiv').hide(); if(result.status == 'error'){ toastr.error(result.msg, "Error"); }else{ $('#remove_ser').modal('hide'); toastr.success('Selected service have been removed from selected year', "Success"); location.reload(); } }, error: function () { return false; //alert("Something went wrong!"); //$('.errorLabel').show(); $('#remove_ser').modal('hide'); $('#loadingDiv').hide(); toastr.success('Selected service have been removed from selected year', "Success"); location.reload(); } }); }); $(".dirForm").submit(function (event) { event.preventDefault(); alert("This may take a few minutes, Please wait and don't do anything"); $('#loadingDiv').show(); var form_data = $(".dirForm").serialize(); var base_url = '<?php echo site_url(); ?>'; $.ajax({ 'url' : base_url + 'webapp/people/makeStructure_pastDir', type: 'POST', data: form_data, dataType: 'json', success: function (result) { $('#loadingDiv').hide(); if(result.status == 'error'){ toastr.error(result.msg, "Error"); }else{ $('#past_dir').modal('hide'); toastr.success('Past year directories has been made', "Success"); location.reload(); } }, error: function () { //alert("Something went wrong!"); //$('.errorLabel').show(); $('#loadingDiv').hide(); toastr.success('Past year directories has been made', "Success"); location.reload(); } }); }); $('.rem_ser_year').on('change', function(){ var year = $('.rem_ser_year').val(); $('.hide_ser').hide(); $('.hide_ser select').prop('required', false); $('.hide_ser select').prop('disabled', true); $('.year_'+year).show(); $('.year_'+year+' select').prop('required', true); $('.year_'+year+' select').prop('disabled', false); }); /* Script written by Adam Khoury @ DevelopPHP.com */ /* Video Tutorial: http://www.youtube.com/watch?v=EraNFJiY0Eg */ function _(el){ return document.getElementById(el); } function uploadFile(){ // alert(file.name+" | "+file.size+" | "+file.type); alert("Please don't close OR change this tab to see progress bar"); $('.up-btn').hide(); $('.save-btn').hide(); $('#up_temp').modal('hide'); var formdata = new FormData(); $.each($("#doc")[0].files, function(i, file) { formdata.append('doc[]', file); }); var other_data = $('.browseForm').serializeArray(); $.each(other_data,function(key,input){ formdata.append(input.name,input.value); }); var ajax = new XMLHttpRequest(); // ajax.upload.addEventListener("progress", progressHandler, false); ajax.upload.addEventListener("progress", function(event){ //console.log(event); console.log("test");console.log(cnt); $('#progressBar').show(); _("loaded_n_total").innerHTML = "(Uploaded "+event.loaded+" bytes of "+event.total+")"; var percent = (event.loaded / event.total) * 100; _("progressBar").value = Math.round(percent); _("status").innerHTML = "<span class='text-danger'>"+Math.round(percent)+"%... wait</span>"; _("status2").innerHTML = "<span class='text-danger'>"+Math.round(percent)+"%... wait</span>"; }, false); ajax.addEventListener("load", function(event){ _("status").innerHTML = '<span class="text-success">Completed</span>'; _("status2").innerHTML = '<span class="text-success">Completed</span>'; //_("status").innerHTML = event.target.responseText; _("progressBar").value = 0; $('.up-btn').show(); $('.save-btn').show(); $('.mydoc').val(''); $('#progressBar').hide(); }, false); ajax.addEventListener("error", errorHandler, false); ajax.addEventListener("abort", abortHandler, false); ajax.open("POST", "<?php echo base_url(); ?>webapp/people/upload_temp"); ajax.send(formdata); } /*function progressHandlerOld(event){ console.log(event); $('#progressBar').show(); _("loaded_n_total").innerHTML = "(Uploaded "+event.loaded+" bytes of "+event.total+")"; var percent = (event.loaded / event.total) * 100; _("progressBar").value = Math.round(percent); _("status").innerHTML = Math.round(percent)+"% uploaded... wait"; _("status2").innerHTML = Math.round(percent)+"% uploaded... wait"; }*/ function completeHandlerOld(event){ _("status").innerHTML = 'Completed'; _("status2").innerHTML = 'Completed'; //_("status").innerHTML = event.target.responseText; _("progressBar").value = 0; $('.up-btn').show(); $('.save-btn').show(); $('.mydoc').val(''); $('#progressBar').hide(); } function errorHandler(event){ _("status").innerHTML = "Upload Failed"; } function abortHandler(event){ _("status").innerHTML = "Upload Aborted"; } $('.view_temp_modal').on('click', function(){ $('#view_temp').modal('show'); var code = '<?php echo $code; ?>'; $.ajax({ url: '<?php echo base_url(); ?>webapp/people/view_temp', type: 'POST', dataType: 'json', data: { code:code, }, success: function (status) { $('.view_temp').html(status.html); }, error: function () { } }); }); function remUsr(aid){ if (confirm("Are you sure?")) { $.ajax({ url: '<?php echo base_url(); ?>webapp/people/remUsr', type: 'POST', dataType: 'json', data: { aid:aid, }, success: function (status) { $('.remUsr'+aid).hide(); toastr.success('Access Removed', "Success"); }, error: function () { } }); } } </script>
Copyright ©2021 || Defacer Indonesia