1
0
Fork 0
forked from lthn/blockchain

Merge remote-tracking branch 'origin/frontend' into develop

This commit is contained in:
wildkif 2019-05-28 19:34:33 +03:00
commit f67688061f
10 changed files with 156 additions and 147 deletions

View file

@ -306,9 +306,9 @@
"POS_REWARD": "POS reward",
"CREATE_CONTRACT": "Contract proposal",
"PLEDGE_CONTRACT": "Contract deposit",
"NULLIFY_CONTRACT": "Nullify pledges for contract",
"NULLIFY_CONTRACT": "Burn deposits for contract",
"PROPOSAL_CANCEL_CONTRACT": "Cancellation request",
"CANCEL_CONTRACT": "Cancel contract, return pledges"
"CANCEL_CONTRACT": "Cancel contract and return deposits"
}
},
"CONTRACTS": {
@ -343,7 +343,7 @@
"WAITING_BUYER": "Waiting for delivery",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"NULLIFIED": "All deposits burned",
"PROPOSAL_CANCEL": "New proposal to cancel contract and return pledges",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
@ -352,14 +352,13 @@
},
"BUYER": {
"WAITING": "Waiting for response",
"PLEDGE_RESERVED": "Pledge amount reserved",
"IGNORED": "The seller ignored your contract proposal",
"ACCEPTED": "The seller accepted your contract proposal",
"WAIT": "Waiting for deposits confirmation",
"WAITING_SELLER": "Waiting for delivery",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"NULLIFIED": "All deposits burned",
"WAITING_CANCEL": "Waiting for contract cancellation",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
@ -398,32 +397,34 @@
"PROGRESS_COMPLETE": "Completed",
"FEE": "Fee",
"PAYMENT": "Payment ID",
"STATUS_MESSAGES": {
"NEW_PURCHASE": "New purchase",
"WAITING_SELLER": "Waiting for response",
"WAITING_BUYER": "Contract proposal received",
"WAITING_CONFIRMATION": "Waiting for deposits confirmation",
"WAITING_DELIVERY": "Waiting for delivery",
"COMPLETED": "Contract completed",
"IGNORED_BUYER": "Contract proposal ignored",
"IGNORED_SELLER": "The seller ignored your contract proposal",
"PROPOSAL_CANCEL_SELLER": "Cancellation request sent",
"PROPOSAL_CANCEL_BUYER": "Cancellation request received",
"BEING_CANCELLED": "Cancellation in progress",
"IGNORED_CANCEL_SELLER": "The seller ignored your proposal to cancel the contract",
"IGNORED_CANCEL_BUYER": "You ignored the proposal to cancel the contract",
"CANCELLED": "Contract canceled",
"EXPIRED": "The contract proposal has expired",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All deposits burned"
},
"ACCEPT_STATE_WAIT_BIG": "Contract started",
"IGNORED_ACCEPT": "Contract proposal ignored",
"BURN_PROPOSAL": "The deposits have been voided.",
"BURN_PROPOSAL": "The deposits have been voided",
"SUCCESS_FINISH_PROPOSAL": "Contract completed",
"SEND_CANCEL_PROPOSAL": "Cancellation request sent",
"IGNORED_CANCEL": "You have ignored the proposal to cancel the contract",
"DEALS_CANCELED_WAIT": "Cancellation in progress",
"WAITING_TIME": "Response time",
"NEED_MONEY": "There are insufficient funds in the wallet. Add funds to the wallet to continue",
"WAITING_SELLER": "Waiting for response",
"IGNORED_SELLER": "The seller ignored your contract proposal",
"WAITING_SHIP": "Waiting for delivery",
"IGNORED_CANCEL_SELLER": "The seller ignored your proposal to cancel the contract",
"EXPIRED": "The contract proposal has expired",
"WAIT": "Waiting for deposits confirmation",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"PROPOSAL_CANCEL_SELLER": "Cancellation request sent",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
"WAITING_BUYER": "Contract proposal received",
"IGNORED_BUYER": "Contract proposal ignored",
"IGNORED_CANCEL_BUYER": "You ignored the proposal to cancel the contract",
"BUYER_WAIT": "Waiting for delivery",
"PROPOSAL_CANCEL_BUYER": "Cancellation request received",
"BUTTON_MAKE_PLEDGE": "Accept and make deposit",
"BUTTON_IGNORE": "Ignore and hide offer",
"BUTTON_NULLIFY": "Terminate and burn deposits",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -214,8 +214,6 @@ export class Wallet {
const searchResult = viewedContracts.some(elem => elem.state === contract.state && elem.is_a === contract.is_a && elem.contract_id === contract.contract_id);
contract.is_new = !searchResult;
contract['private_detailes'].a_pledge = contract['private_detailes'].a_pledge.plus(contract['private_detailes'].to_pay);
wallet.contracts.push(contract);
}
this.recountNewContracts();

View file

@ -426,7 +426,7 @@ export class BackendService {
a_addr: a_addr,
b_addr: b_addr,
to_pay: this.moneyToIntPipe.transform(to_pay),
a_pledge: this.moneyToIntPipe.transform((new BigNumber(a_pledge)).minus(to_pay).toString()),
a_pledge: this.moneyToIntPipe.transform(a_pledge),
b_pledge: this.moneyToIntPipe.transform(b_pledge)
},
payment_id: payment_id,

View file

@ -317,8 +317,6 @@ export class AppComponent implements OnInit, OnDestroy {
const searchResult = this.variablesService.settings.viewedContracts.some(elem => elem.state === contract.state && elem.is_a === contract.is_a && elem.contract_id === contract.contract_id);
contract.is_new = !searchResult;
contract['private_detailes'].a_pledge = contract['private_detailes'].a_pledge.plus(contract['private_detailes'].to_pay);
let findContract = false;
for (let i = 0; i < wallet.contracts.length; i++) {
if (wallet.contracts[i].contract_id === contract.contract_id && wallet.contracts[i].is_a === contract.is_a) {

View file

@ -133,73 +133,9 @@
<button type="button" class="blue-button send-button" *ngIf="newPurchase" [disabled]="!purchaseForm.valid" (click)="createPurchase()">{{ 'PURCHASE.SEND_BUTTON' | translate }}</button>
<div class="purchase-states" *ngIf="!newPurchase">
<ng-container *ngIf="currentContract.state == 1 && !currentContract.is_a && currentContract.private_detailes.b_pledge.plus(variablesService.default_fee_big).plus(variablesService.default_fee_big).isGreaterThan(variablesService.currentWallet.unlocked_balance)">
<span>{{ 'PURCHASE.NEED_MONEY' | translate }}</span>
</ng-container>
<ng-container *ngIf="currentContract.is_a">
<span *ngIf="currentContract.state == 1">{{ 'PURCHASE.WAITING_SELLER' | translate }}</span>
<!--<span *ngIf="currentContract.state == 1" ng-bind="'(' + (currentContract.expiration_time | buyingTime : 0) + ')'"></span>-->
<span *ngIf="currentContract.state == 110">{{ 'PURCHASE.IGNORED_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 120">{{ 'PURCHASE.WAITING_SHIP' | translate }}</span>
<span *ngIf="currentContract.state == 130">{{ 'PURCHASE.IGNORED_CANCEL_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 140">{{ 'PURCHASE.EXPIRED' | translate }}</span>
<span *ngIf="currentContract.state == 201">{{ 'PURCHASE.WAIT' | translate }}</span>
<span *ngIf="currentContract.state == 2">{{ 'PURCHASE.WAITING_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 3">{{ 'PURCHASE.COMPLETED' | translate }}</span>
<span *ngIf="currentContract.state == 4">{{ 'PURCHASE.NOT_RECEIVED' | translate }}</span>
<span *ngIf="currentContract.state == 4" class="error-text">{{ 'PURCHASE.NULLIFIED' | translate }}</span>
<span *ngIf="currentContract.state == 5">{{ 'PURCHASE.PROPOSAL_CANCEL_SELLER' | translate }}</span>
<!--<span *ngIf="currentContract.state == 5" ng-bind="'(' + (contract.cancel_expiration_time | buyingTime : 2) + ')'"></span>-->
<span *ngIf="currentContract.state == 601">{{ 'PURCHASE.BEING_CANCELLED' | translate }}</span>
<span *ngIf="currentContract.state == 6">{{ 'PURCHASE.CANCELLED' | translate }}</span>
</ng-container>
<ng-container *ngIf="!currentContract.is_a">
<span *ngIf="currentContract.state == 1">{{ 'PURCHASE.WAITING_BUYER' | translate }}</span>
<!--<span *ngIf="currentContract.state == 1" ng-bind="'(' + (contract.expiration_time | buyingTime : 1) + ')'"></span>-->
<span *ngIf="currentContract.state == 110">{{ 'PURCHASE.IGNORED_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 130">{{ 'PURCHASE.IGNORED_CANCEL_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 140">{{ 'PURCHASE.EXPIRED' | translate }}</span>
<span *ngIf="currentContract.state == 201">{{ 'PURCHASE.WAIT' | translate }}</span>
<span *ngIf="currentContract.state == 2">{{ 'PURCHASE.BUYER_WAIT' | translate }}</span>
<span *ngIf="currentContract.state == 3">{{ 'PURCHASE.COMPLETED' | translate }}</span>
<span *ngIf="currentContract.state == 4">{{ 'PURCHASE.NOT_RECEIVED' | translate }}</span>
<span *ngIf="currentContract.state == 4" class="error-text">{{ 'PURCHASE.NULLIFIED' | translate }}</span>
<span *ngIf="currentContract.state == 5">{{ 'PURCHASE.PROPOSAL_CANCEL_BUYER' | translate }}</span>
<!--<span *ngIf="currentContract.state == 5" ng-bind="'(' + (contract.cancel_expiration_time | buyingTime : 1) + ')'"></span>-->
<span *ngIf="currentContract.state == 601">{{ 'PURCHASE.BEING_CANCELLED' | translate }}</span>
<span *ngIf="currentContract.state == 6">{{ 'PURCHASE.CANCELLED' | translate }}</span>
</ng-container>
<ng-container *ngIf="currentContract.state == 201 || currentContract.state == 601">
<span *ngIf="currentContract.height === 0">0/10</span>
<span *ngIf="currentContract.height !== 0 && (variablesService.height_app - currentContract.height) < 10">{{variablesService.height_app - currentContract.height}}/10</span>
<span *ngIf="historyBlock && historyBlock.sortAmount && historyBlock.sortAmount.toString() !== '0'">{{(historyBlock.is_income ? '+' : '') + (historyBlock.sortAmount | intToMoney)}} {{variablesService.defaultCurrency}}</span>
</ng-container>
</div>
<div class="purchase-buttons" *ngIf="!newPurchase">
@ -265,9 +201,81 @@
<div class="progress-bar-full" [style.width]="getProgressBarWidth()"></div>
</div>
<div class="progress-labels">
<span>{{ 'PURCHASE.PROGRESS_NEW' | translate }}</span>
<span>{{ 'PURCHASE.PROGRESS_WAIT' | translate }}</span>
<span>{{ 'PURCHASE.PROGRESS_COMPLETE' | translate }}</span>
<ng-container *ngIf="newPurchase">
<span>{{ 'PURCHASE.STATUS_MESSAGES.NEW_PURCHASE' | translate }}</span>
</ng-container>
<ng-container *ngIf="!newPurchase && currentContract.is_a">
<span *ngIf="currentContract.state == 1">{{ 'PURCHASE.STATUS_MESSAGES.WAITING_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 110">{{ 'PURCHASE.STATUS_MESSAGES.IGNORED_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 120">{{ 'PURCHASE.STATUS_MESSAGES.WAITING_DELIVERY' | translate }}</span>
<span *ngIf="currentContract.state == 130">{{ 'PURCHASE.STATUS_MESSAGES.IGNORED_CANCEL_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 140">{{ 'PURCHASE.STATUS_MESSAGES.EXPIRED' | translate }}</span>
<span *ngIf="currentContract.state == 2">{{ 'PURCHASE.STATUS_MESSAGES.WAITING_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 201">
{{ 'PURCHASE.STATUS_MESSAGES.WAITING_CONFIRMATION' | translate }}
<ng-container *ngIf="currentContract.height === 0">(0/10)</ng-container>
<ng-container *ngIf="currentContract.height !== 0 && (variablesService.height_app - currentContract.height) < 10">({{variablesService.height_app - currentContract.height}}/10)</ng-container>
</span>
<span *ngIf="currentContract.state == 3">{{ 'PURCHASE.STATUS_MESSAGES.COMPLETED' | translate }}</span>
<span *ngIf="currentContract.state == 4" class="error-text">
{{ 'PURCHASE.STATUS_MESSAGES.NOT_RECEIVED' | translate }}. {{ 'PURCHASE.STATUS_MESSAGES.NULLIFIED' | translate }}
</span>
<span *ngIf="currentContract.state == 5">{{ 'PURCHASE.STATUS_MESSAGES.PROPOSAL_CANCEL_SELLER' | translate }}</span>
<span *ngIf="currentContract.state == 6">{{ 'PURCHASE.STATUS_MESSAGES.CANCELLED' | translate }}</span>
<span *ngIf="currentContract.state == 601">
{{ 'PURCHASE.STATUS_MESSAGES.BEING_CANCELLED' | translate }}
<ng-container *ngIf="currentContract.height === 0">(0/10)</ng-container>
<ng-container *ngIf="currentContract.height !== 0 && (variablesService.height_app - currentContract.height) < 10">({{variablesService.height_app - currentContract.height}}/10)</ng-container>
</span>
</ng-container>
<ng-container *ngIf="!newPurchase && !currentContract.is_a">
<span *ngIf="currentContract.state == 1">{{ 'PURCHASE.STATUS_MESSAGES.WAITING_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 110">{{ 'PURCHASE.STATUS_MESSAGES.IGNORED_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 130">{{ 'PURCHASE.STATUS_MESSAGES.IGNORED_CANCEL_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 140">{{ 'PURCHASE.STATUS_MESSAGES.EXPIRED' | translate }}</span>
<span *ngIf="currentContract.state == 2">{{ 'PURCHASE.STATUS_MESSAGES.WAITING_DELIVERY' | translate }}</span>
<span *ngIf="currentContract.state == 201">
{{ 'PURCHASE.STATUS_MESSAGES.WAITING_CONFIRMATION' | translate }}
<ng-container *ngIf="currentContract.height === 0">(0/10)</ng-container>
<ng-container *ngIf="currentContract.height !== 0 && (variablesService.height_app - currentContract.height) < 10">({{variablesService.height_app - currentContract.height}}/10)</ng-container>
</span>
<span *ngIf="currentContract.state == 3">{{ 'PURCHASE.STATUS_MESSAGES.COMPLETED' | translate }}</span>
<span *ngIf="currentContract.state == 4" class="error-text">
{{ 'PURCHASE.STATUS_MESSAGES.NOT_RECEIVED' | translate }}. {{ 'PURCHASE.STATUS_MESSAGES.NULLIFIED' | translate }}
</span>
<span *ngIf="currentContract.state == 5">{{ 'PURCHASE.STATUS_MESSAGES.PROPOSAL_CANCEL_BUYER' | translate }}</span>
<span *ngIf="currentContract.state == 6">{{ 'PURCHASE.STATUS_MESSAGES.CANCELLED' | translate }}</span>
<span *ngIf="currentContract.state == 601">
{{ 'PURCHASE.STATUS_MESSAGES.BEING_CANCELLED' | translate }}
<ng-container *ngIf="currentContract.height === 0">(0/10)</ng-container>
<ng-container *ngIf="currentContract.height !== 0 && (variablesService.height_app - currentContract.height) < 10">({{variablesService.height_app - currentContract.height}}/10)</ng-container>
</span>
</ng-container>
</div>
<div class="progress-time" *ngIf="!newPurchase">
<span *ngIf="currentContract.is_a && currentContract.state == 1">{{currentContract.expiration_time | contractTimeLeft: 0}}</span>

View file

@ -188,22 +188,9 @@
.progress-labels {
display: flex;
align-items: center;
justify-content: space-between;
justify-content: center;
font-size: 1.2rem;
height: 100%;
span {
flex: 1 0 0;
text-align: center;
&:first-child {
text-align: left;
}
&:last-child {
text-align: right;
}
}
}
.progress-time {

View file

@ -216,14 +216,24 @@ export class PurchaseComponent implements OnInit, OnDestroy {
}
getProgressBarWidth() {
let progress = '9rem';
let progress = '0';
if (!this.newPurchase) {
if (this.currentContract) {
if ([110, 3, 4, 6, 140].indexOf(this.currentContract.state) !== -1) {
progress = '100%';
} else {
if (this.currentContract.state === 1) {
progress = '10%';
}
if (this.currentContract.state === 201) {
progress = '25%';
}
if ([120, 2].indexOf(this.currentContract.state) !== -1) {
progress = '50%';
}
if ([5, 601].indexOf(this.currentContract.state) !== -1) {
progress = '75%';
}
if ([110, 130, 140, 3, 4, 6].indexOf(this.currentContract.state) !== -1) {
progress = '100%';
}
}
}
return progress;
@ -331,7 +341,6 @@ export class PurchaseComponent implements OnInit, OnDestroy {
this.back();
}
productNotGot() {
this.backend.releaseProposal(this.currentWalletId, this.currentContract.contract_id, 'REL_B', (release_status) => {
if (release_status) {

View file

@ -306,9 +306,9 @@
"POS_REWARD": "POS reward",
"CREATE_CONTRACT": "Contract proposal",
"PLEDGE_CONTRACT": "Contract deposit",
"NULLIFY_CONTRACT": "Nullify pledges for contract",
"NULLIFY_CONTRACT": "Burn deposits for contract",
"PROPOSAL_CANCEL_CONTRACT": "Cancellation request",
"CANCEL_CONTRACT": "Cancel contract, return pledges"
"CANCEL_CONTRACT": "Cancel contract and return deposits"
}
},
"CONTRACTS": {
@ -343,7 +343,7 @@
"WAITING_BUYER": "Waiting for delivery",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"NULLIFIED": "All deposits burned",
"PROPOSAL_CANCEL": "New proposal to cancel contract and return pledges",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
@ -352,14 +352,13 @@
},
"BUYER": {
"WAITING": "Waiting for response",
"PLEDGE_RESERVED": "Pledge amount reserved",
"IGNORED": "The seller ignored your contract proposal",
"ACCEPTED": "The seller accepted your contract proposal",
"WAIT": "Waiting for deposits confirmation",
"WAITING_SELLER": "Waiting for delivery",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"NULLIFIED": "All deposits burned",
"WAITING_CANCEL": "Waiting for contract cancellation",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
@ -398,32 +397,34 @@
"PROGRESS_COMPLETE": "Completed",
"FEE": "Fee",
"PAYMENT": "Payment ID",
"STATUS_MESSAGES": {
"NEW_PURCHASE": "New purchase",
"WAITING_SELLER": "Waiting for response",
"WAITING_BUYER": "Contract proposal received",
"WAITING_CONFIRMATION": "Waiting for deposits confirmation",
"WAITING_DELIVERY": "Waiting for delivery",
"COMPLETED": "Contract completed",
"IGNORED_BUYER": "Contract proposal ignored",
"IGNORED_SELLER": "The seller ignored your contract proposal",
"PROPOSAL_CANCEL_SELLER": "Cancellation request sent",
"PROPOSAL_CANCEL_BUYER": "Cancellation request received",
"BEING_CANCELLED": "Cancellation in progress",
"IGNORED_CANCEL_SELLER": "The seller ignored your proposal to cancel the contract",
"IGNORED_CANCEL_BUYER": "You ignored the proposal to cancel the contract",
"CANCELLED": "Contract canceled",
"EXPIRED": "The contract proposal has expired",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All deposits burned"
},
"ACCEPT_STATE_WAIT_BIG": "Contract started",
"IGNORED_ACCEPT": "Contract proposal ignored",
"BURN_PROPOSAL": "The deposits have been voided.",
"BURN_PROPOSAL": "The deposits have been voided",
"SUCCESS_FINISH_PROPOSAL": "Contract completed",
"SEND_CANCEL_PROPOSAL": "Cancellation request sent",
"IGNORED_CANCEL": "You have ignored the proposal to cancel the contract",
"DEALS_CANCELED_WAIT": "Cancellation in progress",
"WAITING_TIME": "Response time",
"NEED_MONEY": "There are insufficient funds in the wallet. Add funds to the wallet to continue",
"WAITING_SELLER": "Waiting for response",
"IGNORED_SELLER": "The seller ignored your contract proposal",
"WAITING_SHIP": "Waiting for delivery",
"IGNORED_CANCEL_SELLER": "The seller ignored your proposal to cancel the contract",
"EXPIRED": "The contract proposal has expired",
"WAIT": "Waiting for deposits confirmation",
"COMPLETED": "Contract completed",
"NOT_RECEIVED": "Item not received",
"NULLIFIED": "All pledges nullified",
"PROPOSAL_CANCEL_SELLER": "Cancellation request sent",
"BEING_CANCELLED": "Cancellation in progress",
"CANCELLED": "Contract canceled",
"WAITING_BUYER": "Contract proposal received",
"IGNORED_BUYER": "Contract proposal ignored",
"IGNORED_CANCEL_BUYER": "You ignored the proposal to cancel the contract",
"BUYER_WAIT": "Waiting for delivery",
"PROPOSAL_CANCEL_BUYER": "Cancellation request received",
"BUTTON_MAKE_PLEDGE": "Accept and make deposit",
"BUTTON_IGNORE": "Ignore and hide offer",
"BUTTON_NULLIFY": "Terminate and burn deposits",