Updated initial ledger details and added proper field names in the frontend

This commit is contained in:
Annmol 2022-03-07 01:07:38 -06:00
parent 324e03b56a
commit a58bb6897d
2 changed files with 33 additions and 33 deletions

View file

@ -14,46 +14,46 @@ export class AssetTransferContract extends Contract {
public async InitLedger(ctx: Context): Promise<void> { public async InitLedger(ctx: Context): Promise<void> {
const assets: Asset[] = [ const assets: Asset[] = [
{ {
ID: 'asset1', ID: '1',
Color: 'blue', Color: 'Cotton',
Size: 5, Size: 5,
Owner: 'Tomoko', Owner: 'ABC Ltd',
AppraisedValue: 300, AppraisedValue: 200,
}, },
{ {
ID: 'asset2', ID: '2',
Color: 'red', Color: 'Wool',
Size: 5, Size: 2,
Owner: 'Brad', Owner: 'ABC Ltd',
AppraisedValue: 400, AppraisedValue: 400,
}, },
{ {
ID: 'asset3', ID: '3',
Color: 'green', Color: 'Silk',
Size: 10, Size: 10,
Owner: 'Jin Soo', Owner: 'ABC Ltd',
AppraisedValue: 500, AppraisedValue: 500,
}, },
{ {
ID: 'asset4', ID: '4',
Color: 'yellow', Color: 'Linen',
Size: 10, Size: 10,
Owner: 'Max', Owner: 'ABC Ltd',
AppraisedValue: 600, AppraisedValue: 600,
}, },
{ {
ID: 'asset5', ID: '5',
Color: 'black', Color: 'Flannel',
Size: 15, Size: 15,
Owner: 'Adriana', Owner: 'ABC Ltd',
AppraisedValue: 700, AppraisedValue: 300,
}, },
{ {
ID: 'asset6', ID: '6',
Color: 'white', Color: 'Cotton Blend',
Size: 15, Size: 15,
Owner: 'Michel', Owner: 'ABC Ltd',
AppraisedValue: 800, AppraisedValue: 150,
}, },
]; ];

View file

@ -71,15 +71,15 @@
<a href="transaction_flow.PNG" target="_blank"> <a href="transaction_flow.PNG" target="_blank">
<img src="transaction_flow.PNG" style="width:100%"> <img src="transaction_flow.PNG" style="width:100%">
</a> </a>
<label>List All Fabric items in the Ledger</label> <label>List all Fabric items in the Ledger</label>
<p><input id="queryAllProduce" type="submit" value="Query" class="btn btn-primary" ng-click="queryAllProduce()"></p> <p><input id="queryAllProduce" type="submit" value="Query" class="btn btn-primary" ng-click="queryAllProduce()"></p>
</div> </div>
<table id="all_produce" class="table" align="center"> <table id="all_produce" class="table" align="center">
<tr> <tr>
<th>ID</th> <th>ProductID</th>
<th>Color</th> <th>Type</th>
<th>Size</th> <th>Size</th>
<th>Price</th> <th>Price</th>
<th>Owner</th> <th>Owner</th>
@ -98,15 +98,15 @@
<label>Query a Specific Fabric by ID</label><br> <label>Query a Specific Fabric by ID</label><br>
<h5 style="color:red;margin-bottom:2%" id="error_query">Error: Please enter a valid Id</h5> <h5 style="color:red;margin-bottom:2%" id="error_query">Error: Please enter a valid Id</h5>
Enter a ID number: <input id="createName" class="form-control" type="text" placeholder="Ex: 3" ng-model="produce_id"> Enter an ID number: <input id="createName" class="form-control" type="text" placeholder="Ex: 3" ng-model="produce_id">
<input id="querySubmit" type="submit" value="Query" class="btn btn-primary" ng-click="queryProduce()"> <input id="querySubmit" type="submit" value="Query" class="btn btn-primary" ng-click="queryProduce()">
</div> </div>
<table id="query_produce" class="table" align="center"> <table id="query_produce" class="table" align="center">
<tr> <tr>
<th>ID</th> <th>ProductID</th>
<th>Color</th> <th>Type</th>
<th>Size</th> <th>Size</th>
<th>Price</th> <th>Price</th>
<th>Owner</th> <th>Owner</th>
@ -126,19 +126,19 @@
<h5 style="color:green;margin-bottom:2%" id="success_create">Successfully added to Ledger!</h5> <h5 style="color:green;margin-bottom:2%" id="success_create">Successfully added to Ledger!</h5>
<br> <br>
Fabric id: <input class="form-control" type="text" placeholder="Ex: 6" ng-model="produce.assetID"> Fabric id: <input class="form-control" type="text" placeholder="Ex: 6" ng-model="produce.assetID">
Color: <input class="form-control" type=text placeholder="Ex: blue" ng-model="produce.color"> Type: <input class="form-control" type=text placeholder="Ex: Cotton" ng-model="produce.color">
Size: <input class="form-control" type=number step=1 ng-model="produce.size"> Size: <input class="form-control" type=number step=1 ng-model="produce.size">
Price: <input class="form-control" type=number step=1 ng-model="produce.appraisedValue"> Price: <input class="form-control" type=number step=1 ng-model="produce.appraisedValue">
Owner name: <input class="form-control" type="text" placeholder="Ex: Sakya" ng-model="produce.owner"> Owner name: <input class="form-control" type="text" placeholder="Ex: Alice" ng-model="produce.owner">
<input id="createSubmit" type="submit" value="Create" class="btn btn-primary" ng-click="recordProduce()"> <input id="createSubmit" type="submit" value="Create" class="btn btn-primary" ng-click="recordProduce()">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Change Product Owner</label><br> <label>Change Product Owner</label><br>
<h5 style="color:green;margin-bottom:2%" id="success_holder">Successfully updated Ledger! Tx ID: {{change_holder}}</h5> <h5 style="color:green;margin-bottom:2%" id="success_holder">Successfully updated Ledger!</h5>
<h5 style="color:red;margin-bottom:2%" id="error_holder">Error: Please enter a valid Product Id</h5> <h5 style="color:red;margin-bottom:2%" id="error_holder">Error: Please enter a valid Product Id</h5>
Enter a ID of the product to transfer ownership: <input class="form-control" name="assetSelect" placeholder="Ex: 1" ng-model="holder.assetID"> Enter the product ID to transfer ownership: <input class="form-control" name="assetSelect" placeholder="Ex: 1" ng-model="holder.assetID">
Enter name of new owner: <input class="form-control" name="assetSelect" placeholder="Ex: Dalio" ng-model="holder.name"> Enter the name of new owner: <input class="form-control" name="assetSelect" placeholder="Ex: Dalio" ng-model="holder.name">
<input id="transferSubmit" type="submit" value="Change" class="btn btn-primary" ng-click="changeHolder()"> <input id="transferSubmit" type="submit" value="Change" class="btn btn-primary" ng-click="changeHolder()">
</div> </div>