@things-factory/accounting 8.0.0-alpha.7 → 8.0.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. package/client/pages/accounting-category/accounting-category-tree-page.ts +1 -1
  2. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
  3. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-server/service/account/account-history.js +7 -2
  6. package/dist-server/service/account/account-history.js.map +1 -1
  7. package/dist-server/service/accounting-category/accounting-category-history.js +7 -2
  8. package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -1
  9. package/dist-server/service/accounting-document/accounting-document-history.js +7 -2
  10. package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -1
  11. package/dist-server/service/financial-statement/financial-statement-history.js +7 -2
  12. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  13. package/dist-server/service/income-statement/income-statement-history.js +7 -2
  14. package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
  15. package/dist-server/service/payment/payment-history.js +7 -2
  16. package/dist-server/service/payment/payment-history.js.map +1 -1
  17. package/dist-server/service/transaction/transaction-history.js +7 -2
  18. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  19. package/dist-server/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +7 -7
  21. package/server/service/account/account-history.ts +8 -2
  22. package/server/service/accounting-category/accounting-category-history.ts +8 -2
  23. package/server/service/accounting-document/accounting-document-history.ts +8 -2
  24. package/server/service/financial-statement/financial-statement-history.ts +8 -2
  25. package/server/service/income-statement/income-statement-history.ts +8 -2
  26. package/server/service/payment/payment-history.ts +8 -2
  27. package/server/service/transaction/transaction-history.ts +8 -2
@@ -132,7 +132,7 @@ export class AccountingCategoryTreePage extends connect(store)(localize(i18next)
132
132
  <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>
133
133
  <div filler></div>
134
134
  <button @click=${this.create.bind(this)} ?disabled=${!this.appendable}>
135
- <md-icon>add</md-icon>${i18next.t('button.add')}
135
+ <md-icon>clear</md-icon>${i18next.t('button.add')}
136
136
  </button>
137
137
  <button @click=${this.save.bind(this)} ?disabled=${!this.modified} done>
138
138
  <md-icon>save</md-icon>${i18next.t('button.save')}
@@ -79,7 +79,7 @@ let AccountingCategoryTreePage = class AccountingCategoryTreePage extends connec
79
79
  <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>
80
80
  <div filler></div>
81
81
  <button @click=${this.create.bind(this)} ?disabled=${!this.appendable}>
82
- <md-icon>add</md-icon>${i18next.t('button.add')}
82
+ <md-icon>clear</md-icon>${i18next.t('button.add')}
83
83
  </button>
84
84
  <button @click=${this.save.bind(this)} ?disabled=${!this.modified} done>
85
85
  <md-icon>save</md-icon>${i18next.t('button.save')}
@@ -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,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,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AA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AAE,CAAA;QACpB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAc;QAClC,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAY,EAAE,SAAc;QAC5C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,yDAAyD;QAC3D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BN,6BAA6B;OAChC;SACF,CAAC,CAAA;QACF,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;IACxB,CAAC;;AA7SM,iCAAM,GAAG;IACd,kBAAkB;IAClB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCF;CACF,AAzCY,CAyCZ;AAEQ;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>add</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,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAA;AAElF,MAAM,6BAA6B,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAaxC,CAAA;AAGM,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAAzG;;QA+CI,aAAQ,GAAY,KAAK,CAAA;QACzB,eAAU,GAAY,KAAK,CAAA;IA+PtC,CAAC;IA3PC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;YAClD,IAAI,EAAE,gCAAgC;YACtC,OAAO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I,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACxB,CAAC;;AA7SM,iCAAM,GAAG;IACd,kBAAkB;IAClB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCF;CACF,AAzCY,CAyCZ;AAEQ;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"]}