mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
fixed transaction check layout
This commit is contained in:
@@ -5,6 +5,7 @@ import { isTrue } from 'core/utils';
|
|||||||
|
|
||||||
class BasePageElement extends BaseElement {
|
class BasePageElement extends BaseElement {
|
||||||
public _pageTitle: string = '';
|
public _pageTitle: string = '';
|
||||||
|
public hideTitleHead: boolean = false;
|
||||||
@attr hidetitle: string;
|
@attr hidetitle: string;
|
||||||
@attr customtitle: string;
|
@attr customtitle: string;
|
||||||
private _data: any;
|
private _data: any;
|
||||||
@@ -13,6 +14,7 @@ class BasePageElement extends BaseElement {
|
|||||||
if (options?.title) {
|
if (options?.title) {
|
||||||
this._pageTitle = options?.title;
|
this._pageTitle = options?.title;
|
||||||
}
|
}
|
||||||
|
this.hideTitleHead = options?.hideTitleHead || false;
|
||||||
this.connectedCallback = this.connectedCallback.bind(this);
|
this.connectedCallback = this.connectedCallback.bind(this);
|
||||||
this.disconnectedCallback = this.disconnectedCallback.bind(this);
|
this.disconnectedCallback = this.disconnectedCallback.bind(this);
|
||||||
}
|
}
|
||||||
@@ -36,7 +38,9 @@ class BasePageElement extends BaseElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
if (!this.hideTitleHead) {
|
||||||
this.appMain.setTitle(this.pageTitle);
|
this.appMain.setTitle(this.pageTitle);
|
||||||
|
}
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,4 +57,5 @@ export default BasePageElement;
|
|||||||
|
|
||||||
export type OptionType = {
|
export type OptionType = {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
hideTitleHead?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -129,9 +129,10 @@ class AppMainElement extends HTMLElement {
|
|||||||
|
|
||||||
checkSubscriptions = async () => {
|
checkSubscriptions = async () => {
|
||||||
if (this.isAuth && !this.subscriptionChecked) {
|
if (this.isAuth && !this.subscriptionChecked) {
|
||||||
const checked = await this.transactionsService.check({ sortBy: 'transactionDate asc' });
|
const checked = await this.transactionsService.check({ sortBy: 'transactionDate asc', rpp: 10 });
|
||||||
this.createModal('transaction-check', {
|
this.createModal('transaction-check', {
|
||||||
data: checked,
|
data: checked,
|
||||||
|
autoInit: false,
|
||||||
});
|
});
|
||||||
this.subscriptionChecked = true;
|
this.subscriptionChecked = true;
|
||||||
this.removeEventListener('routechanged', this.checkSubscriptions);
|
this.removeEventListener('routechanged', this.checkSubscriptions);
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ class HistoryPageElement extends BasePageElement {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
transactionCheck = () => {
|
||||||
|
this.appMain.createModal('transaction-check', {
|
||||||
|
autoInit: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render = (): TemplateResult =>
|
render = (): TemplateResult =>
|
||||||
HistoryPageElementTemplate({ walletId: this.routerService?.routerState?.data?.walletId });
|
HistoryPageElementTemplate({ walletId: this.routerService?.routerState?.data?.walletId });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import { html, nothing, TemplateResult } from 'core/utils';
|
import { html, nothing, TemplateResult } from 'core/utils';
|
||||||
|
|
||||||
export default (props): TemplateResult => {
|
export default (props): TemplateResult => {
|
||||||
const { walletId } = props;
|
|
||||||
const renderWallet = () => {
|
|
||||||
if (walletId) {
|
|
||||||
return html`<span>${walletId}</span>`;
|
|
||||||
}
|
|
||||||
return nothing;
|
|
||||||
};
|
|
||||||
|
|
||||||
return html`<div>
|
return html`<div>
|
||||||
${renderWallet()}
|
<div class="wallet-buttons">
|
||||||
|
<button class="btn btn-squared btn-primary" app-action="click:history-page#transactionCheck">
|
||||||
|
Check Transactions
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<app-pagination data-target="history-page.pagination"></app-pagination>
|
<app-pagination data-target="history-page.pagination"></app-pagination>
|
||||||
</div>`;
|
</div>`;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class TransactionCheckElement extends BasePageElement {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
title: 'Transaction Check',
|
title: 'Transaction Check',
|
||||||
|
hideTitleHead: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,10 +24,12 @@ class TransactionCheckElement extends BasePageElement {
|
|||||||
await this.fetchTransactionStatus();
|
await this.fetchTransactionStatus();
|
||||||
this.transactionsService = new TransactionsService(this.appMain?.appService);
|
this.transactionsService = new TransactionsService(this.appMain?.appService);
|
||||||
this.update();
|
this.update();
|
||||||
this.pagination?.setCustomRenderItem?.(this.renderSubscription)!;
|
|
||||||
this.pagination?.setFetchFunc?.(this.getTransactions, false)!;
|
|
||||||
this.modalData = this.getData();
|
this.modalData = this.getData();
|
||||||
|
this.pagination?.setCustomRenderItem?.(this.renderSubscription)!;
|
||||||
|
this.pagination?.setFetchFunc?.(this.getTransactions, this.modalData?.autoInit)!;
|
||||||
|
if (!this.modalData?.autoInit) {
|
||||||
this.pagination?.executeFetch?.(null, () => this.mappedData(this.modalData.data));
|
this.pagination?.executeFetch?.(null, () => this.mappedData(this.modalData.data));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mappedData = (data) => {
|
mappedData = (data) => {
|
||||||
@@ -37,22 +40,15 @@ class TransactionCheckElement extends BasePageElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderSubscription = (item) => {
|
renderSubscription = (item) => {
|
||||||
const renderEditActions = () => html`<span
|
const renderEditActions = () => html`<div class="d--flex">
|
||||||
><button class="btn btn-rounded btn-red" @click="${() => this.transactionEdit(item)}}">Cancel</button></span
|
<button class="btn btn-rounded btn-red" @click="${() => this.transactionEdit(item)}}">Cancel</button>
|
||||||
><span
|
<button class="btn btn-rounded btn-primary" @click="${() => this.transactionEditSave(item)}}">Save</button>
|
||||||
><button class="btn btn-rounded btn-primary" @click="${() => this.transactionEditSave(item)}}">
|
</div>`;
|
||||||
Save
|
const renderRegularActions = () => html`<div class="d--flex">
|
||||||
</button></span
|
<button class="btn btn-rounded btn-primary" @click="${() => this.transactionEdit(item)}}">Edit</button>
|
||||||
>`;
|
<button class="btn btn-rounded btn-green" @click="${() => this.transactionEditComplete(item)}}">Complete</button>
|
||||||
const renderRegularActions = () => html`<span
|
</div>`;
|
||||||
><button class="btn btn-rounded btn-primary" @click="${() => this.transactionEdit(item)}}">Edit</button></span
|
return html`<tr class="col-checks">
|
||||||
>
|
|
||||||
<span
|
|
||||||
><button class="btn btn-rounded btn-green" @click="${() => this.transactionEditComplete(item)}}">
|
|
||||||
Complete
|
|
||||||
</button></span
|
|
||||||
>`;
|
|
||||||
return html`<tr class="col-transactions">
|
|
||||||
${!item.isEdit
|
${!item.isEdit
|
||||||
? html`<td class="--left">${dayjs(item.transactionDate).format("MMM DD 'YY")}</td>`
|
? html`<td class="--left">${dayjs(item.transactionDate).format("MMM DD 'YY")}</td>`
|
||||||
: html`<input-field
|
: html`<input-field
|
||||||
@@ -129,7 +125,12 @@ class TransactionCheckElement extends BasePageElement {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
this.pagination?.defaultFetch();
|
const options = {
|
||||||
|
page: this.pagination?.page || 1,
|
||||||
|
rpp: this.pagination?.rpp || 10,
|
||||||
|
};
|
||||||
|
this.pagination?.executeFetch(options);
|
||||||
|
this.appMain?.triggerTransactionUpdate?.()!;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ app-pagination {
|
|||||||
&.col-transactions {
|
&.col-transactions {
|
||||||
grid-template-columns: 1fr 10fr 1fr 1fr;
|
grid-template-columns: 1fr 10fr 1fr 1fr;
|
||||||
}
|
}
|
||||||
|
&.col-checks {
|
||||||
|
grid-template-columns: 3fr 8fr 2fr 3fr;
|
||||||
|
}
|
||||||
&.col-wallet {
|
&.col-wallet {
|
||||||
grid-template-columns: 9fr 1fr;
|
grid-template-columns: 9fr 1fr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,3 +64,13 @@ app-main {
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.d {
|
||||||
|
&--flex {
|
||||||
|
display: flex;
|
||||||
|
> * {
|
||||||
|
flex: 1;
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user