qrcode : suseendhiran
This commit is contained in:
parent
cd3434be47
commit
458a1a0d9b
@ -72,15 +72,6 @@ public function assetList()
|
||||
$this->layout->buffer('main_content', 'Asset/asset_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
}
|
||||
|
||||
public function view_qrcode($id)
|
||||
{
|
||||
$assetData = $this->Asset_model->get_asset_id($id, 'asset' , user()->business_id);
|
||||
$this->layout->set('img', $assetData->qrcode_img);
|
||||
$this->layout->buffer('main_content', 'Asset/view_qr');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
}
|
||||
|
||||
public function createAssets()
|
||||
@ -211,6 +202,33 @@ public function deleteAsset($id)
|
||||
$Data = $this->Asset_model->delete_by_md5_id($id,user()->business_id,'asset');
|
||||
redirect('asset/assetList');
|
||||
}
|
||||
|
||||
|
||||
public function deleteMultipleAsset()
|
||||
{
|
||||
$delete_data_id = $this->input->post('data');
|
||||
foreach ($delete_data_id as $id) {
|
||||
$this->Asset_model->delete_by_md5_id(md5($id),user()->business_id,'asset');
|
||||
}
|
||||
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
public function view_qrcode()
|
||||
{
|
||||
$view_qr_data_id = $this->input->post('data');
|
||||
$output = array();
|
||||
foreach ($view_qr_data_id as $id) {
|
||||
$qr = $this->Asset_model->get_asset_id(md5($id), 'asset' , user()->business_id);
|
||||
array_push($output , $qr);
|
||||
}
|
||||
$data['data'] = $output;
|
||||
$data['htmlPage'] = $this->load->view('view_qr.php',$data,true);
|
||||
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
||||
echo json_encode($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="card-box table-responsive">
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
|
||||
<thead>
|
||||
<thead style="white-space: nowrap;">
|
||||
<tr class="headings">
|
||||
|
||||
<th class="column-title">Category </th>
|
||||
@ -32,7 +32,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tbody style="white-space: nowrap;">
|
||||
|
||||
<?php foreach ($tableData as $key => $value) { ?>
|
||||
<tr class="even pointer">
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
|
||||
<form id="otp-form">
|
||||
<input type="hidden" id="csrf" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
</form>
|
||||
<div class="col-md-12 col-sm-12 ">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Assets Details </h2>
|
||||
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
<a href="<?php echo base_url();?>asset/addAsset" class="btn btn-sm btn-primary">Add Asset</a>
|
||||
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
||||
</li>
|
||||
<a href="<?php echo base_url();?>asset/addAsset" class="btn btn-sm btn-primary">Add Asset</a>
|
||||
<button class="btn btn-sm btn-secondary" onclick="deleteRow();">Remove</button>
|
||||
<button class="btn btn-sm btn-info" onclick="viewQr();">View QR</button>
|
||||
<!-- <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
||||
</li> -->
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
@ -16,69 +21,63 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="card-box table-responsive">
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
|
||||
<thead>
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered bulk_action" width="100%">
|
||||
<thead style="white-space: nowrap;">
|
||||
<tr class="headings">
|
||||
|
||||
|
||||
<th class="column-title">Asset Name </th>
|
||||
<th><input type="checkbox" id="check_all" ></th>
|
||||
<th class="column-title">Asset Name </th>
|
||||
<th class="column-title">Manufacturer </th>
|
||||
<th class="column-title">Tag </th>
|
||||
<th class="column-title">Tag </th>
|
||||
<th class="column-title">Serial </th>
|
||||
<th class="column-title">Model </th>
|
||||
<th class="column-title">Category </th>
|
||||
<th class="column-title">Category </th>
|
||||
<th class="column-title">Status </th>
|
||||
<!-- <th class="column-title">Notes </th>
|
||||
<!-- <th class="column-title">Notes </th>
|
||||
<th class="column-title">Warranty </th>
|
||||
<th class="column-title">Order No </th>
|
||||
<th class="column-title">Purchase Date </th>
|
||||
<th class="column-title">Supplier </th>
|
||||
<th class="column-title">Cost </th>
|
||||
<th class="column-title">Location </th> -->
|
||||
<th class="column-title" >Action </th>
|
||||
|
||||
<th class="column-title">Cost </th>
|
||||
<th class="column-title">Location </th> -->
|
||||
<th class="column-title" style="min-width:120px;">Action </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($tableData as $key => $value) { ?>
|
||||
<tr class="even pointer">
|
||||
|
||||
|
||||
<td class=" "> <?php echo $value->name; ?> </td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($tableData as $key => $value) { ?>
|
||||
<tr class="even pointer">
|
||||
<td><input type="checkbox" id="check-all" value="<?php echo $value->id; ?>" ></td>
|
||||
<td class=" "> <?php echo $value->name; ?> </td>
|
||||
<td class=" "><?php echo $value->manufacturer_name; ?> </td>
|
||||
<td class=" "><?php echo $value->tag; ?></td>
|
||||
<td class=" "><?php echo $value->tag; ?></td>
|
||||
<td class=" "><?php echo $value->serial; ?></td>
|
||||
<td class=" "><?php echo $value->model; ?></td>
|
||||
<td class=" "><?php echo $value->category_name; ?></td>
|
||||
<td class=" "><?php echo $value->status_display_name; ?></td>
|
||||
<!--<td class=" "><?php echo $value->notes; ?> </td>
|
||||
<td class=" "><?php echo $value->category_name; ?></td>
|
||||
<td class=" "><?php echo $value->status_display_name; ?></td>
|
||||
<!--<td class=" "><?php echo $value->notes; ?> </td>
|
||||
<td class=" "><?php echo $value->warranty; ?> </td>
|
||||
<td class=" "><?php echo $value->order_no; ?></td>
|
||||
<td class=" "><?php echo $value->purchase_date; ?></td>
|
||||
<td class=" "><?php echo $value->supplier_name; ?></td>
|
||||
<td class=" "><?php echo $value->cost; ?></td>
|
||||
<td class=" "><?php echo $value->location_name; ?></td> -->
|
||||
<td style=" text-align: center; font-size: 16px;">
|
||||
<a href="<?php echo base_url()?>Asset/editAsset/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/addAsset/<?php echo md5($value->id);?>" ><i class="fa fa-copy"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/deleteAsset/<?php echo md5($value->id);?>" ><i class="fa fa-trash"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/view_asset_details/<?php echo md5($value->id);?>" > <i class="fa fa-eye"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/view_qrcode/<?php echo md5($value->id);?>" > <i class="fa fa-qrcode"></i></a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<td class=" "><?php echo $value->cost; ?></td>
|
||||
<td class=" "><?php echo $value->location_name; ?></td> -->
|
||||
<td style=" text-align: center; font-size: 16px;">
|
||||
<a href="<?php echo base_url()?>Asset/editAsset/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/addAsset/<?php echo md5($value->id);?>" ><i class="fa fa-copy"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/deleteAsset/<?php echo md5($value->id);?>" ><i class="fa fa-trash"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/view_asset_details/<?php echo md5($value->id);?>" > <i class="fa fa-eye"></i></a>
|
||||
|
||||
<!-- <a href="<?php echo base_url()?>Asset/view_qr_code/<?php echo md5($value->id);?>" > <i class="fa fa-qrcode"></i></a> -->
|
||||
<a href="#" class="qr_view" id="<?php echo $value->id; ?>"> <i class="fa fa-qrcode"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -87,7 +86,87 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
|
||||
|
||||
<div style="display:none" id="sub-value">
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function deleteRow() {
|
||||
var csrf_data = $("#otp-form").serialize();
|
||||
delete_id = [];
|
||||
document.querySelectorAll('#datatable-buttons #check-all:checked').forEach(e => {
|
||||
delete_id.push(e.value)
|
||||
e.parentNode.parentNode.remove();
|
||||
});
|
||||
console.log(delete_id);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>asset/deleteMultipleAsset",
|
||||
data: {data:delete_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function viewQr() {
|
||||
var csrf_data = $("#otp-form").serialize();
|
||||
view_qr_id = [];
|
||||
document.querySelectorAll('#datatable-buttons #check-all:checked').forEach(e => {
|
||||
view_qr_id.push(e.value)
|
||||
});
|
||||
console.log(view_qr_id);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>asset/view_qrcode",
|
||||
data: {data:view_qr_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
$('.bs-example-modal-lg').html(response.htmlPage);
|
||||
$('.bs-example-modal-lg').modal("show");
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(document).on('click','.qr_view',function(){
|
||||
var csrf_data = $("#otp-form").serialize();
|
||||
view_qr_id = [];
|
||||
var id = $(this).attr("id");
|
||||
view_qr_id.push(id)
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>asset/view_qrcode",
|
||||
data: {data:view_qr_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
$('.bs-example-modal-lg').html(response.htmlPage);
|
||||
$('.bs-example-modal-lg').modal("show");
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#check_all").click(function(){
|
||||
$('input:checkbox').not(this).prop('checked', this.checked);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="card-box table-responsive">
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
|
||||
<thead>
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered bulk_action" width="100%">
|
||||
<thead style="white-space: nowrap;">
|
||||
<tr class="headings">
|
||||
|
||||
<th class="column-title" width="20%">Category </th>
|
||||
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tbody style="white-space: nowrap;">
|
||||
|
||||
<?php foreach ($tableData as $key => $value) { ?>
|
||||
<tr class="even pointer">
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="card-box table-responsive">
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
|
||||
<thead>
|
||||
<thead style="white-space: nowrap;">
|
||||
<tr class="headings">
|
||||
|
||||
<th class="column-title">Category </th>
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tbody style="white-space: nowrap;">
|
||||
|
||||
<?php foreach ($tableData as $key => $value) { ?>
|
||||
<tr class="even pointer">
|
||||
|
||||
@ -1,2 +1,56 @@
|
||||
<img style="
|
||||
margin-top:10%;margin-left:35%;width: 20%;padding: 10px;" src="<?php echo $img ?>" alt="QR Code" />
|
||||
|
||||
<!-- Large modal -->
|
||||
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
|
||||
<!-- <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> -->
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myModalLabel">QR Code</h4>
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="DivIdToPrint">
|
||||
<?php $my_key = 0 ?>
|
||||
<?php foreach ($data as $key => $value) { ?>
|
||||
<?php if (count($data) == 1 ) {
|
||||
?> <img style="margin-top:10px;margin-left:35%;width: 30%;" src="<?php echo $value->qrcode_img ?>" alt="QR Code" />
|
||||
<p style="text-align: center;color:black;"><?php echo $value->name ?>
|
||||
<?php
|
||||
break;
|
||||
} ?>
|
||||
|
||||
<?php if ($key % 4 == 0 ) {
|
||||
$my_key = $key + 3;
|
||||
?> <div class="row"> <?php
|
||||
} ?>
|
||||
|
||||
<div class="col">
|
||||
<img style="width:120px" src="<?php echo $value->qrcode_img ?>" alt="QR Code" />
|
||||
<p style="color:black;margin-left:10px;"><?php echo $value->name ?></p>
|
||||
</div>
|
||||
|
||||
<?php if ($key == $my_key || $key == count($data) - 1) {
|
||||
?> </div> <?php
|
||||
} ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" onclick="printDiv();" class="btn btn-primary">Print</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
<script>
|
||||
function printDiv()
|
||||
{
|
||||
var divToPrint=document.getElementById('DivIdToPrint');
|
||||
var newWin=window.open('','Print-Window');
|
||||
newWin.document.open();
|
||||
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
|
||||
newWin.document.close();
|
||||
setTimeout(function(){newWin.close();},10);
|
||||
}
|
||||
</script>
|
||||
@ -268,6 +268,9 @@ $("#file_profile").change(function(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user