Perkongsian ini saya menggunakan blockchain hyperledger 1.4 & deploy atas VPS google cloud platform (gcp).Backend nodejs & anggular dan untuk ui client menggunakan PHP.
composer archive create -t dir -n .
Copy the file startFabric.sh, stopFabric.sh, _loader.sh, creatPeerAdminCard.sh, fabric-scripts folder from fabric-dev-servers folder to xxx folder
composer network start –networkName helloworldui –networkVersion 0.0.1 –networkAdmin admin –networkAdminEnrollSecret adminpw –card PeerAdmin@hlfv1 –file networkadmin.card
<?php
include(‘./includes/config.php’);
?>
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”utf-8″ />
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js “></script>
<script>
$(document).ready(function(){
$(‘#userForm’).submit(function(){
/** */
$(‘#response’).html(“<b>Loading response…</b>”);
$.ajax({
type: ‘POST’,
url: ‘http://xxx:3000/api/InitialApplication’,
data: $(this).serialize()
})
.done(function(data){
$(‘#response’).html(data);
swal(“Success!”, “Record has been submitted!”, “success”)
})
.fail(function() {
swal(“Error!”, “Posting failed!”, “error”)
});
returnfalse;
});
});
</script>
</head>
<body>
<?php
$get_data = callAPI(‘GET’, RESTAPI.’/api/queries/selectRawUsers’, false);
$response = json_decode($get_data, true);
?>
<div class=”main-panel”>
<!– End Navbar –>
<div class=”content”>
<div class=”container-fluid”>
<div class=”row”>
<div class=”col-md-12″>
<div class=”card data-tables”>
<div class=”card-header “>
<h4 class=”card-title”>List Raw Material Personel</h4>
</div>
<div class=”card-body”>
<a href=”halal.php?action=createRawPersonel”>
<button class=”btn btn-success btn-wd”><i class=”nc-icon nc-simple-add”></i> New Personel</button>
</a>
</div>
<div class=”card-body table-striped table-no-bordered table-hover dataTable dtr-inline table-full-width”>
<div class=”toolbar”>
<!– Here you can write extra buttons/actions for the toolbar –>
</div>
<div class=”fresh-datatables”>
<table id=”datatables” class=”table table-striped table-no-bordered table-hover” cellspacing=”0″ width=”100%” style=”width:100%”>
<thead>
<tr>
<th>Email</th>
<th>Name</th>
<th>Address</th>
<th>Contact No</th>
<th>Password</th>
<th class=”disabled-sorting text-right”>Actions</th>
</tr>
</thead>
<tbody>
<?php
foreach ($response as $d) { ?>
<tr>
<td><?php echo $d[’email’]; ?></td>
<td><?php echo $d[‘name’]; ?></td>
<td><?php echo $d[‘address’]; ?></td>
<td><?php echo $d[‘contactno’]; ?></td>
<td><?php echo $d[‘password’]; ?></td>
<td class=”text-right”>
<a href=”#” class=”btn btn-link btn-info like”><i class=”fa fa-heart”></i></a>
<a href=”#” class=”btn btn-link btn-warning edit”><i class=”fa fa-edit”></i></a>
<a href=”#” class=”btn btn-link btn-danger remove”><i class=”fa fa-times”></i></a>
</td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type=”text/javascript”>
$(document).ready(function() {
$(‘#datatables’).DataTable({
“pagingType”:”full_numbers”,
“lengthMenu”: [
[10, 25, 50, -1],
[10, 25, 50, “All”]
],
responsive: true,
language: {
search: “_INPUT_”,
searchPlaceholder: “Search records”,
}
});
var table =$(‘#datatables’).DataTable();
// Edit record
table.on(‘click’, ‘.edit’, function() {
$tr = $(this).closest(‘tr’);
if ($tr.hasClass(‘child’)) {
$tr = $tr.prev(‘.parent’);
}
var data = table.row($tr).data();
alert(‘You press on Row: ‘+ data[0] +”+ data[1] +”+ data[2] +’\’s row.’);
});
// Delete a record
table.on(‘click’, ‘.remove’, function(e) {
$tr = $(this).closest(‘tr’);
table.row($tr).remove().draw();
e.preventDefault();
});
//Like record
table.on(‘click’, ‘.like’, function() {
alert(‘You clicked on Like button’);
});
});
</script>
</body>
</html>
Recent Comments