@mj-biz-apps/orders-ng 5.51.0 → 5.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/lib/data/orders-queries.d.ts +32 -4
  2. package/dist/lib/data/orders-queries.d.ts.map +1 -1
  3. package/dist/lib/data/orders-queries.js +79 -7
  4. package/dist/lib/data/orders-queries.js.map +1 -1
  5. package/dist/lib/data/preset-view.d.ts +4 -3
  6. package/dist/lib/data/preset-view.d.ts.map +1 -1
  7. package/dist/lib/data/preset-view.js +4 -3
  8. package/dist/lib/data/preset-view.js.map +1 -1
  9. package/dist/lib/pages/receivables/customer-ar-page.model.d.ts +265 -0
  10. package/dist/lib/pages/receivables/customer-ar-page.model.d.ts.map +1 -0
  11. package/dist/lib/pages/receivables/customer-ar-page.model.js +576 -0
  12. package/dist/lib/pages/receivables/customer-ar-page.model.js.map +1 -0
  13. package/dist/lib/pages/receivables/customer-ar.page.d.ts +209 -79
  14. package/dist/lib/pages/receivables/customer-ar.page.d.ts.map +1 -1
  15. package/dist/lib/pages/receivables/customer-ar.page.js +2181 -568
  16. package/dist/lib/pages/receivables/customer-ar.page.js.map +1 -1
  17. package/dist/lib/panels/stat-tile.component.d.ts +10 -1
  18. package/dist/lib/panels/stat-tile.component.d.ts.map +1 -1
  19. package/dist/lib/panels/stat-tile.component.js +27 -6
  20. package/dist/lib/panels/stat-tile.component.js.map +1 -1
  21. package/dist/lib/sections/orders-sections.component.d.ts +33 -1
  22. package/dist/lib/sections/orders-sections.component.d.ts.map +1 -1
  23. package/dist/lib/sections/orders-sections.component.js +92 -7
  24. package/dist/lib/sections/orders-sections.component.js.map +1 -1
  25. package/dist/lib/sections/section-nav.model.js +5 -5
  26. package/dist/lib/sections/section-nav.model.js.map +1 -1
  27. package/package.json +35 -35
@@ -1,417 +1,1532 @@
1
- import { ChangeDetectorRef, Component, EventEmitter, Output, inject } from '@angular/core';
1
+ import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Output, inject } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { EntityViewerModule } from '@memberjunction/ng-entity-viewer';
4
- import { Metadata } from '@memberjunction/core';
5
- import { AddOrderToAgingBuckets, EmptyAgingBuckets, GroupInstalmentsByOrder, MJOAgingBarComponent, NextDueDayOf } from '../../panels/aging-bar.component.js';
6
- import { PresetViewRef } from '../../data/preset-view.js';
7
- import { MJOMoneyStripComponent } from '../../panels/money-strip.component.js';
8
- import { DaysSince, FormatDate, FormatMoney, Initials } from '../../panels/money-format.js';
9
- import { MJAlertComponent, MJEmptyStateComponent } from '@memberjunction/ng-ui-components';
10
- import { GetOpenBalanceOrders, GetOpenInstalments, GetPaymentsForCustomer, GetSubscriptionsForCustomer } from '../../data/orders-queries.js';
11
- import { MJO_ENTITIES } from '../../data/entity-names.js';
12
- import { MJO_ORDER_HEADER_GRID_STATE } from '../../data/orders-grid-state.js';
13
- import { Today } from '@mj-biz-apps/orders-entities';
3
+ import { CdkMenu, CdkMenuGroup, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
4
+ import { ExportService } from '@memberjunction/ng-export-service';
5
+ import { NavigationService } from '@memberjunction/ng-shared';
6
+ import { MJAlertComponent, MJButtonDirective, MJConfirmService, MJEmptyStateComponent, MJFilterChipComponent } from '@memberjunction/ng-ui-components';
7
+ import { OrdersIssueInstalmentInvoiceOperation, Today, } from '@mj-biz-apps/orders-entities';
8
+ import { CompositeKey } from '@memberjunction/core';
9
+ import { MJO_COMMON_ENTITIES, MJO_ENTITIES } from '../../data/entity-names.js';
10
+ import { GroupInstalmentsByOrder, MJOAgingBarComponent } from '../../panels/aging-bar.component.js';
11
+ import { FormatDate, FormatMoney, Initials } from '../../panels/money-format.js';
12
+ import { MJOMultiSelectComponent } from '../../panels/multi-select.component.js';
13
+ import { MJOStatTileComponent } from '../../panels/stat-tile.component.js';
14
+ import { GetInvoiceServiceByCompany, GetOpenInstalmentDetails, GetPaymentsForCustomer, GetReceivableOrders, GetSubscriptionsForCustomer, } from '../../data/orders-queries.js';
15
+ import { BuildCustomers, BuildItemsExport, BuildSummaryExport, CanIssue, CompanyOptions, FilterByCompany, ItemFilterOptions, ItemStatus, LastReceived, MatchesItemFilter, MatchesPreset, MatchesSearch, NeighbourKey, PruneCompanyPicks, ReadPageState, Slug, SortCustomers, SortItems, SumCustomers, UpdatedLabel, WritePageState, } from './customer-ar-page.model.js';
14
16
  import * as i0 from "@angular/core";
15
- import * as i1 from "@memberjunction/ng-entity-viewer";
16
17
  const _forTrack0 = ($index, $item) => $item.Key;
17
18
  const _forTrack1 = ($index, $item) => $item.ID;
18
- const _forTrack2 = ($index, $item) => $item["ID"];
19
- function MJOCustomerARPageComponent_For_20_Conditional_11_Template(rf, ctx) { if (rf & 1) {
20
- i0.ɵɵelementStart(0, "span", 23);
19
+ function MJOCustomerARPageComponent_Conditional_7_Template(rf, ctx) { if (rf & 1) {
20
+ const _r3 = i0.ɵɵgetCurrentView();
21
+ i0.ɵɵelementStart(0, "mj-filter-chip", 32);
22
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Conditional_7_Template_mj_filter_chip_Clicked_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.OnPreset("all")); });
23
+ i0.ɵɵelementEnd();
24
+ } if (rf & 2) {
25
+ const ctx_r3 = i0.ɵɵnextContext();
26
+ i0.ɵɵproperty("Label", ctx_r3.PresetLabel + " only")("Active", true);
27
+ } }
28
+ function MJOCustomerARPageComponent_Conditional_9_Template(rf, ctx) { if (rf & 1) {
29
+ i0.ɵɵtext(0);
30
+ } if (rf & 2) {
31
+ const ctx_r3 = i0.ɵɵnextContext();
32
+ i0.ɵɵtextInterpolate1(" As of ", ctx_r3.AsOfDisplay, " ");
33
+ } }
34
+ function MJOCustomerARPageComponent_Conditional_10_Template(rf, ctx) { if (rf & 1) {
35
+ i0.ɵɵtext(0);
36
+ } if (rf & 2) {
37
+ const ctx_r3 = i0.ɵɵnextContext();
38
+ i0.ɵɵtextInterpolate1(" \u00B7 ", ctx_r3.UpdatedText, " ");
39
+ } }
40
+ function MJOCustomerARPageComponent_ng_template_18_Template(rf, ctx) { if (rf & 1) {
41
+ const _r5 = i0.ɵɵgetCurrentView();
42
+ i0.ɵɵelementStart(0, "div", 33)(1, "div", 34)(2, "div", 35);
43
+ i0.ɵɵtext(3, "Aging summary, by customer");
44
+ i0.ɵɵelementEnd();
45
+ i0.ɵɵelementStart(4, "button", 36);
46
+ i0.ɵɵlistener("cdkMenuItemTriggered", function MJOCustomerARPageComponent_ng_template_18_Template_button_cdkMenuItemTriggered_4_listener() { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Export("summary", "excel")); });
47
+ i0.ɵɵelement(5, "i", 37);
48
+ i0.ɵɵtext(6, " Excel (.xlsx) ");
49
+ i0.ɵɵelementEnd();
50
+ i0.ɵɵelementStart(7, "button", 36);
51
+ i0.ɵɵlistener("cdkMenuItemTriggered", function MJOCustomerARPageComponent_ng_template_18_Template_button_cdkMenuItemTriggered_7_listener() { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Export("summary", "csv")); });
52
+ i0.ɵɵelement(8, "i", 38);
53
+ i0.ɵɵtext(9, " CSV ");
54
+ i0.ɵɵelementEnd()();
55
+ i0.ɵɵelementStart(10, "div", 39)(11, "div", 35);
56
+ i0.ɵɵtext(12, "Open items, by invoice");
57
+ i0.ɵɵelementEnd();
58
+ i0.ɵɵelementStart(13, "button", 36);
59
+ i0.ɵɵlistener("cdkMenuItemTriggered", function MJOCustomerARPageComponent_ng_template_18_Template_button_cdkMenuItemTriggered_13_listener() { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Export("items", "excel")); });
60
+ i0.ɵɵelement(14, "i", 37);
61
+ i0.ɵɵtext(15, " Excel (.xlsx) ");
62
+ i0.ɵɵelementEnd();
63
+ i0.ɵɵelementStart(16, "button", 36);
64
+ i0.ɵɵlistener("cdkMenuItemTriggered", function MJOCustomerARPageComponent_ng_template_18_Template_button_cdkMenuItemTriggered_16_listener() { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Export("items", "csv")); });
65
+ i0.ɵɵelement(17, "i", 38);
66
+ i0.ɵɵtext(18, " CSV ");
67
+ i0.ɵɵelementEnd()()();
68
+ } }
69
+ function MJOCustomerARPageComponent_Conditional_20_Template(rf, ctx) { if (rf & 1) {
70
+ i0.ɵɵelementStart(0, "mj-alert", 15);
21
71
  i0.ɵɵtext(1);
22
72
  i0.ɵɵelementEnd();
23
73
  } if (rf & 2) {
24
- const customer_r2 = i0.ɵɵnextContext().$implicit;
25
- const ctx_r2 = i0.ɵɵnextContext();
74
+ const ctx_r3 = i0.ɵɵnextContext();
75
+ i0.ɵɵproperty("Variant", ctx_r3.Notice.Tone);
26
76
  i0.ɵɵadvance();
27
- i0.ɵɵtextInterpolate1(" +", ctx_r2.money(customer_r2.Credit), " cr ");
77
+ i0.ɵɵtextInterpolate(ctx_r3.Notice.Text);
28
78
  } }
29
- function MJOCustomerARPageComponent_For_20_Template(rf, ctx) { if (rf & 1) {
30
- const _r1 = i0.ɵɵgetCurrentView();
31
- i0.ɵɵelementStart(0, "button", 16);
32
- i0.ɵɵlistener("click", function MJOCustomerARPageComponent_For_20_Template_button_click_0_listener() { const customer_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.Select(customer_r2.Key)); });
33
- i0.ɵɵelementStart(1, "span", 17);
34
- i0.ɵɵtext(2);
79
+ function MJOCustomerARPageComponent_Conditional_29_Template(rf, ctx) { if (rf & 1) {
80
+ const _r6 = i0.ɵɵgetCurrentView();
81
+ i0.ɵɵelementStart(0, "button", 40);
82
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_29_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r6); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Close()); });
83
+ i0.ɵɵelement(1, "i", 41);
84
+ i0.ɵɵtext(2, " All customers ");
35
85
  i0.ɵɵelementEnd();
36
- i0.ɵɵelementStart(3, "span", 18)(4, "span", 19);
37
- i0.ɵɵtext(5);
86
+ } }
87
+ function MJOCustomerARPageComponent_Conditional_30_Template(rf, ctx) { if (rf & 1) {
88
+ i0.ɵɵelement(0, "i", 42);
89
+ i0.ɵɵelementStart(1, "h3");
90
+ i0.ɵɵtext(2, "Customers");
91
+ i0.ɵɵelementEnd();
92
+ } }
93
+ function MJOCustomerARPageComponent_Conditional_33_Template(rf, ctx) { if (rf & 1) {
94
+ i0.ɵɵelementStart(0, "div", 26);
95
+ i0.ɵɵelement(1, "mjo-aging-bar", 43);
96
+ i0.ɵɵelementEnd();
97
+ } if (rf & 2) {
98
+ const ctx_r3 = i0.ɵɵnextContext();
99
+ i0.ɵɵadvance();
100
+ i0.ɵɵproperty("Buckets", ctx_r3.Totals.Buckets);
101
+ } }
102
+ function MJOCustomerARPageComponent_For_37_Conditional_4_Template(rf, ctx) { if (rf & 1) {
103
+ i0.ɵɵelement(0, "i", 47);
104
+ } if (rf & 2) {
105
+ const ctx_r3 = i0.ɵɵnextContext(2);
106
+ i0.ɵɵclassProp("fa-arrow-down", ctx_r3.SortDescending)("fa-arrow-up", !ctx_r3.SortDescending);
107
+ } }
108
+ function MJOCustomerARPageComponent_For_37_Template(rf, ctx) { if (rf & 1) {
109
+ const _r7 = i0.ɵɵgetCurrentView();
110
+ i0.ɵɵelementStart(0, "div", 44)(1, "button", 45);
111
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_For_37_Template_button_click_1_listener() { const column_r8 = i0.ɵɵrestoreView(_r7).$implicit; const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.OnSort(column_r8.Key)); });
112
+ i0.ɵɵelementStart(2, "span");
113
+ i0.ɵɵtext(3);
38
114
  i0.ɵɵelementEnd();
39
- i0.ɵɵelementStart(6, "span", 20);
40
- i0.ɵɵtext(7);
115
+ i0.ɵɵconditionalCreate(4, MJOCustomerARPageComponent_For_37_Conditional_4_Template, 1, 4, "i", 46);
41
116
  i0.ɵɵelementEnd()();
42
- i0.ɵɵelementStart(8, "span", 21)(9, "b", 22);
43
- i0.ɵɵtext(10);
117
+ } if (rf & 2) {
118
+ const column_r8 = ctx.$implicit;
119
+ const ctx_r3 = i0.ɵɵnextContext();
120
+ i0.ɵɵclassProp("mjo-ar__wide", column_r8.Wide);
121
+ i0.ɵɵattribute("aria-sort", ctx_r3.SortKey === column_r8.Key ? ctx_r3.SortDescending ? "descending" : "ascending" : "none");
122
+ i0.ɵɵadvance();
123
+ i0.ɵɵclassProp("mjo-ar__th--num", column_r8.Key !== "Name")("is-sorted", ctx_r3.SortKey === column_r8.Key);
124
+ i0.ɵɵproperty("title", column_r8.Title);
125
+ i0.ɵɵadvance(2);
126
+ i0.ɵɵtextInterpolate(column_r8.Label);
127
+ i0.ɵɵadvance();
128
+ i0.ɵɵconditional(ctx_r3.SortKey === column_r8.Key ? 4 : -1);
129
+ } }
130
+ function MJOCustomerARPageComponent_Conditional_38_For_1_Template(rf, ctx) { if (rf & 1) {
131
+ i0.ɵɵelementStart(0, "div", 48)(1, "span", 49);
132
+ i0.ɵɵelement(2, "span", 50)(3, "span", 51);
133
+ i0.ɵɵelementEnd();
134
+ i0.ɵɵelementStart(4, "span", 52);
135
+ i0.ɵɵelement(5, "span", 53);
136
+ i0.ɵɵelementEnd()();
137
+ } if (rf & 2) {
138
+ const line_r9 = ctx.$implicit;
139
+ i0.ɵɵadvance(3);
140
+ i0.ɵɵstyleProp("width", 38 + line_r9 * 7, "%");
141
+ } }
142
+ function MJOCustomerARPageComponent_Conditional_38_Template(rf, ctx) { if (rf & 1) {
143
+ i0.ɵɵrepeaterCreate(0, MJOCustomerARPageComponent_Conditional_38_For_1_Template, 6, 2, "div", 48, i0.ɵɵrepeaterTrackByIdentity);
144
+ } if (rf & 2) {
145
+ const ctx_r3 = i0.ɵɵnextContext();
146
+ i0.ɵɵrepeater(ctx_r3.Skeleton);
147
+ } }
148
+ function MJOCustomerARPageComponent_Conditional_39_Template(rf, ctx) { if (rf & 1) {
149
+ i0.ɵɵelementStart(0, "div", 30)(1, "div", 54);
150
+ i0.ɵɵelement(2, "mj-empty-state", 55);
151
+ i0.ɵɵelementEnd()();
152
+ } }
153
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_12_Template(rf, ctx) { if (rf & 1) {
154
+ i0.ɵɵelementStart(0, "span", 66);
155
+ i0.ɵɵelement(1, "i", 78)(2, "i", 79)(3, "i", 80)(4, "i", 81);
156
+ i0.ɵɵelementEnd();
157
+ } if (rf & 2) {
158
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
159
+ i0.ɵɵadvance();
160
+ i0.ɵɵstyleProp("flex-grow", customer_r11.Buckets.Current);
161
+ i0.ɵɵadvance();
162
+ i0.ɵɵstyleProp("flex-grow", customer_r11.Buckets.Days1To30);
163
+ i0.ɵɵadvance();
164
+ i0.ɵɵstyleProp("flex-grow", customer_r11.Buckets.Days31To60);
165
+ i0.ɵɵadvance();
166
+ i0.ɵɵstyleProp("flex-grow", customer_r11.Buckets.Days61Plus);
167
+ } }
168
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_13_Template(rf, ctx) { if (rf & 1) {
169
+ i0.ɵɵelementStart(0, "span", 67);
170
+ i0.ɵɵtext(1);
171
+ i0.ɵɵelementEnd();
172
+ } if (rf & 2) {
173
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
174
+ const ctx_r3 = i0.ɵɵnextContext(2);
175
+ i0.ɵɵadvance();
176
+ i0.ɵɵtextInterpolate1("", ctx_r3.money(customer_r11.Credit), " credit");
177
+ } }
178
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_15_Template(rf, ctx) { if (rf & 1) {
179
+ const _r12 = i0.ɵɵgetCurrentView();
180
+ i0.ɵɵelementStart(0, "button", 82);
181
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_15_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r12); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_15_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r12); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "pastdue", $event)); });
182
+ i0.ɵɵtext(1);
183
+ i0.ɵɵelementEnd();
184
+ } if (rf & 2) {
185
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
186
+ const ctx_r3 = i0.ɵɵnextContext(2);
187
+ i0.ɵɵadvance();
188
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.PastDue));
189
+ } }
190
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_16_Template(rf, ctx) { if (rf & 1) {
191
+ i0.ɵɵelementStart(0, "span", 70);
192
+ i0.ɵɵtext(1, "\u2014");
193
+ i0.ɵɵelementEnd();
194
+ } }
195
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_18_Template(rf, ctx) { if (rf & 1) {
196
+ const _r13 = i0.ɵɵgetCurrentView();
197
+ i0.ɵɵelementStart(0, "button", 83);
198
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_18_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r13); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_18_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r13); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "Current", $event)); });
199
+ i0.ɵɵtext(1);
200
+ i0.ɵɵelementEnd();
201
+ } if (rf & 2) {
202
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
203
+ const ctx_r3 = i0.ɵɵnextContext(2);
204
+ i0.ɵɵadvance();
205
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Buckets.Current));
206
+ } }
207
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_19_Template(rf, ctx) { if (rf & 1) {
208
+ i0.ɵɵelementStart(0, "span", 70);
209
+ i0.ɵɵtext(1, "\u2014");
210
+ i0.ɵɵelementEnd();
211
+ } }
212
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_21_Template(rf, ctx) { if (rf & 1) {
213
+ const _r14 = i0.ɵɵgetCurrentView();
214
+ i0.ɵɵelementStart(0, "button", 84);
215
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_21_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r14); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_21_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r14); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "Days1To30", $event)); });
216
+ i0.ɵɵtext(1);
217
+ i0.ɵɵelementEnd();
218
+ } if (rf & 2) {
219
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
220
+ const ctx_r3 = i0.ɵɵnextContext(2);
221
+ i0.ɵɵadvance();
222
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Buckets.Days1To30));
223
+ } }
224
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_22_Template(rf, ctx) { if (rf & 1) {
225
+ i0.ɵɵelementStart(0, "span", 70);
226
+ i0.ɵɵtext(1, "\u2014");
227
+ i0.ɵɵelementEnd();
228
+ } }
229
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_24_Template(rf, ctx) { if (rf & 1) {
230
+ const _r15 = i0.ɵɵgetCurrentView();
231
+ i0.ɵɵelementStart(0, "button", 85);
232
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_24_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r15); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_24_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r15); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "Days31To60", $event)); });
233
+ i0.ɵɵtext(1);
234
+ i0.ɵɵelementEnd();
235
+ } if (rf & 2) {
236
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
237
+ const ctx_r3 = i0.ɵɵnextContext(2);
238
+ i0.ɵɵadvance();
239
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Buckets.Days31To60));
240
+ } }
241
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_25_Template(rf, ctx) { if (rf & 1) {
242
+ i0.ɵɵelementStart(0, "span", 70);
243
+ i0.ɵɵtext(1, "\u2014");
44
244
  i0.ɵɵelementEnd();
45
- i0.ɵɵconditionalCreate(11, MJOCustomerARPageComponent_For_20_Conditional_11_Template, 2, 1, "span", 23);
245
+ } }
246
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_27_Template(rf, ctx) { if (rf & 1) {
247
+ const _r16 = i0.ɵɵgetCurrentView();
248
+ i0.ɵɵelementStart(0, "button", 86);
249
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_27_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r16); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_27_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r16); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "Days61Plus", $event)); });
250
+ i0.ɵɵtext(1);
251
+ i0.ɵɵelementEnd();
252
+ } if (rf & 2) {
253
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
254
+ const ctx_r3 = i0.ɵɵnextContext(2);
255
+ i0.ɵɵadvance();
256
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Buckets.Days61Plus));
257
+ } }
258
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_28_Template(rf, ctx) { if (rf & 1) {
259
+ i0.ɵɵelementStart(0, "span", 70);
260
+ i0.ɵɵtext(1, "\u2014");
261
+ i0.ɵɵelementEnd();
262
+ } }
263
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_30_Template(rf, ctx) { if (rf & 1) {
264
+ const _r17 = i0.ɵɵgetCurrentView();
265
+ i0.ɵɵelementStart(0, "button", 87);
266
+ i0.ɵɵlistener("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_30_Template_button_keydown_enter_0_listener($event) { i0.ɵɵrestoreView(_r17); return i0.ɵɵresetView($event.stopPropagation()); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_30_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r17); const customer_r11 = i0.ɵɵnextContext().$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenFiltered(customer_r11.Key, "scheduled", $event)); });
267
+ i0.ɵɵtext(1);
268
+ i0.ɵɵelementEnd();
269
+ } if (rf & 2) {
270
+ const customer_r11 = i0.ɵɵnextContext().$implicit;
271
+ const ctx_r3 = i0.ɵɵnextContext(2);
272
+ i0.ɵɵadvance();
273
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Scheduled));
274
+ } }
275
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_31_Template(rf, ctx) { if (rf & 1) {
276
+ i0.ɵɵelementStart(0, "span", 70);
277
+ i0.ɵɵtext(1, "\u2014");
278
+ i0.ɵɵelementEnd();
279
+ } }
280
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_35_Template(rf, ctx) { if (rf & 1) {
281
+ i0.ɵɵelementStart(0, "span", 77);
282
+ i0.ɵɵtext(1, "scheduled");
283
+ i0.ɵɵelementEnd();
284
+ } }
285
+ function MJOCustomerARPageComponent_Conditional_40_For_1_Template(rf, ctx) { if (rf & 1) {
286
+ const _r10 = i0.ɵɵgetCurrentView();
287
+ i0.ɵɵelementStart(0, "div", 58);
288
+ i0.ɵɵlistener("focus", function MJOCustomerARPageComponent_Conditional_40_For_1_Template_div_focus_0_listener() { const customer_r11 = i0.ɵɵrestoreView(_r10).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.FocusKey = customer_r11.Key); })("click", function MJOCustomerARPageComponent_Conditional_40_For_1_Template_div_click_0_listener() { const customer_r11 = i0.ɵɵrestoreView(_r10).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.Toggle(customer_r11.Key)); })("keydown.enter", function MJOCustomerARPageComponent_Conditional_40_For_1_Template_div_keydown_enter_0_listener() { const customer_r11 = i0.ɵɵrestoreView(_r10).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.Toggle(customer_r11.Key)); })("keydown.space", function MJOCustomerARPageComponent_Conditional_40_For_1_Template_div_keydown_space_0_listener($event) { const customer_r11 = i0.ɵɵrestoreView(_r10).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); $event.preventDefault(); return i0.ɵɵresetView(ctx_r3.Toggle(customer_r11.Key)); });
289
+ i0.ɵɵelementStart(1, "span", 59)(2, "span", 60);
290
+ i0.ɵɵtext(3);
291
+ i0.ɵɵelementEnd();
292
+ i0.ɵɵelementStart(4, "span", 61)(5, "span", 62);
293
+ i0.ɵɵtext(6);
294
+ i0.ɵɵelementEnd();
295
+ i0.ɵɵelementStart(7, "span", 63);
296
+ i0.ɵɵtext(8);
297
+ i0.ɵɵelementEnd()()();
298
+ i0.ɵɵelementStart(9, "span", 64)(10, "b", 65);
299
+ i0.ɵɵtext(11);
300
+ i0.ɵɵelementEnd();
301
+ i0.ɵɵconditionalCreate(12, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_12_Template, 5, 8, "span", 66);
302
+ i0.ɵɵconditionalCreate(13, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_13_Template, 2, 1, "span", 67);
303
+ i0.ɵɵelementEnd();
304
+ i0.ɵɵelementStart(14, "span", 68);
305
+ i0.ɵɵconditionalCreate(15, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_15_Template, 2, 1, "button", 69)(16, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_16_Template, 2, 0, "span", 70);
306
+ i0.ɵɵelementEnd();
307
+ i0.ɵɵelementStart(17, "span", 68);
308
+ i0.ɵɵconditionalCreate(18, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_18_Template, 2, 1, "button", 71)(19, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_19_Template, 2, 0, "span", 70);
309
+ i0.ɵɵelementEnd();
310
+ i0.ɵɵelementStart(20, "span", 68);
311
+ i0.ɵɵconditionalCreate(21, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_21_Template, 2, 1, "button", 72)(22, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_22_Template, 2, 0, "span", 70);
312
+ i0.ɵɵelementEnd();
313
+ i0.ɵɵelementStart(23, "span", 68);
314
+ i0.ɵɵconditionalCreate(24, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_24_Template, 2, 1, "button", 73)(25, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_25_Template, 2, 0, "span", 70);
315
+ i0.ɵɵelementEnd();
316
+ i0.ɵɵelementStart(26, "span", 68);
317
+ i0.ɵɵconditionalCreate(27, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_27_Template, 2, 1, "button", 74)(28, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_28_Template, 2, 0, "span", 70);
318
+ i0.ɵɵelementEnd();
319
+ i0.ɵɵelementStart(29, "span", 68);
320
+ i0.ɵɵconditionalCreate(30, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_30_Template, 2, 1, "button", 75)(31, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_31_Template, 2, 0, "span", 70);
321
+ i0.ɵɵelementEnd();
322
+ i0.ɵɵelementStart(32, "span", 76)(33, "span");
323
+ i0.ɵɵtext(34);
324
+ i0.ɵɵelementEnd();
325
+ i0.ɵɵconditionalCreate(35, MJOCustomerARPageComponent_Conditional_40_For_1_Conditional_35_Template, 2, 0, "span", 77);
326
+ i0.ɵɵelementEnd();
327
+ i0.ɵɵelementStart(36, "span", 68);
328
+ i0.ɵɵtext(37);
46
329
  i0.ɵɵelementEnd()();
47
330
  } if (rf & 2) {
48
- const customer_r2 = ctx.$implicit;
49
- const ctx_r2 = i0.ɵɵnextContext();
50
- i0.ɵɵclassProp("is-active", customer_r2.Key === ctx_r2.SelectedKey);
331
+ const customer_r11 = ctx.$implicit;
332
+ const ctx_r3 = i0.ɵɵnextContext(2);
333
+ i0.ɵɵclassProp("is-active", customer_r11.Key === ctx_r3.SelectedKey);
334
+ i0.ɵɵattribute("tabindex", customer_r11.Key === ctx_r3.FocusKey ? 0 : -1)("data-key", customer_r11.Key)("aria-current", customer_r11.Key === ctx_r3.SelectedKey ? "true" : null)("aria-label", ctx_r3.rowLabel(customer_r11));
335
+ i0.ɵɵadvance(3);
336
+ i0.ɵɵtextInterpolate(ctx_r3.initials(customer_r11.Name));
337
+ i0.ɵɵadvance(3);
338
+ i0.ɵɵtextInterpolate(customer_r11.Name);
339
+ i0.ɵɵadvance();
340
+ i0.ɵɵclassProp("mjo-ar__late", customer_r11.PastDue > 0)("muted", customer_r11.PastDue <= 0);
341
+ i0.ɵɵadvance();
342
+ i0.ɵɵtextInterpolate(ctx_r3.subLine(customer_r11));
343
+ i0.ɵɵadvance(3);
344
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r11.Owed));
345
+ i0.ɵɵadvance();
346
+ i0.ɵɵconditional(customer_r11.Owed > 0 ? 12 : -1);
347
+ i0.ɵɵadvance();
348
+ i0.ɵɵconditional(customer_r11.Credit > 0 ? 13 : -1);
51
349
  i0.ɵɵadvance(2);
52
- i0.ɵɵtextInterpolate(ctx_r2.initials(customer_r2.Name));
350
+ i0.ɵɵconditional(customer_r11.PastDue > 0 ? 15 : 16);
351
+ i0.ɵɵadvance(3);
352
+ i0.ɵɵconditional(customer_r11.Buckets.Current > 0 ? 18 : 19);
353
+ i0.ɵɵadvance(3);
354
+ i0.ɵɵconditional(customer_r11.Buckets.Days1To30 > 0 ? 21 : 22);
355
+ i0.ɵɵadvance(3);
356
+ i0.ɵɵconditional(customer_r11.Buckets.Days31To60 > 0 ? 24 : 25);
357
+ i0.ɵɵadvance(3);
358
+ i0.ɵɵconditional(customer_r11.Buckets.Days61Plus > 0 ? 27 : 28);
53
359
  i0.ɵɵadvance(3);
54
- i0.ɵɵtextInterpolate(customer_r2.Name);
360
+ i0.ɵɵconditional(customer_r11.Scheduled > 0 ? 30 : 31);
361
+ i0.ɵɵadvance(2);
362
+ i0.ɵɵclassProp("mjo-ar__zero", !customer_r11.NextDueDate);
363
+ i0.ɵɵadvance(2);
364
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(customer_r11.NextDueDate));
365
+ i0.ɵɵadvance();
366
+ i0.ɵɵconditional(customer_r11.NextDueDate && customer_r11.NextDueIsScheduled ? 35 : -1);
367
+ i0.ɵɵadvance();
368
+ i0.ɵɵclassProp("mjo-ar__zero", !customer_r11.NextDueDate);
369
+ i0.ɵɵadvance();
370
+ i0.ɵɵtextInterpolate(customer_r11.NextDueDate ? ctx_r3.money(customer_r11.NextDueAmount) : "\u2014");
371
+ } }
372
+ function MJOCustomerARPageComponent_Conditional_40_ForEmpty_2_Template(rf, ctx) { if (rf & 1) {
373
+ i0.ɵɵelementStart(0, "div", 30)(1, "div", 54);
374
+ i0.ɵɵelement(2, "mj-empty-state", 88);
375
+ i0.ɵɵelementEnd()();
376
+ } if (rf & 2) {
377
+ const ctx_r3 = i0.ɵɵnextContext(2);
55
378
  i0.ɵɵadvance(2);
56
- i0.ɵɵtextInterpolate1(" ", customer_r2.IsOrganization ? "Organization" : "Individual", " ");
379
+ i0.ɵɵproperty("Title", ctx_r3.AllCount ? "No customers match" : "No open A/R")("Message", ctx_r3.AllCount ? "Clear the search, the quick filter or the company filter to see more." : "No customer has an A/R balance, a scheduled installment or credit on account.");
380
+ } }
381
+ function MJOCustomerARPageComponent_Conditional_40_Conditional_3_Template(rf, ctx) { if (rf & 1) {
382
+ i0.ɵɵelementStart(0, "div", 57)(1, "span", 59)(2, "span", 62);
383
+ i0.ɵɵtext(3);
384
+ i0.ɵɵelementEnd()();
385
+ i0.ɵɵelementStart(4, "span", 89)(5, "b", 65);
386
+ i0.ɵɵtext(6);
387
+ i0.ɵɵelementEnd()();
388
+ i0.ɵɵelementStart(7, "span", 68);
389
+ i0.ɵɵtext(8);
390
+ i0.ɵɵelementEnd();
391
+ i0.ɵɵelementStart(9, "span", 68);
392
+ i0.ɵɵtext(10);
393
+ i0.ɵɵelementEnd();
394
+ i0.ɵɵelementStart(11, "span", 68);
395
+ i0.ɵɵtext(12);
396
+ i0.ɵɵelementEnd();
397
+ i0.ɵɵelementStart(13, "span", 68);
398
+ i0.ɵɵtext(14);
399
+ i0.ɵɵelementEnd();
400
+ i0.ɵɵelementStart(15, "span", 68);
401
+ i0.ɵɵtext(16);
402
+ i0.ɵɵelementEnd();
403
+ i0.ɵɵelementStart(17, "span", 68);
404
+ i0.ɵɵtext(18);
405
+ i0.ɵɵelementEnd();
406
+ i0.ɵɵelement(19, "span", 90)(20, "span", 90);
407
+ i0.ɵɵelementEnd();
408
+ } if (rf & 2) {
409
+ const ctx_r3 = i0.ɵɵnextContext(2);
57
410
  i0.ɵɵadvance(3);
58
- i0.ɵɵtextInterpolate(ctx_r2.money(customer_r2.Open));
411
+ i0.ɵɵtextInterpolate2("", ctx_r3.Preset === "all" && !ctx_r3.Search.trim() ? "Total" : "Total listed", " \u00B7 ", ctx_r3.plural(ctx_r3.Shown.length, "customer"));
412
+ i0.ɵɵadvance(3);
413
+ i0.ɵɵtextInterpolate(ctx_r3.money(ctx_r3.Totals.Owed));
414
+ i0.ɵɵadvance(2);
415
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.PastDue));
416
+ i0.ɵɵadvance(2);
417
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.Buckets.Current));
418
+ i0.ɵɵadvance(2);
419
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.Buckets.Days1To30));
420
+ i0.ɵɵadvance(2);
421
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.Buckets.Days31To60));
422
+ i0.ɵɵadvance(2);
423
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.Buckets.Days61Plus));
424
+ i0.ɵɵadvance(2);
425
+ i0.ɵɵtextInterpolate(ctx_r3.amount(ctx_r3.Totals.Scheduled));
426
+ } }
427
+ function MJOCustomerARPageComponent_Conditional_40_Template(rf, ctx) { if (rf & 1) {
428
+ i0.ɵɵrepeaterCreate(0, MJOCustomerARPageComponent_Conditional_40_For_1_Template, 38, 29, "div", 56, _forTrack0, false, MJOCustomerARPageComponent_Conditional_40_ForEmpty_2_Template, 3, 2, "div", 30);
429
+ i0.ɵɵconditionalCreate(3, MJOCustomerARPageComponent_Conditional_40_Conditional_3_Template, 21, 9, "div", 57);
430
+ } if (rf & 2) {
431
+ const ctx_r3 = i0.ɵɵnextContext();
432
+ i0.ɵɵrepeater(ctx_r3.Shown);
433
+ i0.ɵɵadvance(3);
434
+ i0.ɵɵconditional(ctx_r3.Shown.length > 1 ? 3 : -1);
435
+ } }
436
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_6_Template(rf, ctx) { if (rf & 1) {
437
+ const _r19 = i0.ɵɵgetCurrentView();
438
+ i0.ɵɵelementStart(0, "button", 122);
439
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_Conditional_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r19); const customer_r20 = i0.ɵɵnextContext(); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.OpenCustomerRecord(customer_r20)); });
440
+ i0.ɵɵtext(1);
441
+ i0.ɵɵelement(2, "i", 123);
442
+ i0.ɵɵelementEnd();
443
+ } if (rf & 2) {
444
+ const customer_r20 = i0.ɵɵnextContext();
445
+ i0.ɵɵproperty("title", "Open " + customer_r20.Name);
446
+ i0.ɵɵadvance();
447
+ i0.ɵɵtextInterpolate1(" ", customer_r20.Name, " ");
448
+ } }
449
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_7_Template(rf, ctx) { if (rf & 1) {
450
+ i0.ɵɵelementStart(0, "div", 97);
451
+ i0.ɵɵtext(1);
452
+ i0.ɵɵelementEnd();
453
+ } if (rf & 2) {
454
+ const customer_r20 = i0.ɵɵnextContext();
455
+ i0.ɵɵadvance();
456
+ i0.ɵɵtextInterpolate(customer_r20.Name);
457
+ } }
458
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_11_Template(rf, ctx) { if (rf & 1) {
459
+ const _r21 = i0.ɵɵgetCurrentView();
460
+ i0.ɵɵelementStart(0, "button", 124);
461
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_Conditional_11_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r21); const customer_r20 = i0.ɵɵnextContext(); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.RecordPayment(customer_r20)); });
462
+ i0.ɵɵelement(1, "i", 125);
463
+ i0.ɵɵtext(2, " Record payment ");
464
+ i0.ɵɵelementEnd();
465
+ } }
466
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_47_Template(rf, ctx) { if (rf & 1) {
467
+ const _r22 = i0.ɵɵgetCurrentView();
468
+ i0.ɵɵelementStart(0, "div", 105);
469
+ i0.ɵɵtext(1);
470
+ i0.ɵɵelementEnd();
471
+ i0.ɵɵelementStart(2, "div", 77);
472
+ i0.ɵɵtext(3);
473
+ i0.ɵɵelementStart(4, "button", 126);
474
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_Conditional_47_Template_button_click_4_listener() { const last_r23 = i0.ɵɵrestoreView(_r22); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.PaymentOpened.emit(last_r23)); });
475
+ i0.ɵɵtext(5);
476
+ i0.ɵɵelementEnd()();
477
+ } if (rf & 2) {
478
+ const last_r23 = ctx;
479
+ const ctx_r3 = i0.ɵɵnextContext(2);
480
+ i0.ɵɵadvance();
481
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(last_r23.PaymentDate));
482
+ i0.ɵɵadvance(2);
483
+ i0.ɵɵtextInterpolate1(" ", ctx_r3.money(last_r23.Amount), " \u00B7 ");
59
484
  i0.ɵɵadvance();
60
- i0.ɵɵconditional(customer_r2.Credit > 0 ? 11 : -1);
485
+ i0.ɵɵproperty("title", "Open payment " + last_r23.PaymentNumber);
486
+ i0.ɵɵadvance();
487
+ i0.ɵɵtextInterpolate(last_r23.PaymentNumber);
488
+ } }
489
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_48_Template(rf, ctx) { if (rf & 1) {
490
+ i0.ɵɵelementStart(0, "div", 105);
491
+ i0.ɵɵtext(1, "\u2014");
492
+ i0.ɵɵelementEnd();
493
+ i0.ɵɵelementStart(2, "div", 77);
494
+ i0.ɵɵtext(3);
495
+ i0.ɵɵelementEnd();
496
+ } if (rf & 2) {
497
+ const ctx_r3 = i0.ɵɵnextContext(2);
498
+ i0.ɵɵadvance(3);
499
+ i0.ɵɵtextInterpolate(ctx_r3.DetailLoading ? "Loading\u2026" : ctx_r3.DetailFailed ? "Could not be loaded" : "No payments received");
500
+ } }
501
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_49_Template(rf, ctx) { if (rf & 1) {
502
+ i0.ɵɵelementStart(0, "div", 103)(1, "div", 104);
503
+ i0.ɵɵtext(2, "Credit on account");
504
+ i0.ɵɵelementEnd();
505
+ i0.ɵɵelementStart(3, "div", 127);
506
+ i0.ɵɵtext(4);
507
+ i0.ɵɵelementEnd();
508
+ i0.ɵɵelementStart(5, "div", 77);
509
+ i0.ɵɵtext(6);
510
+ i0.ɵɵelementEnd()();
511
+ } if (rf & 2) {
512
+ const customer_r20 = i0.ɵɵnextContext();
513
+ const ctx_r3 = i0.ɵɵnextContext();
514
+ i0.ɵɵadvance(4);
515
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r20.Credit));
516
+ i0.ɵɵadvance(2);
517
+ i0.ɵɵtextInterpolate1("Net A/R ", ctx_r3.money(ctx_r3.netOwed(customer_r20)));
61
518
  } }
62
- function MJOCustomerARPageComponent_ForEmpty_21_Template(rf, ctx) { if (rf & 1) {
63
- i0.ɵɵelementStart(0, "div", 13);
64
- i0.ɵɵtext(1, "No customers with an open balance.");
519
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_50_Template(rf, ctx) { if (rf & 1) {
520
+ i0.ɵɵelementStart(0, "div", 106);
521
+ i0.ɵɵelement(1, "mjo-aging-bar", 43);
65
522
  i0.ɵɵelementEnd();
523
+ } if (rf & 2) {
524
+ const customer_r20 = i0.ɵɵnextContext();
525
+ i0.ɵɵadvance();
526
+ i0.ɵɵproperty("Buckets", customer_r20.Buckets);
66
527
  } }
67
- function MJOCustomerARPageComponent_Conditional_23_Conditional_13_Template(rf, ctx) { if (rf & 1) {
68
- i0.ɵɵelementStart(0, "mj-alert", 30)(1, "strong");
528
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_51_Template(rf, ctx) { if (rf & 1) {
529
+ i0.ɵɵelementStart(0, "mj-alert", 107)(1, "strong");
69
530
  i0.ɵɵtext(2);
70
531
  i0.ɵɵelementEnd();
71
- i0.ɵɵtext(3, " Consider applying the credit first. ");
532
+ i0.ɵɵtext(3, " To apply it, go to Payments, then Account credits. ");
72
533
  i0.ɵɵelementEnd();
73
534
  } if (rf & 2) {
74
- const ctx_r2 = i0.ɵɵnextContext(2);
535
+ const customer_r20 = i0.ɵɵnextContext();
536
+ const ctx_r3 = i0.ɵɵnextContext();
75
537
  i0.ɵɵadvance(2);
76
- i0.ɵɵtextInterpolate2("This customer has ", ctx_r2.money(ctx_r2.Selected.Credit), " of credit and owes ", ctx_r2.money(ctx_r2.Selected.Open), ".");
538
+ i0.ɵɵtextInterpolate2("This customer has ", ctx_r3.money(customer_r20.Credit), " credit on account and ", ctx_r3.money(customer_r20.Owed), " A/R.");
77
539
  } }
78
- function MJOCustomerARPageComponent_Conditional_23_Conditional_22_Template(rf, ctx) { if (rf & 1) {
79
- const _r4 = i0.ɵɵgetCurrentView();
80
- i0.ɵɵelementStart(0, "mj-entity-viewer", 45);
81
- i0.ɵɵlistener("RecordOpened", function MJOCustomerARPageComponent_Conditional_23_Conditional_22_Template_mj_entity_viewer_RecordOpened_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.OnRecordOpened($event)); });
540
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_59_For_2_Template(rf, ctx) { if (rf & 1) {
541
+ const _r24 = i0.ɵɵgetCurrentView();
542
+ i0.ɵɵelementStart(0, "mj-filter-chip", 129);
543
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Conditional_42_Conditional_59_For_2_Template_mj_filter_chip_Clicked_0_listener() { const option_r25 = i0.ɵɵrestoreView(_r24).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.OnItemFilter(option_r25.Key)); });
82
544
  i0.ɵɵelementEnd();
83
545
  } if (rf & 2) {
84
- const ctx_r2 = i0.ɵɵnextContext(2);
85
- i0.ɵɵproperty("Entity", ctx_r2.OrderEntityInfo)("ViewEntity", ctx_r2.CustomerOpenOrdersView)("GridState", ctx_r2.OrderGridState);
546
+ const option_r25 = ctx.$implicit;
547
+ const ctx_r3 = i0.ɵɵnextContext(3);
548
+ i0.ɵɵproperty("Label", option_r25.Label)("Count", option_r25.Key === "all" ? null : option_r25.Count)("Active", option_r25.Key === ctx_r3.ItemFilter);
86
549
  } }
87
- function MJOCustomerARPageComponent_Conditional_23_Conditional_23_Template(rf, ctx) { if (rf & 1) {
88
- i0.ɵɵelementStart(0, "div", 36);
89
- i0.ɵɵtext(1, "Loading open items...");
550
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_59_Template(rf, ctx) { if (rf & 1) {
551
+ i0.ɵɵelementStart(0, "div", 110);
552
+ i0.ɵɵrepeaterCreate(1, MJOCustomerARPageComponent_Conditional_42_Conditional_59_For_2_Template, 1, 3, "mj-filter-chip", 128, _forTrack0);
90
553
  i0.ɵɵelementEnd();
554
+ } if (rf & 2) {
555
+ const ctx_r3 = i0.ɵɵnextContext(2);
556
+ i0.ɵɵadvance();
557
+ i0.ɵɵrepeater(ctx_r3.ItemFilters);
91
558
  } }
92
- function MJOCustomerARPageComponent_Conditional_23_For_32_Template(rf, ctx) { if (rf & 1) {
93
- i0.ɵɵelementStart(0, "div", 39)(1, "span", 46);
559
+ function MJOCustomerARPageComponent_Conditional_42_For_65_Conditional_4_Template(rf, ctx) { if (rf & 1) {
560
+ i0.ɵɵelement(0, "i", 47);
561
+ } if (rf & 2) {
562
+ const ctx_r3 = i0.ɵɵnextContext(3);
563
+ i0.ɵɵclassProp("fa-arrow-down", ctx_r3.ItemSortDescending)("fa-arrow-up", !ctx_r3.ItemSortDescending);
564
+ } }
565
+ function MJOCustomerARPageComponent_Conditional_42_For_65_Conditional_5_Template(rf, ctx) { if (rf & 1) {
566
+ i0.ɵɵelement(0, "i", 131);
567
+ } }
568
+ function MJOCustomerARPageComponent_Conditional_42_For_65_Template(rf, ctx) { if (rf & 1) {
569
+ const _r26 = i0.ɵɵgetCurrentView();
570
+ i0.ɵɵelementStart(0, "th")(1, "button", 130);
571
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_65_Template_button_click_1_listener() { const column_r27 = i0.ɵɵrestoreView(_r26).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OnItemSort(column_r27.Key)); });
572
+ i0.ɵɵelementStart(2, "span");
573
+ i0.ɵɵtext(3);
574
+ i0.ɵɵelementEnd();
575
+ i0.ɵɵconditionalCreate(4, MJOCustomerARPageComponent_Conditional_42_For_65_Conditional_4_Template, 1, 4, "i", 46)(5, MJOCustomerARPageComponent_Conditional_42_For_65_Conditional_5_Template, 1, 0, "i", 131);
576
+ i0.ɵɵelementEnd()();
577
+ } if (rf & 2) {
578
+ const column_r27 = ctx.$implicit;
579
+ const ctx_r3 = i0.ɵɵnextContext(2);
580
+ i0.ɵɵclassProp("mjo-ar__right", column_r27.Right);
581
+ i0.ɵɵattribute("aria-sort", ctx_r3.ItemSortKey === column_r27.Key ? ctx_r3.ItemSortDescending ? "descending" : "ascending" : "none");
582
+ i0.ɵɵadvance();
583
+ i0.ɵɵclassProp("mjo-ar__ith--right", column_r27.Right)("is-sorted", ctx_r3.ItemSortKey === column_r27.Key);
584
+ i0.ɵɵproperty("title", "Sort by " + column_r27.Label.toLowerCase());
585
+ i0.ɵɵadvance(2);
586
+ i0.ɵɵtextInterpolate(column_r27.Label);
587
+ i0.ɵɵadvance();
588
+ i0.ɵɵconditional(ctx_r3.ItemSortKey === column_r27.Key ? 4 : 5);
589
+ } }
590
+ function MJOCustomerARPageComponent_Conditional_42_For_68_Conditional_18_Template(rf, ctx) { if (rf & 1) {
591
+ const _r30 = i0.ɵɵgetCurrentView();
592
+ i0.ɵɵelementStart(0, "button", 140);
593
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_68_Conditional_18_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r30); const item_r29 = i0.ɵɵnextContext().$implicit; const customer_r20 = i0.ɵɵnextContext(); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Issue(item_r29, customer_r20)); });
594
+ i0.ɵɵelement(1, "i", 141);
595
+ i0.ɵɵtext(2);
596
+ i0.ɵɵelementEnd();
597
+ } if (rf & 2) {
598
+ const item_r29 = i0.ɵɵnextContext().$implicit;
599
+ const ctx_r3 = i0.ɵɵnextContext(2);
600
+ i0.ɵɵproperty("disabled", ctx_r3.IssuingKey !== null);
601
+ i0.ɵɵadvance(2);
602
+ i0.ɵɵtextInterpolate1(" ", ctx_r3.IssuingKey === item_r29.Key ? "Issuing\u2026" : "Issue invoice", " ");
603
+ } }
604
+ function MJOCustomerARPageComponent_Conditional_42_For_68_Template(rf, ctx) { if (rf & 1) {
605
+ const _r28 = i0.ɵɵgetCurrentView();
606
+ i0.ɵɵelementStart(0, "tr", 132);
607
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_tr_click_0_listener() { const item_r29 = i0.ɵɵrestoreView(_r28).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenOrder(item_r29)); })("keydown.enter", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_tr_keydown_enter_0_listener() { const item_r29 = i0.ɵɵrestoreView(_r28).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenOrder(item_r29)); })("keydown.space", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_tr_keydown_space_0_listener($event) { const item_r29 = i0.ɵɵrestoreView(_r28).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); $event.preventDefault(); return i0.ɵɵresetView(ctx_r3.OpenOrder(item_r29)); });
608
+ i0.ɵɵelementStart(1, "td", 133);
94
609
  i0.ɵɵtext(2);
95
610
  i0.ɵɵelementEnd();
96
- i0.ɵɵelementStart(3, "b", 47);
611
+ i0.ɵɵelementStart(3, "td", 134);
612
+ i0.ɵɵtext(4);
613
+ i0.ɵɵelementEnd();
614
+ i0.ɵɵelementStart(5, "td", 134);
615
+ i0.ɵɵtext(6);
616
+ i0.ɵɵelementEnd();
617
+ i0.ɵɵelementStart(7, "td", 135);
618
+ i0.ɵɵtext(8);
619
+ i0.ɵɵelementEnd();
620
+ i0.ɵɵelementStart(9, "td", 134);
621
+ i0.ɵɵtext(10);
622
+ i0.ɵɵelementEnd();
623
+ i0.ɵɵelementStart(11, "td", 134);
624
+ i0.ɵɵtext(12);
625
+ i0.ɵɵelementEnd();
626
+ i0.ɵɵelementStart(13, "td", 136);
627
+ i0.ɵɵtext(14);
628
+ i0.ɵɵelementEnd();
629
+ i0.ɵɵelementStart(15, "td", 137);
630
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_td_click_15_listener($event) { i0.ɵɵrestoreView(_r28); return i0.ɵɵresetView($event.stopPropagation()); })("keydown.enter", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_td_keydown_enter_15_listener($event) { i0.ɵɵrestoreView(_r28); return i0.ɵɵresetView($event.stopPropagation()); })("keydown.space", function MJOCustomerARPageComponent_Conditional_42_For_68_Template_td_keydown_space_15_listener($event) { i0.ɵɵrestoreView(_r28); return i0.ɵɵresetView($event.stopPropagation()); });
631
+ i0.ɵɵelementStart(16, "span", 138);
632
+ i0.ɵɵtext(17);
633
+ i0.ɵɵelementEnd();
634
+ i0.ɵɵconditionalCreate(18, MJOCustomerARPageComponent_Conditional_42_For_68_Conditional_18_Template, 3, 2, "button", 139);
635
+ i0.ɵɵelementEnd();
636
+ i0.ɵɵelementStart(19, "td", 136);
637
+ i0.ɵɵtext(20);
638
+ i0.ɵɵelementEnd();
639
+ i0.ɵɵelementStart(21, "td", 136);
640
+ i0.ɵɵtext(22);
641
+ i0.ɵɵelementEnd();
642
+ i0.ɵɵelementStart(23, "td", 136)(24, "b");
643
+ i0.ɵɵtext(25);
644
+ i0.ɵɵelementEnd()()();
645
+ } if (rf & 2) {
646
+ const item_r29 = ctx.$implicit;
647
+ const ctx_r3 = i0.ɵɵnextContext(2);
648
+ i0.ɵɵattribute("aria-label", "Open order " + item_r29.OrderNumber);
649
+ i0.ɵɵadvance(2);
650
+ i0.ɵɵtextInterpolate(item_r29.OrderNumber);
651
+ i0.ɵɵadvance(2);
652
+ i0.ɵɵtextInterpolate(item_r29.Company || "\u2014");
653
+ i0.ɵɵadvance(2);
654
+ i0.ɵɵtextInterpolate(item_r29.Label);
655
+ i0.ɵɵadvance(2);
656
+ i0.ɵɵtextInterpolate(item_r29.DocumentNumber ?? "\u2014");
657
+ i0.ɵɵadvance(2);
658
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(item_r29.InvoicedOn));
659
+ i0.ɵɵadvance(2);
660
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(item_r29.DueDate));
661
+ i0.ɵɵadvance();
662
+ i0.ɵɵclassProp("mjo-ar__zero", !item_r29.DaysPastDue)("mjo-ar__very-late", item_r29.DaysPastDue > 60);
663
+ i0.ɵɵadvance();
664
+ i0.ɵɵtextInterpolate(item_r29.DaysPastDue || "\u2014");
665
+ i0.ɵɵadvance(2);
666
+ i0.ɵɵclassMap(ctx_r3.itemChip(item_r29));
667
+ i0.ɵɵadvance();
668
+ i0.ɵɵtextInterpolate(ctx_r3.itemStatus(item_r29));
669
+ i0.ɵɵadvance();
670
+ i0.ɵɵconditional(ctx_r3.canIssue(item_r29) ? 18 : -1);
671
+ i0.ɵɵadvance(2);
672
+ i0.ɵɵtextInterpolate(ctx_r3.money(item_r29.Amount));
673
+ i0.ɵɵadvance();
674
+ i0.ɵɵclassProp("mjo-ar__zero", !item_r29.Paid);
675
+ i0.ɵɵadvance();
676
+ i0.ɵɵtextInterpolate(ctx_r3.amount(item_r29.Paid));
677
+ i0.ɵɵadvance(3);
678
+ i0.ɵɵtextInterpolate(ctx_r3.money(item_r29.Balance));
679
+ } }
680
+ function MJOCustomerARPageComponent_Conditional_42_ForEmpty_69_Template(rf, ctx) { if (rf & 1) {
681
+ i0.ɵɵelementStart(0, "tr")(1, "td", 142);
682
+ i0.ɵɵtext(2);
683
+ i0.ɵɵelementEnd()();
684
+ } if (rf & 2) {
685
+ const customer_r20 = i0.ɵɵnextContext();
686
+ i0.ɵɵadvance(2);
687
+ i0.ɵɵtextInterpolate(customer_r20.Items.length ? "No items match this filter." : "No open items. This customer has credit on account only.");
688
+ } }
689
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_70_Template(rf, ctx) { if (rf & 1) {
690
+ i0.ɵɵelementStart(0, "tr", 115)(1, "td", 143);
691
+ i0.ɵɵtext(2);
692
+ i0.ɵɵelementEnd();
693
+ i0.ɵɵelementStart(3, "td", 136);
97
694
  i0.ɵɵtext(4);
98
695
  i0.ɵɵelementEnd()();
99
696
  } if (rf & 2) {
100
- const credit_r5 = ctx.$implicit;
101
- const ctx_r2 = i0.ɵɵnextContext(2);
697
+ const ctx_r3 = i0.ɵɵnextContext(2);
102
698
  i0.ɵɵadvance(2);
103
- i0.ɵɵtextInterpolate(credit_r5.OrderNumber);
699
+ i0.ɵɵtextInterpolate1("A/R \u00B7 ", ctx_r3.plural(ctx_r3.ShownReceivable.Count, "item"));
104
700
  i0.ɵɵadvance(2);
105
- i0.ɵɵtextInterpolate1(" ", ctx_r2.money(-ctx_r2.Math.abs(credit_r5.Balance ?? 0)), " ");
701
+ i0.ɵɵtextInterpolate(ctx_r3.money(ctx_r3.ShownReceivable.Amount));
106
702
  } }
107
- function MJOCustomerARPageComponent_Conditional_23_ForEmpty_33_Template(rf, ctx) { if (rf & 1) {
108
- i0.ɵɵelementStart(0, "div", 13);
703
+ function MJOCustomerARPageComponent_Conditional_42_Conditional_71_Template(rf, ctx) { if (rf & 1) {
704
+ i0.ɵɵelementStart(0, "tr", 115)(1, "td", 143);
705
+ i0.ɵɵtext(2);
706
+ i0.ɵɵelementEnd();
707
+ i0.ɵɵelementStart(3, "td", 136);
708
+ i0.ɵɵtext(4);
709
+ i0.ɵɵelementEnd()();
710
+ } if (rf & 2) {
711
+ const ctx_r3 = i0.ɵɵnextContext(2);
712
+ i0.ɵɵadvance(2);
713
+ i0.ɵɵtextInterpolate1("Scheduled, not yet invoiced \u00B7 ", ctx_r3.plural(ctx_r3.ShownScheduled.Count, "item"));
714
+ i0.ɵɵadvance(2);
715
+ i0.ɵɵtextInterpolate(ctx_r3.money(ctx_r3.ShownScheduled.Amount));
716
+ } }
717
+ function MJOCustomerARPageComponent_Conditional_42_For_80_Template(rf, ctx) { if (rf & 1) {
718
+ const _r31 = i0.ɵɵgetCurrentView();
719
+ i0.ɵɵelementStart(0, "div", 118)(1, "button", 126);
720
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_80_Template_button_click_1_listener() { const credit_r32 = i0.ɵɵrestoreView(_r31).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.OpenCredit(credit_r32.ID)); });
721
+ i0.ɵɵtext(2);
722
+ i0.ɵɵelementEnd();
723
+ i0.ɵɵelementStart(3, "b", 144);
724
+ i0.ɵɵtext(4);
725
+ i0.ɵɵelementEnd()();
726
+ } if (rf & 2) {
727
+ const credit_r32 = ctx.$implicit;
728
+ const ctx_r3 = i0.ɵɵnextContext(2);
729
+ i0.ɵɵadvance();
730
+ i0.ɵɵproperty("title", "Open order " + credit_r32.OrderNumber);
731
+ i0.ɵɵadvance();
732
+ i0.ɵɵtextInterpolate(credit_r32.OrderNumber);
733
+ i0.ɵɵadvance(2);
734
+ i0.ɵɵtextInterpolate(ctx_r3.money(credit_r32.Amount));
735
+ } }
736
+ function MJOCustomerARPageComponent_Conditional_42_ForEmpty_81_Template(rf, ctx) { if (rf & 1) {
737
+ i0.ɵɵelementStart(0, "div", 77);
109
738
  i0.ɵɵtext(1, "No credit on account.");
110
739
  i0.ɵɵelementEnd();
111
740
  } }
112
- function MJOCustomerARPageComponent_Conditional_23_Conditional_34_Template(rf, ctx) { if (rf & 1) {
113
- i0.ɵɵelementStart(0, "div", 8);
114
- i0.ɵɵtext(1, " Apply this credit before issuing the next invoice. ");
741
+ function MJOCustomerARPageComponent_Conditional_42_For_89_Conditional_6_Template(rf, ctx) { if (rf & 1) {
742
+ i0.ɵɵelementStart(0, "span", 145);
743
+ i0.ɵɵtext(1);
115
744
  i0.ɵɵelementEnd();
745
+ } if (rf & 2) {
746
+ const payment_r34 = i0.ɵɵnextContext().$implicit;
747
+ i0.ɵɵadvance();
748
+ i0.ɵɵtextInterpolate1(" \u00B7 ", payment_r34.Status);
116
749
  } }
117
- function MJOCustomerARPageComponent_Conditional_23_For_42_Template(rf, ctx) { if (rf & 1) {
118
- i0.ɵɵelementStart(0, "div", 39)(1, "span", 48)(2, "span", 49);
750
+ function MJOCustomerARPageComponent_Conditional_42_For_89_Template(rf, ctx) { if (rf & 1) {
751
+ const _r33 = i0.ɵɵgetCurrentView();
752
+ i0.ɵɵelementStart(0, "div", 118)(1, "span", 134)(2, "button", 126);
753
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_89_Template_button_click_2_listener() { const payment_r34 = i0.ɵɵrestoreView(_r33).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.PaymentOpened.emit(payment_r34)); });
119
754
  i0.ɵɵtext(3);
120
755
  i0.ɵɵelementEnd();
121
- i0.ɵɵelementStart(4, "span", 50);
756
+ i0.ɵɵelementStart(4, "span", 145);
122
757
  i0.ɵɵtext(5);
123
- i0.ɵɵelementEnd()();
124
- i0.ɵɵelementStart(6, "b", 22);
125
- i0.ɵɵtext(7);
758
+ i0.ɵɵelementEnd();
759
+ i0.ɵɵconditionalCreate(6, MJOCustomerARPageComponent_Conditional_42_For_89_Conditional_6_Template, 2, 1, "span", 145);
760
+ i0.ɵɵelementEnd();
761
+ i0.ɵɵelementStart(7, "b", 65);
762
+ i0.ɵɵtext(8);
126
763
  i0.ɵɵelementEnd()();
127
764
  } if (rf & 2) {
128
- const payment_r6 = ctx.$implicit;
129
- const ctx_r2 = i0.ɵɵnextContext(2);
130
- i0.ɵɵadvance(3);
131
- i0.ɵɵtextInterpolate(payment_r6.PaymentNumber);
765
+ const payment_r34 = ctx.$implicit;
766
+ const ctx_r3 = i0.ɵɵnextContext(2);
132
767
  i0.ɵɵadvance(2);
133
- i0.ɵɵtextInterpolate1(" \u00B7 ", ctx_r2.dateOf(payment_r6.PaymentDate));
768
+ i0.ɵɵproperty("title", "Open payment " + payment_r34.PaymentNumber);
769
+ i0.ɵɵadvance();
770
+ i0.ɵɵtextInterpolate(payment_r34.PaymentNumber);
134
771
  i0.ɵɵadvance(2);
135
- i0.ɵɵtextInterpolate(ctx_r2.money(payment_r6.Amount ?? 0));
772
+ i0.ɵɵtextInterpolate1(" \u00B7 ", ctx_r3.dateOf(payment_r34.PaymentDate));
773
+ i0.ɵɵadvance();
774
+ i0.ɵɵconditional(payment_r34.Status !== "Captured" ? 6 : -1);
775
+ i0.ɵɵadvance();
776
+ i0.ɵɵclassProp("mjo-ar__zero", payment_r34.Status !== "Captured");
777
+ i0.ɵɵadvance();
778
+ i0.ɵɵtextInterpolate(ctx_r3.money(payment_r34.Amount));
136
779
  } }
137
- function MJOCustomerARPageComponent_Conditional_23_ForEmpty_43_Template(rf, ctx) { if (rf & 1) {
138
- i0.ɵɵelementStart(0, "div", 13);
139
- i0.ɵɵtext(1, " No payments recorded for this customer. ");
780
+ function MJOCustomerARPageComponent_Conditional_42_ForEmpty_90_Template(rf, ctx) { if (rf & 1) {
781
+ i0.ɵɵelementStart(0, "div", 77);
782
+ i0.ɵɵtext(1);
140
783
  i0.ɵɵelementEnd();
784
+ } if (rf & 2) {
785
+ const ctx_r3 = i0.ɵɵnextContext(2);
786
+ i0.ɵɵadvance();
787
+ i0.ɵɵtextInterpolate(ctx_r3.DetailLoading ? "Loading payments\u2026" : ctx_r3.DetailFailed ? "Payments could not be loaded." : "No payments received.");
141
788
  } }
142
- function MJOCustomerARPageComponent_Conditional_23_For_67_Template(rf, ctx) { if (rf & 1) {
143
- i0.ɵɵelementStart(0, "tr")(1, "td", 46);
789
+ function MJOCustomerARPageComponent_Conditional_42_For_114_Template(rf, ctx) { if (rf & 1) {
790
+ const _r35 = i0.ɵɵgetCurrentView();
791
+ i0.ɵɵelementStart(0, "tr", 146);
792
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_For_114_Template_tr_click_0_listener() { const sub_r36 = i0.ɵɵrestoreView(_r35).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.SubscriptionOpened.emit(sub_r36)); })("keydown.enter", function MJOCustomerARPageComponent_Conditional_42_For_114_Template_tr_keydown_enter_0_listener() { const sub_r36 = i0.ɵɵrestoreView(_r35).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.SubscriptionOpened.emit(sub_r36)); });
793
+ i0.ɵɵelementStart(1, "td", 135);
144
794
  i0.ɵɵtext(2);
145
795
  i0.ɵɵelementEnd();
146
- i0.ɵɵelementStart(3, "td", 48);
796
+ i0.ɵɵelementStart(3, "td", 134);
147
797
  i0.ɵɵtext(4);
148
798
  i0.ɵɵelementEnd();
149
- i0.ɵɵelementStart(5, "td", 48);
799
+ i0.ɵɵelementStart(5, "td", 134);
150
800
  i0.ɵɵtext(6);
151
801
  i0.ɵɵelementEnd();
152
- i0.ɵɵelementStart(7, "td", 48);
802
+ i0.ɵɵelementStart(7, "td", 134);
153
803
  i0.ɵɵtext(8);
154
804
  i0.ɵɵelementEnd();
155
- i0.ɵɵelementStart(9, "td")(10, "span", 51);
805
+ i0.ɵɵelementStart(9, "td")(10, "span", 138);
156
806
  i0.ɵɵtext(11);
157
807
  i0.ɵɵelementEnd()()();
158
808
  } if (rf & 2) {
159
- const sub_r7 = ctx.$implicit;
160
- const ctx_r2 = i0.ɵɵnextContext(2);
809
+ const sub_r36 = ctx.$implicit;
810
+ const ctx_r3 = i0.ɵɵnextContext(2);
811
+ i0.ɵɵattribute("aria-label", "Open subscription " + sub_r36.SubscriptionNumber);
161
812
  i0.ɵɵadvance(2);
162
- i0.ɵɵtextInterpolate(sub_r7["SubscriptionNumber"]);
813
+ i0.ɵɵtextInterpolate(sub_r36.SubscriptionNumber);
163
814
  i0.ɵɵadvance(2);
164
- i0.ɵɵtextInterpolate(sub_r7["Product"] ?? "\u2014");
815
+ i0.ɵɵtextInterpolate(sub_r36.Product || "\u2014");
165
816
  i0.ɵɵadvance(2);
166
- i0.ɵɵtextInterpolate(ctx_r2.dateOf(sub_r7["EndDate"]));
817
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(sub_r36.EndDate));
167
818
  i0.ɵɵadvance(2);
168
- i0.ɵɵtextInterpolate1(" ", sub_r7["AutoRenew"] ? "automatically" : "it simply ends", " ");
819
+ i0.ɵɵtextInterpolate(sub_r36.AutoRenew ? "Auto-renews" : "Manual renewal");
169
820
  i0.ɵɵadvance(2);
170
- i0.ɵɵclassMap(ctx_r2.subClass(sub_r7));
821
+ i0.ɵɵclassMap(ctx_r3.subClass(sub_r36));
171
822
  i0.ɵɵadvance();
172
- i0.ɵɵtextInterpolate1(" ", sub_r7["Status"] ?? "\u2014", " ");
823
+ i0.ɵɵtextInterpolate(sub_r36.Status || "\u2014");
173
824
  } }
174
- function MJOCustomerARPageComponent_Conditional_23_ForEmpty_68_Template(rf, ctx) { if (rf & 1) {
175
- i0.ɵɵelementStart(0, "tr")(1, "td", 52);
176
- i0.ɵɵtext(2, " No subscriptions. ");
825
+ function MJOCustomerARPageComponent_Conditional_42_ForEmpty_115_Template(rf, ctx) { if (rf & 1) {
826
+ i0.ɵɵelementStart(0, "tr")(1, "td", 147);
827
+ i0.ɵɵtext(2);
177
828
  i0.ɵɵelementEnd()();
829
+ } if (rf & 2) {
830
+ const ctx_r3 = i0.ɵɵnextContext(2);
831
+ i0.ɵɵadvance(2);
832
+ i0.ɵɵtextInterpolate(ctx_r3.DetailLoading ? "Loading subscriptions\u2026" : ctx_r3.DetailFailed ? "Subscriptions could not be loaded." : "No subscriptions.");
178
833
  } }
179
- function MJOCustomerARPageComponent_Conditional_23_Template(rf, ctx) { if (rf & 1) {
180
- i0.ɵɵelementStart(0, "div", 9)(1, "div", 6)(2, "div", 24)(3, "span", 25);
834
+ function MJOCustomerARPageComponent_Conditional_42_Template(rf, ctx) { if (rf & 1) {
835
+ const _r18 = i0.ɵɵgetCurrentView();
836
+ i0.ɵɵelementStart(0, "div", 91)(1, "div", 92)(2, "div", 93)(3, "span", 94);
181
837
  i0.ɵɵtext(4);
182
838
  i0.ɵɵelementEnd();
183
- i0.ɵɵelementStart(5, "div", 26)(6, "div", 27);
184
- i0.ɵɵtext(7);
185
- i0.ɵɵelementEnd();
186
- i0.ɵɵelementStart(8, "div", 13);
839
+ i0.ɵɵelementStart(5, "div", 95);
840
+ i0.ɵɵconditionalCreate(6, MJOCustomerARPageComponent_Conditional_42_Conditional_6_Template, 3, 2, "button", 96)(7, MJOCustomerARPageComponent_Conditional_42_Conditional_7_Template, 2, 1, "div", 97);
841
+ i0.ɵɵelementStart(8, "div", 77);
187
842
  i0.ɵɵtext(9);
843
+ i0.ɵɵelementEnd()();
844
+ i0.ɵɵelementStart(10, "div", 98);
845
+ i0.ɵɵconditionalCreate(11, MJOCustomerARPageComponent_Conditional_42_Conditional_11_Template, 3, 0, "button", 99);
846
+ i0.ɵɵelementStart(12, "button", 100);
847
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Conditional_42_Template_button_click_12_listener() { i0.ɵɵrestoreView(_r18); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Close()); });
848
+ i0.ɵɵelement(13, "i", 101);
849
+ i0.ɵɵtext(14, " Close ");
188
850
  i0.ɵɵelementEnd()()();
189
- i0.ɵɵelement(10, "mjo-money-strip", 28);
190
- i0.ɵɵelementStart(11, "div", 29);
191
- i0.ɵɵelement(12, "mjo-aging-bar", 7);
851
+ i0.ɵɵelementStart(15, "div", 102)(16, "div", 103)(17, "div", 104);
852
+ i0.ɵɵtext(18, "A/R");
853
+ i0.ɵɵelementEnd();
854
+ i0.ɵɵelementStart(19, "div", 105);
855
+ i0.ɵɵtext(20);
192
856
  i0.ɵɵelementEnd();
193
- i0.ɵɵconditionalCreate(13, MJOCustomerARPageComponent_Conditional_23_Conditional_13_Template, 4, 2, "mj-alert", 30);
857
+ i0.ɵɵelementStart(21, "div", 77);
858
+ i0.ɵɵtext(22, "Invoiced and unpaid");
194
859
  i0.ɵɵelementEnd()();
195
- i0.ɵɵelementStart(14, "div", 31)(15, "div", 3);
196
- i0.ɵɵelement(16, "i", 32);
197
- i0.ɵɵelementStart(17, "h3");
198
- i0.ɵɵtext(18, "Open items");
860
+ i0.ɵɵelementStart(23, "div", 103)(24, "div", 104);
861
+ i0.ɵɵtext(25, "Past due");
199
862
  i0.ɵɵelementEnd();
200
- i0.ɵɵelementStart(19, "span", 33);
201
- i0.ɵɵtext(20, "oldest first");
863
+ i0.ɵɵelementStart(26, "div", 105);
864
+ i0.ɵɵtext(27);
865
+ i0.ɵɵelementEnd();
866
+ i0.ɵɵelementStart(28, "div", 77);
867
+ i0.ɵɵtext(29);
202
868
  i0.ɵɵelementEnd()();
203
- i0.ɵɵelementStart(21, "div", 34);
204
- i0.ɵɵconditionalCreate(22, MJOCustomerARPageComponent_Conditional_23_Conditional_22_Template, 1, 3, "mj-entity-viewer", 35)(23, MJOCustomerARPageComponent_Conditional_23_Conditional_23_Template, 2, 0, "div", 36);
869
+ i0.ɵɵelementStart(30, "div", 103)(31, "div", 104);
870
+ i0.ɵɵtext(32, "Scheduled");
871
+ i0.ɵɵelementEnd();
872
+ i0.ɵɵelementStart(33, "div", 105);
873
+ i0.ɵɵtext(34);
874
+ i0.ɵɵelementEnd();
875
+ i0.ɵɵelementStart(35, "div", 77);
876
+ i0.ɵɵtext(36);
205
877
  i0.ɵɵelementEnd()();
206
- i0.ɵɵelementStart(24, "div", 37)(25, "div", 9)(26, "div", 3);
207
- i0.ɵɵelement(27, "i", 38);
208
- i0.ɵɵelementStart(28, "h3");
209
- i0.ɵɵtext(29, "Credits on account");
878
+ i0.ɵɵelementStart(37, "div", 103)(38, "div", 104);
879
+ i0.ɵɵtext(39);
880
+ i0.ɵɵelementEnd();
881
+ i0.ɵɵelementStart(40, "div", 105);
882
+ i0.ɵɵtext(41);
883
+ i0.ɵɵelementEnd();
884
+ i0.ɵɵelementStart(42, "div", 77);
885
+ i0.ɵɵtext(43);
210
886
  i0.ɵɵelementEnd()();
211
- i0.ɵɵelementStart(30, "div", 6);
212
- i0.ɵɵrepeaterCreate(31, MJOCustomerARPageComponent_Conditional_23_For_32_Template, 5, 2, "div", 39, _forTrack1, false, MJOCustomerARPageComponent_Conditional_23_ForEmpty_33_Template, 2, 0, "div", 13);
213
- i0.ɵɵconditionalCreate(34, MJOCustomerARPageComponent_Conditional_23_Conditional_34_Template, 2, 0, "div", 8);
887
+ i0.ɵɵelementStart(44, "div", 103)(45, "div", 104);
888
+ i0.ɵɵtext(46, "Last payment");
889
+ i0.ɵɵelementEnd();
890
+ i0.ɵɵconditionalCreate(47, MJOCustomerARPageComponent_Conditional_42_Conditional_47_Template, 6, 4)(48, MJOCustomerARPageComponent_Conditional_42_Conditional_48_Template, 4, 1);
891
+ i0.ɵɵelementEnd();
892
+ i0.ɵɵconditionalCreate(49, MJOCustomerARPageComponent_Conditional_42_Conditional_49_Template, 7, 2, "div", 103);
893
+ i0.ɵɵelementEnd();
894
+ i0.ɵɵconditionalCreate(50, MJOCustomerARPageComponent_Conditional_42_Conditional_50_Template, 2, 1, "div", 106);
895
+ i0.ɵɵconditionalCreate(51, MJOCustomerARPageComponent_Conditional_42_Conditional_51_Template, 4, 2, "mj-alert", 107);
896
+ i0.ɵɵelementEnd()();
897
+ i0.ɵɵelementStart(52, "div", 108)(53, "div", 23);
898
+ i0.ɵɵelement(54, "i", 109);
899
+ i0.ɵɵelementStart(55, "h3");
900
+ i0.ɵɵtext(56, "Open items");
901
+ i0.ɵɵelementEnd();
902
+ i0.ɵɵelementStart(57, "span", 25);
903
+ i0.ɵɵtext(58);
214
904
  i0.ɵɵelementEnd()();
215
- i0.ɵɵelementStart(35, "div", 9)(36, "div", 3);
216
- i0.ɵɵelement(37, "i", 40);
217
- i0.ɵɵelementStart(38, "h3");
218
- i0.ɵɵtext(39, "Payment history");
905
+ i0.ɵɵconditionalCreate(59, MJOCustomerARPageComponent_Conditional_42_Conditional_59_Template, 3, 0, "div", 110);
906
+ i0.ɵɵelementStart(60, "div", 111)(61, "table", 112)(62, "thead")(63, "tr");
907
+ i0.ɵɵrepeaterCreate(64, MJOCustomerARPageComponent_Conditional_42_For_65_Template, 6, 10, "th", 113, _forTrack0);
219
908
  i0.ɵɵelementEnd()();
220
- i0.ɵɵelementStart(40, "div", 6);
221
- i0.ɵɵrepeaterCreate(41, MJOCustomerARPageComponent_Conditional_23_For_42_Template, 8, 3, "div", 39, _forTrack1, false, MJOCustomerARPageComponent_Conditional_23_ForEmpty_43_Template, 2, 0, "div", 13);
909
+ i0.ɵɵelementStart(66, "tbody");
910
+ i0.ɵɵrepeaterCreate(67, MJOCustomerARPageComponent_Conditional_42_For_68_Template, 26, 21, "tr", 114, _forTrack0, false, MJOCustomerARPageComponent_Conditional_42_ForEmpty_69_Template, 3, 1, "tr");
911
+ i0.ɵɵconditionalCreate(70, MJOCustomerARPageComponent_Conditional_42_Conditional_70_Template, 5, 2, "tr", 115);
912
+ i0.ɵɵconditionalCreate(71, MJOCustomerARPageComponent_Conditional_42_Conditional_71_Template, 5, 2, "tr", 115);
913
+ i0.ɵɵelementEnd()()()();
914
+ i0.ɵɵelementStart(72, "div", 116)(73, "div", 91)(74, "div", 23);
915
+ i0.ɵɵelement(75, "i", 117);
916
+ i0.ɵɵelementStart(76, "h3");
917
+ i0.ɵɵtext(77, "Credit on account");
918
+ i0.ɵɵelementEnd()();
919
+ i0.ɵɵelementStart(78, "div", 92);
920
+ i0.ɵɵrepeaterCreate(79, MJOCustomerARPageComponent_Conditional_42_For_80_Template, 5, 3, "div", 118, _forTrack1, false, MJOCustomerARPageComponent_Conditional_42_ForEmpty_81_Template, 2, 0, "div", 77);
921
+ i0.ɵɵelementEnd()();
922
+ i0.ɵɵelementStart(82, "div", 91)(83, "div", 23);
923
+ i0.ɵɵelement(84, "i", 119);
924
+ i0.ɵɵelementStart(85, "h3");
925
+ i0.ɵɵtext(86, "Payment history");
926
+ i0.ɵɵelementEnd()();
927
+ i0.ɵɵelementStart(87, "div", 92);
928
+ i0.ɵɵrepeaterCreate(88, MJOCustomerARPageComponent_Conditional_42_For_89_Template, 9, 7, "div", 118, _forTrack1, false, MJOCustomerARPageComponent_Conditional_42_ForEmpty_90_Template, 2, 1, "div", 77);
222
929
  i0.ɵɵelementEnd()()();
223
- i0.ɵɵelementStart(44, "div", 41)(45, "div", 3);
224
- i0.ɵɵelement(46, "i", 42);
225
- i0.ɵɵelementStart(47, "h3");
226
- i0.ɵɵtext(48, "Subscriptions");
930
+ i0.ɵɵelementStart(91, "div", 108)(92, "div", 23);
931
+ i0.ɵɵelement(93, "i", 120);
932
+ i0.ɵɵelementStart(94, "h3");
933
+ i0.ɵɵtext(95, "Subscriptions");
227
934
  i0.ɵɵelementEnd();
228
- i0.ɵɵelementStart(49, "span", 33);
229
- i0.ɵɵtext(50);
935
+ i0.ɵɵelementStart(96, "span", 25);
936
+ i0.ɵɵtext(97);
230
937
  i0.ɵɵelementEnd()();
231
- i0.ɵɵelementStart(51, "div", 43)(52, "table", 44)(53, "thead")(54, "tr")(55, "th");
232
- i0.ɵɵtext(56, "Subscription");
938
+ i0.ɵɵelementStart(98, "div", 121)(99, "table", 112)(100, "thead")(101, "tr")(102, "th");
939
+ i0.ɵɵtext(103, "Subscription");
233
940
  i0.ɵɵelementEnd();
234
- i0.ɵɵelementStart(57, "th");
235
- i0.ɵɵtext(58, "Product");
941
+ i0.ɵɵelementStart(104, "th");
942
+ i0.ɵɵtext(105, "Product");
236
943
  i0.ɵɵelementEnd();
237
- i0.ɵɵelementStart(59, "th");
238
- i0.ɵɵtext(60, "Covered to");
944
+ i0.ɵɵelementStart(106, "th");
945
+ i0.ɵɵtext(107, "Covered through");
239
946
  i0.ɵɵelementEnd();
240
- i0.ɵɵelementStart(61, "th");
241
- i0.ɵɵtext(62, "Renews");
947
+ i0.ɵɵelementStart(108, "th");
948
+ i0.ɵɵtext(109, "Renewal");
242
949
  i0.ɵɵelementEnd();
243
- i0.ɵɵelementStart(63, "th");
244
- i0.ɵɵtext(64, "Status");
950
+ i0.ɵɵelementStart(110, "th");
951
+ i0.ɵɵtext(111, "Status");
245
952
  i0.ɵɵelementEnd()()();
246
- i0.ɵɵelementStart(65, "tbody");
247
- i0.ɵɵrepeaterCreate(66, MJOCustomerARPageComponent_Conditional_23_For_67_Template, 12, 7, "tr", null, _forTrack2, false, MJOCustomerARPageComponent_Conditional_23_ForEmpty_68_Template, 3, 0, "tr");
953
+ i0.ɵɵelementStart(112, "tbody");
954
+ i0.ɵɵrepeaterCreate(113, MJOCustomerARPageComponent_Conditional_42_For_114_Template, 12, 8, "tr", 114, _forTrack1, false, MJOCustomerARPageComponent_Conditional_42_ForEmpty_115_Template, 3, 1, "tr");
248
955
  i0.ɵɵelementEnd()()()();
249
956
  } if (rf & 2) {
250
- const ctx_r2 = i0.ɵɵnextContext();
957
+ let tmp_17_0;
958
+ const customer_r20 = ctx;
959
+ const ctx_r3 = i0.ɵɵnextContext();
251
960
  i0.ɵɵadvance(4);
252
- i0.ɵɵtextInterpolate(ctx_r2.initials(ctx_r2.Selected.Name));
961
+ i0.ɵɵtextInterpolate(ctx_r3.initials(customer_r20.Name));
962
+ i0.ɵɵadvance(2);
963
+ i0.ɵɵconditional(ctx_r3.canOpenCustomer(customer_r20) ? 6 : 7);
253
964
  i0.ɵɵadvance(3);
254
- i0.ɵɵtextInterpolate(ctx_r2.Selected.Name);
965
+ i0.ɵɵtextInterpolate2(" ", customer_r20.IsOrganization ? "Organization" : "Individual", " \u00B7 ", ctx_r3.plural(customer_r20.OrderCount, "order"), " with a balance ");
966
+ i0.ɵɵadvance(2);
967
+ i0.ɵɵconditional(ctx_r3.canRecordPayment(customer_r20) ? 11 : -1);
968
+ i0.ɵɵadvance(9);
969
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r20.Owed));
970
+ i0.ɵɵadvance(6);
971
+ i0.ɵɵclassProp("mjo-ar__very-late", customer_r20.PastDue > 0);
972
+ i0.ɵɵadvance();
973
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r20.PastDue));
974
+ i0.ɵɵadvance(2);
975
+ i0.ɵɵtextInterpolate(customer_r20.PastDue > 0 ? "Oldest: " + ctx_r3.plural(customer_r20.OldestDaysPastDue, "day") + " past due" : "Nothing past due");
976
+ i0.ɵɵadvance(5);
977
+ i0.ɵɵtextInterpolate(ctx_r3.money(customer_r20.Scheduled));
978
+ i0.ɵɵadvance(2);
979
+ i0.ɵɵtextInterpolate(customer_r20.ReadyToInvoice > 0 ? ctx_r3.money(customer_r20.ReadyToInvoice) + " ready to invoice" : "Not yet invoiced");
980
+ i0.ɵɵadvance(3);
981
+ i0.ɵɵtextInterpolate(customer_r20.NextDueIsScheduled ? "Next scheduled" : "Next due");
982
+ i0.ɵɵadvance(2);
983
+ i0.ɵɵtextInterpolate(ctx_r3.dateOf(customer_r20.NextDueDate));
984
+ i0.ɵɵadvance(2);
985
+ i0.ɵɵtextInterpolate(customer_r20.NextDueDate ? ctx_r3.money(customer_r20.NextDueAmount) : "No upcoming dates");
986
+ i0.ɵɵadvance(4);
987
+ i0.ɵɵconditional((tmp_17_0 = ctx_r3.LastPayment) ? 47 : 48, tmp_17_0);
255
988
  i0.ɵɵadvance(2);
256
- i0.ɵɵtextInterpolate3(" ", ctx_r2.Selected.IsOrganization ? "Organization" : "Individual", " \u00B7 ", ctx_r2.Selected.Orders.length, " order", ctx_r2.Selected.Orders.length === 1 ? "" : "s", " ");
989
+ i0.ɵɵconditional(customer_r20.Credit > 0 ? 49 : -1);
257
990
  i0.ɵɵadvance();
258
- i0.ɵɵproperty("Total", ctx_r2.Selected.Open)("ShowPaid", false)("Balance", ctx_r2.NetOwed)("ShowStatus", false);
259
- i0.ɵɵadvance(2);
260
- i0.ɵɵproperty("Buckets", ctx_r2.Selected.Buckets);
991
+ i0.ɵɵconditional(customer_r20.Owed > 0 ? 50 : -1);
261
992
  i0.ɵɵadvance();
262
- i0.ɵɵconditional(ctx_r2.Selected.Credit > 0 ? 13 : -1);
263
- i0.ɵɵadvance(9);
264
- i0.ɵɵconditional(ctx_r2.OrderEntityInfo ? 22 : 23);
265
- i0.ɵɵadvance(9);
266
- i0.ɵɵrepeater(ctx_r2.CreditItems);
267
- i0.ɵɵadvance(3);
268
- i0.ɵɵconditional(ctx_r2.CreditItems.length ? 34 : -1);
993
+ i0.ɵɵconditional(customer_r20.Credit > 0 && customer_r20.Owed > 0 ? 51 : -1);
269
994
  i0.ɵɵadvance(7);
270
- i0.ɵɵrepeater(ctx_r2.Payments);
995
+ i0.ɵɵtextInterpolate(ctx_r3.plural(ctx_r3.ShownItems.length, "item"));
996
+ i0.ɵɵadvance();
997
+ i0.ɵɵconditional(ctx_r3.ItemFilters.length > 2 ? 59 : -1);
998
+ i0.ɵɵadvance(5);
999
+ i0.ɵɵrepeater(ctx_r3.ItemColumnsList);
1000
+ i0.ɵɵadvance(3);
1001
+ i0.ɵɵrepeater(ctx_r3.ShownItems);
1002
+ i0.ɵɵadvance(3);
1003
+ i0.ɵɵconditional(ctx_r3.ShownReceivable.Count > 1 || ctx_r3.ShownReceivable.Count && ctx_r3.ShownScheduled.Count ? 70 : -1);
1004
+ i0.ɵɵadvance();
1005
+ i0.ɵɵconditional(ctx_r3.ShownScheduled.Count > 1 || ctx_r3.ShownReceivable.Count && ctx_r3.ShownScheduled.Count ? 71 : -1);
1006
+ i0.ɵɵadvance(8);
1007
+ i0.ɵɵrepeater(customer_r20.Credits);
271
1008
  i0.ɵɵadvance(9);
272
- i0.ɵɵtextInterpolate(ctx_r2.Subscriptions.length);
1009
+ i0.ɵɵrepeater(ctx_r3.Payments);
1010
+ i0.ɵɵadvance(9);
1011
+ i0.ɵɵtextInterpolate(ctx_r3.Subscriptions.length);
273
1012
  i0.ɵɵadvance(16);
274
- i0.ɵɵrepeater(ctx_r2.Subscriptions);
275
- } }
276
- function MJOCustomerARPageComponent_Conditional_24_Template(rf, ctx) { if (rf & 1) {
277
- i0.ɵɵelement(0, "mj-empty-state", 15);
1013
+ i0.ɵɵrepeater(ctx_r3.Subscriptions);
278
1014
  } }
1015
+ /** Every date on this page is written `MM/DD/YYYY`. */
1016
+ /** How long the arrow keys must rest before the customer they stopped on is read and written to the address. */
1017
+ const ARROW_SETTLE_MS = 220;
1018
+ const DATE_FORMAT = { Numeric: true };
1019
+ /** The words for the quick filter that is on, shown beside the search so it can be cleared. */
1020
+ const PRESET_LABELS = {
1021
+ all: 'All customers',
1022
+ pastdue: 'Past due',
1023
+ scheduled: 'Scheduled',
1024
+ credit: 'Credit on account',
1025
+ };
279
1026
  /**
280
- * `mjo-customer-ar-page` — one customer's whole money picture.
1027
+ * `mjo-customer-ar-page` — the A/R book, and one customer on demand.
1028
+ *
1029
+ * TWO STATES OF ONE SCREEN. It opens on the whole book: one row per customer with their receivable,
1030
+ * how old it is, what is scheduled but not yet invoiced, and the next date anything falls. Choosing
1031
+ * a customer folds that table into a narrow list and opens their detail beside it, so moving to the
1032
+ * next customer is one click (or an arrow key) and the book never leaves the screen. Choosing the
1033
+ * same customer again, "All customers", Close or Escape unfolds it.
1034
+ *
1035
+ * INVOICED AND NOT YET INVOICED ARE SHOWN APART (bc-aidp-next-golive#481). A scheduled installment
1036
+ * has no invoice behind it, so it is not receivable and is never aged; see the page model.
281
1037
  *
282
- * WHY THIS IS ITS OWN SCREEN. The accounting team's job is not looking up an
283
- * invoice; it is knowing where a relationship stands before picking up the phone.
284
- * So aging, open items, credits held and payment history sit together rather than
285
- * across four surfaces.
1038
+ * IT IS A PLACE TO WORK FROM, NOT ONLY TO READ. From a customer you can record a payment, and issue
1039
+ * a scheduled installment that is due; a figure in the table opens the invoices behind it.
286
1040
  *
287
- * BALANCES ARE DERIVED FROM THE ORDER ROWS, never stored separately. A customer's
288
- * open balance is the sum of what their orders carry, and their credit is the sum
289
- * of the negative ones — because a credit IS a negative order balance and there
290
- * is no separate instrument. Two hand-maintained numbers would eventually
291
- * disagree; one derived number cannot.
1041
+ * THE OPEN CUSTOMER IS IN THE TAB'S ADDRESS, AND THE SECTION WRITES IT. The page emits
1042
+ * `AddressChanged` and is told the address through `ApplyAddress`; it never touches the shell or
1043
+ * the browser's history itself, because a cached page acting on "the active tab" would rewrite
1044
+ * whichever tab the user happened to be looking at.
1045
+ *
1046
+ * BALANCES ARE DERIVED FROM THE ORDER ROWS, never stored separately. Credit is a negative order
1047
+ * balance; there is no separate instrument.
292
1048
  *
293
1049
  * ## Example
294
1050
  *
295
1051
  * ```html
296
- * <mjo-customer-ar-page (OrderOpened)="open($event)" />
1052
+ * <mjo-customer-ar-page (OrderOpened)="open($event)" (AddressChanged)="write($event)" />
297
1053
  * ```
298
1054
  */
299
1055
  export class MJOCustomerARPageComponent {
300
1056
  cdr = inject(ChangeDetectorRef);
1057
+ exporter = inject(ExportService);
1058
+ host = inject(ElementRef);
1059
+ confirm = inject(MJConfirmService);
1060
+ /** Absent in a host that is not the Explorer shell; the action that needs it is then not offered. */
1061
+ navigation = inject(NavigationService, { optional: true });
301
1062
  OrderOpened = new EventEmitter();
302
- OrderEntityInfo = null;
303
- /**
304
- * The shared order grid, with the due column reading the NEXT UNPAID instalment's day
305
- * (bc-aidp-next-golive#481). On an aging screen the header's `DueDate` is the wrong day to show
306
- * for an instalment order: it never moves as instalments are paid. For an order with no
307
- * schedule `NextDueDate` IS `DueDate`, so nothing else changes.
308
- */
309
- OrderGridState = {
310
- ...MJO_ORDER_HEADER_GRID_STATE,
311
- columnSettings: (MJO_ORDER_HEADER_GRID_STATE.columnSettings ?? []).map((column) => column.Name === 'DueDate' ? { ...column, Name: 'NextDueDate', DisplayName: 'Next due' } : column),
312
- };
313
- Customers = [];
1063
+ /** A subscription or a payment in the customer's detail was chosen; the section opens the record. */
1064
+ SubscriptionOpened = new EventEmitter();
1065
+ PaymentOpened = new EventEmitter();
1066
+ /** Asks the section to put the open customer in the tab's address, or take it out (`customer: null`). */
1067
+ AddressChanged = new EventEmitter();
1068
+ Columns = [
1069
+ { Key: 'Name', Label: 'Customer', Title: 'Sort by customer name', Wide: false },
1070
+ { Key: 'Owed', Label: 'A/R', Title: 'Invoiced and unpaid: Current plus Past due', Wide: false },
1071
+ { Key: 'PastDue', Label: 'Past due', Title: 'Total past due: 1–30, 31–60 and 61+ days', Wide: true },
1072
+ { Key: 'Current', Label: 'Current', Title: 'Invoiced and not past its due date', Wide: true },
1073
+ { Key: 'Days1To30', Label: '1–30 days', Title: '1 to 30 days past due', Wide: true },
1074
+ { Key: 'Days31To60', Label: '31–60 days', Title: '31 to 60 days past due', Wide: true },
1075
+ { Key: 'Days61Plus', Label: '61+ days', Title: 'More than 60 days past due', Wide: true },
1076
+ { Key: 'Scheduled', Label: 'Scheduled', Title: 'Installments not yet invoiced. Not included in A/R.', Wide: true },
1077
+ { Key: 'NextDueDate', Label: 'Next due date', Title: 'The next date an invoice falls due or an installment is scheduled to be invoiced', Wide: true },
1078
+ { Key: 'NextDueAmount', Label: 'Next amount', Title: 'Everything falling on the next due date', Wide: true },
1079
+ ];
1080
+ /** Placeholder rows shown while the first read is in flight. */
1081
+ Skeleton = [0, 1, 2, 3, 4, 5];
1082
+ /** A read is in flight. */
1083
+ Loading = true;
1084
+ /** A read has succeeded at least once. Until then there are no figures, only placeholders or an error. */
1085
+ Loaded = false;
1086
+ Notice = null;
1087
+ AsOfDisplay = '';
1088
+ /** "Updated 4 minutes ago", refreshed on a timer so it does not go stale on a screen left open. */
1089
+ UpdatedText = '';
1090
+ /** Company filter: what is offered, and what is ticked (company ids, lower case). */
1091
+ Companies = [];
1092
+ CompanyPicks = [];
1093
+ Search = '';
1094
+ Preset = 'all';
1095
+ SortKey = 'Owed';
1096
+ SortDescending = true;
1097
+ /** Customers the company filter leaves; the ones the search and quick filter then list; and the two totals. */
1098
+ AllCount = 0;
1099
+ Shown = [];
1100
+ /** The list's total row: what is listed. */
1101
+ Totals = SumCustomers([]);
1102
+ /** The tiles: the book under the company filter and the search. A quick filter does not change them. */
1103
+ Book = SumCustomers([]);
1104
+ /** The open customer's key, or null for the whole book. */
314
1105
  SelectedKey = null;
315
- openOrdersView = new PresetViewRef();
316
- get CustomerOpenOrdersView() {
317
- if (!this.OrderEntityInfo || !this.Selected)
318
- return null;
319
- const col = this.Selected.IsOrganization ? 'BillToOrganizationID' : 'BillToPersonID';
320
- // Keyed on every input the view reads: a new object each pass deadlocks the grid (#362).
321
- return this.openOrdersView.For(`${this.OrderEntityInfo.ID}|${this.Selected.Key}|${col}|${this.Selected.Name}`, () => ({
322
- EntityID: this.OrderEntityInfo.ID,
323
- Entity: this.OrderEntityInfo.Name,
324
- WhereClause: `${col} = '${this.Selected.Key}' AND Balance > 0`,
325
- ID: `preset-customer-orders-${this.Selected.Key}`,
326
- Name: `${this.Selected.Name} Open Items`
327
- }));
1106
+ /** The row that takes Tab focus: the open customer, the last one focused, or the first listed. */
1107
+ FocusKey = null;
1108
+ /** The customer the detail pane renders. Kept after closing so the pane folds away with its content, not empty. */
1109
+ Detail = null;
1110
+ DetailLoading = false;
1111
+ /** The open customer's payments and subscriptions could not be read, so their absence is not "none". */
1112
+ DetailFailed = false;
1113
+ Payments = [];
1114
+ LastPayment = null;
1115
+ Subscriptions = [];
1116
+ /** Which of the open customer's items are listed, the choices offered, and the rows that result. */
1117
+ ItemFilter = 'all';
1118
+ ItemFilters = [];
1119
+ ShownItems = [];
1120
+ ShownReceivable = { Count: 0, Amount: 0 };
1121
+ ShownScheduled = { Count: 0, Amount: 0 };
1122
+ /** The column the open items are sorted on; null for their own order (invoiced first, then by due date). */
1123
+ ItemSortKey = null;
1124
+ ItemSortDescending = false;
1125
+ ItemColumnsList = [
1126
+ { Key: 'OrderNumber', Label: 'Order', Right: false },
1127
+ { Key: 'Company', Label: 'Company', Right: false },
1128
+ { Key: 'Label', Label: 'Type', Right: false },
1129
+ { Key: 'DocumentNumber', Label: 'Invoice #', Right: false },
1130
+ { Key: 'InvoicedOn', Label: 'Invoice date', Right: false },
1131
+ { Key: 'DueDate', Label: 'Due date', Right: false },
1132
+ { Key: 'DaysPastDue', Label: 'Days past due', Right: true },
1133
+ { Key: 'Status', Label: 'Status', Right: false },
1134
+ { Key: 'Amount', Label: 'Amount', Right: true },
1135
+ { Key: 'Paid', Label: 'Paid', Right: true },
1136
+ { Key: 'Balance', Label: 'Balance', Right: true },
1137
+ ];
1138
+ /** The item whose installment is being issued, so its button shows progress and the others wait. */
1139
+ IssuingKey = null;
1140
+ Exporting = false;
1141
+ orders = [];
1142
+ instalments = new Map();
1143
+ customers = [];
1144
+ today = '';
1145
+ loadedAt = null;
1146
+ ticker = null;
1147
+ destroyed = false;
1148
+ /** Counts reads, so a slower earlier one cannot overwrite a later one. */
1149
+ loadSequence = 0;
1150
+ /** The customer the tab's address names, held until the first read lands. */
1151
+ linkedCustomer = null;
1152
+ /** The linked customer we have already said is not in this view, so it is said once. */
1153
+ missingLinkTold = null;
1154
+ /** Company id (lower case) to the service that sends its invoices, for the wording of the issue dialog. */
1155
+ invoiceServices = new Map();
1156
+ /** Waits for arrow keys to stop before the open customer is written to the address and their history read. */
1157
+ settleTimer = null;
1158
+ get IsDetail() {
1159
+ return this.SelectedKey !== null;
1160
+ }
1161
+ get PresetLabel() {
1162
+ return PRESET_LABELS[this.Preset];
328
1163
  }
329
1164
  async ngOnInit() {
330
- const md = new Metadata();
331
- this.OrderEntityInfo = md.Entities.find((e) => e.Name === MJO_ENTITIES.OrderHeader) || null;
1165
+ const saved = ReadPageState(globalThis.localStorage);
1166
+ if (saved) {
1167
+ this.CompanyPicks = saved.Companies;
1168
+ this.SortKey = saved.SortKey;
1169
+ this.SortDescending = saved.SortDescending;
1170
+ }
1171
+ // Started before the first await, so a page destroyed mid-load still has its timer cleared.
1172
+ this.ticker = globalThis.setInterval(() => this.tick(), 60000);
332
1173
  await this.load();
1174
+ if (this.destroyed)
1175
+ return;
1176
+ this.followAddress();
333
1177
  this.cdr.detectChanges();
334
1178
  }
335
- OnRecordOpened(event) {
336
- const id = (event.compositeKey?.GetValueByFieldName('ID') ?? event.record?.['ID']);
337
- if (id) {
338
- const surrogate = { ID: id };
339
- this.OrderOpened.emit(surrogate);
340
- }
1179
+ ngOnDestroy() {
1180
+ this.destroyed = true;
1181
+ if (this.ticker)
1182
+ globalThis.clearInterval(this.ticker);
1183
+ if (this.settleTimer)
1184
+ globalThis.clearTimeout(this.settleTimer);
341
1185
  }
342
- Payments = [];
343
- Subscriptions = [];
344
- /** Exposed for the template — `Math` is not in Angular's expression scope. */
345
- Math = Math;
346
- async Select(key) {
347
- this.SelectedKey = key;
348
- await this.loadCustomerDetail();
349
- this.cdr.detectChanges();
1186
+ /**
1187
+ * The tab's address, from the section: on first show, and on Back, Forward or a link.
1188
+ * `customer` names the customer to open; without it the book is shown.
1189
+ */
1190
+ ApplyAddress(params) {
1191
+ this.linkedCustomer = params['customer']?.toLowerCase() || null;
1192
+ if (this.Loaded)
1193
+ this.followAddress();
1194
+ }
1195
+ /* ── Keys. Bound on the page's own elements, so a cached page that is not on screen hears nothing. ── */
1196
+ /** Escape closes the open customer. */
1197
+ OnEscape(event) {
1198
+ if (!this.IsDetail || event.defaultPrevented)
1199
+ return;
1200
+ // Escape in a field (the search box, a menu) belongs to that field.
1201
+ const target = event.target;
1202
+ if (target?.closest?.('input, textarea, select, [contenteditable], [role="menu"], [role="listbox"]'))
1203
+ return;
1204
+ event.preventDefault();
1205
+ this.Close();
1206
+ }
1207
+ /** Arrows move through the customers; with one open, they open the next. Focus follows. */
1208
+ OnArrow(event, step) {
1209
+ const next = NeighbourKey(this.Shown, this.FocusKey, step);
1210
+ if (!next)
1211
+ return;
1212
+ event.preventDefault();
1213
+ if (next === this.FocusKey)
1214
+ return;
1215
+ this.FocusKey = next;
1216
+ // Held down, the arrows pass through many customers: each is shown at once, but only the one
1217
+ // the keys stop on is written to the address and has its history read.
1218
+ if (this.IsDetail)
1219
+ void this.Open(next, 'all', true, ARROW_SETTLE_MS);
1220
+ else
1221
+ this.cdr.detectChanges();
1222
+ this.focusRow(next);
1223
+ }
1224
+ /* ── Choosing a customer ───────────────────────────────────────────── */
1225
+ /** Open a customer, or close them when they are the one already open. */
1226
+ Toggle(key) {
1227
+ if (this.SelectedKey === key)
1228
+ this.Close();
1229
+ else
1230
+ void this.Open(key);
1231
+ }
1232
+ /** Open a customer on the invoices behind one figure in their row. */
1233
+ OpenFiltered(key, filter, event) {
1234
+ event.stopPropagation();
1235
+ void this.Open(key, filter);
350
1236
  }
351
1237
  /**
352
- * Payments and subscriptions for the selected customer only.
1238
+ * Open a customer.
353
1239
  *
354
- * Fetched on selection rather than up front: this screen shows one customer at
355
- * a time, and loading a hundred payment histories to render one is work with
356
- * no answer attached to it. Both awaits complete BEFORE either is assigned, so
357
- * no assignment straddles the boundary that produces NG0100.
1240
+ * @param filter - Which of their items to list first.
1241
+ * @param record - Whether to ask for the customer to be written into the tab's address. False when the address is what told us.
1242
+ * @param settleMs - How long to wait before the address is written and the history read; another open in that time replaces this one.
358
1243
  */
359
- async loadCustomerDetail() {
360
- const selected = this.Selected;
361
- if (!selected) {
362
- this.Payments = [];
363
- this.Subscriptions = [];
1244
+ async Open(key, filter = 'all', record = true, settleMs = 0) {
1245
+ const customer = this.customers.find((c) => c.Key === key);
1246
+ if (!customer)
364
1247
  return;
365
- }
366
- const identity = {
367
- OrganizationID: selected.IsOrganization ? selected.Key : null,
368
- PersonID: selected.IsOrganization ? null : selected.Key,
1248
+ this.SelectedKey = key;
1249
+ this.FocusKey = key;
1250
+ this.Detail = customer;
1251
+ this.ItemFilter = filter;
1252
+ this.applyItems();
1253
+ this.Payments = [];
1254
+ this.LastPayment = null;
1255
+ this.Subscriptions = [];
1256
+ this.DetailFailed = false;
1257
+ this.DetailLoading = true;
1258
+ if (this.settleTimer)
1259
+ globalThis.clearTimeout(this.settleTimer);
1260
+ this.settleTimer = null;
1261
+ this.cdr.detectChanges();
1262
+ this.revealSelected();
1263
+ const settle = async () => {
1264
+ this.settleTimer = null;
1265
+ if (this.destroyed || this.SelectedKey !== key)
1266
+ return;
1267
+ if (record)
1268
+ this.AddressChanged.emit({ customer: key });
1269
+ await this.loadDetail(customer);
369
1270
  };
370
- const [payments, subscriptions] = await Promise.all([
371
- GetPaymentsForCustomer(identity),
372
- GetSubscriptionsForCustomer(identity),
373
- ]);
374
- this.Payments = payments;
375
- this.Subscriptions = subscriptions;
1271
+ if (settleMs > 0)
1272
+ this.settleTimer = globalThis.setTimeout(() => void settle(), settleMs);
1273
+ else
1274
+ await settle();
1275
+ }
1276
+ Close(record = true) {
1277
+ const closed = this.SelectedKey;
1278
+ if (closed === null)
1279
+ return;
1280
+ this.SelectedKey = null;
1281
+ if (this.settleTimer)
1282
+ globalThis.clearTimeout(this.settleTimer);
1283
+ this.settleTimer = null;
1284
+ if (record)
1285
+ this.AddressChanged.emit({ customer: null });
376
1286
  this.cdr.detectChanges();
1287
+ // The button that closed it is inside a pane that is now inert; put focus back on the row.
1288
+ this.focusRow(closed);
1289
+ }
1290
+ OnItemFilter(filter) {
1291
+ this.ItemFilter = this.ItemFilter === filter ? 'all' : filter;
1292
+ this.applyItems();
1293
+ this.cdr.detectChanges();
1294
+ }
1295
+ /** Sort the open items on a column; the same column again reverses it, and a third click returns to their own order. */
1296
+ OnItemSort(key) {
1297
+ // Text and dates start A to Z and soonest first; amounts and days start largest first.
1298
+ const startsDescending = key === 'Amount' || key === 'Paid' || key === 'Balance' || key === 'DaysPastDue';
1299
+ if (this.ItemSortKey !== key) {
1300
+ this.ItemSortKey = key;
1301
+ this.ItemSortDescending = startsDescending;
1302
+ }
1303
+ else if (this.ItemSortDescending === startsDescending) {
1304
+ this.ItemSortDescending = !startsDescending;
1305
+ }
1306
+ else {
1307
+ this.ItemSortKey = null;
1308
+ }
1309
+ this.applyItems();
1310
+ this.cdr.detectChanges();
1311
+ }
1312
+ /** The customer's own record (the organization, or the person), in a new tab. */
1313
+ OpenCustomerRecord(customer) {
1314
+ this.navigation?.OpenEntityRecord(customer.IsOrganization ? MJO_COMMON_ENTITIES.Organization : MJO_COMMON_ENTITIES.Person, CompositeKey.FromID(customer.Key));
1315
+ }
1316
+ OpenOrder(item) {
1317
+ this.OrderOpened.emit({ ID: item.OrderID });
1318
+ }
1319
+ OpenCredit(orderID) {
1320
+ this.OrderOpened.emit({ ID: orderID });
1321
+ }
1322
+ /* ── Acting on a customer ──────────────────────────────────────────── */
1323
+ /** A new payment for this customer, in its own tab. The payment form lists their open orders to allocate against. */
1324
+ RecordPayment(customer) {
1325
+ this.navigation?.OpenNewEntityRecord(MJO_ENTITIES.PaymentHeader, {
1326
+ newRecordValues: customer.IsOrganization ? { BillToOrganizationID: customer.Key } : { BillToPersonID: customer.Key },
1327
+ });
377
1328
  }
378
1329
  /**
379
- * The whole portfolio's aging, summed from the per-customer buckets.
1330
+ * Issue a scheduled installment as an invoice.
380
1331
  *
381
- * Derived rather than queried — the customers are already grouped and bucketed
382
- * in memory, and asking the database to age the same rows again would be a
383
- * second implementation of the same rule.
1332
+ * THE IRREVERSIBLE STEP, so it asks first and says what it does: issuing posts the amount to A/R
1333
+ * and, for a company that invoices through an external service, sends the invoice through it.
1334
+ * The server re-checks that the installment can be issued.
384
1335
  */
385
- get TotalBuckets() {
386
- const total = EmptyAgingBuckets();
387
- for (const customer of this.Customers) {
388
- total.Current += customer.Buckets.Current;
389
- total.Days1To30 += customer.Buckets.Days1To30;
390
- total.Days31To60 += customer.Buckets.Days31To60;
391
- total.Days61Plus += customer.Buckets.Days61Plus;
1336
+ async Issue(item, customer) {
1337
+ if (!item.ScheduleID || this.IssuingKey)
1338
+ return;
1339
+ const service = this.invoiceServices.get((item.CompanyID ?? '').toLowerCase());
1340
+ const late = item.DaysPastDue > 0 ? ` That date is ${this.plural(item.DaysPastDue, 'day')} ago, so it will show as past due.` : '';
1341
+ const proceed = await this.confirm.Confirm({
1342
+ title: `Issue the invoice for ${item.Label.toLowerCase()} of order ${item.OrderNumber}?`,
1343
+ message: `${customer.Name} · ${FormatMoney(item.Amount)} due ${FormatDate(item.DueDate, DATE_FORMAT)}.`,
1344
+ detail: (service
1345
+ ? `This sends the invoice through ${service}, posts the amount to A/R, and starts aging from the due date.`
1346
+ : 'This posts the amount to A/R and starts aging from the due date.') + late,
1347
+ type: 'warning',
1348
+ confirmText: 'Issue invoice',
1349
+ cancelText: 'Not yet',
1350
+ });
1351
+ if (!proceed || this.destroyed)
1352
+ return;
1353
+ this.IssuingKey = item.Key;
1354
+ this.Notice = null;
1355
+ this.cdr.detectChanges();
1356
+ try {
1357
+ const result = await new OrdersIssueInstalmentInvoiceOperation().Execute({ OrderHeaderPaymentScheduleID: item.ScheduleID });
1358
+ const output = result.Output;
1359
+ if (!result.Success || !output?.Success) {
1360
+ this.Notice = { Tone: 'error', Text: output?.Message?.trim() || result.ErrorMessage?.trim() || 'The installment could not be issued.' };
1361
+ }
1362
+ else {
1363
+ this.Notice = {
1364
+ Tone: 'success',
1365
+ Text: `${item.Label} of order ${item.OrderNumber} was issued${output.DocumentNumber ? ` as invoice ${output.DocumentNumber}` : ''}.`,
1366
+ };
1367
+ await this.load();
1368
+ }
1369
+ }
1370
+ catch (err) {
1371
+ this.Notice = { Tone: 'error', Text: err instanceof Error ? err.message : String(err) };
1372
+ }
1373
+ finally {
1374
+ this.IssuingKey = null;
1375
+ if (!this.destroyed)
1376
+ this.cdr.detectChanges();
1377
+ }
1378
+ }
1379
+ /** Read the figures again, keeping the open customer and every filter. */
1380
+ async Refresh() {
1381
+ if (this.Loading || this.IssuingKey)
1382
+ return;
1383
+ this.Notice = null;
1384
+ await this.load();
1385
+ if (!this.destroyed)
1386
+ this.cdr.detectChanges();
1387
+ }
1388
+ /* ── Narrowing and ordering ────────────────────────────────────────── */
1389
+ OnCompanies(ids) {
1390
+ this.CompanyPicks = ids;
1391
+ this.saveView();
1392
+ this.rebuild();
1393
+ }
1394
+ OnSearch(text) {
1395
+ this.Search = text;
1396
+ this.applyView();
1397
+ }
1398
+ /** A tile turns its quick filter on; the same tile again, or "All", turns it off. */
1399
+ OnPreset(key) {
1400
+ this.Preset = this.Preset === key ? 'all' : key;
1401
+ this.applyView();
1402
+ }
1403
+ OnSort(key) {
1404
+ if (this.SortKey === key)
1405
+ this.SortDescending = !this.SortDescending;
1406
+ else {
1407
+ this.SortKey = key;
1408
+ // Names read A to Z and dates soonest first; money reads largest first.
1409
+ this.SortDescending = key !== 'Name' && key !== 'NextDueDate';
1410
+ }
1411
+ this.saveView();
1412
+ this.applyView();
1413
+ }
1414
+ /* ── Export ────────────────────────────────────────────────────────── */
1415
+ /** The customers listed, as an aging summary or as one row per invoice and installment. */
1416
+ async Export(kind, format) {
1417
+ if (!this.Shown.length || this.Exporting)
1418
+ return;
1419
+ const result = kind === 'summary' ? BuildSummaryExport(this.Shown, this.today, format) : BuildItemsExport(this.Shown, this.today, format);
1420
+ const company = this.CompanyPicks.length === 1 ? this.Companies.find((o) => o.Value === this.CompanyPicks[0])?.Text : null;
1421
+ const fileName = [kind === 'summary' ? 'ar-aging-summary' : 'ar-open-items', company ? Slug(company) : null, this.today ? `as-of-${this.today}` : null].filter(Boolean).join('-');
1422
+ this.Exporting = true;
1423
+ this.Notice = null;
1424
+ this.cdr.detectChanges();
1425
+ try {
1426
+ // The lower-case name: it is the one every ng-export-service since 6.1 exposes (6.2 adds a capitalised alias).
1427
+ const outcome = await this.exporter.exportAndDownload(result.Rows, { format, fileName, columns: result.Columns, includeHeaders: true });
1428
+ if (!outcome.success)
1429
+ this.Notice = { Tone: 'error', Text: `The export failed: ${outcome.error ?? 'unknown error'}` };
392
1430
  }
393
- Object.keys(total).forEach((k) => (total[k] = Math.round(total[k] * 100) / 100));
394
- return total;
1431
+ catch (err) {
1432
+ this.Notice = { Tone: 'error', Text: `The export failed: ${err instanceof Error ? err.message : String(err)}` };
1433
+ }
1434
+ finally {
1435
+ this.Exporting = false;
1436
+ if (!this.destroyed)
1437
+ this.cdr.detectChanges();
1438
+ }
1439
+ }
1440
+ /* ── Display helpers ───────────────────────────────────────────────── */
1441
+ get pastDueDetail() {
1442
+ if (!this.Loaded)
1443
+ return 'Loading…';
1444
+ if (this.Book.PastDue <= 0)
1445
+ return 'Nothing past due';
1446
+ return `${this.plural(this.Book.PastDueCustomers, 'customer')} · ${this.percent(this.Book.PastDue, this.Book.Owed)} of A/R`;
1447
+ }
1448
+ get scheduledDetail() {
1449
+ if (!this.Loaded)
1450
+ return 'Loading…';
1451
+ if (this.Book.ReadyToInvoice > 0)
1452
+ return `${FormatMoney(this.Book.ReadyToInvoice)} is ready to invoice. Not included in A/R.`;
1453
+ return 'Future installments. Not included in A/R.';
395
1454
  }
396
- /** What the whole book is owed, before credits are spent. */
397
- get TotalOpen() {
398
- return Math.round(this.Customers.reduce((sum, c) => sum + c.Open, 0) * 100) / 100;
1455
+ money(value) {
1456
+ return FormatMoney(value ?? 0);
399
1457
  }
400
- /** Orders this customer has OVER-paid — their spendable credit. */
401
- get CreditItems() {
402
- return (this.Selected?.Orders ?? []).filter((o) => (o.Balance ?? 0) < 0);
1458
+ /** Money in a table cell: a dash for nothing, so a column of zeros does not read as data. */
1459
+ amount(value) {
1460
+ return value ? FormatMoney(value) : '—';
403
1461
  }
404
- /** A `date` cell (PaymentDate, EndDate), passed as it is — `String()` of a `Date` reads as no date. */
1462
+ /**
1463
+ * A `date` cell (due date, invoice day, payment date) as `MM/DD/YYYY`, which is how every date on
1464
+ * this page is written. Passed as it is: `String()` of a `Date` reads as no date.
1465
+ */
405
1466
  dateOf(value) {
406
- return value ? FormatDate(value, { Short: true }) : '—';
1467
+ return value ? FormatDate(value, DATE_FORMAT) : '—';
1468
+ }
1469
+ initials(name) {
1470
+ return Initials(name);
1471
+ }
1472
+ plural(count, noun) {
1473
+ return `${count} ${noun}${count === 1 ? '' : 's'}`;
1474
+ }
1475
+ percent(part, whole) {
1476
+ if (whole <= 0 || part <= 0)
1477
+ return '0%';
1478
+ const share = (part / whole) * 100;
1479
+ // A small past-due balance is not "0%".
1480
+ return share < 1 ? '<1%' : `${Math.round(share)}%`;
1481
+ }
1482
+ netOwed(customer) {
1483
+ return Math.max(0, Math.round((customer.Owed - customer.Credit) * 100) / 100);
1484
+ }
1485
+ /** The name links to the customer's record when there is a shell to open it in and a real customer behind the row. */
1486
+ canOpenCustomer(customer) {
1487
+ return !!this.navigation && customer.Key !== 'unknown';
1488
+ }
1489
+ /** Recording a payment opens the payment form in a new tab, which needs the Explorer shell and a real customer. */
1490
+ canRecordPayment(customer) {
1491
+ return !!this.navigation && customer.Owed > 0 && customer.Key !== 'unknown';
1492
+ }
1493
+ rowLabel(customer) {
1494
+ const late = customer.PastDue > 0 ? `, ${FormatMoney(customer.PastDue)} past due` : '';
1495
+ return `${customer.Name}, ${FormatMoney(customer.Owed)} A/R${late}. ${customer.Key === this.SelectedKey ? 'Open. Press Enter to close.' : 'Press Enter to open.'}`;
1496
+ }
1497
+ /** The line under a customer's name: what is past due if anything is, then what is waiting to be invoiced, otherwise how much is open. */
1498
+ subLine(customer) {
1499
+ if (customer.PastDue > 0)
1500
+ return `${FormatMoney(customer.PastDue)} past due, oldest ${this.plural(customer.OldestDaysPastDue, 'day')}`;
1501
+ if (customer.ReadyToInvoice > 0)
1502
+ return `${FormatMoney(customer.ReadyToInvoice)} ready to invoice`;
1503
+ if (customer.Owed <= 0 && customer.Scheduled > 0)
1504
+ return `${FormatMoney(customer.Scheduled)} scheduled, not yet invoiced`;
1505
+ if (customer.Owed <= 0 && customer.Credit > 0)
1506
+ return 'Credit on account only';
1507
+ return `${this.plural(customer.OrderCount, 'order')} with a balance`;
1508
+ }
1509
+ canIssue(item) {
1510
+ return CanIssue(item);
1511
+ }
1512
+ itemStatus(item) {
1513
+ return ItemStatus(item);
1514
+ }
1515
+ itemChip(item) {
1516
+ switch (ItemStatus(item)) {
1517
+ case 'Past due':
1518
+ return item.DaysPastDue > 60 ? 'mjo-chip--error' : 'mjo-chip--warning';
1519
+ case 'Ready to invoice':
1520
+ return 'mjo-chip--brand';
1521
+ case 'Scheduled':
1522
+ return 'mjo-chip--outline';
1523
+ default:
1524
+ return 'mjo-chip--info';
1525
+ }
407
1526
  }
408
1527
  /**
409
- * The chip for a subscription's state.
410
- *
411
- * `'Grace'` was here and is not a status this schema has — the union is
412
- * Active / Paused / Canceled / Migrated / Trialing — so the warning chip could never render and
413
- * a paused subscription looked exactly like a cancelled one. Paused is the state that wants
414
- * attention: the customer still holds the seat and is not currently being served by it.
1528
+ * The chip for a subscription's state. Paused is the one that wants attention: the customer still
1529
+ * holds the seat and is not currently being served by it.
415
1530
  */
416
1531
  subClass(sub) {
417
1532
  switch (sub.Status) {
@@ -425,357 +1540,855 @@ export class MJOCustomerARPageComponent {
425
1540
  return 'mjo-chip--outline';
426
1541
  }
427
1542
  }
428
- get Selected() {
429
- return this.Customers.find((c) => c.Key === this.SelectedKey);
1543
+ /* ── Loading and deriving ──────────────────────────────────────────── */
1544
+ /**
1545
+ * Read the book. On failure what is on screen STAYS: figures a minute old are more use than an
1546
+ * empty page, and an empty page under "Nothing is owed" would be a lie. Both reads throw on
1547
+ * failure for exactly that reason.
1548
+ */
1549
+ async load() {
1550
+ const sequence = ++this.loadSequence;
1551
+ this.Loading = true;
1552
+ this.cdr.detectChanges();
1553
+ try {
1554
+ // The invoice services only word the issue dialog; that read never throws.
1555
+ const [orders, instalments, services] = await Promise.all([GetReceivableOrders(), GetOpenInstalmentDetails(), GetInvoiceServiceByCompany()]);
1556
+ if (this.destroyed || sequence !== this.loadSequence)
1557
+ return;
1558
+ this.invoiceServices = services;
1559
+ this.orders = orders;
1560
+ this.instalments = GroupInstalmentsByOrder(instalments);
1561
+ this.today = Today();
1562
+ this.AsOfDisplay = FormatDate(this.today, DATE_FORMAT);
1563
+ this.loadedAt = new Date();
1564
+ this.Loaded = true;
1565
+ this.UpdatedText = UpdatedLabel(this.loadedAt, this.loadedAt);
1566
+ }
1567
+ catch (err) {
1568
+ if (this.destroyed || sequence !== this.loadSequence)
1569
+ return;
1570
+ this.Notice = { Tone: 'error', Text: `A/R could not be loaded: ${err instanceof Error ? err.message : String(err)}` };
1571
+ }
1572
+ this.Loading = false;
1573
+ this.rebuild();
1574
+ // A refresh also refreshes the open customer's payments and subscriptions.
1575
+ if (this.Detail && this.IsDetail)
1576
+ await this.loadDetail(this.Detail);
430
1577
  }
431
- /** What they owe after their credit is spent — the number that matters. */
432
- get NetOwed() {
433
- if (!this.Selected)
434
- return 0;
435
- return Math.round((this.Selected.Open - this.Selected.Credit) * 100) / 100;
1578
+ /** The open customer's payments and subscriptions. Dropped if another customer is opened meanwhile. */
1579
+ async loadDetail(customer) {
1580
+ const key = customer.Key;
1581
+ this.DetailLoading = true;
1582
+ this.cdr.detectChanges();
1583
+ const identity = { OrganizationID: customer.IsOrganization ? key : null, PersonID: customer.IsOrganization ? null : key };
1584
+ try {
1585
+ const [payments, subscriptions] = await Promise.all([GetPaymentsForCustomer(identity), GetSubscriptionsForCustomer(identity)]);
1586
+ if (this.destroyed || this.SelectedKey !== key)
1587
+ return;
1588
+ this.Payments = payments;
1589
+ this.LastPayment = LastReceived(payments);
1590
+ this.Subscriptions = subscriptions;
1591
+ this.DetailFailed = false;
1592
+ }
1593
+ catch (err) {
1594
+ if (this.destroyed || this.SelectedKey !== key)
1595
+ return;
1596
+ this.DetailFailed = true;
1597
+ this.Notice = { Tone: 'error', Text: `This customer's history could not be loaded: ${err instanceof Error ? err.message : String(err)}` };
1598
+ }
1599
+ this.DetailLoading = false;
1600
+ this.cdr.detectChanges();
436
1601
  }
437
- get OpenItems() {
438
- return (this.Selected?.Orders ?? [])
439
- .filter((o) => (o.Balance ?? 0) !== 0)
440
- .slice()
441
- // Undated last: an order with no due date is not "due first", and an empty string
442
- // sorted ahead of every real date, which put unscheduled work at the top of an aging list.
443
- .sort((a, b) => (NextDueDayOf(a)?.getTime() ?? Infinity) - (NextDueDayOf(b)?.getTime() ?? Infinity));
1602
+ /** Re-derive the customers from the orders the company filter leaves. */
1603
+ rebuild() {
1604
+ this.Companies = CompanyOptions(this.orders);
1605
+ // A saved pick for a company with nothing open any more is dropped, and the saved view with it.
1606
+ const pruned = PruneCompanyPicks(this.CompanyPicks, this.Companies);
1607
+ if (this.Loaded && pruned.length !== this.CompanyPicks.length) {
1608
+ this.CompanyPicks = pruned;
1609
+ this.saveView();
1610
+ }
1611
+ this.customers = BuildCustomers(FilterByCompany(this.orders, this.CompanyPicks), this.instalments, this.today);
1612
+ this.AllCount = this.customers.length;
1613
+ if (this.SelectedKey) {
1614
+ const still = this.customers.find((c) => c.Key === this.SelectedKey);
1615
+ // The same customer with fresh figures keeps their payments and subscriptions on screen.
1616
+ if (still)
1617
+ this.Detail = still;
1618
+ else
1619
+ this.Close();
1620
+ }
1621
+ this.applyItems();
1622
+ this.applyView();
444
1623
  }
445
- initials(name) {
446
- return Initials(name);
1624
+ /** The open customer's items under the current filter. A filter that no longer matches anything falls back to all. */
1625
+ applyItems() {
1626
+ const items = this.Detail?.Items ?? [];
1627
+ this.ItemFilters = ItemFilterOptions(items);
1628
+ if (!this.ItemFilters.some((o) => o.Key === this.ItemFilter))
1629
+ this.ItemFilter = 'all';
1630
+ this.ShownItems = SortItems(items.filter((i) => MatchesItemFilter(i, this.ItemFilter)), this.ItemSortKey, this.ItemSortDescending);
1631
+ const subtotal = (state) => {
1632
+ const rows = this.ShownItems.filter((i) => i.State === state);
1633
+ return { Count: rows.length, Amount: rows.reduce((sum, i) => sum + Math.round(i.Balance * 100), 0) / 100 };
1634
+ };
1635
+ this.ShownReceivable = subtotal('Invoiced');
1636
+ this.ShownScheduled = subtotal('Scheduled');
447
1637
  }
448
- money(value) {
449
- return FormatMoney(value);
450
- }
451
- ageLabel(row) {
452
- const due = NextDueDayOf(row);
453
- if (!due || (row.Balance ?? 0) <= 0)
454
- return 'Current';
455
- const late = DaysSince(due, Today());
456
- return late > 0 ? `${late}d` : 'Current';
457
- }
458
- ageClass(row) {
459
- const due = NextDueDayOf(row);
460
- if (!due || (row.Balance ?? 0) <= 0)
461
- return '';
462
- const late = DaysSince(due, Today());
463
- if (late > 60)
464
- return 'mjo-chip--error';
465
- if (late > 0)
466
- return 'mjo-chip--warning';
467
- return '';
1638
+ /** Apply the search, the quick filter and the sort, and total both what is in scope and what is listed. */
1639
+ applyView() {
1640
+ const searched = this.customers.filter((c) => MatchesSearch(c, this.Search));
1641
+ this.Book = SumCustomers(searched);
1642
+ this.Shown = SortCustomers(searched.filter((c) => MatchesPreset(c, this.Preset)), this.SortKey, this.SortDescending);
1643
+ this.Totals = SumCustomers(this.Shown);
1644
+ if (!this.FocusKey || !this.Shown.some((c) => c.Key === this.FocusKey))
1645
+ this.FocusKey = this.SelectedKey ?? this.Shown[0]?.Key ?? null;
1646
+ this.cdr.detectChanges();
468
1647
  }
469
- /**
470
- * Group open orders by customer and derive every figure from them.
471
- *
472
- * The organization wins over the person when both are present: an employee's
473
- * order billed to their employer is the employer's receivable.
474
- */
475
- async load() {
476
- const [orders, instalments] = await Promise.all([GetOpenBalanceOrders(), GetOpenInstalments()]);
477
- const instalmentsByOrder = GroupInstalmentsByOrder(instalments);
478
- const open = orders.filter((o) => !['Draft', 'Quoted', 'Voided'].includes(o.Status) && (o.Balance ?? 0) !== 0);
479
- const byCustomer = new Map();
480
- const today = Today();
481
- for (const order of open) {
482
- const key = order['BillToOrganizationID'] ?? order['BillToPersonID'] ?? 'unknown';
483
- const name = (order.BillToOrganization ?? order.BillToPerson ?? 'Unknown');
484
- const isOrg = !!order['BillToOrganizationID'];
485
- const existing = byCustomer.get(key) ??
486
- {
487
- Key: key,
488
- Name: name,
489
- IsOrganization: isOrg,
490
- Open: 0,
491
- Credit: 0,
492
- Buckets: EmptyAgingBuckets(),
493
- Orders: [],
494
- };
495
- existing.Orders.push(order);
496
- if ((order.Balance ?? 0) < 0) {
497
- // A negative balance IS the credit — no separate instrument.
498
- existing.Credit += Math.abs((order.Balance ?? 0));
499
- }
500
- else {
501
- existing.Open += (order.Balance ?? 0);
502
- // The age rule lives beside the bucket type, so this page and the Orders dashboard
503
- // cannot drift apart about what "current" means (golive#361), nor about ageing each
504
- // instalment on its own due date (golive#481).
505
- AddOrderToAgingBuckets(existing.Buckets, order, instalmentsByOrder.get(String(order.ID).toLowerCase()), today);
506
- }
507
- byCustomer.set(key, existing);
1648
+ /** Open or close to match the address the section last gave us. */
1649
+ followAddress() {
1650
+ const linked = this.linkedCustomer && this.customers.some((c) => c.Key === this.linkedCustomer) ? this.linkedCustomer : null;
1651
+ // A link to a customer who is not listed says so, once, instead of silently showing the book.
1652
+ if (this.linkedCustomer && !linked && this.missingLinkTold !== this.linkedCustomer) {
1653
+ this.missingLinkTold = this.linkedCustomer;
1654
+ this.Notice = {
1655
+ Tone: 'warning',
1656
+ Text: this.CompanyPicks.length
1657
+ ? 'The customer in this link is not listed under the current company filter. Clear the filter to look for them.'
1658
+ : 'The customer in this link has no A/R, scheduled installments or credit on account.',
1659
+ };
1660
+ this.cdr.detectChanges();
508
1661
  }
509
- const round = (v) => Math.round((v + Number.EPSILON) * 100) / 100;
510
- this.Customers = [...byCustomer.values()]
511
- .map((c) => ({
512
- ...c,
513
- Open: round(c.Open),
514
- Credit: round(c.Credit),
515
- Buckets: {
516
- Current: round(c.Buckets.Current),
517
- Days1To30: round(c.Buckets.Days1To30),
518
- Days31To60: round(c.Buckets.Days31To60),
519
- Days61Plus: round(c.Buckets.Days61Plus),
520
- },
521
- }))
522
- .sort((a, b) => b.Open - a.Open);
523
- if (!this.SelectedKey && this.Customers.length)
524
- this.SelectedKey = this.Customers[0].Key;
1662
+ if (linked === this.SelectedKey)
1663
+ return;
1664
+ if (linked)
1665
+ void this.Open(linked, 'all', false);
1666
+ else
1667
+ this.Close(false);
1668
+ }
1669
+ saveView() {
1670
+ WritePageState(globalThis.localStorage, { Companies: this.CompanyPicks, SortKey: this.SortKey, SortDescending: this.SortDescending });
1671
+ }
1672
+ tick() {
1673
+ const text = UpdatedLabel(this.loadedAt, new Date());
1674
+ if (this.destroyed || text === this.UpdatedText)
1675
+ return;
1676
+ this.UpdatedText = text;
525
1677
  this.cdr.detectChanges();
526
1678
  }
1679
+ rowOf(key) {
1680
+ return this.host.nativeElement.querySelector(`.mjo-ar__row[data-key="${key}"]`);
1681
+ }
1682
+ focusRow(key) {
1683
+ globalThis.setTimeout?.(() => {
1684
+ if (!this.destroyed)
1685
+ this.rowOf(key)?.focus();
1686
+ });
1687
+ }
1688
+ /** Keep the open customer's row in view once the list has folded to its rail. */
1689
+ revealSelected() {
1690
+ const key = this.SelectedKey;
1691
+ if (!key)
1692
+ return;
1693
+ const calm = !!globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
1694
+ globalThis.setTimeout?.(() => {
1695
+ if (this.destroyed || this.SelectedKey !== key)
1696
+ return;
1697
+ this.rowOf(key)?.scrollIntoView?.({ block: 'nearest', behavior: calm ? 'auto' : 'smooth' });
1698
+ }, calm ? 0 : 340);
1699
+ }
527
1700
  static ɵfac = function MJOCustomerARPageComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJOCustomerARPageComponent)(); };
528
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJOCustomerARPageComponent, selectors: [["mjo-customer-ar-page"]], outputs: { OrderOpened: "OrderOpened" }, decls: 25, vars: 4, consts: [[1, "mjo-ar__split"], [1, "mjo-ar__left"], [1, "mj-card", "mjo-ar__total"], [1, "mj-card-head"], ["aria-hidden", "true", 1, "fa-solid", "fa-chart-column"], [1, "right", "mj-num", "small", "strong"], [1, "mj-card-pad"], [3, "Buckets"], [1, "small", "muted", "mjo-ar__note"], [1, "mj-card"], ["aria-hidden", "true", 1, "fa-solid", "fa-user-tag"], [1, "mj-card-pad", "mjo-ar__list"], ["type", "button", 1, "mjo-ar__cust", 3, "is-active"], [1, "small", "muted"], [1, "mjo-ar__right"], ["Icon", "fa-solid fa-user-tag", "Title", "Select a customer", "Message", "Aging, open items and credits will appear here."], ["type", "button", 1, "mjo-ar__cust", 3, "click"], [1, "mj-avatar", "mjo-ar__avatar"], [1, "mjo-ar__cust-body"], [1, "mjo-ar__cust-name"], [1, "small", "muted", "mjo-ar__cust-sub"], [1, "mjo-ar__cust-amt"], [1, "mj-num"], [1, "small", "mj-money--credit", "mjo-ar__cust-credit"], [1, "mjo-ar__header"], [1, "mj-avatar", "mjo-ar__avatar-lg"], [1, "mjo-ar__header-body"], [1, "mjo-ar__header-name"], ["TotalLabel", "Open balance", 1, "mjo-ar__strip", 3, "Total", "ShowPaid", "Balance", "ShowStatus"], [1, "mjo-ar__aging"], ["Variant", "success", "Icon", "fa-solid fa-piggy-bank", 1, "mjo-ar__credit"], [1, "mj-card", "mjo-ar__items"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-invoice-dollar"], [1, "right", "small", "muted"], [1, "mjo-ar__viewer-host"], [3, "Entity", "ViewEntity", "GridState"], [1, "small", "muted", 2, "padding", "24px"], [1, "mjo-ar__grid"], ["aria-hidden", "true", 1, "fa-solid", "fa-piggy-bank"], [1, "mjo-ar__row"], ["aria-hidden", "true", 1, "fa-solid", "fa-clock-rotate-left"], [1, "mj-card", "mjo-ar__block"], ["aria-hidden", "true", 1, "fa-solid", "fa-rotate"], [1, "mj-table-wrap"], [1, "mj-table", "mj-table--compact"], [3, "RecordOpened", "Entity", "ViewEntity", "GridState"], [1, "mono", "small"], [1, "mj-num", "mj-money--credit"], [1, "small"], [1, "mono"], [1, "muted"], [1, "mjo-chip"], ["colspan", "5", 1, "small", "muted"]], template: function MJOCustomerARPageComponent_Template(rf, ctx) { if (rf & 1) {
529
- i0.ɵɵelementStart(0, "div", 0)(1, "aside", 1)(2, "div", 2)(3, "div", 3);
530
- i0.ɵɵelement(4, "i", 4);
531
- i0.ɵɵelementStart(5, "h3");
532
- i0.ɵɵtext(6, "Total A/R by age");
1701
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJOCustomerARPageComponent, selectors: [["mjo-customer-ar-page"]], outputs: { OrderOpened: "OrderOpened", SubscriptionOpened: "SubscriptionOpened", PaymentOpened: "PaymentOpened", AddressChanged: "AddressChanged" }, decls: 43, vars: 41, consts: [["search", ""], ["exportMenu", ""], [1, "mjo-ar", 3, "keydown.escape"], [1, "mjo-ar__bar"], ["Label", "Company", "Icon", "fa-solid fa-building", 3, "SelectedChange", "Options", "Selected"], [1, "mjo-search", "mjo-ar__search"], ["aria-hidden", "true", 1, "fa-solid", "fa-magnifying-glass"], ["placeholder", "Search customer, order or invoice number", "aria-label", "Search customer, order or invoice number", 3, "input", "value"], ["Icon", "fa-solid fa-xmark", 3, "Label", "Active"], ["role", "status", 1, "small", "muted", "mjo-ar__asof"], ["type", "button", "mjButton", "", "variant", "outline", "size", "sm", "title", "Refresh balances", 1, "mjo-ar__refresh", 3, "click", "disabled"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrows-rotate"], ["type", "button", "mjButton", "", "variant", "outline", "size", "sm", "title", "Export the customers listed", 1, "mjo-ar__export", 3, "cdkMenuTriggerFor", "disabled"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-export"], ["aria-hidden", "true", 1, "fa-solid", "fa-chevron-down", "mjo-ar__caret"], [1, "mjo-ar__notice", 3, "Variant"], [1, "mj-stat-grid", "mjo-ar__tiles"], ["Hint", "Show all customers", "Label", "A/R", "Icon", "fa-solid fa-file-invoice-dollar", 1, "mjo-ar__tile", 3, "Clicked", "Value", "Detail"], ["Hint", "Show customers with a past-due balance", "Label", "Past due", "Icon", "fa-solid fa-hourglass-half", 1, "mjo-ar__tile", 3, "Clicked", "Pressed", "Tone", "Value", "Detail"], ["Hint", "Show customers with installments not yet invoiced", "Label", "Scheduled, not yet invoiced", "Icon", "fa-solid fa-calendar-day", 1, "mjo-ar__tile", 3, "Clicked", "Pressed", "Value", "Detail"], ["Hint", "Show customers with credit on account", "Label", "Credit on account", "Icon", "fa-solid fa-piggy-bank", 1, "mjo-ar__tile", 3, "Clicked", "Pressed", "Value", "Detail"], [1, "mjo-ar__stage"], ["aria-label", "Customers", 1, "mj-card", "mjo-ar__list"], [1, "mj-card-head"], ["type", "button", "title", "Back to all customers (Esc)", 1, "mjo-ar__back"], [1, "right", "small", "muted"], [1, "mjo-ar__age"], ["role", "table", "aria-label", "A/R by customer", 1, "mjo-ar__table", 3, "keydown.arrowdown", "keydown.arrowup"], ["role", "row", 1, "mjo-ar__cols", "mjo-ar__cols--head"], ["role", "columnheader", 1, "mjo-ar__hcell", 3, "mjo-ar__wide"], ["role", "row"], ["aria-label", "Customer detail", 1, "mjo-ar__detail"], ["Icon", "fa-solid fa-xmark", 3, "Clicked", "Label", "Active"], ["cdkMenu", "", "aria-label", "Export", 1, "mjo-ar__menu"], ["cdkMenuGroup", "", "aria-label", "Aging summary, by customer"], ["aria-hidden", "true", 1, "mjo-ar__menu-label"], ["type", "button", "cdkMenuItem", "", 1, "mjo-ar__menu-item", 3, "cdkMenuItemTriggered"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-excel"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-csv"], ["cdkMenuGroup", "", "aria-label", "Open items, by invoice"], ["type", "button", "title", "Back to all customers (Esc)", 1, "mjo-ar__back", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-left"], ["aria-hidden", "true", 1, "fa-solid", "fa-user-tag"], [3, "Buckets"], ["role", "columnheader", 1, "mjo-ar__hcell"], ["type", "button", 1, "mjo-ar__th", 3, "click", "title"], ["aria-hidden", "true", 1, "fa-solid", 3, "fa-arrow-down", "fa-arrow-up"], ["aria-hidden", "true", 1, "fa-solid"], ["aria-hidden", "true", 1, "mjo-ar__cols", "mjo-ar__row", "mjo-ar__skeleton"], [1, "mjo-ar__cell", "mjo-ar__who"], [1, "mjo-ar__bone", "mjo-ar__bone--dot"], [1, "mjo-ar__bone"], [1, "mjo-ar__cell", "mjo-ar__num"], [1, "mjo-ar__bone", "mjo-ar__bone--num"], ["role", "cell"], ["Icon", "fa-solid fa-triangle-exclamation", "Title", "A/R could not be loaded", "Message", "Nothing is shown because the read failed, not because nothing is owed. Use Refresh to try again.", 1, "mjo-ar__empty"], ["role", "row", 1, "mjo-ar__cols", "mjo-ar__row", 3, "is-active"], ["role", "row", 1, "mjo-ar__cols", "mjo-ar__row", "mjo-ar__total"], ["role", "row", 1, "mjo-ar__cols", "mjo-ar__row", 3, "focus", "click", "keydown.enter", "keydown.space"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__who"], ["aria-hidden", "true", 1, "mj-avatar", "mjo-ar__avatar"], [1, "mjo-ar__who-body"], [1, "mjo-ar__name"], [1, "small", "mjo-ar__sub"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__num", "mjo-ar__owed"], [1, "mj-num"], ["aria-hidden", "true", 1, "mjo-ar__mix"], [1, "small", "mj-money--credit", "mjo-ar__cr"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__num", "mjo-ar__wide", "mj-num"], ["type", "button", "tabindex", "-1", "title", "View past-due invoices", 1, "mjo-ar__drill", "mjo-ar__very-late"], [1, "mjo-ar__zero"], ["type", "button", "tabindex", "-1", "title", "View current invoices", 1, "mjo-ar__drill"], ["type", "button", "tabindex", "-1", "title", "View invoices 1 to 30 days past due", 1, "mjo-ar__drill", "mjo-ar__late"], ["type", "button", "tabindex", "-1", "title", "View invoices 31 to 60 days past due", 1, "mjo-ar__drill", "mjo-ar__late"], ["type", "button", "tabindex", "-1", "title", "View invoices more than 60 days past due", 1, "mjo-ar__drill", "mjo-ar__late"], ["type", "button", "tabindex", "-1", "title", "View scheduled installments", 1, "mjo-ar__drill"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__num", "mjo-ar__wide", "mjo-ar__next"], [1, "small", "muted"], [1, "mjo-ar__mix-cur"], [1, "mjo-ar__mix-30"], [1, "mjo-ar__mix-60"], [1, "mjo-ar__mix-90"], ["type", "button", "tabindex", "-1", "title", "View past-due invoices", 1, "mjo-ar__drill", "mjo-ar__very-late", 3, "keydown.enter", "click"], ["type", "button", "tabindex", "-1", "title", "View current invoices", 1, "mjo-ar__drill", 3, "keydown.enter", "click"], ["type", "button", "tabindex", "-1", "title", "View invoices 1 to 30 days past due", 1, "mjo-ar__drill", "mjo-ar__late", 3, "keydown.enter", "click"], ["type", "button", "tabindex", "-1", "title", "View invoices 31 to 60 days past due", 1, "mjo-ar__drill", "mjo-ar__late", 3, "keydown.enter", "click"], ["type", "button", "tabindex", "-1", "title", "View invoices more than 60 days past due", 1, "mjo-ar__drill", "mjo-ar__late", 3, "keydown.enter", "click"], ["type", "button", "tabindex", "-1", "title", "View scheduled installments", 1, "mjo-ar__drill", 3, "keydown.enter", "click"], ["Icon", "fa-solid fa-user-tag", 1, "mjo-ar__empty", 3, "Title", "Message"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__num"], ["role", "cell", 1, "mjo-ar__cell", "mjo-ar__wide"], [1, "mj-card"], [1, "mj-card-pad"], [1, "mjo-ar__header"], ["aria-hidden", "true", 1, "mj-avatar", "mjo-ar__avatar-lg"], [1, "mjo-ar__header-body"], ["type", "button", 1, "mjo-ar__header-name", "mjo-ar__header-link", 3, "title"], [1, "mjo-ar__header-name"], [1, "mjo-ar__actions"], ["type", "button", "mjButton", "", "variant", "primary", "size", "sm", "title", "Start a new payment for this customer in a new tab"], ["type", "button", "mjButton", "", "variant", "outline", "size", "sm", "title", "Back to all customers (Esc)", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-xmark"], [1, "mjo-ar__figures"], [1, "mjo-ar__figure"], [1, "mjo-ar__figure-label"], [1, "mjo-ar__figure-value"], [1, "mjo-ar__aging"], ["Variant", "success", "Icon", "fa-solid fa-piggy-bank", 1, "mjo-ar__credit"], [1, "mj-card", "mjo-ar__block"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-invoice-dollar"], ["role", "group", "aria-label", "Show", 1, "row", "wrap", "mjo-ar__item-filters"], [1, "mj-table-wrap", "mjo-ar__items"], [1, "mj-table", "mj-table--compact"], [3, "mjo-ar__right"], ["tabindex", "0", 1, "is-clickable"], [1, "is-total"], [1, "mjo-ar__grid"], ["aria-hidden", "true", 1, "fa-solid", "fa-piggy-bank"], [1, "mjo-ar__line"], ["aria-hidden", "true", 1, "fa-solid", "fa-clock-rotate-left"], ["aria-hidden", "true", 1, "fa-solid", "fa-rotate"], [1, "mj-table-wrap"], ["type", "button", 1, "mjo-ar__header-name", "mjo-ar__header-link", 3, "click", "title"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-up-right-from-square"], ["type", "button", "mjButton", "", "variant", "primary", "size", "sm", "title", "Start a new payment for this customer in a new tab", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-hand-holding-dollar"], ["type", "button", 1, "mjo-ar__ref", "mono", "small", 3, "click", "title"], [1, "mjo-ar__figure-value", "mj-money--credit"], [3, "Label", "Count", "Active"], [3, "Clicked", "Label", "Count", "Active"], ["type", "button", 1, "mjo-ar__ith", 3, "click", "title"], ["aria-hidden", "true", 1, "fa-solid", "fa-sort", "mjo-ar__sort-idle"], ["tabindex", "0", 1, "is-clickable", 3, "click", "keydown.enter", "keydown.space"], [1, "mono", "small", "primary"], [1, "small"], [1, "mono", "small"], [1, "mj-num", "mjo-ar__right"], [1, "mjo-ar__status", 3, "click", "keydown.enter", "keydown.space"], [1, "mjo-chip"], ["type", "button", "mjButton", "", "variant", "outline", "size", "sm", "title", "Issue this installment as an invoice", 3, "disabled"], ["type", "button", "mjButton", "", "variant", "outline", "size", "sm", "title", "Issue this installment as an invoice", 3, "click", "disabled"], ["aria-hidden", "true", 1, "fa-solid", "fa-file-invoice"], ["colspan", "11", 1, "small", "muted"], ["colspan", "10"], [1, "mj-num", "mj-money--credit"], [1, "muted"], ["tabindex", "0", 1, "is-clickable", 3, "click", "keydown.enter"], ["colspan", "5", 1, "small", "muted"]], template: function MJOCustomerARPageComponent_Template(rf, ctx) { if (rf & 1) {
1702
+ const _r1 = i0.ɵɵgetCurrentView();
1703
+ i0.ɵɵelementStart(0, "div", 2);
1704
+ i0.ɵɵlistener("keydown.escape", function MJOCustomerARPageComponent_Template_div_keydown_escape_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnEscape($event)); });
1705
+ i0.ɵɵelementStart(1, "div", 3)(2, "mjo-multi-select", 4);
1706
+ i0.ɵɵlistener("SelectedChange", function MJOCustomerARPageComponent_Template_mjo_multi_select_SelectedChange_2_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnCompanies($event)); });
533
1707
  i0.ɵɵelementEnd();
534
- i0.ɵɵelementStart(7, "span", 5);
535
- i0.ɵɵtext(8);
1708
+ i0.ɵɵelementStart(3, "div", 5);
1709
+ i0.ɵɵelement(4, "i", 6);
1710
+ i0.ɵɵelementStart(5, "input", 7, 0);
1711
+ i0.ɵɵlistener("input", function MJOCustomerARPageComponent_Template_input_input_5_listener() { i0.ɵɵrestoreView(_r1); const search_r2 = i0.ɵɵreference(6); return i0.ɵɵresetView(ctx.OnSearch(search_r2.value)); });
536
1712
  i0.ɵɵelementEnd()();
537
- i0.ɵɵelementStart(9, "div", 6);
538
- i0.ɵɵelement(10, "mjo-aging-bar", 7);
539
- i0.ɵɵelementStart(11, "div", 8);
540
- i0.ɵɵtext(12, " All customers with an open balance. ");
541
- i0.ɵɵelementEnd()()();
542
- i0.ɵɵelementStart(13, "div", 9)(14, "div", 3);
543
- i0.ɵɵelement(15, "i", 10);
544
- i0.ɵɵelementStart(16, "h3");
545
- i0.ɵɵtext(17, "Customers with a balance");
1713
+ i0.ɵɵconditionalCreate(7, MJOCustomerARPageComponent_Conditional_7_Template, 1, 2, "mj-filter-chip", 8);
1714
+ i0.ɵɵelementStart(8, "span", 9);
1715
+ i0.ɵɵconditionalCreate(9, MJOCustomerARPageComponent_Conditional_9_Template, 1, 1);
1716
+ i0.ɵɵconditionalCreate(10, MJOCustomerARPageComponent_Conditional_10_Template, 1, 1);
1717
+ i0.ɵɵelementEnd();
1718
+ i0.ɵɵelementStart(11, "button", 10);
1719
+ i0.ɵɵlistener("click", function MJOCustomerARPageComponent_Template_button_click_11_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.Refresh()); });
1720
+ i0.ɵɵelement(12, "i", 11);
1721
+ i0.ɵɵtext(13, " Refresh ");
1722
+ i0.ɵɵelementEnd();
1723
+ i0.ɵɵelementStart(14, "button", 12);
1724
+ i0.ɵɵelement(15, "i", 13);
1725
+ i0.ɵɵtext(16);
1726
+ i0.ɵɵelement(17, "i", 14);
1727
+ i0.ɵɵelementEnd();
1728
+ i0.ɵɵtemplate(18, MJOCustomerARPageComponent_ng_template_18_Template, 19, 0, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor);
1729
+ i0.ɵɵelementEnd();
1730
+ i0.ɵɵconditionalCreate(20, MJOCustomerARPageComponent_Conditional_20_Template, 2, 2, "mj-alert", 15);
1731
+ i0.ɵɵelementStart(21, "div", 16)(22, "mjo-stat-tile", 17);
1732
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Template_mjo_stat_tile_Clicked_22_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPreset("all")); });
1733
+ i0.ɵɵelementEnd();
1734
+ i0.ɵɵelementStart(23, "mjo-stat-tile", 18);
1735
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Template_mjo_stat_tile_Clicked_23_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPreset("pastdue")); });
1736
+ i0.ɵɵelementEnd();
1737
+ i0.ɵɵelementStart(24, "mjo-stat-tile", 19);
1738
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Template_mjo_stat_tile_Clicked_24_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPreset("scheduled")); });
1739
+ i0.ɵɵelementEnd();
1740
+ i0.ɵɵelementStart(25, "mjo-stat-tile", 20);
1741
+ i0.ɵɵlistener("Clicked", function MJOCustomerARPageComponent_Template_mjo_stat_tile_Clicked_25_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPreset("credit")); });
546
1742
  i0.ɵɵelementEnd()();
547
- i0.ɵɵelementStart(18, "div", 11);
548
- i0.ɵɵrepeaterCreate(19, MJOCustomerARPageComponent_For_20_Template, 12, 7, "button", 12, _forTrack0, false, MJOCustomerARPageComponent_ForEmpty_21_Template, 2, 0, "div", 13);
549
- i0.ɵɵelementEnd()()();
550
- i0.ɵɵelementStart(22, "div", 14);
551
- i0.ɵɵconditionalCreate(23, MJOCustomerARPageComponent_Conditional_23_Template, 69, 17)(24, MJOCustomerARPageComponent_Conditional_24_Template, 1, 0, "mj-empty-state", 15);
1743
+ i0.ɵɵelementStart(26, "div", 21)(27, "section", 22)(28, "div", 23);
1744
+ i0.ɵɵconditionalCreate(29, MJOCustomerARPageComponent_Conditional_29_Template, 3, 0, "button", 24)(30, MJOCustomerARPageComponent_Conditional_30_Template, 3, 0);
1745
+ i0.ɵɵelementStart(31, "span", 25);
1746
+ i0.ɵɵtext(32);
1747
+ i0.ɵɵelementEnd()();
1748
+ i0.ɵɵconditionalCreate(33, MJOCustomerARPageComponent_Conditional_33_Template, 2, 1, "div", 26);
1749
+ i0.ɵɵelementStart(34, "div", 27);
1750
+ i0.ɵɵlistener("keydown.arrowdown", function MJOCustomerARPageComponent_Template_div_keydown_arrowdown_34_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnArrow($event, 1)); })("keydown.arrowup", function MJOCustomerARPageComponent_Template_div_keydown_arrowup_34_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnArrow($event, -1)); });
1751
+ i0.ɵɵelementStart(35, "div", 28);
1752
+ i0.ɵɵrepeaterCreate(36, MJOCustomerARPageComponent_For_37_Template, 5, 10, "div", 29, _forTrack0);
1753
+ i0.ɵɵelementEnd();
1754
+ i0.ɵɵconditionalCreate(38, MJOCustomerARPageComponent_Conditional_38_Template, 2, 0)(39, MJOCustomerARPageComponent_Conditional_39_Template, 3, 0, "div", 30)(40, MJOCustomerARPageComponent_Conditional_40_Template, 4, 2);
552
1755
  i0.ɵɵelementEnd()();
1756
+ i0.ɵɵelementStart(41, "section", 31);
1757
+ i0.ɵɵconditionalCreate(42, MJOCustomerARPageComponent_Conditional_42_Template, 116, 28);
1758
+ i0.ɵɵelementEnd()()();
553
1759
  } if (rf & 2) {
554
- i0.ɵɵadvance(8);
555
- i0.ɵɵtextInterpolate(ctx.money(ctx.TotalOpen));
1760
+ let tmp_37_0;
1761
+ const exportMenu_r37 = i0.ɵɵreference(19);
1762
+ i0.ɵɵclassProp("is-detail", ctx.IsDetail);
1763
+ i0.ɵɵadvance(2);
1764
+ i0.ɵɵproperty("Options", ctx.Companies)("Selected", ctx.CompanyPicks);
1765
+ i0.ɵɵadvance(3);
1766
+ i0.ɵɵproperty("value", ctx.Search);
1767
+ i0.ɵɵadvance(2);
1768
+ i0.ɵɵconditional(ctx.Preset !== "all" ? 7 : -1);
556
1769
  i0.ɵɵadvance(2);
557
- i0.ɵɵproperty("Buckets", ctx.TotalBuckets);
558
- i0.ɵɵadvance(9);
559
- i0.ɵɵrepeater(ctx.Customers);
1770
+ i0.ɵɵconditional(ctx.AsOfDisplay ? 9 : -1);
1771
+ i0.ɵɵadvance();
1772
+ i0.ɵɵconditional(ctx.UpdatedText ? 10 : -1);
1773
+ i0.ɵɵadvance();
1774
+ i0.ɵɵproperty("disabled", ctx.Loading);
1775
+ i0.ɵɵadvance();
1776
+ i0.ɵɵclassProp("fa-spin", ctx.Loading);
1777
+ i0.ɵɵadvance(2);
1778
+ i0.ɵɵproperty("cdkMenuTriggerFor", exportMenu_r37)("disabled", !ctx.Shown.length || ctx.Exporting);
1779
+ i0.ɵɵadvance(2);
1780
+ i0.ɵɵtextInterpolate1(" ", ctx.Exporting ? "Exporting\u2026" : "Export", " ");
1781
+ i0.ɵɵadvance(4);
1782
+ i0.ɵɵconditional(ctx.Notice ? 20 : -1);
1783
+ i0.ɵɵadvance(2);
1784
+ i0.ɵɵproperty("Value", ctx.Loaded ? ctx.money(ctx.Book.Owed) : "\u2014")("Detail", ctx.Loaded ? "Invoiced and unpaid \u00B7 " + ctx.plural(ctx.Book.OwingCustomers, "customer") : "Loading\u2026");
1785
+ i0.ɵɵadvance();
1786
+ i0.ɵɵclassProp("is-on", ctx.Preset === "pastdue");
1787
+ i0.ɵɵproperty("Pressed", ctx.Preset === "pastdue")("Tone", ctx.Book.PastDue > 0 ? "alert" : "default")("Value", ctx.Loaded ? ctx.money(ctx.Book.PastDue) : "\u2014")("Detail", ctx.pastDueDetail);
1788
+ i0.ɵɵadvance();
1789
+ i0.ɵɵclassProp("is-on", ctx.Preset === "scheduled");
1790
+ i0.ɵɵproperty("Pressed", ctx.Preset === "scheduled")("Value", ctx.Loaded ? ctx.money(ctx.Book.Scheduled) : "\u2014")("Detail", ctx.scheduledDetail);
1791
+ i0.ɵɵadvance();
1792
+ i0.ɵɵclassProp("is-on", ctx.Preset === "credit");
1793
+ i0.ɵɵproperty("Pressed", ctx.Preset === "credit")("Value", ctx.Loaded ? ctx.money(ctx.Book.Credit) : "\u2014")("Detail", ctx.Loaded ? "Unapplied customer credit" : "Loading\u2026");
560
1794
  i0.ɵɵadvance(4);
561
- i0.ɵɵconditional(ctx.Selected ? 23 : 24);
562
- } }, dependencies: [CommonModule, EntityViewerModule, i1.EntityViewerComponent, MJOAgingBarComponent, MJOMoneyStripComponent, MJAlertComponent, MJEmptyStateComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n height: 100%;\n overflow: auto;\n padding: var(--mj-space-6);\n }\n .mjo-ar__split[_ngcontent-%COMP%] {\n display: flex;\n gap: var(--mj-space-4);\n align-items: flex-start;\n }\n .mjo-ar__left[_ngcontent-%COMP%] { flex: 0 0 300px; min-width: 0; }\n .mjo-ar__right[_ngcontent-%COMP%] { flex: 1; min-width: 0; }\n .mjo-ar__list[_ngcontent-%COMP%] { padding: var(--mj-space-2); }\n\n .mjo-ar__cust[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n padding: var(--mj-space-3);\n border-radius: var(--mj-radius-md);\n cursor: pointer;\n border: 1px solid transparent;\n background: none;\n width: 100%;\n text-align: left;\n font-family: inherit;\n color: inherit;\n }\n .mjo-ar__cust[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); }\n .mjo-ar__cust.is-active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n border-color: color-mix(in srgb, var(--mj-brand-primary) 35%, transparent);\n }\n .mjo-ar__avatar[_ngcontent-%COMP%] { width: 30px; height: 30px; font-size: 11px; }\n .mjo-ar__avatar-lg[_ngcontent-%COMP%] { width: 44px; height: 44px; font-size: 15px; }\n .mjo-ar__cust-body[_ngcontent-%COMP%] { flex: 1; min-width: 0; }\n .mjo-ar__cust-name[_ngcontent-%COMP%] { font-size: 13px; font-weight: var(--mj-font-medium); display: block; }\n .mjo-ar__cust-sub[_ngcontent-%COMP%] { display: block; }\n .mjo-ar__cust-amt[_ngcontent-%COMP%] { text-align: right; }\n .mjo-ar__cust-credit[_ngcontent-%COMP%] { display: block; }\n\n .mjo-ar__header[_ngcontent-%COMP%] { display: flex; align-items: flex-start; gap: var(--mj-space-4); }\n .mjo-ar__header-body[_ngcontent-%COMP%] { flex: 1; min-width: 0; }\n .mjo-ar__header-name[_ngcontent-%COMP%] { font-size: 17px; font-weight: var(--mj-font-semibold); }\n .mjo-ar__strip[_ngcontent-%COMP%] { display: block; margin-top: var(--mj-space-4); }\n .mjo-ar__aging[_ngcontent-%COMP%] { margin-top: var(--mj-space-4); }\n .mjo-ar__credit[_ngcontent-%COMP%] { margin-top: var(--mj-space-4); }\n .mjo-ar__items[_ngcontent-%COMP%] {\n margin-top: var(--mj-space-4);\n display: flex;\n flex-direction: column;\n height: 520px;\n min-height: 450px;\n }\n .mjo-ar__viewer-host[_ngcontent-%COMP%] {\n flex: 1 1 auto;\n height: 100%;\n min-height: 380px;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n }\n mj-entity-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n height: 100%;\n width: 100%;\n }\n \n\n\n\n .mjo-ar__grid[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: var(--mj-space-4);\n margin-top: var(--mj-space-4);\n }\n .mjo-ar__row[_ngcontent-%COMP%] {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--mj-space-3);\n padding: var(--mj-space-2) 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n .mjo-ar__row[_ngcontent-%COMP%]:last-child { border-bottom: none; }\n .mjo-ar__block[_ngcontent-%COMP%] { margin-top: var(--mj-space-4); }\n .mjo-ar__total[_ngcontent-%COMP%] { display: block; }\n\n @media (max-width: 900px) {\n .mjo-ar__grid[_ngcontent-%COMP%] { grid-template-columns: 1fr; }\n }\n\n @media (max-width: 1100px) {\n .mjo-ar__split[_ngcontent-%COMP%] { flex-direction: column; }\n .mjo-ar__left[_ngcontent-%COMP%], .mjo-ar__right[_ngcontent-%COMP%] { flex: 1 1 auto; width: 100%; }\n }\n @media (max-width: 760px) {\n [_nghost-%COMP%] { padding: var(--mj-space-4); }\n }"] });
1795
+ i0.ɵɵconditional(ctx.IsDetail ? 29 : 30);
1796
+ i0.ɵɵadvance(3);
1797
+ i0.ɵɵtextInterpolate2("", ctx.Shown.length, "", ctx.Shown.length !== ctx.AllCount ? " of " + ctx.AllCount : "");
1798
+ i0.ɵɵadvance();
1799
+ i0.ɵɵconditional(ctx.Totals.Owed > 0 ? 33 : -1);
1800
+ i0.ɵɵadvance();
1801
+ i0.ɵɵattribute("aria-busy", ctx.Loading);
1802
+ i0.ɵɵadvance(2);
1803
+ i0.ɵɵrepeater(ctx.Columns);
1804
+ i0.ɵɵadvance(2);
1805
+ i0.ɵɵconditional(!ctx.Loaded && ctx.Loading ? 38 : !ctx.Loaded ? 39 : 40);
1806
+ i0.ɵɵadvance(3);
1807
+ i0.ɵɵattribute("inert", ctx.IsDetail ? null : "");
1808
+ i0.ɵɵadvance();
1809
+ i0.ɵɵconditional((tmp_37_0 = ctx.Detail) ? 42 : -1, tmp_37_0);
1810
+ } }, dependencies: [CommonModule,
1811
+ CdkMenu,
1812
+ CdkMenuGroup,
1813
+ CdkMenuItem,
1814
+ CdkMenuTrigger,
1815
+ MJAlertComponent,
1816
+ MJButtonDirective,
1817
+ MJEmptyStateComponent,
1818
+ MJFilterChipComponent,
1819
+ MJOAgingBarComponent,
1820
+ MJOMultiSelectComponent,
1821
+ MJOStatTileComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n height: 100%;\n overflow: auto;\n padding: var(--mj-space-6);\n \n\n\n --mjo-ar-fold: 320ms;\n --mjo-ar-ease: cubic-bezier(0.22, 0.8, 0.26, 1);\n --mjo-ar-list-width: 372px;\n }\n \n\n\n .mjo-ar[_ngcontent-%COMP%] { container-type: inline-size; container-name: mjo-ar; }\n\n \n\n .mjo-ar__bar[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n flex-wrap: wrap;\n margin-bottom: var(--mj-space-4);\n }\n .mjo-ar__search[_ngcontent-%COMP%] { min-width: 300px; }\n .mjo-ar__asof[_ngcontent-%COMP%] { margin-left: auto; white-space: nowrap; }\n .mjo-ar__refresh[_ngcontent-%COMP%], .mjo-ar__export[_ngcontent-%COMP%] { flex: none; }\n .mjo-ar__caret[_ngcontent-%COMP%] { font-size: 10px; margin-left: 2px; }\n .mjo-ar__menu[_ngcontent-%COMP%] {\n min-width: 260px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-md);\n box-shadow: var(--mj-shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));\n padding: var(--mj-space-1, 4px);\n }\n .mjo-ar__menu-label[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-text-muted);\n padding: 8px 10px 2px;\n }\n .mjo-ar__menu-item[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: var(--mj-space-2);\n width: 100%;\n font: inherit;\n font-size: 13px;\n text-align: left;\n padding: 8px 10px;\n border: none;\n border-radius: var(--mj-radius-md);\n background: none;\n color: inherit;\n cursor: pointer;\n }\n .mjo-ar__menu-item[_ngcontent-%COMP%]:hover, .mjo-ar__menu-item[_ngcontent-%COMP%]:focus-visible { background: var(--mj-bg-surface-sunken); outline: none; }\n .mjo-ar__menu-item[_ngcontent-%COMP%] i[_ngcontent-%COMP%] { color: var(--mj-text-muted); width: 16px; }\n .mjo-ar__notice[_ngcontent-%COMP%] { display: block; margin-bottom: var(--mj-space-4); }\n\n \n\n .mjo-ar__tiles[_ngcontent-%COMP%] { margin-bottom: var(--mj-space-4); }\n .mjo-ar__tile[_ngcontent-%COMP%] {\n display: block;\n border-radius: var(--mj-radius-md);\n transition: box-shadow 140ms ease;\n }\n \n\n .mjo-ar__tile.is-on[_ngcontent-%COMP%] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 55%, transparent); }\n\n \n\n\n\n .mjo-ar__stage[_ngcontent-%COMP%] {\n display: flex;\n align-items: flex-start;\n gap: 0;\n }\n .mjo-ar__list[_ngcontent-%COMP%] {\n flex: 1 1 100%;\n min-width: 0;\n \n\n\n overflow: clip;\n transition: flex-basis var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar__detail[_ngcontent-%COMP%] {\n flex: 0 1 0%;\n min-width: 0;\n max-width: 0;\n opacity: 0;\n overflow: hidden;\n transform: translateX(24px);\n transition:\n max-width var(--mjo-ar-fold) var(--mjo-ar-ease),\n opacity 200ms ease,\n transform var(--mjo-ar-fold) var(--mjo-ar-ease),\n margin-left var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__list[_ngcontent-%COMP%] {\n flex: 0 0 var(--mjo-ar-list-width);\n position: sticky;\n top: 0;\n max-height: calc(100vh - 140px);\n overflow-y: auto;\n }\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__detail[_ngcontent-%COMP%] {\n flex: 1 1 0%;\n max-width: 100%;\n opacity: 1;\n transform: none;\n margin-left: var(--mj-space-5);\n overflow: visible;\n transition:\n max-width var(--mjo-ar-fold) var(--mjo-ar-ease),\n opacity 260ms ease 120ms,\n transform var(--mjo-ar-fold) var(--mjo-ar-ease),\n margin-left var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar__back[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n border: none;\n background: none;\n font: inherit;\n font-size: 13px;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-brand-primary);\n cursor: pointer;\n padding: 2px 4px;\n border-radius: var(--mj-radius-md);\n }\n .mjo-ar__back[_ngcontent-%COMP%]:hover { background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent); }\n\n \n\n\n\n .mjo-ar__age[_ngcontent-%COMP%] { padding: var(--mj-space-3) var(--mj-space-4) var(--mj-space-2); }\n .mjo-ar__table[_ngcontent-%COMP%] { display: block; }\n .mjo-ar__cols[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 118px 104px 96px 96px 96px 96px 112px 104px 108px;\n align-items: center;\n column-gap: 0;\n transition: grid-template-columns var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__cols[_ngcontent-%COMP%] { grid-template-columns: minmax(0, 1fr) 124px 0px 0px 0px 0px 0px 0px 0px 0px; }\n .mjo-ar__wide[_ngcontent-%COMP%] {\n overflow: hidden;\n white-space: nowrap;\n transition: opacity 180ms ease, padding var(--mjo-ar-fold) var(--mjo-ar-ease), visibility 0s;\n }\n \n\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__wide[_ngcontent-%COMP%] {\n opacity: 0;\n visibility: hidden;\n padding-left: 0;\n padding-right: 0;\n transition: opacity 180ms ease, padding var(--mjo-ar-fold) var(--mjo-ar-ease), visibility 0s linear 180ms;\n }\n\n .mjo-ar__cols--head[_ngcontent-%COMP%] {\n border-top: 1px solid var(--mj-border-subtle);\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n position: sticky;\n top: 0;\n z-index: 1;\n }\n .mjo-ar__hcell[_ngcontent-%COMP%] { min-width: 0; }\n .mjo-ar__th[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-width: 0;\n padding: 9px var(--mj-space-3);\n border: none;\n background: none;\n font: inherit;\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n letter-spacing: 0.03em;\n text-transform: uppercase;\n color: var(--mj-text-muted);\n cursor: pointer;\n white-space: nowrap;\n }\n .mjo-ar__hcell[_ngcontent-%COMP%]:first-child .mjo-ar__th[_ngcontent-%COMP%] { padding-left: var(--mj-space-4); }\n .mjo-ar__th--num[_ngcontent-%COMP%] { justify-content: flex-end; }\n .mjo-ar__th[_ngcontent-%COMP%]:hover, .mjo-ar__th.is-sorted[_ngcontent-%COMP%] { color: var(--mj-text-primary); }\n .mjo-ar__th[_ngcontent-%COMP%] i[_ngcontent-%COMP%] { font-size: 9px; }\n .mjo-ar__th[_ngcontent-%COMP%]:focus-visible, .mjo-ar__row[_ngcontent-%COMP%]:focus-visible, .mjo-ar__back[_ngcontent-%COMP%]:focus-visible, .mjo-ar__ref[_ngcontent-%COMP%]:focus-visible, .mjo-ar__ith[_ngcontent-%COMP%]:focus-visible, .mjo-ar__header-link[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: -2px;\n }\n\n .mjo-ar__row[_ngcontent-%COMP%] {\n width: 100%;\n border-bottom: 1px solid var(--mj-border-subtle);\n border-left: 3px solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease;\n }\n .mjo-ar__row[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); }\n .mjo-ar__row.is-active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n border-left-color: var(--mj-brand-primary);\n }\n \n\n .mjo-ar__total[_ngcontent-%COMP%] {\n cursor: default;\n border-bottom: none;\n border-top: 2px solid var(--mj-border-strong);\n background: var(--mj-bg-surface-card);\n font-weight: var(--mj-font-semibold);\n position: sticky;\n bottom: 0;\n z-index: 1;\n }\n .mjo-ar__total[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-card); }\n .mjo-ar__cell[_ngcontent-%COMP%] { min-width: 0; padding: 10px var(--mj-space-3); font-size: 13px; }\n .mjo-ar__num[_ngcontent-%COMP%] { text-align: right; white-space: nowrap; }\n .mjo-ar__who[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n padding-left: var(--mj-space-3);\n }\n .mjo-ar__who-body[_ngcontent-%COMP%] { min-width: 0; display: flex; flex-direction: column; }\n .mjo-ar__name[_ngcontent-%COMP%] {\n font-weight: var(--mj-font-medium);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .mjo-ar__sub[_ngcontent-%COMP%] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .mjo-ar__owed[_ngcontent-%COMP%] { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }\n .mjo-ar__next[_ngcontent-%COMP%] { display: flex; flex-direction: column; align-items: flex-end; }\n \n\n .mjo-ar__mix[_ngcontent-%COMP%] {\n display: flex;\n width: 72px;\n height: 4px;\n border-radius: 2px;\n overflow: hidden;\n background: var(--mj-border-subtle);\n }\n .mjo-ar__mix[_ngcontent-%COMP%] i[_ngcontent-%COMP%] { display: block; flex: 0 0 0; min-width: 0; }\n .mjo-ar__mix-cur[_ngcontent-%COMP%] { background: var(--mj-color-neutral-500); }\n .mjo-ar__mix-30[_ngcontent-%COMP%] { background: var(--mj-color-warning-500); }\n .mjo-ar__mix-60[_ngcontent-%COMP%] { background: var(--mj-color-error-500); }\n .mjo-ar__mix-90[_ngcontent-%COMP%] { background: var(--mj-color-error-700); }\n .mjo-ar__cr[_ngcontent-%COMP%] { white-space: nowrap; }\n .mjo-ar__zero[_ngcontent-%COMP%] { color: var(--mj-text-disabled); }\n .mjo-ar__late[_ngcontent-%COMP%] { color: var(--mj-status-warning-text); }\n .mjo-ar__very-late[_ngcontent-%COMP%] { color: var(--mj-status-error-text); font-weight: var(--mj-font-semibold); }\n \n\n .mjo-ar__drill[_ngcontent-%COMP%] {\n border: none;\n background: none;\n padding: 1px 3px;\n margin: -1px -3px;\n font: inherit;\n font-variant-numeric: tabular-nums;\n color: inherit;\n cursor: pointer;\n border-radius: var(--mj-radius-md);\n text-decoration: underline dotted;\n text-underline-offset: 3px;\n }\n .mjo-ar__drill.mjo-ar__late[_ngcontent-%COMP%] { color: var(--mj-status-warning-text); }\n .mjo-ar__drill.mjo-ar__very-late[_ngcontent-%COMP%] { color: var(--mj-status-error-text); }\n .mjo-ar__drill[_ngcontent-%COMP%]:hover { text-decoration: underline; background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent); }\n .mjo-ar__avatar[_ngcontent-%COMP%] { width: 30px; height: 30px; font-size: 11px; flex: none; }\n .mjo-ar__avatar-lg[_ngcontent-%COMP%] { width: 44px; height: 44px; font-size: 15px; flex: none; }\n .mjo-ar__empty[_ngcontent-%COMP%] { display: block; padding: var(--mj-space-6) var(--mj-space-4); }\n\n \n\n .mjo-ar__skeleton[_ngcontent-%COMP%] { cursor: default; }\n .mjo-ar__skeleton[_ngcontent-%COMP%]:hover { background: none; }\n .mjo-ar__bone[_ngcontent-%COMP%] {\n display: inline-block;\n height: 12px;\n border-radius: 6px;\n background: linear-gradient(90deg, var(--mj-bg-surface-sunken) 25%, var(--mj-bg-surface-hover) 50%, var(--mj-bg-surface-sunken) 75%);\n background-size: 200% 100%;\n animation: _ngcontent-%COMP%_mjo-ar-shimmer 1.3s ease-in-out infinite;\n }\n .mjo-ar__bone--dot[_ngcontent-%COMP%] { width: 30px; height: 30px; border-radius: 50%; flex: none; }\n .mjo-ar__bone--num[_ngcontent-%COMP%] { width: 76px; }\n @keyframes _ngcontent-%COMP%_mjo-ar-shimmer {\n from { background-position: 200% 0; }\n to { background-position: -200% 0; }\n }\n\n \n\n .mjo-ar__header[_ngcontent-%COMP%] { display: flex; align-items: flex-start; gap: var(--mj-space-4); }\n .mjo-ar__header-body[_ngcontent-%COMP%] { flex: 1; min-width: 0; }\n .mjo-ar__header-name[_ngcontent-%COMP%] { font-size: 18px; font-weight: var(--mj-font-semibold); }\n \n\n .mjo-ar__header-link[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: baseline;\n gap: var(--mj-space-2);\n border: none;\n background: none;\n padding: 0;\n font-family: inherit;\n color: var(--mj-brand-primary);\n cursor: pointer;\n text-align: left;\n }\n .mjo-ar__header-link[_ngcontent-%COMP%] i[_ngcontent-%COMP%] { font-size: 11px; }\n .mjo-ar__header-link[_ngcontent-%COMP%]:hover { text-decoration: underline; text-underline-offset: 3px; }\n .mjo-ar__actions[_ngcontent-%COMP%] { display: flex; align-items: center; gap: var(--mj-space-2); flex: none; }\n .mjo-ar__figures[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: var(--mj-space-3);\n margin: var(--mj-space-4) 0 0;\n }\n .mjo-ar__figure[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-subtle);\n border-radius: var(--mj-radius-md);\n padding: var(--mj-space-3);\n min-width: 0;\n }\n .mjo-ar__figure-label[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n letter-spacing: 0.03em;\n text-transform: uppercase;\n color: var(--mj-text-muted);\n }\n \n\n .mjo-ar__figure-value[_ngcontent-%COMP%] {\n margin: 2px 0;\n font-size: 19px;\n font-weight: var(--mj-font-semibold);\n font-variant-numeric: tabular-nums;\n text-align: left;\n }\n .mjo-ar__aging[_ngcontent-%COMP%] { margin-top: var(--mj-space-4); }\n .mjo-ar__credit[_ngcontent-%COMP%] { display: block; margin-top: var(--mj-space-4); }\n .mjo-ar__block[_ngcontent-%COMP%] { margin-top: var(--mj-space-4); }\n .mjo-ar__item-filters[_ngcontent-%COMP%] { gap: var(--mj-space-2); padding: var(--mj-space-3) var(--mj-space-4) 0; }\n .mjo-ar__items[_ngcontent-%COMP%] { border: none; border-radius: 0; }\n .mjo-ar__right[_ngcontent-%COMP%] { text-align: right; }\n \n\n .mjo-ar__ith[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n border: none;\n background: none;\n padding: 0;\n font: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n color: inherit;\n cursor: pointer;\n white-space: nowrap;\n }\n .mjo-ar__ith--right[_ngcontent-%COMP%] { flex-direction: row-reverse; }\n .mjo-ar__ith[_ngcontent-%COMP%]:hover, .mjo-ar__ith.is-sorted[_ngcontent-%COMP%] { color: var(--mj-text-primary); }\n .mjo-ar__ith[_ngcontent-%COMP%] i[_ngcontent-%COMP%] { font-size: 9px; }\n .mjo-ar__sort-idle[_ngcontent-%COMP%] { opacity: 0.35; }\n .mjo-ar__ith[_ngcontent-%COMP%]:hover .mjo-ar__sort-idle[_ngcontent-%COMP%] { opacity: 0.8; }\n .mjo-ar__status[_ngcontent-%COMP%] { white-space: nowrap; }\n .mjo-ar__status[_ngcontent-%COMP%] .mjo-chip[_ngcontent-%COMP%] { margin-right: var(--mj-space-2); }\n .mjo-ar__grid[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--mj-space-4);\n margin-top: var(--mj-space-4);\n }\n .mjo-ar__line[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--mj-space-3);\n padding: 6px 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n .mjo-ar__line[_ngcontent-%COMP%]:last-child { border-bottom: none; }\n .mjo-ar__ref[_ngcontent-%COMP%] {\n border: none;\n background: none;\n padding: 0;\n color: var(--mj-brand-primary);\n cursor: pointer;\n }\n .mjo-ar__ref[_ngcontent-%COMP%]:hover { text-decoration: underline; }\n\n \n\n @container mjo-ar (max-width: 1120px) {\n \n\n .mjo-ar__cols[_ngcontent-%COMP%] { grid-template-columns: minmax(0, 1fr) 118px 104px 96px 0px 0px 0px 112px 104px 108px; }\n .mjo-ar__cols[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(n + 5):nth-child(-n + 7) { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; overflow: hidden; }\n }\n @container mjo-ar (max-width: 900px) {\n \n\n .mjo-ar__cols[_ngcontent-%COMP%] { grid-template-columns: minmax(0, 1fr) 118px 104px 0px 0px 0px 0px 112px 104px 0px; }\n .mjo-ar__cols[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(n + 4):nth-child(-n + 7), .mjo-ar__cols[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(10) { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; overflow: hidden; }\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__list[_ngcontent-%COMP%] { display: none; }\n .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__detail[_ngcontent-%COMP%] { margin-left: 0; }\n .mjo-ar__grid[_ngcontent-%COMP%] { grid-template-columns: 1fr; }\n }\n @container mjo-ar (max-width: 560px) {\n .mjo-ar__cols[_ngcontent-%COMP%], .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__cols[_ngcontent-%COMP%] { grid-template-columns: minmax(0, 1fr) 116px 0px 0px 0px 0px 0px 0px 0px 0px; }\n .mjo-ar__wide[_ngcontent-%COMP%] { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; }\n .mjo-ar__search[_ngcontent-%COMP%] { min-width: 0; flex: 1 1 100%; }\n }\n @media (max-width: 760px) {\n [_nghost-%COMP%] { padding: var(--mj-space-4); }\n }\n @media (prefers-reduced-motion: reduce) {\n .mjo-ar__list[_ngcontent-%COMP%], .mjo-ar__detail[_ngcontent-%COMP%], .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__detail[_ngcontent-%COMP%], .mjo-ar__cols[_ngcontent-%COMP%], .mjo-ar__wide[_ngcontent-%COMP%], .mjo-ar.is-detail[_ngcontent-%COMP%] .mjo-ar__wide[_ngcontent-%COMP%], .mjo-ar__row[_ngcontent-%COMP%], .mjo-ar__tile[_ngcontent-%COMP%] { transition: none; }\n .mjo-ar__bone[_ngcontent-%COMP%] { animation: none; }\n }"] });
563
1822
  }
564
1823
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJOCustomerARPageComponent, [{
565
1824
  type: Component,
566
- args: [{ selector: 'mjo-customer-ar-page', standalone: true, imports: [CommonModule, EntityViewerModule, MJOAgingBarComponent, MJOMoneyStripComponent, MJAlertComponent, MJEmptyStateComponent], template: `
567
- <div class="mjo-ar__split">
568
- <!-- ── Customers ── -->
569
- <aside class="mjo-ar__left">
570
- <div class="mj-card mjo-ar__total">
571
- <div class="mj-card-head">
572
- <i class="fa-solid fa-chart-column" aria-hidden="true"></i>
573
- <h3>Total A/R by age</h3>
574
- <span class="right mj-num small strong">{{ money(TotalOpen) }}</span>
575
- </div>
576
- <div class="mj-card-pad">
577
- <mjo-aging-bar [Buckets]="TotalBuckets" />
578
- <div class="small muted mjo-ar__note">
579
- All customers with an open balance.
1825
+ args: [{ selector: 'mjo-customer-ar-page', standalone: true, imports: [
1826
+ CommonModule,
1827
+ CdkMenu,
1828
+ CdkMenuGroup,
1829
+ CdkMenuItem,
1830
+ CdkMenuTrigger,
1831
+ MJAlertComponent,
1832
+ MJButtonDirective,
1833
+ MJEmptyStateComponent,
1834
+ MJFilterChipComponent,
1835
+ MJOAgingBarComponent,
1836
+ MJOMultiSelectComponent,
1837
+ MJOStatTileComponent,
1838
+ ], template: `
1839
+ <div class="mjo-ar" [class.is-detail]="IsDetail" (keydown.escape)="OnEscape($event)">
1840
+ <!-- ── Filters ── -->
1841
+ <div class="mjo-ar__bar">
1842
+ <mjo-multi-select
1843
+ Label="Company"
1844
+ Icon="fa-solid fa-building"
1845
+ [Options]="Companies"
1846
+ [Selected]="CompanyPicks"
1847
+ (SelectedChange)="OnCompanies($event)" />
1848
+ <div class="mjo-search mjo-ar__search">
1849
+ <i class="fa-solid fa-magnifying-glass" aria-hidden="true"></i>
1850
+ <input
1851
+ #search
1852
+ [value]="Search"
1853
+ (input)="OnSearch(search.value)"
1854
+ placeholder="Search customer, order or invoice number"
1855
+ aria-label="Search customer, order or invoice number" />
1856
+ </div>
1857
+ @if (Preset !== 'all') {
1858
+ <mj-filter-chip [Label]="PresetLabel + ' only'" Icon="fa-solid fa-xmark" [Active]="true" (Clicked)="OnPreset('all')" />
1859
+ }
1860
+ <span class="small muted mjo-ar__asof" role="status">
1861
+ @if (AsOfDisplay) {
1862
+ As of {{ AsOfDisplay }}
1863
+ }
1864
+ @if (UpdatedText) {
1865
+ · {{ UpdatedText }}
1866
+ }
1867
+ </span>
1868
+ <button type="button" mjButton variant="outline" size="sm" class="mjo-ar__refresh" [disabled]="Loading" (click)="Refresh()" title="Refresh balances">
1869
+ <i class="fa-solid fa-arrows-rotate" [class.fa-spin]="Loading" aria-hidden="true"></i> Refresh
1870
+ </button>
1871
+ <button
1872
+ type="button"
1873
+ mjButton
1874
+ variant="outline"
1875
+ size="sm"
1876
+ class="mjo-ar__export"
1877
+ [cdkMenuTriggerFor]="exportMenu"
1878
+ [disabled]="!Shown.length || Exporting"
1879
+ title="Export the customers listed">
1880
+ <i class="fa-solid fa-file-export" aria-hidden="true"></i> {{ Exporting ? 'Exporting…' : 'Export' }}
1881
+ <i class="fa-solid fa-chevron-down mjo-ar__caret" aria-hidden="true"></i>
1882
+ </button>
1883
+ <ng-template #exportMenu>
1884
+ <div class="mjo-ar__menu" cdkMenu aria-label="Export">
1885
+ <div cdkMenuGroup aria-label="Aging summary, by customer">
1886
+ <div class="mjo-ar__menu-label" aria-hidden="true">Aging summary, by customer</div>
1887
+ <button type="button" class="mjo-ar__menu-item" cdkMenuItem (cdkMenuItemTriggered)="Export('summary', 'excel')">
1888
+ <i class="fa-solid fa-file-excel" aria-hidden="true"></i> Excel (.xlsx)
1889
+ </button>
1890
+ <button type="button" class="mjo-ar__menu-item" cdkMenuItem (cdkMenuItemTriggered)="Export('summary', 'csv')">
1891
+ <i class="fa-solid fa-file-csv" aria-hidden="true"></i> CSV
1892
+ </button>
1893
+ </div>
1894
+ <div cdkMenuGroup aria-label="Open items, by invoice">
1895
+ <div class="mjo-ar__menu-label" aria-hidden="true">Open items, by invoice</div>
1896
+ <button type="button" class="mjo-ar__menu-item" cdkMenuItem (cdkMenuItemTriggered)="Export('items', 'excel')">
1897
+ <i class="fa-solid fa-file-excel" aria-hidden="true"></i> Excel (.xlsx)
1898
+ </button>
1899
+ <button type="button" class="mjo-ar__menu-item" cdkMenuItem (cdkMenuItemTriggered)="Export('items', 'csv')">
1900
+ <i class="fa-solid fa-file-csv" aria-hidden="true"></i> CSV
1901
+ </button>
580
1902
  </div>
581
1903
  </div>
582
- </div>
1904
+ </ng-template>
1905
+ </div>
1906
+
1907
+ @if (Notice) {
1908
+ <mj-alert [Variant]="Notice.Tone" class="mjo-ar__notice">{{ Notice.Text }}</mj-alert>
1909
+ }
1910
+
1911
+ <!-- ── The book at a glance. Past due, Scheduled and Credit are also quick filters (A/R clears them); the figures do not change when one is on. ── -->
1912
+ <div class="mj-stat-grid mjo-ar__tiles">
1913
+ <mjo-stat-tile
1914
+ class="mjo-ar__tile"
1915
+ Hint="Show all customers"
1916
+ Label="A/R"
1917
+ Icon="fa-solid fa-file-invoice-dollar"
1918
+ [Value]="Loaded ? money(Book.Owed) : '—'"
1919
+ [Detail]="Loaded ? 'Invoiced and unpaid · ' + plural(Book.OwingCustomers, 'customer') : 'Loading…'"
1920
+ (Clicked)="OnPreset('all')" />
1921
+ <mjo-stat-tile
1922
+ class="mjo-ar__tile"
1923
+ [class.is-on]="Preset === 'pastdue'"
1924
+ [Pressed]="Preset === 'pastdue'"
1925
+ Hint="Show customers with a past-due balance"
1926
+ Label="Past due"
1927
+ Icon="fa-solid fa-hourglass-half"
1928
+ [Tone]="Book.PastDue > 0 ? 'alert' : 'default'"
1929
+ [Value]="Loaded ? money(Book.PastDue) : '—'"
1930
+ [Detail]="pastDueDetail"
1931
+ (Clicked)="OnPreset('pastdue')" />
1932
+ <mjo-stat-tile
1933
+ class="mjo-ar__tile"
1934
+ [class.is-on]="Preset === 'scheduled'"
1935
+ [Pressed]="Preset === 'scheduled'"
1936
+ Hint="Show customers with installments not yet invoiced"
1937
+ Label="Scheduled, not yet invoiced"
1938
+ Icon="fa-solid fa-calendar-day"
1939
+ [Value]="Loaded ? money(Book.Scheduled) : '—'"
1940
+ [Detail]="scheduledDetail"
1941
+ (Clicked)="OnPreset('scheduled')" />
1942
+ <mjo-stat-tile
1943
+ class="mjo-ar__tile"
1944
+ [class.is-on]="Preset === 'credit'"
1945
+ [Pressed]="Preset === 'credit'"
1946
+ Hint="Show customers with credit on account"
1947
+ Label="Credit on account"
1948
+ Icon="fa-solid fa-piggy-bank"
1949
+ [Value]="Loaded ? money(Book.Credit) : '—'"
1950
+ [Detail]="Loaded ? 'Unapplied customer credit' : 'Loading…'"
1951
+ (Clicked)="OnPreset('credit')" />
1952
+ </div>
583
1953
 
584
- <div class="mj-card">
1954
+ <div class="mjo-ar__stage">
1955
+ <!-- ── Customers ── -->
1956
+ <section class="mj-card mjo-ar__list" aria-label="Customers">
585
1957
  <div class="mj-card-head">
586
- <i class="fa-solid fa-user-tag" aria-hidden="true"></i>
587
- <h3>Customers with a balance</h3>
588
- </div>
589
- <div class="mj-card-pad mjo-ar__list">
590
- @for (customer of Customers; track customer.Key) {
591
- <button
592
- type="button"
593
- class="mjo-ar__cust"
594
- [class.is-active]="customer.Key === SelectedKey"
595
- (click)="Select(customer.Key)">
596
- <span class="mj-avatar mjo-ar__avatar">{{ initials(customer.Name) }}</span>
597
- <span class="mjo-ar__cust-body">
598
- <span class="mjo-ar__cust-name">{{ customer.Name }}</span>
599
- <span class="small muted mjo-ar__cust-sub">
600
- {{ customer.IsOrganization ? 'Organization' : 'Individual' }}
601
- </span>
602
- </span>
603
- <span class="mjo-ar__cust-amt">
604
- <b class="mj-num">{{ money(customer.Open) }}</b>
605
- @if (customer.Credit > 0) {
606
- <span class="small mj-money--credit mjo-ar__cust-credit">
607
- +{{ money(customer.Credit) }} cr
608
- </span>
609
- }
610
- </span>
1958
+ @if (IsDetail) {
1959
+ <button type="button" class="mjo-ar__back" (click)="Close()" title="Back to all customers (Esc)">
1960
+ <i class="fa-solid fa-arrow-left" aria-hidden="true"></i> All customers
611
1961
  </button>
612
- } @empty {
613
- <div class="small muted">No customers with an open balance.</div>
1962
+ } @else {
1963
+ <i class="fa-solid fa-user-tag" aria-hidden="true"></i>
1964
+ <h3>Customers</h3>
614
1965
  }
1966
+ <span class="right small muted">{{ Shown.length }}{{ Shown.length !== AllCount ? ' of ' + AllCount : '' }}</span>
615
1967
  </div>
616
- </div>
617
- </aside>
618
-
619
- <!-- ── Detail ── -->
620
- <div class="mjo-ar__right">
621
- @if (Selected) {
622
- <div class="mj-card">
623
- <div class="mj-card-pad">
624
- <div class="mjo-ar__header">
625
- <span class="mj-avatar mjo-ar__avatar-lg">{{ initials(Selected.Name) }}</span>
626
- <div class="mjo-ar__header-body">
627
- <div class="mjo-ar__header-name">{{ Selected.Name }}</div>
628
- <div class="small muted">
629
- {{ Selected.IsOrganization ? 'Organization' : 'Individual' }} ·
630
- {{ Selected.Orders.length }} order{{ Selected.Orders.length === 1 ? '' : 's' }}
631
- </div>
1968
+ @if (Totals.Owed > 0) {
1969
+ <div class="mjo-ar__age">
1970
+ <mjo-aging-bar [Buckets]="Totals.Buckets" />
1971
+ </div>
1972
+ }
1973
+ <div
1974
+ class="mjo-ar__table"
1975
+ role="table"
1976
+ aria-label="A/R by customer"
1977
+ [attr.aria-busy]="Loading"
1978
+ (keydown.arrowdown)="OnArrow($event, 1)"
1979
+ (keydown.arrowup)="OnArrow($event, -1)">
1980
+ <div class="mjo-ar__cols mjo-ar__cols--head" role="row">
1981
+ @for (column of Columns; track column.Key) {
1982
+ <div
1983
+ role="columnheader"
1984
+ class="mjo-ar__hcell"
1985
+ [class.mjo-ar__wide]="column.Wide"
1986
+ [attr.aria-sort]="SortKey === column.Key ? (SortDescending ? 'descending' : 'ascending') : 'none'">
1987
+ <button
1988
+ type="button"
1989
+ class="mjo-ar__th"
1990
+ [class.mjo-ar__th--num]="column.Key !== 'Name'"
1991
+ [class.is-sorted]="SortKey === column.Key"
1992
+ [title]="column.Title"
1993
+ (click)="OnSort(column.Key)">
1994
+ <span>{{ column.Label }}</span>
1995
+ @if (SortKey === column.Key) {
1996
+ <i class="fa-solid" [class.fa-arrow-down]="SortDescending" [class.fa-arrow-up]="!SortDescending" aria-hidden="true"></i>
1997
+ }
1998
+ </button>
632
1999
  </div>
633
- </div>
634
-
635
- <mjo-money-strip
636
- class="mjo-ar__strip"
637
- TotalLabel="Open balance"
638
- [Total]="Selected.Open"
639
- [ShowPaid]="false"
640
- [Balance]="NetOwed"
641
- [ShowStatus]="false" />
642
-
643
- <div class="mjo-ar__aging">
644
- <mjo-aging-bar [Buckets]="Selected.Buckets" />
645
- </div>
646
-
647
- @if (Selected.Credit > 0) {
648
- <mj-alert Variant="success" Icon="fa-solid fa-piggy-bank" class="mjo-ar__credit">
649
- <strong>This customer has {{ money(Selected.Credit) }} of credit and owes
650
- {{ money(Selected.Open) }}.</strong>
651
- Consider applying the credit first.
652
- </mj-alert>
653
2000
  }
654
2001
  </div>
655
- </div>
656
-
657
- <div class="mj-card mjo-ar__items">
658
- <div class="mj-card-head">
659
- <i class="fa-solid fa-file-invoice-dollar" aria-hidden="true"></i>
660
- <h3>Open items</h3>
661
- <span class="right small muted">oldest first</span>
662
- </div>
663
- <div class="mjo-ar__viewer-host">
664
- @if (OrderEntityInfo) {
665
- <mj-entity-viewer
666
- [Entity]="OrderEntityInfo"
667
- [ViewEntity]="CustomerOpenOrdersView"
668
- [GridState]="OrderGridState"
669
- (RecordOpened)="OnRecordOpened($event)">
670
- </mj-entity-viewer>
671
- } @else {
672
- <div class="small muted" style="padding: 24px;">Loading open items...</div>
2002
+ @if (!Loaded && Loading) {
2003
+ @for (line of Skeleton; track line) {
2004
+ <div class="mjo-ar__cols mjo-ar__row mjo-ar__skeleton" aria-hidden="true">
2005
+ <span class="mjo-ar__cell mjo-ar__who"><span class="mjo-ar__bone mjo-ar__bone--dot"></span><span class="mjo-ar__bone" [style.width.%]="38 + line * 7"></span></span>
2006
+ <span class="mjo-ar__cell mjo-ar__num"><span class="mjo-ar__bone mjo-ar__bone--num"></span></span>
2007
+ </div>
673
2008
  }
674
- </div>
2009
+ } @else if (!Loaded) {
2010
+ <div role="row">
2011
+ <div role="cell">
2012
+ <mj-empty-state
2013
+ class="mjo-ar__empty"
2014
+ Icon="fa-solid fa-triangle-exclamation"
2015
+ Title="A/R could not be loaded"
2016
+ Message="Nothing is shown because the read failed, not because nothing is owed. Use Refresh to try again." />
2017
+ </div>
2018
+ </div>
2019
+ } @else {
2020
+ @for (customer of Shown; track customer.Key) {
2021
+ <div
2022
+ role="row"
2023
+ class="mjo-ar__cols mjo-ar__row"
2024
+ [class.is-active]="customer.Key === SelectedKey"
2025
+ [attr.tabindex]="customer.Key === FocusKey ? 0 : -1"
2026
+ [attr.data-key]="customer.Key"
2027
+ [attr.aria-current]="customer.Key === SelectedKey ? 'true' : null"
2028
+ [attr.aria-label]="rowLabel(customer)"
2029
+ (focus)="FocusKey = customer.Key"
2030
+ (click)="Toggle(customer.Key)"
2031
+ (keydown.enter)="Toggle(customer.Key)"
2032
+ (keydown.space)="$event.preventDefault(); Toggle(customer.Key)">
2033
+ <span class="mjo-ar__cell mjo-ar__who" role="cell">
2034
+ <span class="mj-avatar mjo-ar__avatar" aria-hidden="true">{{ initials(customer.Name) }}</span>
2035
+ <span class="mjo-ar__who-body">
2036
+ <span class="mjo-ar__name">{{ customer.Name }}</span>
2037
+ <span class="small mjo-ar__sub" [class.mjo-ar__late]="customer.PastDue > 0" [class.muted]="customer.PastDue <= 0">{{ subLine(customer) }}</span>
2038
+ </span>
2039
+ </span>
2040
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__owed" role="cell">
2041
+ <b class="mj-num">{{ money(customer.Owed) }}</b>
2042
+ @if (customer.Owed > 0) {
2043
+ <span class="mjo-ar__mix" aria-hidden="true">
2044
+ <i class="mjo-ar__mix-cur" [style.flex-grow]="customer.Buckets.Current"></i>
2045
+ <i class="mjo-ar__mix-30" [style.flex-grow]="customer.Buckets.Days1To30"></i>
2046
+ <i class="mjo-ar__mix-60" [style.flex-grow]="customer.Buckets.Days31To60"></i>
2047
+ <i class="mjo-ar__mix-90" [style.flex-grow]="customer.Buckets.Days61Plus"></i>
2048
+ </span>
2049
+ }
2050
+ @if (customer.Credit > 0) {
2051
+ <span class="small mj-money--credit mjo-ar__cr">{{ money(customer.Credit) }} credit</span>
2052
+ }
2053
+ </span>
2054
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2055
+ @if (customer.PastDue > 0) {
2056
+ <button type="button" class="mjo-ar__drill mjo-ar__very-late" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View past-due invoices" (click)="OpenFiltered(customer.Key, 'pastdue', $event)">{{ money(customer.PastDue) }}</button>
2057
+ } @else {
2058
+ <span class="mjo-ar__zero">—</span>
2059
+ }
2060
+ </span>
2061
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2062
+ @if (customer.Buckets.Current > 0) {
2063
+ <button type="button" class="mjo-ar__drill" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View current invoices" (click)="OpenFiltered(customer.Key, 'Current', $event)">{{ money(customer.Buckets.Current) }}</button>
2064
+ } @else {
2065
+ <span class="mjo-ar__zero">—</span>
2066
+ }
2067
+ </span>
2068
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2069
+ @if (customer.Buckets.Days1To30 > 0) {
2070
+ <button type="button" class="mjo-ar__drill mjo-ar__late" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View invoices 1 to 30 days past due" (click)="OpenFiltered(customer.Key, 'Days1To30', $event)">{{ money(customer.Buckets.Days1To30) }}</button>
2071
+ } @else {
2072
+ <span class="mjo-ar__zero">—</span>
2073
+ }
2074
+ </span>
2075
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2076
+ @if (customer.Buckets.Days31To60 > 0) {
2077
+ <button type="button" class="mjo-ar__drill mjo-ar__late" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View invoices 31 to 60 days past due" (click)="OpenFiltered(customer.Key, 'Days31To60', $event)">{{ money(customer.Buckets.Days31To60) }}</button>
2078
+ } @else {
2079
+ <span class="mjo-ar__zero">—</span>
2080
+ }
2081
+ </span>
2082
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2083
+ @if (customer.Buckets.Days61Plus > 0) {
2084
+ <button type="button" class="mjo-ar__drill mjo-ar__late" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View invoices more than 60 days past due" (click)="OpenFiltered(customer.Key, 'Days61Plus', $event)">{{ money(customer.Buckets.Days61Plus) }}</button>
2085
+ } @else {
2086
+ <span class="mjo-ar__zero">—</span>
2087
+ }
2088
+ </span>
2089
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">
2090
+ @if (customer.Scheduled > 0) {
2091
+ <button type="button" class="mjo-ar__drill" tabindex="-1" (keydown.enter)="$event.stopPropagation()" title="View scheduled installments" (click)="OpenFiltered(customer.Key, 'scheduled', $event)">{{ money(customer.Scheduled) }}</button>
2092
+ } @else {
2093
+ <span class="mjo-ar__zero">—</span>
2094
+ }
2095
+ </span>
2096
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mjo-ar__next" role="cell" [class.mjo-ar__zero]="!customer.NextDueDate">
2097
+ <span>{{ dateOf(customer.NextDueDate) }}</span>
2098
+ @if (customer.NextDueDate && customer.NextDueIsScheduled) {
2099
+ <span class="small muted">scheduled</span>
2100
+ }
2101
+ </span>
2102
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell" [class.mjo-ar__zero]="!customer.NextDueDate">{{ customer.NextDueDate ? money(customer.NextDueAmount) : '—' }}</span>
2103
+ </div>
2104
+ } @empty {
2105
+ <div role="row">
2106
+ <div role="cell">
2107
+ <mj-empty-state
2108
+ class="mjo-ar__empty"
2109
+ Icon="fa-solid fa-user-tag"
2110
+ [Title]="AllCount ? 'No customers match' : 'No open A/R'"
2111
+ [Message]="AllCount ? 'Clear the search, the quick filter or the company filter to see more.' : 'No customer has an A/R balance, a scheduled installment or credit on account.'" />
2112
+ </div>
2113
+ </div>
2114
+ }
2115
+ @if (Shown.length > 1) {
2116
+ <div class="mjo-ar__cols mjo-ar__row mjo-ar__total" role="row">
2117
+ <span class="mjo-ar__cell mjo-ar__who" role="cell"><span class="mjo-ar__name">{{ Preset === 'all' && !Search.trim() ? 'Total' : 'Total listed' }} · {{ plural(Shown.length, 'customer') }}</span></span>
2118
+ <span class="mjo-ar__cell mjo-ar__num" role="cell"><b class="mj-num">{{ money(Totals.Owed) }}</b></span>
2119
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.PastDue) }}</span>
2120
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.Buckets.Current) }}</span>
2121
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.Buckets.Days1To30) }}</span>
2122
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.Buckets.Days31To60) }}</span>
2123
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.Buckets.Days61Plus) }}</span>
2124
+ <span class="mjo-ar__cell mjo-ar__num mjo-ar__wide mj-num" role="cell">{{ amount(Totals.Scheduled) }}</span>
2125
+ <span class="mjo-ar__cell mjo-ar__wide" role="cell"></span>
2126
+ <span class="mjo-ar__cell mjo-ar__wide" role="cell"></span>
2127
+ </div>
2128
+ }
2129
+ }
675
2130
  </div>
2131
+ </section>
676
2132
 
677
- <div class="mjo-ar__grid">
2133
+ <!-- ── One customer ── -->
2134
+ <section class="mjo-ar__detail" [attr.inert]="IsDetail ? null : ''" aria-label="Customer detail">
2135
+ @if (Detail; as customer) {
678
2136
  <div class="mj-card">
679
- <div class="mj-card-head">
680
- <i class="fa-solid fa-piggy-bank" aria-hidden="true"></i>
681
- <h3>Credits on account</h3>
682
- </div>
683
2137
  <div class="mj-card-pad">
684
- @for (credit of CreditItems; track credit.ID) {
685
- <div class="mjo-ar__row">
686
- <span class="mono small">{{ credit.OrderNumber }}</span>
687
- <b class="mj-num mj-money--credit">
688
- {{ money(-Math.abs((credit.Balance ?? 0))) }}
689
- </b>
2138
+ <div class="mjo-ar__header">
2139
+ <span class="mj-avatar mjo-ar__avatar-lg" aria-hidden="true">{{ initials(customer.Name) }}</span>
2140
+ <div class="mjo-ar__header-body">
2141
+ @if (canOpenCustomer(customer)) {
2142
+ <button type="button" class="mjo-ar__header-name mjo-ar__header-link" (click)="OpenCustomerRecord(customer)" [title]="'Open ' + customer.Name">
2143
+ {{ customer.Name }} <i class="fa-solid fa-arrow-up-right-from-square" aria-hidden="true"></i>
2144
+ </button>
2145
+ } @else {
2146
+ <div class="mjo-ar__header-name">{{ customer.Name }}</div>
2147
+ }
2148
+ <div class="small muted">
2149
+ {{ customer.IsOrganization ? 'Organization' : 'Individual' }} · {{ plural(customer.OrderCount, 'order') }} with a balance
2150
+ </div>
690
2151
  </div>
691
- } @empty {
692
- <div class="small muted">No credit on account.</div>
693
- }
694
- @if (CreditItems.length) {
695
- <div class="small muted mjo-ar__note">
696
- Apply this credit before issuing the next invoice.
2152
+ <div class="mjo-ar__actions">
2153
+ @if (canRecordPayment(customer)) {
2154
+ <button type="button" mjButton variant="primary" size="sm" (click)="RecordPayment(customer)" title="Start a new payment for this customer in a new tab">
2155
+ <i class="fa-solid fa-hand-holding-dollar" aria-hidden="true"></i> Record payment
2156
+ </button>
2157
+ }
2158
+ <button type="button" mjButton variant="outline" size="sm" (click)="Close()" title="Back to all customers (Esc)">
2159
+ <i class="fa-solid fa-xmark" aria-hidden="true"></i> Close
2160
+ </button>
697
2161
  </div>
698
- }
699
- </div>
700
- </div>
2162
+ </div>
701
2163
 
702
- <div class="mj-card">
703
- <div class="mj-card-head">
704
- <i class="fa-solid fa-clock-rotate-left" aria-hidden="true"></i>
705
- <h3>Payment history</h3>
706
- </div>
707
- <div class="mj-card-pad">
708
- @for (payment of Payments; track payment.ID) {
709
- <div class="mjo-ar__row">
710
- <span class="small">
711
- <span class="mono">{{ payment.PaymentNumber }}</span>
712
- <span class="muted"> · {{ dateOf(payment.PaymentDate) }}</span>
713
- </span>
714
- <b class="mj-num">{{ money((payment.Amount ?? 0)) }}</b>
2164
+ <div class="mjo-ar__figures">
2165
+ <div class="mjo-ar__figure">
2166
+ <div class="mjo-ar__figure-label">A/R</div>
2167
+ <div class="mjo-ar__figure-value">{{ money(customer.Owed) }}</div>
2168
+ <div class="small muted">Invoiced and unpaid</div>
2169
+ </div>
2170
+ <div class="mjo-ar__figure">
2171
+ <div class="mjo-ar__figure-label">Past due</div>
2172
+ <div class="mjo-ar__figure-value" [class.mjo-ar__very-late]="customer.PastDue > 0">{{ money(customer.PastDue) }}</div>
2173
+ <div class="small muted">{{ customer.PastDue > 0 ? 'Oldest: ' + plural(customer.OldestDaysPastDue, 'day') + ' past due' : 'Nothing past due' }}</div>
715
2174
  </div>
716
- } @empty {
717
- <div class="small muted">
718
- No payments recorded for this customer.
2175
+ <div class="mjo-ar__figure">
2176
+ <div class="mjo-ar__figure-label">Scheduled</div>
2177
+ <div class="mjo-ar__figure-value">{{ money(customer.Scheduled) }}</div>
2178
+ <div class="small muted">{{ customer.ReadyToInvoice > 0 ? money(customer.ReadyToInvoice) + ' ready to invoice' : 'Not yet invoiced' }}</div>
719
2179
  </div>
2180
+ <div class="mjo-ar__figure">
2181
+ <div class="mjo-ar__figure-label">{{ customer.NextDueIsScheduled ? 'Next scheduled' : 'Next due' }}</div>
2182
+ <div class="mjo-ar__figure-value">{{ dateOf(customer.NextDueDate) }}</div>
2183
+ <div class="small muted">{{ customer.NextDueDate ? money(customer.NextDueAmount) : 'No upcoming dates' }}</div>
2184
+ </div>
2185
+ <div class="mjo-ar__figure">
2186
+ <div class="mjo-ar__figure-label">Last payment</div>
2187
+ @if (LastPayment; as last) {
2188
+ <div class="mjo-ar__figure-value">{{ dateOf(last.PaymentDate) }}</div>
2189
+ <div class="small muted">
2190
+ {{ money(last.Amount) }} ·
2191
+ <button type="button" class="mjo-ar__ref mono small" (click)="PaymentOpened.emit(last)" [title]="'Open payment ' + last.PaymentNumber">{{ last.PaymentNumber }}</button>
2192
+ </div>
2193
+ } @else {
2194
+ <div class="mjo-ar__figure-value">—</div>
2195
+ <div class="small muted">{{ DetailLoading ? 'Loading…' : DetailFailed ? 'Could not be loaded' : 'No payments received' }}</div>
2196
+ }
2197
+ </div>
2198
+ @if (customer.Credit > 0) {
2199
+ <div class="mjo-ar__figure">
2200
+ <div class="mjo-ar__figure-label">Credit on account</div>
2201
+ <div class="mjo-ar__figure-value mj-money--credit">{{ money(customer.Credit) }}</div>
2202
+ <div class="small muted">Net A/R {{ money(netOwed(customer)) }}</div>
2203
+ </div>
2204
+ }
2205
+ </div>
2206
+
2207
+ @if (customer.Owed > 0) {
2208
+ <div class="mjo-ar__aging">
2209
+ <mjo-aging-bar [Buckets]="customer.Buckets" />
2210
+ </div>
2211
+ }
2212
+
2213
+ @if (customer.Credit > 0 && customer.Owed > 0) {
2214
+ <mj-alert Variant="success" Icon="fa-solid fa-piggy-bank" class="mjo-ar__credit">
2215
+ <strong>This customer has {{ money(customer.Credit) }} credit on account and {{ money(customer.Owed) }} A/R.</strong>
2216
+ To apply it, go to Payments, then Account credits.
2217
+ </mj-alert>
720
2218
  }
721
2219
  </div>
722
2220
  </div>
723
- </div>
724
2221
 
725
- <div class="mj-card mjo-ar__block">
726
- <div class="mj-card-head">
727
- <i class="fa-solid fa-rotate" aria-hidden="true"></i>
728
- <h3>Subscriptions</h3>
729
- <span class="right small muted">{{ Subscriptions.length }}</span>
730
- </div>
731
- <div class="mj-table-wrap">
732
- <table class="mj-table mj-table--compact">
733
- <thead>
734
- <tr>
735
- <th>Subscription</th>
736
- <th>Product</th>
737
- <th>Covered to</th>
738
- <th>Renews</th>
739
- <th>Status</th>
740
- </tr>
741
- </thead>
742
- <tbody>
743
- @for (sub of Subscriptions; track sub['ID']) {
2222
+ <div class="mj-card mjo-ar__block">
2223
+ <div class="mj-card-head">
2224
+ <i class="fa-solid fa-file-invoice-dollar" aria-hidden="true"></i>
2225
+ <h3>Open items</h3>
2226
+ <span class="right small muted">{{ plural(ShownItems.length, 'item') }}</span>
2227
+ </div>
2228
+ @if (ItemFilters.length > 2) {
2229
+ <div class="row wrap mjo-ar__item-filters" role="group" aria-label="Show">
2230
+ @for (option of ItemFilters; track option.Key) {
2231
+ <mj-filter-chip
2232
+ [Label]="option.Label"
2233
+ [Count]="option.Key === 'all' ? null : option.Count"
2234
+ [Active]="option.Key === ItemFilter"
2235
+ (Clicked)="OnItemFilter(option.Key)" />
2236
+ }
2237
+ </div>
2238
+ }
2239
+ <div class="mj-table-wrap mjo-ar__items">
2240
+ <table class="mj-table mj-table--compact">
2241
+ <thead>
744
2242
  <tr>
745
- <td class="mono small">{{ sub['SubscriptionNumber'] }}</td>
746
- <td class="small">{{ sub['Product'] ?? '—' }}</td>
747
- <td class="small">{{ dateOf(sub['EndDate']) }}</td>
748
- <td class="small">
749
- {{ sub['AutoRenew'] ? 'automatically' : 'it simply ends' }}
750
- </td>
751
- <td>
752
- <span class="mjo-chip" [class]="subClass(sub)">
753
- {{ sub['Status'] ?? '—' }}
754
- </span>
755
- </td>
2243
+ @for (column of ItemColumnsList; track column.Key) {
2244
+ <th [class.mjo-ar__right]="column.Right" [attr.aria-sort]="ItemSortKey === column.Key ? (ItemSortDescending ? 'descending' : 'ascending') : 'none'">
2245
+ <button type="button" class="mjo-ar__ith" [class.mjo-ar__ith--right]="column.Right" [class.is-sorted]="ItemSortKey === column.Key" [title]="'Sort by ' + column.Label.toLowerCase()" (click)="OnItemSort(column.Key)">
2246
+ <span>{{ column.Label }}</span>
2247
+ @if (ItemSortKey === column.Key) {
2248
+ <i class="fa-solid" [class.fa-arrow-down]="ItemSortDescending" [class.fa-arrow-up]="!ItemSortDescending" aria-hidden="true"></i>
2249
+ } @else {
2250
+ <i class="fa-solid fa-sort mjo-ar__sort-idle" aria-hidden="true"></i>
2251
+ }
2252
+ </button>
2253
+ </th>
2254
+ }
756
2255
  </tr>
2256
+ </thead>
2257
+ <tbody>
2258
+ @for (item of ShownItems; track item.Key) {
2259
+ <tr class="is-clickable" tabindex="0" (click)="OpenOrder(item)" (keydown.enter)="OpenOrder(item)" (keydown.space)="$event.preventDefault(); OpenOrder(item)" [attr.aria-label]="'Open order ' + item.OrderNumber">
2260
+ <td class="mono small primary">{{ item.OrderNumber }}</td>
2261
+ <td class="small">{{ item.Company || '—' }}</td>
2262
+ <td class="small">{{ item.Label }}</td>
2263
+ <td class="mono small">{{ item.DocumentNumber ?? '—' }}</td>
2264
+ <td class="small">{{ dateOf(item.InvoicedOn) }}</td>
2265
+ <td class="small">{{ dateOf(item.DueDate) }}</td>
2266
+ <td class="mj-num mjo-ar__right" [class.mjo-ar__zero]="!item.DaysPastDue" [class.mjo-ar__very-late]="item.DaysPastDue > 60">{{ item.DaysPastDue || '—' }}</td>
2267
+ <td class="mjo-ar__status" (click)="$event.stopPropagation()" (keydown.enter)="$event.stopPropagation()" (keydown.space)="$event.stopPropagation()">
2268
+ <span class="mjo-chip" [class]="itemChip(item)">{{ itemStatus(item) }}</span>
2269
+ @if (canIssue(item)) {
2270
+ <button type="button" mjButton variant="outline" size="sm" [disabled]="IssuingKey !== null" (click)="Issue(item, customer)" title="Issue this installment as an invoice">
2271
+ <i class="fa-solid fa-file-invoice" aria-hidden="true"></i> {{ IssuingKey === item.Key ? 'Issuing…' : 'Issue invoice' }}
2272
+ </button>
2273
+ }
2274
+ </td>
2275
+ <td class="mj-num mjo-ar__right">{{ money(item.Amount) }}</td>
2276
+ <td class="mj-num mjo-ar__right" [class.mjo-ar__zero]="!item.Paid">{{ amount(item.Paid) }}</td>
2277
+ <td class="mj-num mjo-ar__right"><b>{{ money(item.Balance) }}</b></td>
2278
+ </tr>
2279
+ } @empty {
2280
+ <tr>
2281
+ <td colspan="11" class="small muted">{{ customer.Items.length ? 'No items match this filter.' : 'No open items. This customer has credit on account only.' }}</td>
2282
+ </tr>
2283
+ }
2284
+ <!-- A/R and scheduled are subtotalled apart: adding them would put money that has not been invoiced into a balance. -->
2285
+ @if (ShownReceivable.Count > 1 || (ShownReceivable.Count && ShownScheduled.Count)) {
2286
+ <tr class="is-total">
2287
+ <td colspan="10">A/R · {{ plural(ShownReceivable.Count, 'item') }}</td>
2288
+ <td class="mj-num mjo-ar__right">{{ money(ShownReceivable.Amount) }}</td>
2289
+ </tr>
2290
+ }
2291
+ @if (ShownScheduled.Count > 1 || (ShownReceivable.Count && ShownScheduled.Count)) {
2292
+ <tr class="is-total">
2293
+ <td colspan="10">Scheduled, not yet invoiced · {{ plural(ShownScheduled.Count, 'item') }}</td>
2294
+ <td class="mj-num mjo-ar__right">{{ money(ShownScheduled.Amount) }}</td>
2295
+ </tr>
2296
+ }
2297
+ </tbody>
2298
+ </table>
2299
+ </div>
2300
+ </div>
2301
+
2302
+ <div class="mjo-ar__grid">
2303
+ <div class="mj-card">
2304
+ <div class="mj-card-head">
2305
+ <i class="fa-solid fa-piggy-bank" aria-hidden="true"></i>
2306
+ <h3>Credit on account</h3>
2307
+ </div>
2308
+ <div class="mj-card-pad">
2309
+ @for (credit of customer.Credits; track credit.ID) {
2310
+ <div class="mjo-ar__line">
2311
+ <button type="button" class="mjo-ar__ref mono small" (click)="OpenCredit(credit.ID)" [title]="'Open order ' + credit.OrderNumber">{{ credit.OrderNumber }}</button>
2312
+ <b class="mj-num mj-money--credit">{{ money(credit.Amount) }}</b>
2313
+ </div>
2314
+ } @empty {
2315
+ <div class="small muted">No credit on account.</div>
2316
+ }
2317
+ </div>
2318
+ </div>
2319
+
2320
+ <div class="mj-card">
2321
+ <div class="mj-card-head">
2322
+ <i class="fa-solid fa-clock-rotate-left" aria-hidden="true"></i>
2323
+ <h3>Payment history</h3>
2324
+ </div>
2325
+ <div class="mj-card-pad">
2326
+ @for (payment of Payments; track payment.ID) {
2327
+ <div class="mjo-ar__line">
2328
+ <span class="small">
2329
+ <button type="button" class="mjo-ar__ref mono small" (click)="PaymentOpened.emit(payment)" [title]="'Open payment ' + payment.PaymentNumber">{{ payment.PaymentNumber }}</button>
2330
+ <span class="muted"> · {{ dateOf(payment.PaymentDate) }}</span>
2331
+ @if (payment.Status !== 'Captured') {
2332
+ <span class="muted"> · {{ payment.Status }}</span>
2333
+ }
2334
+ </span>
2335
+ <b class="mj-num" [class.mjo-ar__zero]="payment.Status !== 'Captured'">{{ money(payment.Amount) }}</b>
2336
+ </div>
757
2337
  } @empty {
2338
+ <div class="small muted">{{ DetailLoading ? 'Loading payments…' : DetailFailed ? 'Payments could not be loaded.' : 'No payments received.' }}</div>
2339
+ }
2340
+ </div>
2341
+ </div>
2342
+ </div>
2343
+
2344
+ <div class="mj-card mjo-ar__block">
2345
+ <div class="mj-card-head">
2346
+ <i class="fa-solid fa-rotate" aria-hidden="true"></i>
2347
+ <h3>Subscriptions</h3>
2348
+ <span class="right small muted">{{ Subscriptions.length }}</span>
2349
+ </div>
2350
+ <div class="mj-table-wrap">
2351
+ <table class="mj-table mj-table--compact">
2352
+ <thead>
758
2353
  <tr>
759
- <td colspan="5" class="small muted">
760
- No subscriptions.
761
- </td>
2354
+ <th>Subscription</th>
2355
+ <th>Product</th>
2356
+ <th>Covered through</th>
2357
+ <th>Renewal</th>
2358
+ <th>Status</th>
762
2359
  </tr>
763
- }
764
- </tbody>
765
- </table>
2360
+ </thead>
2361
+ <tbody>
2362
+ @for (sub of Subscriptions; track sub.ID) {
2363
+ <tr class="is-clickable" tabindex="0" (click)="SubscriptionOpened.emit(sub)" (keydown.enter)="SubscriptionOpened.emit(sub)" [attr.aria-label]="'Open subscription ' + sub.SubscriptionNumber">
2364
+ <td class="mono small">{{ sub.SubscriptionNumber }}</td>
2365
+ <td class="small">{{ sub.Product || '—' }}</td>
2366
+ <td class="small">{{ dateOf(sub.EndDate) }}</td>
2367
+ <td class="small">{{ sub.AutoRenew ? 'Auto-renews' : 'Manual renewal' }}</td>
2368
+ <td><span class="mjo-chip" [class]="subClass(sub)">{{ sub.Status || '—' }}</span></td>
2369
+ </tr>
2370
+ } @empty {
2371
+ <tr>
2372
+ <td colspan="5" class="small muted">{{ DetailLoading ? 'Loading subscriptions…' : DetailFailed ? 'Subscriptions could not be loaded.' : 'No subscriptions.' }}</td>
2373
+ </tr>
2374
+ }
2375
+ </tbody>
2376
+ </table>
2377
+ </div>
766
2378
  </div>
767
- </div>
768
- } @else {
769
- <mj-empty-state
770
- Icon="fa-solid fa-user-tag"
771
- Title="Select a customer"
772
- Message="Aging, open items and credits will appear here." />
773
- }
2379
+ }
2380
+ </section>
774
2381
  </div>
775
2382
  </div>
776
- `, styles: ["\n :host {\n display: block;\n height: 100%;\n overflow: auto;\n padding: var(--mj-space-6);\n }\n .mjo-ar__split {\n display: flex;\n gap: var(--mj-space-4);\n align-items: flex-start;\n }\n .mjo-ar__left { flex: 0 0 300px; min-width: 0; }\n .mjo-ar__right { flex: 1; min-width: 0; }\n .mjo-ar__list { padding: var(--mj-space-2); }\n\n .mjo-ar__cust {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n padding: var(--mj-space-3);\n border-radius: var(--mj-radius-md);\n cursor: pointer;\n border: 1px solid transparent;\n background: none;\n width: 100%;\n text-align: left;\n font-family: inherit;\n color: inherit;\n }\n .mjo-ar__cust:hover { background: var(--mj-bg-surface-hover); }\n .mjo-ar__cust.is-active {\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n border-color: color-mix(in srgb, var(--mj-brand-primary) 35%, transparent);\n }\n .mjo-ar__avatar { width: 30px; height: 30px; font-size: 11px; }\n .mjo-ar__avatar-lg { width: 44px; height: 44px; font-size: 15px; }\n .mjo-ar__cust-body { flex: 1; min-width: 0; }\n .mjo-ar__cust-name { font-size: 13px; font-weight: var(--mj-font-medium); display: block; }\n .mjo-ar__cust-sub { display: block; }\n .mjo-ar__cust-amt { text-align: right; }\n .mjo-ar__cust-credit { display: block; }\n\n .mjo-ar__header { display: flex; align-items: flex-start; gap: var(--mj-space-4); }\n .mjo-ar__header-body { flex: 1; min-width: 0; }\n .mjo-ar__header-name { font-size: 17px; font-weight: var(--mj-font-semibold); }\n .mjo-ar__strip { display: block; margin-top: var(--mj-space-4); }\n .mjo-ar__aging { margin-top: var(--mj-space-4); }\n .mjo-ar__credit { margin-top: var(--mj-space-4); }\n .mjo-ar__items {\n margin-top: var(--mj-space-4);\n display: flex;\n flex-direction: column;\n height: 520px;\n min-height: 450px;\n }\n .mjo-ar__viewer-host {\n flex: 1 1 auto;\n height: 100%;\n min-height: 380px;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n }\n mj-entity-viewer {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n height: 100%;\n width: 100%;\n }\n /* These four hooks were in the markup with no rule anywhere, so the\n two lower cards stacked full-width instead of pairing, and each\n order/amount pair ran together as one line of text. */\n .mjo-ar__grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: var(--mj-space-4);\n margin-top: var(--mj-space-4);\n }\n .mjo-ar__row {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--mj-space-3);\n padding: var(--mj-space-2) 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n .mjo-ar__row:last-child { border-bottom: none; }\n .mjo-ar__block { margin-top: var(--mj-space-4); }\n .mjo-ar__total { display: block; }\n\n @media (max-width: 900px) {\n .mjo-ar__grid { grid-template-columns: 1fr; }\n }\n\n @media (max-width: 1100px) {\n .mjo-ar__split { flex-direction: column; }\n .mjo-ar__left, .mjo-ar__right { flex: 1 1 auto; width: 100%; }\n }\n @media (max-width: 760px) {\n :host { padding: var(--mj-space-4); }\n }\n "] }]
2383
+ `, styles: ["\n :host {\n display: block;\n height: 100%;\n overflow: auto;\n padding: var(--mj-space-6);\n /* How long the fold between the two states takes, and its curve. The 340ms wait in\n revealSelected() is this plus a frame. */\n --mjo-ar-fold: 320ms;\n --mjo-ar-ease: cubic-bezier(0.22, 0.8, 0.26, 1);\n --mjo-ar-list-width: 372px;\n }\n /* The page sits beside the shell's rail and the section's menu, so its own width, not the\n window's, decides how many columns fit. */\n .mjo-ar { container-type: inline-size; container-name: mjo-ar; }\n\n /* \u2500\u2500 Filters \u2500\u2500 */\n .mjo-ar__bar {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n flex-wrap: wrap;\n margin-bottom: var(--mj-space-4);\n }\n .mjo-ar__search { min-width: 300px; }\n .mjo-ar__asof { margin-left: auto; white-space: nowrap; }\n .mjo-ar__refresh, .mjo-ar__export { flex: none; }\n .mjo-ar__caret { font-size: 10px; margin-left: 2px; }\n .mjo-ar__menu {\n min-width: 260px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-md);\n box-shadow: var(--mj-shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));\n padding: var(--mj-space-1, 4px);\n }\n .mjo-ar__menu-label {\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-text-muted);\n padding: 8px 10px 2px;\n }\n .mjo-ar__menu-item {\n display: flex;\n align-items: center;\n gap: var(--mj-space-2);\n width: 100%;\n font: inherit;\n font-size: 13px;\n text-align: left;\n padding: 8px 10px;\n border: none;\n border-radius: var(--mj-radius-md);\n background: none;\n color: inherit;\n cursor: pointer;\n }\n .mjo-ar__menu-item:hover, .mjo-ar__menu-item:focus-visible { background: var(--mj-bg-surface-sunken); outline: none; }\n .mjo-ar__menu-item i { color: var(--mj-text-muted); width: 16px; }\n .mjo-ar__notice { display: block; margin-bottom: var(--mj-space-4); }\n\n /* \u2500\u2500 Tiles: the book's totals, and the quick filters \u2500\u2500 */\n .mjo-ar__tiles { margin-bottom: var(--mj-space-4); }\n .mjo-ar__tile {\n display: block;\n border-radius: var(--mj-radius-md);\n transition: box-shadow 140ms ease;\n }\n /* Ringed only while its quick filter is on. A/R, which clears the filter, never is. */\n .mjo-ar__tile.is-on { box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 55%, transparent); }\n\n /* \u2500\u2500 The two panes \u2500\u2500\n The list starts at full width. Opening a customer animates its flex-basis down to a fixed\n rail while the detail pane grows from nothing, so the table folds rather than swaps. */\n .mjo-ar__stage {\n display: flex;\n align-items: flex-start;\n gap: 0;\n }\n .mjo-ar__list {\n flex: 1 1 100%;\n min-width: 0;\n /* clip, not hidden: hidden would make this card the sticky container, and it does not\n scroll in the full-width state, so the header and total row would never stick. */\n overflow: clip;\n transition: flex-basis var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar__detail {\n flex: 0 1 0%;\n min-width: 0;\n max-width: 0;\n opacity: 0;\n overflow: hidden;\n transform: translateX(24px);\n transition:\n max-width var(--mjo-ar-fold) var(--mjo-ar-ease),\n opacity 200ms ease,\n transform var(--mjo-ar-fold) var(--mjo-ar-ease),\n margin-left var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar.is-detail .mjo-ar__list {\n flex: 0 0 var(--mjo-ar-list-width);\n position: sticky;\n top: 0;\n max-height: calc(100vh - 140px);\n overflow-y: auto;\n }\n .mjo-ar.is-detail .mjo-ar__detail {\n flex: 1 1 0%;\n max-width: 100%;\n opacity: 1;\n transform: none;\n margin-left: var(--mj-space-5);\n overflow: visible;\n transition:\n max-width var(--mjo-ar-fold) var(--mjo-ar-ease),\n opacity 260ms ease 120ms,\n transform var(--mjo-ar-fold) var(--mjo-ar-ease),\n margin-left var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar__back {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n border: none;\n background: none;\n font: inherit;\n font-size: 13px;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-brand-primary);\n cursor: pointer;\n padding: 2px 4px;\n border-radius: var(--mj-radius-md);\n }\n .mjo-ar__back:hover { background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent); }\n\n /* \u2500\u2500 The customer table \u2500\u2500\n A grid whose track list is the same length in every state, so the wide tracks animate to\n zero instead of the columns popping out of the row. */\n .mjo-ar__age { padding: var(--mj-space-3) var(--mj-space-4) var(--mj-space-2); }\n .mjo-ar__table { display: block; }\n .mjo-ar__cols {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 118px 104px 96px 96px 96px 96px 112px 104px 108px;\n align-items: center;\n column-gap: 0;\n transition: grid-template-columns var(--mjo-ar-fold) var(--mjo-ar-ease);\n }\n .mjo-ar.is-detail .mjo-ar__cols { grid-template-columns: minmax(0, 1fr) 124px 0px 0px 0px 0px 0px 0px 0px 0px; }\n .mjo-ar__wide {\n overflow: hidden;\n white-space: nowrap;\n transition: opacity 180ms ease, padding var(--mjo-ar-fold) var(--mjo-ar-ease), visibility 0s;\n }\n /* Folded columns are taken out of the tab order and the accessibility tree, once they have faded. */\n .mjo-ar.is-detail .mjo-ar__wide {\n opacity: 0;\n visibility: hidden;\n padding-left: 0;\n padding-right: 0;\n transition: opacity 180ms ease, padding var(--mjo-ar-fold) var(--mjo-ar-ease), visibility 0s linear 180ms;\n }\n\n .mjo-ar__cols--head {\n border-top: 1px solid var(--mj-border-subtle);\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n position: sticky;\n top: 0;\n z-index: 1;\n }\n .mjo-ar__hcell { min-width: 0; }\n .mjo-ar__th {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-width: 0;\n padding: 9px var(--mj-space-3);\n border: none;\n background: none;\n font: inherit;\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n letter-spacing: 0.03em;\n text-transform: uppercase;\n color: var(--mj-text-muted);\n cursor: pointer;\n white-space: nowrap;\n }\n .mjo-ar__hcell:first-child .mjo-ar__th { padding-left: var(--mj-space-4); }\n .mjo-ar__th--num { justify-content: flex-end; }\n .mjo-ar__th:hover, .mjo-ar__th.is-sorted { color: var(--mj-text-primary); }\n .mjo-ar__th i { font-size: 9px; }\n .mjo-ar__th:focus-visible, .mjo-ar__row:focus-visible, .mjo-ar__back:focus-visible, .mjo-ar__ref:focus-visible, .mjo-ar__ith:focus-visible, .mjo-ar__header-link:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: -2px;\n }\n\n .mjo-ar__row {\n width: 100%;\n border-bottom: 1px solid var(--mj-border-subtle);\n border-left: 3px solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease;\n }\n .mjo-ar__row:hover { background: var(--mj-bg-surface-hover); }\n .mjo-ar__row.is-active {\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n border-left-color: var(--mj-brand-primary);\n }\n /* The total stays in view while the list scrolls under it. */\n .mjo-ar__total {\n cursor: default;\n border-bottom: none;\n border-top: 2px solid var(--mj-border-strong);\n background: var(--mj-bg-surface-card);\n font-weight: var(--mj-font-semibold);\n position: sticky;\n bottom: 0;\n z-index: 1;\n }\n .mjo-ar__total:hover { background: var(--mj-bg-surface-card); }\n .mjo-ar__cell { min-width: 0; padding: 10px var(--mj-space-3); font-size: 13px; }\n .mjo-ar__num { text-align: right; white-space: nowrap; }\n .mjo-ar__who {\n display: flex;\n align-items: center;\n gap: var(--mj-space-3);\n padding-left: var(--mj-space-3);\n }\n .mjo-ar__who-body { min-width: 0; display: flex; flex-direction: column; }\n .mjo-ar__name {\n font-weight: var(--mj-font-medium);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .mjo-ar__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .mjo-ar__owed { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }\n .mjo-ar__next { display: flex; flex-direction: column; align-items: flex-end; }\n /* The customer's receivable by age, as a thin strip under the amount: the same four colours as the aging bar. */\n .mjo-ar__mix {\n display: flex;\n width: 72px;\n height: 4px;\n border-radius: 2px;\n overflow: hidden;\n background: var(--mj-border-subtle);\n }\n .mjo-ar__mix i { display: block; flex: 0 0 0; min-width: 0; }\n .mjo-ar__mix-cur { background: var(--mj-color-neutral-500); }\n .mjo-ar__mix-30 { background: var(--mj-color-warning-500); }\n .mjo-ar__mix-60 { background: var(--mj-color-error-500); }\n .mjo-ar__mix-90 { background: var(--mj-color-error-700); }\n .mjo-ar__cr { white-space: nowrap; }\n .mjo-ar__zero { color: var(--mj-text-disabled); }\n .mjo-ar__late { color: var(--mj-status-warning-text); }\n .mjo-ar__very-late { color: var(--mj-status-error-text); font-weight: var(--mj-font-semibold); }\n /* A figure that opens the invoices behind it: underlined so it reads as a link at rest. */\n .mjo-ar__drill {\n border: none;\n background: none;\n padding: 1px 3px;\n margin: -1px -3px;\n font: inherit;\n font-variant-numeric: tabular-nums;\n color: inherit;\n cursor: pointer;\n border-radius: var(--mj-radius-md);\n text-decoration: underline dotted;\n text-underline-offset: 3px;\n }\n .mjo-ar__drill.mjo-ar__late { color: var(--mj-status-warning-text); }\n .mjo-ar__drill.mjo-ar__very-late { color: var(--mj-status-error-text); }\n .mjo-ar__drill:hover { text-decoration: underline; background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent); }\n .mjo-ar__avatar { width: 30px; height: 30px; font-size: 11px; flex: none; }\n .mjo-ar__avatar-lg { width: 44px; height: 44px; font-size: 15px; flex: none; }\n .mjo-ar__empty { display: block; padding: var(--mj-space-6) var(--mj-space-4); }\n\n /* Placeholder rows while the first read is in flight. */\n .mjo-ar__skeleton { cursor: default; }\n .mjo-ar__skeleton:hover { background: none; }\n .mjo-ar__bone {\n display: inline-block;\n height: 12px;\n border-radius: 6px;\n background: linear-gradient(90deg, var(--mj-bg-surface-sunken) 25%, var(--mj-bg-surface-hover) 50%, var(--mj-bg-surface-sunken) 75%);\n background-size: 200% 100%;\n animation: mjo-ar-shimmer 1.3s ease-in-out infinite;\n }\n .mjo-ar__bone--dot { width: 30px; height: 30px; border-radius: 50%; flex: none; }\n .mjo-ar__bone--num { width: 76px; }\n @keyframes mjo-ar-shimmer {\n from { background-position: 200% 0; }\n to { background-position: -200% 0; }\n }\n\n /* \u2500\u2500 One customer \u2500\u2500 */\n .mjo-ar__header { display: flex; align-items: flex-start; gap: var(--mj-space-4); }\n .mjo-ar__header-body { flex: 1; min-width: 0; }\n .mjo-ar__header-name { font-size: 18px; font-weight: var(--mj-font-semibold); }\n /* The customer's name is a link to their record, and reads as one at rest. */\n .mjo-ar__header-link {\n display: inline-flex;\n align-items: baseline;\n gap: var(--mj-space-2);\n border: none;\n background: none;\n padding: 0;\n font-family: inherit;\n color: var(--mj-brand-primary);\n cursor: pointer;\n text-align: left;\n }\n .mjo-ar__header-link i { font-size: 11px; }\n .mjo-ar__header-link:hover { text-decoration: underline; text-underline-offset: 3px; }\n .mjo-ar__actions { display: flex; align-items: center; gap: var(--mj-space-2); flex: none; }\n .mjo-ar__figures {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: var(--mj-space-3);\n margin: var(--mj-space-4) 0 0;\n }\n .mjo-ar__figure {\n border: 1px solid var(--mj-border-subtle);\n border-radius: var(--mj-radius-md);\n padding: var(--mj-space-3);\n min-width: 0;\n }\n .mjo-ar__figure-label {\n font-size: 11px;\n font-weight: var(--mj-font-semibold);\n letter-spacing: 0.03em;\n text-transform: uppercase;\n color: var(--mj-text-muted);\n }\n /* Every card reads from the left, money or date alike. */\n .mjo-ar__figure-value {\n margin: 2px 0;\n font-size: 19px;\n font-weight: var(--mj-font-semibold);\n font-variant-numeric: tabular-nums;\n text-align: left;\n }\n .mjo-ar__aging { margin-top: var(--mj-space-4); }\n .mjo-ar__credit { display: block; margin-top: var(--mj-space-4); }\n .mjo-ar__block { margin-top: var(--mj-space-4); }\n .mjo-ar__item-filters { gap: var(--mj-space-2); padding: var(--mj-space-3) var(--mj-space-4) 0; }\n .mjo-ar__items { border: none; border-radius: 0; }\n .mjo-ar__right { text-align: right; }\n /* A column heading of the open-items table that sorts it. Inherits the table's heading type. */\n .mjo-ar__ith {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n border: none;\n background: none;\n padding: 0;\n font: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n color: inherit;\n cursor: pointer;\n white-space: nowrap;\n }\n .mjo-ar__ith--right { flex-direction: row-reverse; }\n .mjo-ar__ith:hover, .mjo-ar__ith.is-sorted { color: var(--mj-text-primary); }\n .mjo-ar__ith i { font-size: 9px; }\n .mjo-ar__sort-idle { opacity: 0.35; }\n .mjo-ar__ith:hover .mjo-ar__sort-idle { opacity: 0.8; }\n .mjo-ar__status { white-space: nowrap; }\n .mjo-ar__status .mjo-chip { margin-right: var(--mj-space-2); }\n .mjo-ar__grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--mj-space-4);\n margin-top: var(--mj-space-4);\n }\n .mjo-ar__line {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--mj-space-3);\n padding: 6px 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n .mjo-ar__line:last-child { border-bottom: none; }\n .mjo-ar__ref {\n border: none;\n background: none;\n padding: 0;\n color: var(--mj-brand-primary);\n cursor: pointer;\n }\n .mjo-ar__ref:hover { text-decoration: underline; }\n\n /* \u2500\u2500 Less room: drop columns from the right, then stack. Sized on the page, not the window. \u2500\u2500 */\n @container mjo-ar (max-width: 1120px) {\n /* First to go: the three late buckets. Past due still totals them, and a figure opens the detail. */\n .mjo-ar__cols { grid-template-columns: minmax(0, 1fr) 118px 104px 96px 0px 0px 0px 112px 104px 108px; }\n .mjo-ar__cols > :nth-child(n + 5):nth-child(-n + 7) { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; overflow: hidden; }\n }\n @container mjo-ar (max-width: 900px) {\n /* Then Current and the next amount; the next due date stays. */\n .mjo-ar__cols { grid-template-columns: minmax(0, 1fr) 118px 104px 0px 0px 0px 0px 112px 104px 0px; }\n .mjo-ar__cols > :nth-child(n + 4):nth-child(-n + 7), .mjo-ar__cols > :nth-child(10) { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; overflow: hidden; }\n .mjo-ar.is-detail .mjo-ar__list { display: none; }\n .mjo-ar.is-detail .mjo-ar__detail { margin-left: 0; }\n .mjo-ar__grid { grid-template-columns: 1fr; }\n }\n @container mjo-ar (max-width: 560px) {\n .mjo-ar__cols, .mjo-ar.is-detail .mjo-ar__cols { grid-template-columns: minmax(0, 1fr) 116px 0px 0px 0px 0px 0px 0px 0px 0px; }\n .mjo-ar__wide { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; }\n .mjo-ar__search { min-width: 0; flex: 1 1 100%; }\n }\n @media (max-width: 760px) {\n :host { padding: var(--mj-space-4); }\n }\n @media (prefers-reduced-motion: reduce) {\n .mjo-ar__list, .mjo-ar__detail, .mjo-ar.is-detail .mjo-ar__detail, .mjo-ar__cols, .mjo-ar__wide, .mjo-ar.is-detail .mjo-ar__wide, .mjo-ar__row, .mjo-ar__tile { transition: none; }\n .mjo-ar__bone { animation: none; }\n }\n "] }]
777
2384
  }], null, { OrderOpened: [{
778
2385
  type: Output
2386
+ }], SubscriptionOpened: [{
2387
+ type: Output
2388
+ }], PaymentOpened: [{
2389
+ type: Output
2390
+ }], AddressChanged: [{
2391
+ type: Output
779
2392
  }] }); })();
780
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJOCustomerARPageComponent, { className: "MJOCustomerARPageComponent", filePath: "lib/pages/receivables/customer-ar.page.ts", lineNumber: 369 }); })();
2393
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJOCustomerARPageComponent, { className: "MJOCustomerARPageComponent", filePath: "lib/pages/receivables/customer-ar.page.ts", lineNumber: 1104 }); })();
781
2394
  //# sourceMappingURL=customer-ar.page.js.map