Skip to content

Commit

Permalink
Addition of withdrawal feature to the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomes123 committed Mar 12, 2018
1 parent 361c752 commit 789f21c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Frontend/client/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ <h4>Dogtag</h4>
Sending a transaction with a verification from this address will have no result.
</div>
</template>

<template name="confirmDogtagPopup">
<div class="popup" id="confirmDogtagPopup">
<div class="popupContent">
Expand All @@ -169,4 +170,11 @@ <h4>Dogtag</h4>
<button class="previewbut" id="confirm">Confirm</button><button class="previewbut" id="cancel">Cancel</button>
</div>
</div>
</template>

<template name="withdraw">
<h2>Withdraw</h2>
<p>This page is ment only for the owner of this contract in order to simplify withdrawls. Do not invoke a withdrawl unless you are the owner, the transaction will have no effect otherwise.</p>
<p style="display: flex; justify-content: space-around; align-items: center;">How much do you wish to withdraw (less than 90% of total contract balance)? <input type="number" step="0.0001" placeholder="0.5 ETH" id="ethWithdrawAmount"></p>
<button class="previewbut">Withdraw</button>
</template>
22 changes: 22 additions & 0 deletions Frontend/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,28 @@ Template.confirmDogtagPopup.events({
}
});
//--------------------------------------------------------
//Withdraw
//--------------------------------------------------------
Template.withdraw.onCreated(function mainOnCreated() {
//Check if web3 is installed
if(typeof web3 === 'undefined')
BlazeLayout.render('App_Body', {main: 'eth_miss'});

var Dogtags = getContract();
console.log(Dogtags);
this.dogtags = Dogtags;
});
Template.withdraw.events({
'click .previewbut'(event, instance) {
instance.dogtags.Withdraw(1000000000000000000 * $("#ethWithdrawAmount").get(0).value ,function (error, result){
if(!error)
console.log(result)
else
console.error(error);
});
},
});
//--------------------------------------------------------
//Verification
//--------------------------------------------------------
Template.verification.events({
Expand Down
6 changes: 6 additions & 0 deletions Frontend/client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ FlowRouter.route('/iframe/:_id', {
action() {
BlazeLayout.render('App_Body', {main: 'verificationConfirm', id: FlowRouter.getParam("_id")});
}
});
FlowRouter.route('/withdraw', {
name: 'withdraw',
action() {
BlazeLayout.render('App_Body', {main: 'withdraw'});
}
});

0 comments on commit 789f21c

Please sign in to comment.