@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
@@ -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 { AccountingCategoryImporter } from './accounting-category-importer';
17
- let AccountingCategoryListPage = class AccountingCategoryListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
16
+ let AccountingCategoryListPage = class AccountingCategoryListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
18
17
  constructor() {
19
18
  super(...arguments);
20
19
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -23,62 +22,50 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
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
- ox-grist {
36
- overflow-y: auto;
33
+ ox-grist { overflow-y: auto;
37
34
  flex: 1;
38
- }
35
+ }
39
36
  `
40
37
  ]; }
41
38
  static get scopedElements() {
42
- return {
43
- 'accounting-category-importer': AccountingCategoryImporter
39
+ return { 'accounting-category-importer': AccountingCategoryImporter
44
40
  };
45
41
  }
46
42
  get context() {
47
- return {
48
- title: i18next.t('title.accounting-category list'),
49
- search: {
50
- handler: (search) => {
43
+ return { title: i18next.t('title.accounting-category list'),
44
+ search: { handler: (search) => {
51
45
  this.grist.searchText = search;
52
46
  },
53
47
  value: this.grist?.searchText || '',
54
- autofocus: true
55
- },
56
- filter: {
57
- handler: () => {
48
+ autofocus: true },
49
+ filter: { handler: () => {
58
50
  this.grist.toggleHeadroom();
59
51
  }
60
52
  },
61
53
  help: 'accounting/accounting-category',
62
54
  actions: [
63
- {
64
- title: i18next.t('button.save'),
55
+ { title: i18next.t('button.save'),
65
56
  action: this._updateAccountingCategory.bind(this),
66
57
  ...CommonButtonStyles.save
67
58
  },
68
- {
69
- title: i18next.t('button.delete'),
59
+ { title: i18next.t('button.delete'),
70
60
  action: this._deleteAccountingCategory.bind(this),
71
61
  ...CommonButtonStyles.delete
72
62
  }
73
63
  ],
74
- exportable: {
75
- name: i18next.t('title.accounting-category list'),
64
+ exportable: { name: i18next.t('title.accounting-category list'),
76
65
  data: this.exportHandler.bind(this)
77
66
  },
78
- importable: {
79
- handler: this.importHandler.bind(this)
80
- }
81
- };
67
+ importable: { handler: this.importHandler.bind(this)
68
+ } };
82
69
  }
83
70
  render() {
84
71
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
@@ -94,8 +81,7 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
94
81
  <mwc-icon
95
82
  @click=${e => {
96
83
  const target = e.currentTarget;
97
- this.sortersControl.open({
98
- right: 0,
84
+ this.sortersControl.open({ right: 0,
99
85
  top: target.offsetTop + target.offsetHeight
100
86
  });
101
87
  }}
@@ -116,143 +102,115 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
116
102
  `;
117
103
  }
118
104
  async pageInitialized(lifecycle) {
119
- this.gristConfig = {
120
- list: {
121
- fields: ['name', 'description'],
105
+ this.gristConfig = { list: { fields: ['name', 'description'],
122
106
  details: ['active', 'updatedAt']
123
107
  },
124
108
  columns: [
125
109
  { type: 'gutter', gutterName: 'sequence' },
126
110
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
127
- {
128
- type: 'string',
111
+ { type: 'string',
129
112
  name: 'code',
130
113
  header: i18next.t('field.code'),
131
- record: {
132
- editable: true,
114
+ record: { editable: true,
133
115
  mandatory: true
134
116
  },
135
117
  filter: 'search',
136
118
  sortable: true,
137
119
  width: 150
138
120
  },
139
- {
140
- type: 'string',
121
+ { type: 'string',
141
122
  name: 'name',
142
123
  header: i18next.t('field.name'),
143
- record: {
144
- editable: true,
124
+ record: { editable: true,
145
125
  mandatory: true
146
126
  },
147
127
  filter: 'search',
148
128
  sortable: true,
149
129
  width: 150
150
130
  },
151
- {
152
- type: 'resource-object',
131
+ { type: 'resource-object',
153
132
  name: 'parent',
154
133
  header: i18next.t('field.parent'),
155
- record: {
156
- editable: true
134
+ record: { editable: true
157
135
  },
158
136
  filter: true,
159
137
  sortable: true,
160
138
  width: 150
161
139
  },
162
- {
163
- type: 'string',
140
+ { type: 'string',
164
141
  name: 'description',
165
142
  header: i18next.t('field.description'),
166
- record: {
167
- editable: true
143
+ record: { editable: true
168
144
  },
169
145
  filter: 'search',
170
146
  width: 200
171
147
  },
172
- {
173
- type: 'checkbox',
148
+ { type: 'checkbox',
174
149
  name: 'active',
175
150
  label: true,
176
151
  header: i18next.t('field.active'),
177
- record: {
178
- editable: true
152
+ record: { editable: true
179
153
  },
180
154
  filter: true,
181
155
  sortable: true,
182
156
  width: 60
183
157
  },
184
- {
185
- type: 'resource-object',
158
+ { type: 'resource-object',
186
159
  name: 'updater',
187
160
  header: i18next.t('field.updater'),
188
- record: {
189
- editable: false
161
+ record: { editable: false
190
162
  },
191
163
  sortable: true,
192
164
  width: 120
193
165
  },
194
- {
195
- type: 'datetime',
166
+ { type: 'datetime',
196
167
  name: 'updatedAt',
197
168
  header: i18next.t('field.updated_at'),
198
- record: {
199
- editable: false
169
+ record: { editable: false
200
170
  },
201
171
  sortable: true,
202
172
  width: 180
203
173
  }
204
174
  ],
205
- rows: {
206
- selectable: {
207
- multiple: true
175
+ rows: { selectable: { multiple: true
208
176
  }
209
177
  },
210
178
  sorters: [
211
- {
212
- name: 'name'
179
+ { name: 'name'
213
180
  }
214
181
  ]
215
182
  };
216
183
  }
217
184
  async pageUpdated(changes, lifecycle) {
218
- if (this.active) {
219
- // do something here when this page just became as active
185
+ if (this.active) { // do something here when this page just became as active
220
186
  }
221
187
  }
222
188
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
223
- const response = await client.query({
224
- query: gql `
225
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
226
- responses: accountingCategories(filters: $filters, pagination: $pagination, sortings: $sortings) {
227
- items {
228
- id
189
+ const response = await client.query({ query: gql `
190
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: accountingCategories(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
229
191
  code
230
192
  name
231
193
  description
232
194
  active
233
- parent {
234
- code
195
+ parent { code
235
196
  name
236
197
  description
237
- }
238
- updater {
239
- id
198
+ }
199
+ updater { id
240
200
  name
241
- }
201
+ }
242
202
  updatedAt
243
- }
203
+ }
244
204
  total
245
- }
246
- }
205
+ }
206
+ }
247
207
  `,
248
- variables: {
249
- filters,
208
+ variables: { filters,
250
209
  pagination: { page, limit },
251
210
  sortings
252
211
  }
253
212
  });
254
- return {
255
- total: response.data.responses.total || 0,
213
+ return { total: response.data.responses.total || 0,
256
214
  records: response.data.responses.items || []
257
215
  };
258
216
  }
@@ -260,20 +218,16 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
260
218
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
261
219
  const ids = this.grist.selected.map(record => record.id);
262
220
  if (ids && ids.length > 0) {
263
- const response = await client.mutate({
264
- mutation: gql `
265
- mutation ($ids: [String!]!) {
266
- deleteAccountingCategories(ids: $ids)
267
- }
221
+ const response = await client.mutate({ mutation: gql `
222
+ mutation ($ids: [String!]!) { deleteAccountingCategories(ids: $ids)
223
+ }
268
224
  `,
269
- variables: {
270
- ids
225
+ variables: { ids
271
226
  }
272
227
  });
273
228
  if (!response.errors) {
274
229
  this.grist.fetch();
275
- notify({
276
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
230
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
277
231
  });
278
232
  }
279
233
  }
@@ -291,16 +245,12 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
291
245
  patchField.cuFlag = patch.__dirty__;
292
246
  return patchField;
293
247
  });
294
- const response = await client.mutate({
295
- mutation: gql `
296
- mutation ($patches: [AccountingCategoryPatch!]!) {
297
- updateMultipleAccountingCategory(patches: $patches) {
298
- name
299
- }
300
- }
248
+ const response = await client.mutate({ mutation: gql `
249
+ mutation ($patches: [AccountingCategoryPatch!]!) { updateMultipleAccountingCategory(patches: $patches) { name
250
+ }
251
+ }
301
252
  `,
302
- variables: {
303
- patches
253
+ variables: { patches
304
254
  }
305
255
  });
306
256
  if (!response.errors) {
@@ -328,8 +278,7 @@ let AccountingCategoryListPage = class AccountingCategoryListPage extends connec
328
278
  this.grist.fetch();
329
279
  }}
330
280
  ></accounting-category-importer>
331
- `, {
332
- backdrop: true,
281
+ `, { backdrop: true,
333
282
  size: 'large',
334
283
  title: i18next.t('title.import accounting-category')
335
284
  });
@@ -1 +1 @@
1
- {"version":3,"file":"accounting-category-list-page.js","sourceRoot":"","sources":["../../../client/pages/accounting-category/accounting-category-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,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,M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-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 { AccountingCategoryImporter } from './accounting-category-importer'\n\n@customElement('accounting-category-list-page')\nexport class AccountingCategoryListPage 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 ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'accounting-category-importer': AccountingCategoryImporter\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.accounting-category 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/accounting-category',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateAccountingCategory.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteAccountingCategory.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.accounting-category 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: 'resource-object',\n name: 'parent',\n header: i18next.t('field.parent'),\n record: {\n editable: true\n },\n filter: true,\n sortable: 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: 'name'\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: accountingCategories(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n code\n name\n description\n active\n parent {\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 _deleteAccountingCategory() {\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 deleteAccountingCategories(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 _updateAccountingCategory() {\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: [AccountingCategoryPatch!]!) {\n updateMultipleAccountingCategory(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(accountingCategory => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = accountingCategory[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <accounting-category-importer\n .accountingCategories=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></accounting-category-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import accounting-category')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"accounting-category-list-page.js","sourceRoot":"","sources":["../../../client/pages/accounting-category/accounting-category-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,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,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;AA1B/C,0BAA0B;IADtC,aAAa,CAAC,+BAA+B,CAAC;GAClC,0BAA0B,CAkRtC","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 { AccountingCategoryImporter } from './accounting-category-importer'\n\n@customElement('accounting-category-list-page')\nexport class AccountingCategoryListPage 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 ox-grist { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'accounting-category-importer': AccountingCategoryImporter\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.accounting-category 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/accounting-category',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateAccountingCategory.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteAccountingCategory.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.accounting-category 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: 'resource-object',\n name: 'parent',\n header: i18next.t('field.parent'),\n record: { editable: true\n },\n filter: true,\n sortable: 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: 'name'\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: accountingCategories(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n code\n name\n description\n active\n parent { 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 _deleteAccountingCategory() { 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!]!) { deleteAccountingCategories(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 _updateAccountingCategory() { 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: [AccountingCategoryPatch!]!) { updateMultipleAccountingCategory(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(accountingCategory => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = accountingCategory[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <accounting-category-importer\n .accountingCategories=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></accounting-category-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import accounting-category')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
@@ -4,13 +4,7 @@ import { PropertyValues } from 'lit';
4
4
  import { PageView } from '@operato/shell';
5
5
  import { AccountingCategory } from '../../types/accounting-category';
6
6
  import { AccountingCategoryView } from '../../components/accounting-category-view';
7
- declare const AccountingCategoryTreePage_base: (new (...args: any[]) => {
8
- _storeUnsubscribe: import("redux").Unsubscribe;
9
- connectedCallback(): void;
10
- disconnectedCallback(): void;
11
- stateChanged(_state: unknown): void;
12
- readonly isConnected: boolean;
13
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
7
+ declare const AccountingCategoryTreePage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
14
8
  export declare class AccountingCategoryTreePage extends AccountingCategoryTreePage_base {
15
9
  static styles: import("lit").CSSResult[];
16
10
  root?: AccountingCategory;