mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
formatted files
This commit is contained in:
@@ -1,63 +1,57 @@
|
||||
import { controller, target } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { TransactionsService } from "services/";
|
||||
import { AppMainElement, AppPaginationElement } from "components/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { controller, target } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { TransactionsService } from 'services/';
|
||||
import { AppMainElement, AppPaginationElement } from 'components/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class HistoryPageElement extends BasePageElement {
|
||||
private transactionsService: TransactionsService;
|
||||
@target pagination: AppPaginationElement;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Transaction History",
|
||||
});
|
||||
}
|
||||
private transactionsService: TransactionsService;
|
||||
@target pagination: AppPaginationElement;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Transaction History',
|
||||
});
|
||||
}
|
||||
|
||||
elementConnected = (): void => {
|
||||
this.transactionsService = new TransactionsService(
|
||||
this.appMain?.appService
|
||||
);
|
||||
this.update();
|
||||
this.pagination?.setFetchFunc?.(this.getTransactions, true)!;
|
||||
this.appMain.addEventListener("tokenchange", this.update);
|
||||
};
|
||||
elementConnected = (): void => {
|
||||
this.transactionsService = new TransactionsService(this.appMain?.appService);
|
||||
this.update();
|
||||
this.pagination?.setFetchFunc?.(this.getTransactions, true)!;
|
||||
this.appMain.addEventListener('tokenchange', this.update);
|
||||
};
|
||||
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener("tokenchange", this.update);
|
||||
};
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener('tokenchange', this.update);
|
||||
};
|
||||
|
||||
getTransactions = async (options): Promise<any> => {
|
||||
try {
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
options["walletId"] = walletId;
|
||||
}
|
||||
}
|
||||
const response = await this.transactionsService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
getTransactions = async (options): Promise<any> => {
|
||||
try {
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
options['walletId'] = walletId;
|
||||
}
|
||||
}
|
||||
const response = await this.transactionsService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
render = (): TemplateResult => {
|
||||
const renderWallet = () => {
|
||||
if (this.routerService?.routerState?.data?.walletId) {
|
||||
return html`<span
|
||||
>${this.routerService?.routerState?.data?.walletId}</span
|
||||
>`;
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
return html`<div>
|
||||
${renderWallet()}
|
||||
<app-pagination
|
||||
data-target="history-page.pagination"
|
||||
></app-pagination>
|
||||
</div>`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
const renderWallet = () => {
|
||||
if (this.routerService?.routerState?.data?.walletId) {
|
||||
return html`<span>${this.routerService?.routerState?.data?.walletId}</span>`;
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
return html`<div>
|
||||
${renderWallet()}
|
||||
<app-pagination data-target="history-page.pagination"></app-pagination>
|
||||
</div>`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { HistoryPageElement };
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
import { controller, target } from "@github/catalyst";
|
||||
import { html, TemplateResult, until } from "lit-html";
|
||||
import { WalletService } from "services/";
|
||||
import { AppMainElement, WalletHeaderElement } from "components/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { controller, target } from '@github/catalyst';
|
||||
import { html, TemplateResult, until } from 'lit-html';
|
||||
import { WalletService } from 'services/';
|
||||
import { AppMainElement, WalletHeaderElement } from 'components/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class HomePageElement extends BasePageElement {
|
||||
@target walletHeader: WalletHeaderElement;
|
||||
private walletService: WalletService;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Home",
|
||||
});
|
||||
}
|
||||
@target walletHeader: WalletHeaderElement;
|
||||
private walletService: WalletService;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Home',
|
||||
});
|
||||
}
|
||||
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.update();
|
||||
this.appMain.addEventListener("tokenchange", this.update);
|
||||
this.getBalance();
|
||||
};
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.update();
|
||||
this.appMain.addEventListener('tokenchange', this.update);
|
||||
this.getBalance();
|
||||
};
|
||||
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener("tokenchange", this.update);
|
||||
};
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener('tokenchange', this.update);
|
||||
};
|
||||
|
||||
getBalance = async (): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getBalance();
|
||||
this.setBalance(response);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
getBalance = async (): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getBalance();
|
||||
this.setBalance(response);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
setBalance = (header) => {
|
||||
if (!this.walletHeader) return;
|
||||
this.walletHeader.currency = header.currency;
|
||||
this.walletHeader.currentBalance = header.currentBalance || "0";
|
||||
this.walletHeader.lastMonth = header.lastMonth || "0";
|
||||
this.walletHeader.nextMonth = header.nextMonth || "0";
|
||||
};
|
||||
setBalance = (header) => {
|
||||
if (!this.walletHeader) return;
|
||||
this.walletHeader.currency = header.currency;
|
||||
this.walletHeader.currentBalance = header.currentBalance || '0';
|
||||
this.walletHeader.lastMonth = header.lastMonth || '0';
|
||||
this.walletHeader.nextMonth = header.nextMonth || '0';
|
||||
};
|
||||
|
||||
openModal = (): void => {
|
||||
const _modal = this.appMain.appModal;
|
||||
if (_modal) {
|
||||
this.appMain.closeModal();
|
||||
} else {
|
||||
this.appMain.createModal("wallet-create");
|
||||
}
|
||||
};
|
||||
openModal = (): void => {
|
||||
const _modal = this.appMain.appModal;
|
||||
if (_modal) {
|
||||
this.appMain.closeModal();
|
||||
} else {
|
||||
this.appMain.createModal('wallet-create');
|
||||
}
|
||||
};
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<button app-action="click:home-page#openModal">New Wallet</button>
|
||||
<wallet-header
|
||||
data-target="home-page.walletHeader"
|
||||
data-current-balance="0"
|
||||
data-last-month="0"
|
||||
data-next-month="0"
|
||||
data-currency="0"
|
||||
data-custom="home-page#getBalance"
|
||||
></wallet-header>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<button app-action="click:home-page#openModal">New Wallet</button>
|
||||
<wallet-header
|
||||
data-target="home-page.walletHeader"
|
||||
data-current-balance="0"
|
||||
data-last-month="0"
|
||||
data-next-month="0"
|
||||
data-currency="0"
|
||||
data-custom="home-page#getBalance"
|
||||
></wallet-header>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export { HomePageElement };
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export * from "./logout-page/LogoutPageElement";
|
||||
export * from "./home-page/HomePageElement";
|
||||
export * from "./register-page/RegisterPageElement";
|
||||
export * from "./login-page/LoginPageElement";
|
||||
export * from "./not-found/NotFoundElement";
|
||||
export * from "./history-page/HistoryPageElement";
|
||||
export * from "./wallet-list/WalletListElement";
|
||||
export * from "./wallet-create/WalletCreateElement";
|
||||
export * from "./transaction-create/TransactionCreateElement";
|
||||
export * from "./wallet-page/WalletPageElement";
|
||||
export * from './logout-page/LogoutPageElement';
|
||||
export * from './home-page/HomePageElement';
|
||||
export * from './register-page/RegisterPageElement';
|
||||
export * from './login-page/LoginPageElement';
|
||||
export * from './not-found/NotFoundElement';
|
||||
export * from './history-page/HistoryPageElement';
|
||||
export * from './wallet-list/WalletListElement';
|
||||
export * from './wallet-create/WalletCreateElement';
|
||||
export * from './transaction-create/TransactionCreateElement';
|
||||
export * from './wallet-page/WalletPageElement';
|
||||
|
||||
@@ -1,115 +1,107 @@
|
||||
import { targets, controller, target } from "@github/catalyst";
|
||||
import { targets, controller, target } from '@github/catalyst';
|
||||
//import { html, TemplateResult } from "lit-html";
|
||||
import { html, render, TemplateResult } from "lit-html";
|
||||
import { AuthService } from "services/";
|
||||
import { AppFormElement, InputFieldElement } from "components/";
|
||||
import { RouterService } from "core/services";
|
||||
import { BasePageElement } from "common/";
|
||||
import { html, render, TemplateResult } from 'lit-html';
|
||||
import { AuthService } from 'services/';
|
||||
import { AppFormElement, InputFieldElement } from 'components/';
|
||||
import { RouterService } from 'core/services';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class LoginPageElement extends BasePageElement {
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
@target appForm: AppFormElement;
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Login",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
@target appForm: AppFormElement;
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Login',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
|
||||
get emailInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == "email") {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
get emailInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == 'email') {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get passwordInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == "password") {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
get passwordInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == 'password') {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get values(): Object {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
get values(): Object {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.appMain.authStore.userLogin(
|
||||
this.values
|
||||
);
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.appMain.authStore.userLogin(this.values);
|
||||
|
||||
if (response?.token) {
|
||||
this.routerService.goTo("/");
|
||||
}
|
||||
} catch (err) {
|
||||
if (err?.errorCode == 400103) {
|
||||
this.emailInput.error = err?.message;
|
||||
this.emailInput.update();
|
||||
} else if (err?.errorCode == 400104) {
|
||||
this.passwordInput.error = err?.message;
|
||||
this.passwordInput.update();
|
||||
} else {
|
||||
this.appForm?.setError("Unable to log in!");
|
||||
}
|
||||
}
|
||||
};
|
||||
if (response?.token) {
|
||||
this.routerService.goTo('/');
|
||||
}
|
||||
} catch (err) {
|
||||
if (err?.errorCode == 400103) {
|
||||
this.emailInput.error = err?.message;
|
||||
this.emailInput.update();
|
||||
} else if (err?.errorCode == 400104) {
|
||||
this.passwordInput.error = err?.message;
|
||||
this.passwordInput.update();
|
||||
} else {
|
||||
this.appForm?.setError('Unable to log in!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<app-form
|
||||
data-custom="login-page#onSubmit"
|
||||
data-target="login-page.appForm"
|
||||
>
|
||||
<input-field
|
||||
data-type="email"
|
||||
data-name="email"
|
||||
data-label="E-mail"
|
||||
data-targets="login-page.inputs"
|
||||
data-rules="required|isEmail"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="password"
|
||||
data-name="password"
|
||||
data-label="Password"
|
||||
data-targets="login-page.inputs"
|
||||
data-rules="required"
|
||||
>
|
||||
</input-field>
|
||||
</app-form>
|
||||
<div>
|
||||
<app-link
|
||||
data-to="/register"
|
||||
data-title="Create new account"
|
||||
></app-link>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<app-form data-custom="login-page#onSubmit" data-target="login-page.appForm">
|
||||
<input-field
|
||||
data-type="email"
|
||||
data-name="email"
|
||||
data-label="E-mail"
|
||||
data-targets="login-page.inputs"
|
||||
data-rules="required|isEmail"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="password"
|
||||
data-name="password"
|
||||
data-label="Password"
|
||||
data-targets="login-page.inputs"
|
||||
data-rules="required"
|
||||
>
|
||||
</input-field>
|
||||
</app-form>
|
||||
<div>
|
||||
<app-link data-to="/register" data-title="Create new account"></app-link>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { LoginPageElement };
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { controller } from "@github/catalyst";
|
||||
import { AuthService } from "services/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { controller } from '@github/catalyst';
|
||||
import { AuthService } from 'services/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class LogoutPageElement extends BasePageElement {
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Logout",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.appMain?.authStore?.userLogout();
|
||||
this.appMain?.routerService.goTo("/login");
|
||||
};
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Logout',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.appMain?.authStore?.userLogout();
|
||||
this.appMain?.routerService.goTo('/login');
|
||||
};
|
||||
}
|
||||
|
||||
export type { LogoutPageElement };
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import { controller } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { BasePageElement } from "common/";
|
||||
import { controller } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class NotFoundElement extends BasePageElement {
|
||||
constructor() {
|
||||
super({
|
||||
title: "404 - Not Found",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.update();
|
||||
};
|
||||
constructor() {
|
||||
super({
|
||||
title: '404 - Not Found',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.update();
|
||||
};
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>404 - Page not found</div>
|
||||
<div><app-link data-to="/" data-title="Homepage"></app-link></div>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>404 - Page not found</div>
|
||||
<div><app-link data-to="/" data-title="Homepage"></app-link></div>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { NotFoundElement };
|
||||
|
||||
@@ -1,87 +1,82 @@
|
||||
import { targets, controller } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { AuthService } from "services/";
|
||||
import { InputFieldElement } from "components/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { targets, controller } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { AuthService } from 'services/';
|
||||
import { InputFieldElement } from 'components/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class RegisterPageElement extends BasePageElement {
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Register",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
authService: AuthService;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Register',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
|
||||
get values(): Object {
|
||||
const formObject = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
get values(): Object {
|
||||
const formObject = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.appMain.authStore.userRegister(
|
||||
this.values
|
||||
);
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.appMain.authStore.userRegister(this.values);
|
||||
|
||||
if (response?.id) {
|
||||
this.appMain.routerService.goTo("/login");
|
||||
}
|
||||
} catch (err) {}
|
||||
};
|
||||
if (response?.id) {
|
||||
this.appMain.routerService.goTo('/login');
|
||||
}
|
||||
} catch (err) {}
|
||||
};
|
||||
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<app-form
|
||||
data-custom="register-page#onSubmit"
|
||||
data-has-cancel="true"
|
||||
>
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="username"
|
||||
data-label="Username"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="email"
|
||||
data-name="email"
|
||||
data-label="E-mail"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required|isEmail"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="password"
|
||||
data-name="password"
|
||||
data-label="Password"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required"
|
||||
>
|
||||
</input-field>
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<app-form data-custom="register-page#onSubmit" data-has-cancel="true">
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="username"
|
||||
data-label="Username"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="email"
|
||||
data-name="email"
|
||||
data-label="E-mail"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required|isEmail"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="password"
|
||||
data-name="password"
|
||||
data-label="Password"
|
||||
data-targets="register-page.inputs"
|
||||
data-rules="required"
|
||||
>
|
||||
</input-field>
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { RegisterPageElement };
|
||||
|
||||
@@ -1,130 +1,119 @@
|
||||
import { targets, controller } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { AuthService, TransactionsService, WalletService } from "services/";
|
||||
import { InputFieldElement } from "components/";
|
||||
import { RouterService } from "core/services";
|
||||
import { BasePageElement } from "common/";
|
||||
import { AppDropdownElement } from "components/app-dropdown/AppDropdownElement";
|
||||
import { targets, controller } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { AuthService, TransactionsService, WalletService } from 'services/';
|
||||
import { InputFieldElement } from 'components/';
|
||||
import { RouterService } from 'core/services';
|
||||
import { BasePageElement } from 'common/';
|
||||
import { AppDropdownElement } from 'components/app-dropdown/AppDropdownElement';
|
||||
|
||||
@controller
|
||||
class TransactionCreateElement extends BasePageElement {
|
||||
@targets inputs: Array<InputFieldElement | AppDropdownElement>;
|
||||
private transactionService: TransactionsService;
|
||||
private walletService: WalletService;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: "New Transaction",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.transactionService = new TransactionsService(
|
||||
this.appMain?.appService
|
||||
);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
@targets inputs: Array<InputFieldElement | AppDropdownElement>;
|
||||
private transactionService: TransactionsService;
|
||||
private walletService: WalletService;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'New Transaction',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.transactionService = new TransactionsService(this.appMain?.appService);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
|
||||
get nameInput(): InputFieldElement | AppDropdownElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == "name") {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
get nameInput(): InputFieldElement | AppDropdownElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == 'name') {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get values(): any {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
get values(): any {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
|
||||
getWallets = async (options): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {}
|
||||
};
|
||||
getWallets = async (options): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {}
|
||||
};
|
||||
|
||||
onSubmit = async (values): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
onSubmit = async (values): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
description: description,
|
||||
wallet: walletId,
|
||||
amount,
|
||||
} = values;
|
||||
const { description: description, wallet: walletId, amount } = values;
|
||||
|
||||
const response = await this.transactionService.post({
|
||||
description,
|
||||
walletId,
|
||||
amount,
|
||||
});
|
||||
const response = await this.transactionService.post({
|
||||
description,
|
||||
walletId,
|
||||
amount,
|
||||
});
|
||||
|
||||
if (response?.id) {
|
||||
this.appMain.triggerWalletUpdate();
|
||||
this.routerService.goTo("/history", {
|
||||
walletId: response.id,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this.errorMessage = "Unable to create transaction!";
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
if (response?.id) {
|
||||
this.appMain.triggerWalletUpdate();
|
||||
this.routerService.goTo('/history', {
|
||||
walletId: response.id,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this.errorMessage = 'Unable to create transaction!';
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Create wallet</div>
|
||||
<app-form
|
||||
data-custom="transaction-create#onSubmit"
|
||||
data-has-cancel="true"
|
||||
>
|
||||
<input-field
|
||||
data-type="number"
|
||||
data-name="amount"
|
||||
data-label="Amount"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="description"
|
||||
data-label="Description"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<app-dropdown
|
||||
data-name="wallet"
|
||||
data-label="Wallet"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
data-fetch="transaction-create#getWallets"
|
||||
>
|
||||
</app-dropdown>
|
||||
${this.errorMessage
|
||||
? html`<div>${this.errorMessage}</div>`
|
||||
: html``}
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Create wallet</div>
|
||||
<app-form data-custom="transaction-create#onSubmit" data-has-cancel="true">
|
||||
<input-field
|
||||
data-type="number"
|
||||
data-name="amount"
|
||||
data-label="Amount"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="description"
|
||||
data-label="Description"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
<app-dropdown
|
||||
data-name="wallet"
|
||||
data-label="Wallet"
|
||||
data-targets="transaction-create.inputs"
|
||||
data-rules="required"
|
||||
data-fetch="transaction-create#getWallets"
|
||||
>
|
||||
</app-dropdown>
|
||||
${this.errorMessage ? html`<div>${this.errorMessage}</div>` : html``}
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { TransactionCreateElement };
|
||||
|
||||
@@ -1,92 +1,87 @@
|
||||
import { targets, controller } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { AuthService, WalletService } from "services/";
|
||||
import { InputFieldElement } from "components/";
|
||||
import { RouterService } from "core/services";
|
||||
import { BasePageElement } from "common/";
|
||||
import { targets, controller } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { AuthService, WalletService } from 'services/';
|
||||
import { InputFieldElement } from 'components/';
|
||||
import { RouterService } from 'core/services';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class WalletCreateElement extends BasePageElement {
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
private walletService: WalletService;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: "New Wallet",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
private walletService: WalletService;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'New Wallet',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
};
|
||||
|
||||
get nameInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == "name") {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
get nameInput(): InputFieldElement {
|
||||
for (const i in this.inputs) {
|
||||
if (this.inputs[i]?.name == 'name') {
|
||||
return this.inputs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get values(): Object {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
get values(): Object {
|
||||
const formObject: any = {};
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const inputType = input.inp;
|
||||
formObject[input.name] = (inputType as HTMLInputElement).value;
|
||||
});
|
||||
return formObject;
|
||||
}
|
||||
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.walletService.post(this.values);
|
||||
onSubmit = async (): Promise<void> => {
|
||||
try {
|
||||
if (!this.validate()) {
|
||||
return;
|
||||
}
|
||||
const response = await this.walletService.post(this.values);
|
||||
|
||||
if (response?.id) {
|
||||
this.appMain.triggerWalletUpdate();
|
||||
this.routerService.goTo("/wallet/:walletId", {
|
||||
walletId: response.id,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this.errorMessage = "Unable to create wallet!";
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
if (response?.id) {
|
||||
this.appMain.triggerWalletUpdate();
|
||||
this.routerService.goTo('/wallet/:walletId', {
|
||||
walletId: response.id,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this.errorMessage = 'Unable to create wallet!';
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
validate(): boolean {
|
||||
let _return = true;
|
||||
this.inputs.forEach((input: InputFieldElement) => {
|
||||
const valid: boolean = input.validate();
|
||||
if (!valid) _return = false;
|
||||
});
|
||||
return _return;
|
||||
}
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Create wallet</div>
|
||||
<app-form
|
||||
data-custom="wallet-create#onSubmit"
|
||||
data-has-cancel="true"
|
||||
>
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="name"
|
||||
data-label="Name"
|
||||
data-targets="wallet-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
${this.errorMessage
|
||||
? html`<div>${this.errorMessage}</div>`
|
||||
: html``}
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Create wallet</div>
|
||||
<app-form data-custom="wallet-create#onSubmit" data-has-cancel="true">
|
||||
<input-field
|
||||
data-type="text"
|
||||
data-name="name"
|
||||
data-label="Name"
|
||||
data-targets="wallet-create.inputs"
|
||||
data-rules="required"
|
||||
></input-field>
|
||||
${this.errorMessage ? html`<div>${this.errorMessage}</div>` : html``}
|
||||
</app-form>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { WalletCreateElement };
|
||||
|
||||
@@ -1,50 +1,48 @@
|
||||
import { targets, controller, target } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { AuthService, WalletService } from "services/";
|
||||
import { AppPaginationElement, InputFieldElement } from "components/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { targets, controller, target } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { AuthService, WalletService } from 'services/';
|
||||
import { AppPaginationElement, InputFieldElement } from 'components/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class WalletListElement extends BasePageElement {
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
private walletService: WalletService;
|
||||
@target pagination: AppPaginationElement;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Wallet List",
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
this.pagination?.setCustomRenderItem(this.renderItem);
|
||||
this.pagination?.setFetchFunc?.(this.getWallets, true)!;
|
||||
};
|
||||
@targets inputs: Array<InputFieldElement>;
|
||||
private walletService: WalletService;
|
||||
@target pagination: AppPaginationElement;
|
||||
authService: AuthService;
|
||||
errorMessage: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Wallet List',
|
||||
});
|
||||
}
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.authService = new AuthService(this.appMain.appService);
|
||||
this.update();
|
||||
this.pagination?.setCustomRenderItem(this.renderItem);
|
||||
this.pagination?.setFetchFunc?.(this.getWallets, true)!;
|
||||
};
|
||||
|
||||
getWallets = async (options): Promise<any> => {
|
||||
try {
|
||||
const response = await this.walletService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
getWallets = async (options): Promise<any> => {
|
||||
try {
|
||||
const response = await this.walletService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
renderItem = (item): TemplateResult => html`<tr>
|
||||
<td><app-link data-to="/wallet/${item.id}">${item.name}</app-link></td>
|
||||
</tr>`;
|
||||
renderItem = (item): TemplateResult => html`<tr>
|
||||
<td><app-link data-to="/wallet/${item.id}">${item.name}</app-link></td>
|
||||
</tr>`;
|
||||
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Wallets</div>
|
||||
<app-pagination
|
||||
data-target="wallet-list.pagination"
|
||||
></app-pagination>
|
||||
`;
|
||||
};
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div>Wallets</div>
|
||||
<app-pagination data-target="wallet-list.pagination"></app-pagination>
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { WalletListElement };
|
||||
|
||||
@@ -1,105 +1,95 @@
|
||||
import { controller, target } from "@github/catalyst";
|
||||
import { html, TemplateResult } from "lit-html";
|
||||
import { TransactionsService, WalletService } from "services/";
|
||||
import {
|
||||
AppMainElement,
|
||||
AppPaginationElement,
|
||||
WalletHeaderElement,
|
||||
} from "components/";
|
||||
import { BasePageElement } from "common/";
|
||||
import { controller, target } from '@github/catalyst';
|
||||
import { html, TemplateResult } from 'lit-html';
|
||||
import { TransactionsService, WalletService } from 'services/';
|
||||
import { AppMainElement, AppPaginationElement, WalletHeaderElement } from 'components/';
|
||||
import { BasePageElement } from 'common/';
|
||||
|
||||
@controller
|
||||
class WalletPageElement extends BasePageElement {
|
||||
private transactionsService: TransactionsService;
|
||||
private walletService: WalletService;
|
||||
@target pagination: AppPaginationElement;
|
||||
@target walletHeader: WalletHeaderElement;
|
||||
walletId: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: "Wallet",
|
||||
});
|
||||
}
|
||||
private transactionsService: TransactionsService;
|
||||
private walletService: WalletService;
|
||||
@target pagination: AppPaginationElement;
|
||||
@target walletHeader: WalletHeaderElement;
|
||||
walletId: string;
|
||||
constructor() {
|
||||
super({
|
||||
title: 'Wallet',
|
||||
});
|
||||
}
|
||||
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.transactionsService = new TransactionsService(
|
||||
this.appMain?.appService
|
||||
);
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
this.walletId = walletId;
|
||||
}
|
||||
}
|
||||
this.update();
|
||||
this.pagination?.setFetchFunc?.(this.getTransactions, true)!;
|
||||
this.appMain.addEventListener("tokenchange", this.update);
|
||||
};
|
||||
elementConnected = (): void => {
|
||||
this.walletService = new WalletService(this.appMain?.appService);
|
||||
this.transactionsService = new TransactionsService(this.appMain?.appService);
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
this.walletId = walletId;
|
||||
}
|
||||
}
|
||||
this.update();
|
||||
this.pagination?.setFetchFunc?.(this.getTransactions, true)!;
|
||||
this.appMain.addEventListener('tokenchange', this.update);
|
||||
};
|
||||
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener("tokenchange", this.update);
|
||||
};
|
||||
elementDisconnected = (appMain: AppMainElement): void => {
|
||||
appMain?.removeEventListener('tokenchange', this.update);
|
||||
};
|
||||
|
||||
getTransactions = async (options): Promise<any> => {
|
||||
try {
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
options["walletId"] = walletId;
|
||||
}
|
||||
}
|
||||
const response = await this.transactionsService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
getTransactions = async (options): Promise<any> => {
|
||||
try {
|
||||
if (this?.routerService?.routerState?.data) {
|
||||
const { walletId } = this?.routerService?.routerState?.data;
|
||||
if (walletId) {
|
||||
options['walletId'] = walletId;
|
||||
}
|
||||
}
|
||||
const response = await this.transactionsService.getAll(options);
|
||||
return response;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
getBalance = async (): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getBalance({
|
||||
walletId: this.walletId,
|
||||
});
|
||||
this.setBalance(response);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
getBalance = async (): Promise<void> => {
|
||||
try {
|
||||
const response = await this.walletService.getBalance({
|
||||
walletId: this.walletId,
|
||||
});
|
||||
this.setBalance(response);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
setBalance = (header) => {
|
||||
if (!this.walletHeader) return;
|
||||
this.walletHeader.currency = header.currency;
|
||||
this.walletHeader.currentBalance = header.currentBalance || "0";
|
||||
this.walletHeader.lastMonth = header.lastMonth || "0";
|
||||
this.walletHeader.nextMonth = header.nextMonth || "0";
|
||||
};
|
||||
setBalance = (header) => {
|
||||
if (!this.walletHeader) return;
|
||||
this.walletHeader.currency = header.currency;
|
||||
this.walletHeader.currentBalance = header.currentBalance || '0';
|
||||
this.walletHeader.lastMonth = header.lastMonth || '0';
|
||||
this.walletHeader.nextMonth = header.nextMonth || '0';
|
||||
};
|
||||
|
||||
render = (): TemplateResult => {
|
||||
const renderHeader = () => html`<wallet-header
|
||||
data-target="wallet-page.walletHeader"
|
||||
data-current-balance="0"
|
||||
data-last-month="0"
|
||||
data-next-month="0"
|
||||
data-currency="0"
|
||||
data-custom="wallet-page#getBalance"
|
||||
></wallet-header>`;
|
||||
render = (): TemplateResult => {
|
||||
const renderHeader = () => html`<wallet-header
|
||||
data-target="wallet-page.walletHeader"
|
||||
data-current-balance="0"
|
||||
data-last-month="0"
|
||||
data-next-month="0"
|
||||
data-currency="0"
|
||||
data-custom="wallet-page#getBalance"
|
||||
></wallet-header>`;
|
||||
|
||||
const renderWallet = () => {
|
||||
if (this.routerService?.routerState?.data?.walletId) {
|
||||
return html`<span
|
||||
>${this.routerService?.routerState?.data?.walletId}</span
|
||||
>`;
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
return html`<div>
|
||||
${renderHeader()} ${renderWallet()}
|
||||
<app-pagination
|
||||
data-target="wallet-page.pagination"
|
||||
></app-pagination>
|
||||
</div>`;
|
||||
};
|
||||
const renderWallet = () => {
|
||||
if (this.routerService?.routerState?.data?.walletId) {
|
||||
return html`<span>${this.routerService?.routerState?.data?.walletId}</span>`;
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
return html`<div>
|
||||
${renderHeader()} ${renderWallet()}
|
||||
<app-pagination data-target="wallet-page.pagination"></app-pagination>
|
||||
</div>`;
|
||||
};
|
||||
}
|
||||
|
||||
export type { WalletPageElement };
|
||||
|
||||
Reference in New Issue
Block a user