@things-factory/accounting 9.1.19 → 10.0.0-beta.2

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 (48) hide show
  1. package/dist-client/pages/account/account-list-page.d.ts +1 -7
  2. package/dist-client/pages/account/account-list-page.js +55 -105
  3. package/dist-client/pages/account/account-list-page.js.map +1 -1
  4. package/dist-client/pages/accounting-category/accounting-category-list-page.d.ts +1 -7
  5. package/dist-client/pages/accounting-category/accounting-category-list-page.js +57 -108
  6. package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
  7. package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +1 -7
  8. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +62 -103
  9. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
  10. package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +1 -7
  11. package/dist-client/pages/accounting-document/accounting-document-list-page.js +62 -118
  12. package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -1
  13. package/dist-client/pages/bank/bank-list-page.d.ts +1 -7
  14. package/dist-client/pages/bank/bank-list-page.js +62 -118
  15. package/dist-client/pages/bank/bank-list-page.js.map +1 -1
  16. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +1 -7
  17. package/dist-client/pages/bank-account/bank-account-list-page.js +62 -118
  18. package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -1
  19. package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +1 -7
  20. package/dist-client/pages/financial-institution/financial-institution-list-page.js +62 -118
  21. package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -1
  22. package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +1 -7
  23. package/dist-client/pages/financial-statement/financial-statement-list-page.js +51 -97
  24. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -1
  25. package/dist-client/pages/fiscal-month/fiscal-month-list-page.d.ts +1 -7
  26. package/dist-client/pages/fiscal-month/fiscal-month-list-page.js +62 -118
  27. package/dist-client/pages/fiscal-month/fiscal-month-list-page.js.map +1 -1
  28. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.d.ts +1 -7
  29. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js +62 -118
  30. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js.map +1 -1
  31. package/dist-client/pages/fiscal-year/fiscal-year-list-page.d.ts +1 -7
  32. package/dist-client/pages/fiscal-year/fiscal-year-list-page.js +62 -118
  33. package/dist-client/pages/fiscal-year/fiscal-year-list-page.js.map +1 -1
  34. package/dist-client/pages/income-statement/income-statement-list-page.d.ts +1 -7
  35. package/dist-client/pages/income-statement/income-statement-list-page.js +51 -97
  36. package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -1
  37. package/dist-client/pages/payment/payment-list-page.d.ts +1 -7
  38. package/dist-client/pages/payment/payment-list-page.js +62 -118
  39. package/dist-client/pages/payment/payment-list-page.js.map +1 -1
  40. package/dist-client/pages/transaction/transaction-list-page.d.ts +1 -7
  41. package/dist-client/pages/transaction/transaction-list-page.js +51 -97
  42. package/dist-client/pages/transaction/transaction-list-page.js.map +1 -1
  43. package/dist-client/tsconfig.tsbuildinfo +1 -1
  44. package/dist-server/service/financial-statement/index.d.ts +1 -1
  45. package/dist-server/service/income-statement/index.d.ts +1 -1
  46. package/dist-server/service/index.d.ts +1 -1
  47. package/dist-server/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +7 -7
@@ -2,13 +2,7 @@ import '@operato/data-grist';
2
2
  import { PageView } from '@operato/shell';
3
3
  import { FetchOption } from '@operato/data-grist';
4
4
  import { AccountImporter } from './account-importer';
5
- declare const AccountListPage_base: (new (...args: any[]) => {
6
- _storeUnsubscribe: import("redux").Unsubscribe;
7
- connectedCallback(): void;
8
- disconnectedCallback(): void;
9
- stateChanged(_state: unknown): void;
10
- readonly isConnected: boolean;
11
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
5
+ declare const AccountListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
12
6
  export declare class AccountListPage extends AccountListPage_base {
13
7
  static styles: import("lit").CSSResult[];
14
8
  static get scopedElements(): {
@@ -1,7 +1,7 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@operato/data-grist';
3
3
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
- import { PageView, store } from '@operato/shell';
4
+ import { PageView } from '@operato/shell';
5
5
  import { css, html } from 'lit';
6
6
  import { customElement, property, query } from 'lit/decorators.js';
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements';
@@ -11,10 +11,9 @@ import { i18next, localize } from '@operato/i18n';
11
11
  import { notify, openPopup } from '@operato/layout';
12
12
  import { OxPopup } from '@operato/popup';
13
13
  import { isMobileDevice } from '@operato/utils';
14
- import { connect } from 'pwa-helpers/connect-mixin';
15
14
  import gql from 'graphql-tag';
16
15
  import { AccountImporter } from './account-importer';
17
- let AccountListPage = class AccountListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
16
+ let AccountListPage = class AccountListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
18
17
  constructor() {
19
18
  super(...arguments);
20
19
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -23,57 +22,46 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
23
22
  ScrollbarStyles,
24
23
  CommonGristStyles,
25
24
  css `
26
- :host {
27
- display: flex;
25
+ :host { display: flex;
28
26
 
29
27
  width: 100%;
30
28
 
31
29
  --grid-record-emphasized-background-color: #8b0000;
32
30
  --grid-record-emphasized-color: #ff6b6b;
33
- }
31
+ }
34
32
  `
35
33
  ]; }
36
34
  static get scopedElements() {
37
- return {
38
- 'account-importer': AccountImporter
35
+ return { 'account-importer': AccountImporter
39
36
  };
40
37
  }
41
38
  get context() {
42
- return {
43
- title: i18next.t('title.account list'),
44
- search: {
45
- handler: (search) => {
39
+ return { title: i18next.t('title.account list'),
40
+ search: { handler: (search) => {
46
41
  this.grist.searchText = search;
47
42
  },
48
43
  value: this.grist?.searchText || '',
49
- autofocus: true
50
- },
51
- filter: {
52
- handler: () => {
44
+ autofocus: true },
45
+ filter: { handler: () => {
53
46
  this.grist.toggleHeadroom();
54
47
  }
55
48
  },
56
49
  help: 'accounting/account',
57
50
  actions: [
58
- {
59
- title: i18next.t('button.save'),
51
+ { title: i18next.t('button.save'),
60
52
  action: this._updateAccount.bind(this),
61
53
  ...CommonButtonStyles.save
62
54
  },
63
- {
64
- title: i18next.t('button.delete'),
55
+ { title: i18next.t('button.delete'),
65
56
  action: this._deleteAccount.bind(this),
66
57
  ...CommonButtonStyles.delete
67
58
  }
68
59
  ],
69
- exportable: {
70
- name: i18next.t('title.account list'),
60
+ exportable: { name: i18next.t('title.account list'),
71
61
  data: this.exportHandler.bind(this)
72
62
  },
73
- importable: {
74
- handler: this.importHandler.bind(this)
75
- }
76
- };
63
+ importable: { handler: this.importHandler.bind(this)
64
+ } };
77
65
  }
78
66
  render() {
79
67
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
@@ -89,8 +77,7 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
89
77
  <mwc-icon
90
78
  @click=${e => {
91
79
  const target = e.currentTarget;
92
- this.sortersControl.open({
93
- right: 0,
80
+ this.sortersControl.open({ right: 0,
94
81
  top: target.offsetTop + target.offsetHeight
95
82
  });
96
83
  }}
@@ -111,144 +98,116 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
111
98
  `;
112
99
  }
113
100
  async pageInitialized(lifecycle) {
114
- this.gristConfig = {
115
- list: {
116
- fields: ['name', 'description'],
101
+ this.gristConfig = { list: { fields: ['name', 'description'],
117
102
  details: ['active', 'updatedAt']
118
103
  },
119
104
  columns: [
120
105
  { type: 'gutter', gutterName: 'sequence' },
121
106
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
122
- {
123
- type: 'string',
107
+ { type: 'string',
124
108
  name: 'code',
125
109
  header: i18next.t('field.code'),
126
- record: {
127
- editable: true,
110
+ record: { editable: true,
128
111
  mandatory: true
129
112
  },
130
113
  filter: 'search',
131
114
  sortable: true,
132
115
  width: 150
133
116
  },
134
- {
135
- type: 'string',
117
+ { type: 'string',
136
118
  name: 'name',
137
119
  header: i18next.t('field.name'),
138
- record: {
139
- editable: true,
120
+ record: { editable: true,
140
121
  mandatory: true
141
122
  },
142
123
  filter: 'search',
143
124
  sortable: true,
144
125
  width: 150
145
126
  },
146
- {
147
- type: 'accounting-category-object',
127
+ { type: 'accounting-category-object',
148
128
  name: 'category',
149
129
  header: i18next.t('field.category'),
150
- record: {
151
- editable: true,
130
+ record: { editable: true,
152
131
  mandatory: true
153
132
  },
154
133
  sortable: false,
155
134
  filter: true,
156
135
  width: 150
157
136
  },
158
- {
159
- type: 'string',
137
+ { type: 'string',
160
138
  name: 'description',
161
139
  header: i18next.t('field.description'),
162
- record: {
163
- editable: true
140
+ record: { editable: true
164
141
  },
165
142
  filter: 'search',
166
143
  width: 200
167
144
  },
168
- {
169
- type: 'checkbox',
145
+ { type: 'checkbox',
170
146
  name: 'active',
171
147
  label: true,
172
148
  header: i18next.t('field.active'),
173
- record: {
174
- editable: true
149
+ record: { editable: true
175
150
  },
176
151
  filter: true,
177
152
  sortable: true,
178
153
  width: 60
179
154
  },
180
- {
181
- type: 'resource-object',
155
+ { type: 'resource-object',
182
156
  name: 'updater',
183
157
  header: i18next.t('field.updater'),
184
- record: {
185
- editable: false
158
+ record: { editable: false
186
159
  },
187
160
  sortable: true,
188
161
  width: 120
189
162
  },
190
- {
191
- type: 'datetime',
163
+ { type: 'datetime',
192
164
  name: 'updatedAt',
193
165
  header: i18next.t('field.updated_at'),
194
- record: {
195
- editable: false
166
+ record: { editable: false
196
167
  },
197
168
  sortable: true,
198
169
  width: 180
199
170
  }
200
171
  ],
201
- rows: {
202
- selectable: {
203
- multiple: true
172
+ rows: { selectable: { multiple: true
204
173
  }
205
174
  },
206
175
  sorters: [
207
- {
208
- name: 'code'
176
+ { name: 'code'
209
177
  }
210
178
  ]
211
179
  };
212
180
  }
213
181
  async pageUpdated(changes, lifecycle) {
214
- if (this.active) {
215
- // do something here when this page just became as active
182
+ if (this.active) { // do something here when this page just became as active
216
183
  }
217
184
  }
218
185
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
219
- const response = await client.query({
220
- query: gql `
221
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
222
- responses: accounts(filters: $filters, pagination: $pagination, sortings: $sortings) {
223
- items {
224
- id
186
+ const response = await client.query({ query: gql `
187
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: accounts(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
225
188
  code
226
189
  name
227
190
  description
228
191
  active
229
- category {
230
- code
192
+ category { code
231
193
  name
232
194
  description
233
- }
234
- updater {
235
- id
195
+ }
196
+ updater { id
236
197
  name
237
- }
198
+ }
238
199
  updatedAt
239
- }
200
+ }
240
201
  total
241
- }
242
- }
202
+ }
203
+ }
243
204
  `,
244
- variables: {
245
- filters,
205
+ variables: { filters,
246
206
  pagination: { page, limit },
247
207
  sortings
248
208
  }
249
209
  });
250
- return {
251
- total: response.data.responses.total || 0,
210
+ return { total: response.data.responses.total || 0,
252
211
  records: response.data.responses.items || []
253
212
  };
254
213
  }
@@ -256,20 +215,16 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
256
215
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
257
216
  const ids = this.grist.selected.map(record => record.id);
258
217
  if (ids && ids.length > 0) {
259
- const response = await client.mutate({
260
- mutation: gql `
261
- mutation ($ids: [String!]!) {
262
- deleteAccounts(ids: $ids)
263
- }
218
+ const response = await client.mutate({ mutation: gql `
219
+ mutation ($ids: [String!]!) { deleteAccounts(ids: $ids)
220
+ }
264
221
  `,
265
- variables: {
266
- ids
222
+ variables: { ids
267
223
  }
268
224
  });
269
225
  if (!response.errors) {
270
226
  this.grist.fetch();
271
- notify({
272
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
227
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
273
228
  });
274
229
  }
275
230
  }
@@ -287,16 +242,12 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
287
242
  patchField.cuFlag = patch.__dirty__;
288
243
  return patchField;
289
244
  });
290
- const response = await client.mutate({
291
- mutation: gql `
292
- mutation ($patches: [AccountPatch!]!) {
293
- updateMultipleAccount(patches: $patches) {
294
- name
295
- }
296
- }
245
+ const response = await client.mutate({ mutation: gql `
246
+ mutation ($patches: [AccountPatch!]!) { updateMultipleAccount(patches: $patches) { name
247
+ }
248
+ }
297
249
  `,
298
- variables: {
299
- patches
250
+ variables: { patches
300
251
  }
301
252
  });
302
253
  if (!response.errors) {
@@ -324,8 +275,7 @@ let AccountListPage = class AccountListPage extends connect(store)(localize(i18n
324
275
  this.grist.fetch();
325
276
  }}
326
277
  ></account-importer>
327
- `, {
328
- backdrop: true,
278
+ `, { backdrop: true,
329
279
  size: 'large',
330
280
  title: i18next.t('title.import account')
331
281
  });
@@ -1 +1 @@
1
- {"version":3,"file":"account-list-page.js","sourceRoot":"","sources":["../../../client/pages/account/account-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AACV;IAAjC,KAAK,CAAC,iBAAiB,CAAC;8BAA0B,OAAO;uDAAA;AA1B/C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAuV3B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { AccountImporter } from './account-importer'\n\n@customElement('account-list-page')\nexport class AccountListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'account-importer': AccountImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n @query('#sorter-control') private sortersControl!: OxPopup\n\n get context() {\n return {\n title: i18next.t('title.account list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || '',\n autofocus: true\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'accounting/account',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateAccount.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteAccount.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.account list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${e => {\n const target = e.currentTarget\n this.sortersControl.open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'code',\n header: i18next.t('field.code'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'accounting-category-object',\n name: 'category',\n header: i18next.t('field.category'),\n record: {\n editable: true,\n mandatory: true\n },\n sortable: false,\n filter: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'code'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: accounts(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n code\n name\n description\n active\n category {\n code\n name\n description\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteAccount() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteAccounts(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateAccount() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [AccountPatch!]!) {\n updateMultipleAccount(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(account => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = account[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <account-importer\n .accounts=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></account-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import account')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"account-list-page.js","sourceRoot":"","sources":["../../../client/pages/account/account-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AACV;IAAjC,KAAK,CAAC,iBAAiB,CAAC;8BAA0B,OAAO;uDAAA;AAtB/C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA+Q3B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { AccountImporter } from './account-importer'\n\n@customElement('account-list-page')\nexport class AccountListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n `\n ]\n\n static get scopedElements() { return { 'account-importer': AccountImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n @query('#sorter-control') private sortersControl!: OxPopup\n\n get context() { return { title: i18next.t('title.account list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || '',\n autofocus: true\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'accounting/account',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateAccount.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteAccount.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.account list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${e => { const target = e.currentTarget\n this.sortersControl.open({ right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'code',\n header: i18next.t('field.code'),\n record: { editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'accounting-category-object',\n name: 'category',\n header: i18next.t('field.category'),\n record: { editable: true,\n mandatory: true\n },\n sortable: false,\n filter: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'code'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: accounts(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n code\n name\n description\n active\n category { code\n name\n description\n }\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteAccount() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteAccounts(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateAccount() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [AccountPatch!]!) { updateMultipleAccount(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(account => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = account[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <account-importer\n .accounts=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></account-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import account')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
@@ -2,13 +2,7 @@ import '@operato/data-grist';
2
2
  import { PageView } from '@operato/shell';
3
3
  import { FetchOption } from '@operato/data-grist';
4
4
  import { AccountingCategoryImporter } from './accounting-category-importer';
5
- declare const AccountingCategoryListPage_base: (new (...args: any[]) => {
6
- _storeUnsubscribe: import("redux").Unsubscribe;
7
- connectedCallback(): void;
8
- disconnectedCallback(): void;
9
- stateChanged(_state: unknown): void;
10
- readonly isConnected: boolean;
11
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
5
+ declare const AccountingCategoryListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
12
6
  export declare class AccountingCategoryListPage extends AccountingCategoryListPage_base {
13
7
  static styles: import("lit").CSSResult[];
14
8
  static get scopedElements(): {