Skip to content

Commit

Permalink
Merge pull request #349 from proximax-storage/fix-bug/tasks
Browse files Browse the repository at this point in the history
date format in partial
  • Loading branch information
devyin7 committed May 19, 2021
2 parents 5fa30e3 + f16edb7 commit 08e4e08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/app/dashboard/views/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
linkedInfo = "-";
break;
case 1:
aliasType = "Mosaic";
aliasType = "Asset";
linkedInfo = ownedNamespace.namespaceInfo.alias.mosaicId.toHex();
break;
case 2:
Expand Down
37 changes: 10 additions & 27 deletions src/app/transactions/views/partial/partial.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TransactionsInterface, TransactionsService } from '../../services/trans
import { SharedService, ConfigurationForm } from '../../../shared/services/shared.service';
import { environment } from '../../../../environments/environment';
import { CosignerFirmList, MultisigService } from 'src/app/multi-sign/service/multisig.service';

import { formatDate } from '@angular/common';
@Component({
selector: 'app-partial',
templateUrl: './partial.component.html',
Expand Down Expand Up @@ -92,9 +92,8 @@ export class PartialComponent implements OnInit, OnDestroy {
transaction['isSigned'] = true;
}
});

transaction.hash = transaction.data.transactionInfo.hash;
transaction['deadline'] = `${this.transactionService.dateFormat(transaction.data.deadline)} - UTC`;
transaction['deadline'] = this.convertDateTimeFormat(transaction.data.deadline.value.toString());
});
}
));
Expand All @@ -110,6 +109,13 @@ export class PartialComponent implements OnInit, OnDestroy {
subscription.unsubscribe();
});
}
convertDateTimeFormat(dateTime: string): string{
let dateFormat = "MM/dd/yyyy HH:mm:ss";
let date = new Date(dateTime);
let timezone = - date.getTimezoneOffset();

return formatDate(date, dateFormat, 'en-us', timezone.toString());
}

/**
*
Expand Down Expand Up @@ -150,14 +156,13 @@ export class PartialComponent implements OnInit, OnDestroy {
this.showSwap = false;
this.modalPartial.show();
this.dataSelected = transaction;
this.deadline = `${this.transactionService.dateFormat(this.dataSelected.data['deadline'])} - UTC`;
this.deadline = this.convertDateTimeFormat(this.dataSelected.data['deadline'].value.toString());
this.arraySelect = this.arraySelect.slice(0);
// this.arraySelect = [];
this.account = null;
this.password = '';
let arraySelect = [];
const accountMultisig = this.walletService.filterAccountInfo(transaction.data['innerTransactions'][0].signer.address.pretty(), true);
console.log('accountMultisig', accountMultisig);
if (accountMultisig && accountMultisig.multisigInfo && accountMultisig.multisigInfo.cosignatories && accountMultisig.multisigInfo.cosignatories.length > 0) {
arraySelect = this.multisigService.buildCosignerList(accountMultisig.multisigInfo, this.walletService.currentWallet.accounts);
arraySelect.map((r: CosignerFirmList | any) => {
Expand All @@ -169,21 +174,6 @@ export class PartialComponent implements OnInit, OnDestroy {
r.disabled = r.disabled || hasSigned;
}
});
/* accountMultisig.multisigInfo.cosignatories.forEach(element => {
const cosignatorie: AccountsInterface = this.walletService.filterAccountWallet('', null, element.address.pretty());
console.log('cosignatorie', cosignatorie);
if (cosignatorie) {
const publicAccount = this.proximaxProvider.createPublicAccount(cosignatorie.publicAccount.publicKey, cosignatorie.publicAccount.address.networkType);
const signedByAccount = transaction.data.signedByAccount(publicAccount);
arraySelect.push({
label: (signedByAccount) ? `${cosignatorie.name} - Signed` : cosignatorie.name,
value: cosignatorie,
selected: false,
signed: signedByAccount,
disabled: signedByAccount
});
}
}); */
}

transaction.data['innerTransactions'].forEach((element: any) => {
Expand All @@ -195,10 +185,8 @@ export class PartialComponent implements OnInit, OnDestroy {
// tslint:disable-next-line: no-shadowed-variable
data.modifications.forEach(element => {
const exist = arraySelect.find((b: any) => b.value.address === element.cosignatoryPublicAccount.address.plain());
console.log('exist', exist);
if (!exist) {
const possibleCosignatory: AccountsInterface = this.walletService.filterAccountWallet('', null, element.cosignatoryPublicAccount.address.pretty());
console.log('possibleCosignatory ---->', possibleCosignatory);
// Address encontrada
if (possibleCosignatory) {
if (possibleCosignatory && possibleCosignatory.isMultisign && possibleCosignatory.isMultisign.isMultisig()) {
Expand All @@ -209,18 +197,15 @@ export class PartialComponent implements OnInit, OnDestroy {
if (!existOtherCosignatory) {
// Other cosignatory level 2
const cosignatoryLevelTwo: AccountsInterface = this.walletService.filterAccountWallet('', null, level2.address.pretty());
console.log('cosignatoryLevelTwo', cosignatoryLevelTwo);
if (cosignatoryLevelTwo) {
if (cosignatoryLevelTwo && cosignatoryLevelTwo.isMultisign && cosignatoryLevelTwo.isMultisign.isMultisig()) {
// All cosignatories level 3
cosignatoryLevelTwo.isMultisign.cosignatories.forEach(level3 => {
// Is added before in array select?
const existCosignatoryLevelThree = arraySelect.find((b: any) => b.value.address === level3.address.plain());
console.log('existCosignatoryLevelThree', existCosignatoryLevelThree);
if (!existCosignatoryLevelThree) {
// Other cosignatory level 3
const cosignatoryLevelThree: AccountsInterface = this.walletService.filterAccountWallet('', null, level3.address.pretty());
console.log('cosignatoryLevelThree', cosignatoryLevelThree);
if (cosignatoryLevelThree) {
const publicAccount = this.proximaxProvider.createPublicAccount(
cosignatoryLevelThree.publicAccount.publicKey,
Expand Down Expand Up @@ -288,7 +273,6 @@ export class PartialComponent implements OnInit, OnDestroy {
const addressSender = innerTransactions[0].signer.address.plain();
if ((addressSender === addressAccountMultisig) || (addressSender === addressAccountSimple)) {
if (msg && msg['type'] && msg['type'] === 'Swap') {
// console.log('IS SWAP');
this.nis1hash = msg['nis1Hash'];
this.msg = msg['message'];
this.showSwap = true;
Expand Down Expand Up @@ -361,7 +345,6 @@ export class PartialComponent implements OnInit, OnDestroy {
this.password.length <= this.configurationForm.passwordWallet.maxLength
) {
const common: any = { password: this.password };
// console.log(this.account);
if (this.walletService.decrypt(common, this.account)) {
const transaction: any = this.dataSelected.data;
const account = this.proximaxProvider.getAccountFromPrivateKey(common.privateKey, this.walletService.currentAccount.network);
Expand Down

0 comments on commit 08e4e08

Please sign in to comment.