@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
@@ -7,26 +7,23 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
7
7
  import { client } from '@operato/graphql';
8
8
  import { i18next, localize } from '@operato/i18n';
9
9
  import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
10
- import { CustomAlert, PageView, store } from '@operato/shell';
11
- import { connect } from 'pwa-helpers/connect-mixin';
10
+ import { CustomAlert, PageView } from '@operato/shell';
12
11
  import gql from 'graphql-tag';
13
12
  import { AccountingCategory } from '../../types/accounting-category';
14
13
  import { AccountingCategoryView } from '../../components/accounting-category-view';
15
14
  const SubAccountingCategoryFragment = gql `
16
- fragment SubAccountingCategoryFragment on AccountingCategory {
17
- id
15
+ fragment SubAccountingCategoryFragment on AccountingCategory { id
18
16
  code
19
17
  name
20
18
  description
21
19
  active
22
- updater {
23
- id
20
+ updater { id
24
21
  name
25
- }
22
+ }
26
23
  updatedAt
27
- }
24
+ }
28
25
  `;
29
- let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
26
+ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends localize(i18next)(ScopedElementsMixin(PageView)) {
30
27
  constructor() {
31
28
  super(...arguments);
32
29
  this.modified = false;
@@ -36,55 +33,46 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
36
33
  CommonHeaderStyles,
37
34
  ScrollbarStyles,
38
35
  css `
39
- :host {
40
- display: flex;
36
+ :host { display: flex;
41
37
  flex-direction: column;
42
38
 
43
39
  width: 100%;
44
40
  overflow: auto;
45
- }
41
+ }
46
42
 
47
- content {
48
- flex: 1;
43
+ content { flex: 1;
49
44
  display: flex;
50
45
  flex-direction: row;
51
- }
46
+ }
52
47
 
53
- div[editor] {
54
- width: 300px;
48
+ div[editor] { width: 300px;
55
49
  display: flex;
56
50
  flex-direction: column;
57
- }
51
+ }
58
52
 
59
- ox-tree-vertical {
60
- flex: 1;
53
+ ox-tree-vertical { flex: 1;
61
54
  overflow: auto;
62
- }
55
+ }
63
56
 
64
- accounting-category-view {
65
- flex: 1;
57
+ accounting-category-view { flex: 1;
66
58
  padding: var(--spacing-medium);
67
59
  background-color: var(--md-sys-color-surface-variant);
68
60
  overflow: auto;
69
- }
61
+ }
70
62
 
71
- .footer button[disabled] {
72
- color: var(--md-sys-color-surface-dim);
63
+ .footer button[disabled] { color: var(--md-sys-color-surface-dim);
73
64
  background-color: transparent;
74
- }
65
+ }
75
66
  `
76
67
  ]; }
77
68
  get context() {
78
- return {
79
- title: i18next.t('title.accounting-category list'),
69
+ return { title: i18next.t('title.accounting-category list'),
80
70
  help: 'accounting/accounting-category',
81
71
  actions: [
82
- {
83
- icon: 'delete',
72
+ { icon: 'delete',
84
73
  title: i18next.t('button.delete'),
85
74
  action: this.delete.bind(this),
86
- emphasis: {
87
- danger: true
75
+ emphasis: { danger: true
88
76
  }
89
77
  }
90
78
  ].filter(Boolean),
@@ -146,8 +134,7 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
146
134
  async create() {
147
135
  const { id: parentId } = this.accountingCategory || {};
148
136
  const { code, name, description, active } = this.accountingCategory || {};
149
- var accountingCategory = {
150
- code,
137
+ var accountingCategory = { code,
151
138
  name,
152
139
  description,
153
140
  active
@@ -155,18 +142,14 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
155
142
  if (parentId) {
156
143
  accountingCategory.parent = { id: parentId };
157
144
  }
158
- const response = await client.mutate({
159
- mutation: gql `
160
- mutation ($accountingCategory: NewAccountingCategory!) {
161
- createAccountingCategory(accountingCategory: $accountingCategory) {
162
- ...SubAccountingCategoryFragment
163
- }
164
- }
145
+ const response = await client.mutate({ mutation: gql `
146
+ mutation ($accountingCategory: NewAccountingCategory!) { createAccountingCategory(accountingCategory: $accountingCategory) { ...SubAccountingCategoryFragment
147
+ }
148
+ }
165
149
 
166
150
  ${SubAccountingCategoryFragment}
167
151
  `,
168
- variables: {
169
- accountingCategory
152
+ variables: { accountingCategory
170
153
  }
171
154
  });
172
155
  this.selected = response.data.createAccountingCategory;
@@ -176,36 +159,29 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
176
159
  async save() {
177
160
  const { id, code, name, description, active } = this.accountingCategory || {};
178
161
  if (!id) {
179
- await CustomAlert({
180
- type: 'warning',
162
+ await CustomAlert({ type: 'warning',
181
163
  title: 'accounting-category not selected',
182
164
  text: 'Please select accounting-category first.',
183
165
  confirmButton: { text: i18next.t('button.confirm') }
184
166
  });
185
167
  return;
186
168
  }
187
- var patch = {
188
- code,
169
+ var patch = { code,
189
170
  name,
190
171
  description,
191
172
  active
192
173
  };
193
- const response = await client.mutate({
194
- mutation: gql `
195
- mutation ($id: String!, $patch: AccountingCategoryPatch!) {
196
- updateAccountingCategory(id: $id, patch: $patch) {
197
- ...SubAccountingCategoryFragment
198
- }
199
- }
174
+ const response = await client.mutate({ mutation: gql `
175
+ mutation ($id: String!, $patch: AccountingCategoryPatch!) { updateAccountingCategory(id: $id, patch: $patch) { ...SubAccountingCategoryFragment
176
+ }
177
+ }
200
178
 
201
179
  ${SubAccountingCategoryFragment}
202
180
  `,
203
- variables: {
204
- id,
181
+ variables: { id,
205
182
  patch
206
183
  },
207
- context: {
208
- hasUpload: true
184
+ context: { hasUpload: true
209
185
  }
210
186
  });
211
187
  this.selected = response.data.updateAccountingCategory;
@@ -213,8 +189,7 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
213
189
  }
214
190
  async delete() {
215
191
  if (!this.selected) {
216
- await CustomAlert({
217
- type: 'warning',
192
+ await CustomAlert({ type: 'warning',
218
193
  title: 'accounting category not selected',
219
194
  text: 'Please select accounting category first.',
220
195
  confirmButton: { text: i18next.t('button.confirm') }
@@ -223,8 +198,7 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
223
198
  }
224
199
  const children = this.selected?.children;
225
200
  if (children && children.length > 0) {
226
- await CustomAlert({
227
- type: 'warning',
201
+ await CustomAlert({ type: 'warning',
228
202
  title: 'AccountingCategorys with subordinates cannot be deleted.',
229
203
  text: 'AccountingCategory having children cannot be deleted.',
230
204
  confirmButton: { text: i18next.t('button.confirm') }
@@ -233,14 +207,11 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
233
207
  }
234
208
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
235
209
  const { id } = this.selected || {};
236
- const response = await client.mutate({
237
- mutation: gql `
238
- mutation ($id: String!) {
239
- deleteAccountingCategory(id: $id)
240
- }
210
+ const response = await client.mutate({ mutation: gql `
211
+ mutation ($id: String!) { deleteAccountingCategory(id: $id)
212
+ }
241
213
  `,
242
- variables: {
243
- id
214
+ variables: { id
244
215
  }
245
216
  });
246
217
  this.selected = {};
@@ -252,42 +223,30 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
252
223
  this.fetch();
253
224
  }
254
225
  async pageUpdated(changes, lifecycle) {
255
- if (this.active) {
256
- // do something here when this page just became as active
226
+ if (this.active) { // do something here when this page just became as active
257
227
  }
258
228
  }
259
229
  async fetch() {
260
- const response = await client.query({
261
- query: gql `
262
- query {
263
- responses: accountingCategoryRoots {
264
- total
265
- items {
266
- ...SubAccountingCategoryFragment
267
- children {
268
- ...SubAccountingCategoryFragment
269
- children {
270
- ...SubAccountingCategoryFragment
271
- children {
272
- ...SubAccountingCategoryFragment
273
- children {
274
- ...SubAccountingCategoryFragment
275
- children {
276
- ...SubAccountingCategoryFragment
277
- children {
278
- ...SubAccountingCategoryFragment
279
- children {
280
- ...SubAccountingCategoryFragment
281
- }
282
- }
283
- }
284
- }
285
- }
286
- }
287
- }
288
- }
289
- }
290
- }
230
+ const response = await client.query({ query: gql `
231
+ query { responses: accountingCategoryRoots { total
232
+ items { ...SubAccountingCategoryFragment
233
+ children { ...SubAccountingCategoryFragment
234
+ children { ...SubAccountingCategoryFragment
235
+ children { ...SubAccountingCategoryFragment
236
+ children { ...SubAccountingCategoryFragment
237
+ children { ...SubAccountingCategoryFragment
238
+ children { ...SubAccountingCategoryFragment
239
+ children { ...SubAccountingCategoryFragment
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ }
291
250
 
292
251
  ${SubAccountingCategoryFragment}
293
252
  `
@@ -1 +1 @@
1
- {"version":3,"file":"accounting-category-tree-page.js","sourceRoot":"","sources":["../../../client/pages/accounting-category/accounting-category-tree-page.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OA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C,CAAA;IACxB,CAAC;;AAlQQ;IAAR,KAAK,EAAE;8BAAQ,kBAAkB;wDAAA;AACzB;IAAR,KAAK,EAAE;8BAAY,kBAAkB;4DAAA;AAC7B;IAAR,KAAK,EAAE;8BAAsB,kBAAkB;sEAAA;AACvC;IAAR,KAAK,EAAE;;4DAA0B;AACzB;IAAR,KAAK,EAAE;;8DAA4B;AAED;IAAlC,KAAK,CAAC,0BAA0B,CAAC;8BAA0B,sBAAsB;0EAAA;AAlDvE,0BAA0B;IADtC,aAAa,CAAC,+BAA+B,CAAC;GAClC,0BAA0B,CA+StC","sourcesContent":["import '@operato/data-tree'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { CustomAlert, PageView, store } from '@operato/shell'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { AccountingCategory } from '../../types/accounting-category'\n\nimport { AccountingCategoryView } from '../../components/accounting-category-view'\n\nconst SubAccountingCategoryFragment = gql`\n fragment SubAccountingCategoryFragment on AccountingCategory {\n id\n code\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\n }\n`\n\n@customElement('accounting-category-tree-page')\nexport class AccountingCategoryTreePage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n overflow: auto;\n }\n\n content {\n flex: 1;\n display: flex;\n flex-direction: row;\n }\n\n div[editor] {\n width: 300px;\n display: flex;\n flex-direction: column;\n }\n\n ox-tree-vertical {\n flex: 1;\n overflow: auto;\n }\n\n accounting-category-view {\n flex: 1;\n padding: var(--spacing-medium);\n background-color: var(--md-sys-color-surface-variant);\n overflow: auto;\n }\n\n .footer button[disabled] {\n color: var(--md-sys-color-surface-dim);\n background-color: transparent;\n }\n `\n ]\n\n @state() root?: AccountingCategory\n @state() selected?: AccountingCategory\n @state() accountingCategory?: AccountingCategory\n @state() modified: boolean = false\n @state() appendable: boolean = false\n\n @query('accounting-category-view') accountingCategoryView!: AccountingCategoryView\n\n get context() {\n return {\n title: i18next.t('title.accounting-category list'),\n help: 'accounting/accounting-category',\n actions: [\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.delete.bind(this),\n emphasis: {\n danger: true\n }\n }\n ].filter(Boolean),\n toolbar: false\n }\n }\n\n render() {\n return html`\n <div class=\"header\">\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <content>\n <ox-tree-vertical\n .data=${this.root}\n .selected=${this.selected}\n @select=${this.onSelect.bind(this)}\n id-property=\"code\"\n label-property=\"name\"\n description-property=\"description\"\n ></ox-tree-vertical>\n\n <div editor>\n <accounting-category-view\n .accountingCategory=${this.accountingCategory}\n @property-change=${(e: CustomEvent) => {\n const { code, name } = e.detail || {}\n\n this.modified = true\n this.appendable = code && code !== this.selected?.code && name !== this.selected?.name\n }}\n ></accounting-category-view>\n <div class=\"footer\">\n <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>\n <div filler></div>\n <button @click=${this.create.bind(this)} ?disabled=${!this.appendable}>\n <md-icon>clear</md-icon>${i18next.t('button.add')}\n </button>\n <button @click=${this.save.bind(this)} ?disabled=${!this.modified} done>\n <md-icon>save</md-icon>${i18next.t('button.save')}\n </button>\n </div>\n </div>\n </content>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('selected')) {\n this.modified = false\n this.accountingCategory = { ...this.selected }\n }\n }\n\n onSelect(e: CustomEvent) {\n this.selected = e.detail as AccountingCategory\n this.updateContext()\n }\n\n reset() {\n this.accountingCategoryView.accountingCategory = {}\n }\n\n async create() {\n const { id: parentId } = this.accountingCategory || {}\n const { code, name, description, active } = this.accountingCategory || {}\n\n var accountingCategory = {\n code,\n name,\n description,\n active\n } as any\n\n if (parentId) {\n accountingCategory.parent = { id: parentId }\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($accountingCategory: NewAccountingCategory!) {\n createAccountingCategory(accountingCategory: $accountingCategory) {\n ...SubAccountingCategoryFragment\n }\n }\n\n ${SubAccountingCategoryFragment}\n `,\n variables: {\n accountingCategory\n }\n })\n\n this.selected = response.data.createAccountingCategory\n this.updateContext()\n\n await this.fetch()\n }\n\n async save() {\n const { id, code, name, description, active } = this.accountingCategory || {}\n\n if (!id) {\n await CustomAlert({\n type: 'warning',\n title: 'accounting-category not selected',\n text: 'Please select accounting-category first.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n var patch = {\n code,\n name,\n description,\n active\n } as any\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: AccountingCategoryPatch!) {\n updateAccountingCategory(id: $id, patch: $patch) {\n ...SubAccountingCategoryFragment\n }\n }\n\n ${SubAccountingCategoryFragment}\n `,\n variables: {\n id,\n patch\n },\n context: {\n hasUpload: true\n }\n })\n\n this.selected = response.data.updateAccountingCategory\n\n this.fetch()\n }\n\n async delete() {\n if (!this.selected) {\n await CustomAlert({\n type: 'warning',\n title: 'accounting category not selected',\n text: 'Please select accounting category first.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n const children = this.selected?.children\n if (children && children.length > 0) {\n await CustomAlert({\n type: 'warning',\n title: 'AccountingCategorys with subordinates cannot be deleted.',\n text: 'AccountingCategory having children cannot be deleted.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const { id } = this.selected || {}\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteAccountingCategory(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n\n this.selected = {}\n this.updateContext()\n\n await this.fetch()\n }\n }\n\n async pageInitialized(lifecycle: any) {\n this.fetch()\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 fetch() {\n const response = await client.query({\n query: gql`\n query {\n responses: accountingCategoryRoots {\n total\n items {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n children {\n ...SubAccountingCategoryFragment\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n ${SubAccountingCategoryFragment}\n `\n })\n const { items: records, total } = response.data.responses\n\n this.root = records[0]\n }\n}\n"]}
1
+ {"version":3,"file":"accounting-category-tree-page.js","sourceRoot":"","sources":["../../../client/pages/accounting-category/accounting-category-tree-page.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,6CAA6C,CAAA;AAEpD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EA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AAA;YAEpB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC;IACD,CAAC;IAEA,KAAK,CAAC,eAAe,CAAC,SAAc;QAAQ,IAAI,CAAC,KAAK,EAAE,CAAA;IACzD,CAAC;IAEA,KAAK,CAAC,WAAW,CAAC,OAAY,EAAE,SAAc;QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAO,yDAAyD;QACzI,CAAC;IACD,CAAC;IAEA,KAAK,CAAC,KAAK;QAAS,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAQ,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;UAqBlE,6BAA6B;OAChC;SACL,CAAC,CAAA;QACC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;QAEzD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACzB,CAAC;;AAhNS;IAAR,KAAK,EAAE;8BAAQ,kBAAkB;wDAAA;AACzB;IAAR,KAAK,EAAE;8BAAY,kBAAkB;4DAAA;AAC7B;IAAR,KAAK,EAAE;8BAAsB,kBAAkB;sEAAA;AACvC;IAAR,KAAK,EAAE;;4DAA0B;AACzB;IAAR,KAAK,EAAE;;8DAA4B;AAED;IAAlC,KAAK,CAAC,0BAA0B,CAAC;8BAA0B,sBAAsB;0EAAA;AA3CvE,0BAA0B;IADtC,aAAa,CAAC,+BAA+B,CAAC;GAClC,0BAA0B,CAsPtC","sourcesContent":["import '@operato/data-tree'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { CustomAlert, PageView } from '@operato/shell'\n\nimport gql from 'graphql-tag'\n\nimport { AccountingCategory } from '../../types/accounting-category'\n\nimport { AccountingCategoryView } from '../../components/accounting-category-view'\n\nconst SubAccountingCategoryFragment = gql`\n fragment SubAccountingCategoryFragment on AccountingCategory { id\n code\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n`\n\n@customElement('accounting-category-tree-page')\nexport class AccountingCategoryTreePage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n width: 100%;\n overflow: auto;\n }\n\n content { flex: 1;\n display: flex;\n flex-direction: row;\n }\n\n div[editor] { width: 300px;\n display: flex;\n flex-direction: column;\n }\n\n ox-tree-vertical { flex: 1;\n overflow: auto;\n }\n\n accounting-category-view { flex: 1;\n padding: var(--spacing-medium);\n background-color: var(--md-sys-color-surface-variant);\n overflow: auto;\n }\n\n .footer button[disabled] { color: var(--md-sys-color-surface-dim);\n background-color: transparent;\n }\n `\n ]\n\n @state() root?: AccountingCategory\n @state() selected?: AccountingCategory\n @state() accountingCategory?: AccountingCategory\n @state() modified: boolean = false\n @state() appendable: boolean = false\n\n @query('accounting-category-view') accountingCategoryView!: AccountingCategoryView\n\n get context() { return { title: i18next.t('title.accounting-category list'),\n help: 'accounting/accounting-category',\n actions: [\n { icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.delete.bind(this),\n emphasis: { danger: true\n }\n }\n ].filter(Boolean),\n toolbar: false\n }\n }\n\n render() { return html`\n <div class=\"header\">\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <content>\n <ox-tree-vertical\n .data=${this.root}\n .selected=${this.selected}\n @select=${this.onSelect.bind(this)}\n id-property=\"code\"\n label-property=\"name\"\n description-property=\"description\"\n ></ox-tree-vertical>\n\n <div editor>\n <accounting-category-view\n .accountingCategory=${this.accountingCategory}\n @property-change=${(e: CustomEvent) => { const { code, name } = e.detail || {}\n\n this.modified = true\n this.appendable = code && code !== this.selected?.code && name !== this.selected?.name\n }}\n ></accounting-category-view>\n <div class=\"footer\">\n <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>\n <div filler></div>\n <button @click=${this.create.bind(this)} ?disabled=${!this.appendable}>\n <md-icon>clear</md-icon>${i18next.t('button.add')}\n </button>\n <button @click=${this.save.bind(this)} ?disabled=${!this.modified} done>\n <md-icon>save</md-icon>${i18next.t('button.save')}\n </button>\n </div>\n </div>\n </content>\n `\n }\n\n updated(changes: PropertyValues<this>) { if (changes.has('selected')) { this.modified = false\n this.accountingCategory = { ...this.selected }\n }\n }\n\n onSelect(e: CustomEvent) { this.selected = e.detail as AccountingCategory\n this.updateContext()\n }\n\n reset() { this.accountingCategoryView.accountingCategory = {}\n }\n\n async create() { const { id: parentId } = this.accountingCategory || {}\n const { code, name, description, active } = this.accountingCategory || {}\n\n var accountingCategory = { code,\n name,\n description,\n active\n } as any\n\n if (parentId) { accountingCategory.parent = { id: parentId }\n }\n\n const response = await client.mutate({ mutation: gql`\n mutation ($accountingCategory: NewAccountingCategory!) { createAccountingCategory(accountingCategory: $accountingCategory) { ...SubAccountingCategoryFragment\n }\n }\n\n ${SubAccountingCategoryFragment}\n `,\n variables: { accountingCategory\n }\n })\n\n this.selected = response.data.createAccountingCategory\n this.updateContext()\n\n await this.fetch()\n }\n\n async save() { const { id, code, name, description, active } = this.accountingCategory || {}\n\n if (!id) { await CustomAlert({ type: 'warning',\n title: 'accounting-category not selected',\n text: 'Please select accounting-category first.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n var patch = { code,\n name,\n description,\n active\n } as any\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $patch: AccountingCategoryPatch!) { updateAccountingCategory(id: $id, patch: $patch) { ...SubAccountingCategoryFragment\n }\n }\n\n ${SubAccountingCategoryFragment}\n `,\n variables: { id,\n patch\n },\n context: { hasUpload: true\n }\n })\n\n this.selected = response.data.updateAccountingCategory\n\n this.fetch()\n }\n\n async delete() { if (!this.selected) { await CustomAlert({ type: 'warning',\n title: 'accounting category not selected',\n text: 'Please select accounting category first.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n const children = this.selected?.children\n if (children && children.length > 0) { await CustomAlert({ type: 'warning',\n title: 'AccountingCategorys with subordinates cannot be deleted.',\n text: 'AccountingCategory having children cannot be deleted.',\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n return\n }\n\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const { id } = this.selected || {}\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!) { deleteAccountingCategory(id: $id)\n }\n `,\n variables: { id\n }\n })\n\n this.selected = {}\n this.updateContext()\n\n await this.fetch()\n }\n }\n\n async pageInitialized(lifecycle: any) { this.fetch()\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 fetch() { const response = await client.query({ query: gql`\n query { responses: accountingCategoryRoots { total\n items { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n children { ...SubAccountingCategoryFragment\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n ${SubAccountingCategoryFragment}\n `\n })\n const { items: records, total } = response.data.responses\n\n this.root = records[0]\n }\n}\n"]}
@@ -6,13 +6,7 @@ import '@operato/data-grist/ox-record-creator.js';
6
6
  import { PageView } from '@operato/shell';
7
7
  import { FetchOption } from '@operato/data-grist';
8
8
  import { AccountingDocumentImporter } from './accounting-document-importer';
9
- declare const AccountingDocumentListPage_base: (new (...args: any[]) => {
10
- _storeUnsubscribe: import("redux").Unsubscribe;
11
- connectedCallback(): void;
12
- disconnectedCallback(): void;
13
- stateChanged(_state: unknown): void;
14
- readonly isConnected: boolean;
15
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
9
+ declare const AccountingDocumentListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
16
10
  export declare class AccountingDocumentListPage extends AccountingDocumentListPage_base {
17
11
  static styles: import("lit").CSSResult[];
18
12
  static get scopedElements(): {