Skip to content

Commit 5e20437

Browse files
committed
upgraded dependencies improved widgets
1 parent e13abdf commit 5e20437

12 files changed

Lines changed: 30 additions & 36 deletions

addon/components/wallet/transaction-history.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,13 @@ export default class WalletTransactionHistoryComponent extends Component {
6666
if (!wallet?.id) return;
6767

6868
try {
69-
console.log('fetching wallet transactions');
7069
const result = yield this.fetch.get(`wallets/${wallet.id}/transactions`, { page: this.page, limit: 20 }, { namespace: 'ledger/int/v1' });
71-
7270
const transactions = (result?.transactions ?? []).map((trx) => this.store.push(this.store.normalize('ledger-transaction', trx)));
7371

74-
console.log('[result]', result);
75-
console.log('[transactions]', transactions);
7672
this.transactions = transactions;
7773
this.meta = result?.meta ?? null;
7874
} catch (e) {
7975
console.error(e);
80-
console.log(e.message);
8176
this.transactions = [];
8277
}
8378
}

addon/components/widget/activity-feed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetActivityFeedComponent extends Component {
99
@tracked entries = [];
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/components/widget/ar-aging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetArAgingComponent extends Component {
99
@tracked buckets = null;
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/components/widget/invoice-summary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetInvoiceSummaryComponent extends Component {
99
@tracked counts = null;
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/components/widget/overview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetOverviewComponent extends Component {
99
@tracked data = null;
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/components/widget/revenue-chart.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="space-y-1">
1010
{{#each this.data as |day|}}
1111
<div class="flex items-center gap-2 text-sm">
12-
<span class="w-20 text-gray-500 text-xs">{{day.date}}</span>
12+
<span class="w-20 text-gray-500 text-xs">{{format-date-fns day.date "yyyy-MM-dd"}}</span>
1313
<div class="flex-1 bg-gray-100 dark:bg-gray-700 rounded-full h-2">
1414
<div class="bg-blue-500 h-2 rounded-full" style={{html-safe (concat "width: " day.pct "%")}}></div>
1515
</div>

addon/components/widget/revenue-chart.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import Component from '@glimmer/component';
22
import { tracked } from '@glimmer/tracking';
33
import { inject as service } from '@ember/service';
44
import { task } from 'ember-concurrency';
5-
import { format } from 'date-fns';
65

76
export default class WidgetRevenueChartComponent extends Component {
87
@service fetch;
98
@service currentUser;
109
@tracked data = [];
1110

1211
get companyCurrency() {
13-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1413
}
1514

1615
constructor() {
@@ -29,7 +28,7 @@ export default class WidgetRevenueChartComponent extends Component {
2928
const maxAmount = trend.reduce((max, row) => Math.max(max, row.daily_revenue ?? 0), 0);
3029

3130
this.data = trend.map((row) => ({
32-
date: format(row.date, 'yyyy-MM-DD'),
31+
date: row.date,
3332
amount: row.daily_revenue ?? 0,
3433
// Percentage of the tallest bar; guard against division-by-zero.
3534
pct: maxAmount > 0 ? Math.round(((row.daily_revenue ?? 0) / maxAmount) * 100) : 0,

addon/components/widget/top-wallets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetTopWalletsComponent extends Component {
99
@tracked wallets = [];
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/components/widget/wallet-balances.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WidgetWalletBalancesComponent extends Component {
99
@tracked totals = null;
1010

1111
get companyCurrency() {
12-
return this.currentUser.getCompany()?.currency ?? 'USD';
12+
return this.currentUser.company?.currency ?? this.currentUser.whoisData?.currency?.code ?? 'USD';
1313
}
1414

1515
constructor() {

addon/extension.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export default {
5656
],
5757
});
5858

59+
console.log('[menuService]', menuService);
60+
5961
// ── Public customer invoice view ───────────────────────────────────────
6062
// Registers the customer-facing invoice view to the 'engine:ledger'
6163
// registry so it is accessible at /ledger/invoice/<public_id> without
@@ -99,8 +101,6 @@ export default {
99101
slug: 'invoice',
100102
})
101103
);
102-
console.log('[menuService]', menuService);
103-
console.log(menuService.getMenuItems('fleet-ops:component:order:details'));
104104

105105
// Register dashboard and widgets
106106
this.registerWidgets(widgetService);
@@ -125,7 +125,7 @@ export default {
125125
description: 'Daily revenue trend chart for the current period.',
126126
icon: 'chart-line',
127127
component: new ExtensionComponent('@fleetbase/ledger-engine', 'widget/revenue-chart'),
128-
grid_options: { w: 8, h: 6, minW: 6, minH: 5 },
128+
grid_options: { w: 8, h: 7, minW: 6, minH: 6 },
129129
options: { title: 'Revenue Chart' },
130130
default: true,
131131
}),
@@ -158,7 +158,7 @@ export default {
158158
description: 'Live feed of the most recent double-entry journal entries in the ledger.',
159159
icon: 'book',
160160
component: new ExtensionComponent('@fleetbase/ledger-engine', 'widget/activity-feed'),
161-
grid_options: { w: 8, h: 10, minW: 6, minH: 8 },
161+
grid_options: { w: 8, h: 11, minW: 6, minH: 8 },
162162
options: { title: 'Recent Journal Entries' },
163163
default: true,
164164
}),

0 commit comments

Comments
 (0)