@things-factory/accounting 6.0.46
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.
- package/CHANGELOG.md +8 -0
- package/README.md +31 -0
- package/assets/images/book-activity.jpg +0 -0
- package/assets/images/expense-activity.jpg +0 -0
- package/assets/images/hatiolab-logo.png +0 -0
- package/client/activities/activity-book-edit.ts +88 -0
- package/client/activities/activity-book-view.ts +88 -0
- package/client/activities/activity-expense-edit.ts +88 -0
- package/client/activities/activity-expense-view.ts +88 -0
- package/client/bootstrap.ts +1 -0
- package/client/index.ts +0 -0
- package/client/pages/account/account-importer.ts +97 -0
- package/client/pages/account/account-list-page.ts +348 -0
- package/client/pages/accounting-category/accounting-category-importer.ts +97 -0
- package/client/pages/accounting-category/accounting-category-list-page.ts +348 -0
- package/client/pages/financial-statement/financial-statement-importer.ts +97 -0
- package/client/pages/financial-statement/financial-statement-list-page.ts +348 -0
- package/client/pages/income-statement/income-statement-importer.ts +97 -0
- package/client/pages/income-statement/income-statement-list-page.ts +348 -0
- package/client/pages/ledger/ledger-importer.ts +97 -0
- package/client/pages/ledger/ledger-list-page.ts +332 -0
- package/client/pages/main.ts +24 -0
- package/client/pages/transaction/transaction-importer.ts +97 -0
- package/client/pages/transaction/transaction-list-page.ts +348 -0
- package/client/route.ts +27 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/activities/activity-book-edit.d.ts +14 -0
- package/dist-client/activities/activity-book-edit.js +85 -0
- package/dist-client/activities/activity-book-edit.js.map +1 -0
- package/dist-client/activities/activity-book-view.d.ts +14 -0
- package/dist-client/activities/activity-book-view.js +85 -0
- package/dist-client/activities/activity-book-view.js.map +1 -0
- package/dist-client/activities/activity-expense-edit.d.ts +14 -0
- package/dist-client/activities/activity-expense-edit.js +85 -0
- package/dist-client/activities/activity-expense-edit.js.map +1 -0
- package/dist-client/activities/activity-expense-view.d.ts +14 -0
- package/dist-client/activities/activity-expense-view.js +85 -0
- package/dist-client/activities/activity-expense-view.js.map +1 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/account/account-importer.d.ts +22 -0
- package/dist-client/pages/account/account-importer.js +100 -0
- package/dist-client/pages/account/account-importer.js.map +1 -0
- package/dist-client/pages/account/account-list-page.d.ts +62 -0
- package/dist-client/pages/account/account-list-page.js +326 -0
- package/dist-client/pages/account/account-list-page.js.map +1 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +22 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.js +100 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.d.ts +62 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +326 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +22 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.js +100 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +62 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +326 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +22 -0
- package/dist-client/pages/income-statement/income-statement-importer.js +100 -0
- package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-list-page.d.ts +62 -0
- package/dist-client/pages/income-statement/income-statement-list-page.js +326 -0
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -0
- package/dist-client/pages/ledger/ledger-importer.d.ts +22 -0
- package/dist-client/pages/ledger/ledger-importer.js +100 -0
- package/dist-client/pages/ledger/ledger-importer.js.map +1 -0
- package/dist-client/pages/ledger/ledger-list-page.d.ts +62 -0
- package/dist-client/pages/ledger/ledger-list-page.js +317 -0
- package/dist-client/pages/ledger/ledger-list-page.js.map +1 -0
- package/dist-client/pages/main.d.ts +1 -0
- package/dist-client/pages/main.js +27 -0
- package/dist-client/pages/main.js.map +1 -0
- package/dist-client/pages/transaction/transaction-importer.d.ts +22 -0
- package/dist-client/pages/transaction/transaction-importer.js +100 -0
- package/dist-client/pages/transaction/transaction-importer.js.map +1 -0
- package/dist-client/pages/transaction/transaction-list-page.d.ts +62 -0
- package/dist-client/pages/transaction/transaction-list-page.js +326 -0
- package/dist-client/pages/transaction/transaction-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +23 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/activities/activity-book.js +150 -0
- package/dist-server/activities/activity-book.js.map +1 -0
- package/dist-server/activities/activity-expense.js +150 -0
- package/dist-server/activities/activity-expense.js.map +1 -0
- package/dist-server/activities/index.js +19 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.js +7 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/account/account-history.js +113 -0
- package/dist-server/service/account/account-history.js.map +1 -0
- package/dist-server/service/account/account-mutation.js +130 -0
- package/dist-server/service/account/account-mutation.js.map +1 -0
- package/dist-server/service/account/account-query.js +79 -0
- package/dist-server/service/account/account-query.js.map +1 -0
- package/dist-server/service/account/account-type.js +65 -0
- package/dist-server/service/account/account-type.js.map +1 -0
- package/dist-server/service/account/account.js +102 -0
- package/dist-server/service/account/account.js.map +1 -0
- package/dist-server/service/account/event-subscriber.js +21 -0
- package/dist-server/service/account/event-subscriber.js.map +1 -0
- package/dist-server/service/account/index.js +12 -0
- package/dist-server/service/account/index.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js +132 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +79 -0
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-type.js +65 -0
- package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category.js +89 -0
- package/dist-server/service/accounting-category/accounting-category.js.map +1 -0
- package/dist-server/service/accounting-category/index.js +10 -0
- package/dist-server/service/accounting-category/index.js.map +1 -0
- package/dist-server/service/financial-statement/event-subscriber.js +21 -0
- package/dist-server/service/financial-statement/event-subscriber.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.js +126 -0
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js +132 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-query.js +79 -0
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-type.js +77 -0
- package/dist-server/service/financial-statement/financial-statement-type.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement.js +111 -0
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -0
- package/dist-server/service/financial-statement/index.js +12 -0
- package/dist-server/service/financial-statement/index.js.map +1 -0
- package/dist-server/service/income-statement/event-subscriber.js +21 -0
- package/dist-server/service/income-statement/event-subscriber.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-history.js +126 -0
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-mutation.js +132 -0
- package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-query.js +79 -0
- package/dist-server/service/income-statement/income-statement-query.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-type.js +77 -0
- package/dist-server/service/income-statement/income-statement-type.js.map +1 -0
- package/dist-server/service/income-statement/income-statement.js +117 -0
- package/dist-server/service/income-statement/income-statement.js.map +1 -0
- package/dist-server/service/income-statement/index.js +12 -0
- package/dist-server/service/income-statement/index.js.map +1 -0
- package/dist-server/service/index.js +43 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/transaction/event-subscriber.js +21 -0
- package/dist-server/service/transaction/event-subscriber.js.map +1 -0
- package/dist-server/service/transaction/index.js +12 -0
- package/dist-server/service/transaction/index.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.js +123 -0
- package/dist-server/service/transaction/transaction-history.js.map +1 -0
- package/dist-server/service/transaction/transaction-mutation.js +130 -0
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -0
- package/dist-server/service/transaction/transaction-query.js +79 -0
- package/dist-server/service/transaction/transaction-query.js.map +1 -0
- package/dist-server/service/transaction/transaction-type.js +73 -0
- package/dist-server/service/transaction/transaction-type.js.map +1 -0
- package/dist-server/service/transaction/transaction.js +130 -0
- package/dist-server/service/transaction/transaction.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/accounting/account.md +160 -0
- package/helps/accounting/accounting-category.md +160 -0
- package/helps/accounting/financial-accounting.md +53 -0
- package/helps/accounting/financial-statement.md +160 -0
- package/helps/accounting/income-statement.md +160 -0
- package/helps/accounting/transaction.md +160 -0
- package/package.json +36 -0
- package/server/activities/activity-book.ts +149 -0
- package/server/activities/activity-expense.ts +149 -0
- package/server/activities/index.ts +19 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +4 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +28 -0
- package/server/service/account/account-history.ts +103 -0
- package/server/service/account/account-mutation.ts +137 -0
- package/server/service/account/account-query.ts +49 -0
- package/server/service/account/account-type.ts +44 -0
- package/server/service/account/account.ts +86 -0
- package/server/service/account/event-subscriber.ts +17 -0
- package/server/service/account/index.ts +9 -0
- package/server/service/accounting-category/accounting-category-mutation.ts +145 -0
- package/server/service/accounting-category/accounting-category-query.ts +51 -0
- package/server/service/accounting-category/accounting-category-type.ts +42 -0
- package/server/service/accounting-category/accounting-category.ts +80 -0
- package/server/service/accounting-category/index.ts +7 -0
- package/server/service/financial-statement/event-subscriber.ts +17 -0
- package/server/service/financial-statement/financial-statement-history.ts +114 -0
- package/server/service/financial-statement/financial-statement-mutation.ts +145 -0
- package/server/service/financial-statement/financial-statement-query.ts +51 -0
- package/server/service/financial-statement/financial-statement-type.ts +51 -0
- package/server/service/financial-statement/financial-statement.ts +100 -0
- package/server/service/financial-statement/index.ts +9 -0
- package/server/service/income-statement/event-subscriber.ts +17 -0
- package/server/service/income-statement/income-statement-history.ts +114 -0
- package/server/service/income-statement/income-statement-mutation.ts +145 -0
- package/server/service/income-statement/income-statement-query.ts +48 -0
- package/server/service/income-statement/income-statement-type.ts +51 -0
- package/server/service/income-statement/income-statement.ts +105 -0
- package/server/service/income-statement/index.ts +9 -0
- package/server/service/index.ts +62 -0
- package/server/service/transaction/event-subscriber.ts +17 -0
- package/server/service/transaction/index.ts +9 -0
- package/server/service/transaction/transaction-history.ts +111 -0
- package/server/service/transaction/transaction-mutation.ts +143 -0
- package/server/service/transaction/transaction-query.ts +48 -0
- package/server/service/transaction/transaction-type.ts +48 -0
- package/server/service/transaction/transaction.ts +115 -0
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +16 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
4
|
+
import { PageView, store } from '@operato/shell'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
|
+
import {
|
|
9
|
+
ColumnConfig,
|
|
10
|
+
DataGrist,
|
|
11
|
+
FetchOption,
|
|
12
|
+
SortersControl
|
|
13
|
+
} from '@operato/data-grist'
|
|
14
|
+
import { client } from '@operato/graphql'
|
|
15
|
+
import { i18next, localize } from '@operato/i18n'
|
|
16
|
+
import { notify, openPopup } from '@operato/layout'
|
|
17
|
+
import { OxPopup } from '@operato/popup'
|
|
18
|
+
import { isMobileDevice } from '@operato/utils'
|
|
19
|
+
|
|
20
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
21
|
+
import gql from 'graphql-tag'
|
|
22
|
+
|
|
23
|
+
import { TransactionImporter } from './transaction-importer'
|
|
24
|
+
|
|
25
|
+
@customElement('transaction-list-page')
|
|
26
|
+
export class TransactionListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
27
|
+
|
|
28
|
+
static styles = [
|
|
29
|
+
ScrollbarStyles,
|
|
30
|
+
CommonGristStyles,
|
|
31
|
+
css`
|
|
32
|
+
:host {
|
|
33
|
+
display: flex;
|
|
34
|
+
|
|
35
|
+
width: 100%;
|
|
36
|
+
|
|
37
|
+
--grid-record-emphasized-background-color: red;
|
|
38
|
+
--grid-record-emphasized-color: yellow;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
static get scopedElements() {
|
|
44
|
+
return {
|
|
45
|
+
'transaction-importer': TransactionImporter
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@property({ type: Object }) gristConfig: any
|
|
50
|
+
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
51
|
+
|
|
52
|
+
@query('ox-grist') private grist!: DataGrist
|
|
53
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
|
54
|
+
|
|
55
|
+
get context() {
|
|
56
|
+
return {
|
|
57
|
+
search: {
|
|
58
|
+
handler: (search: string) => {
|
|
59
|
+
this.grist.searchText = search
|
|
60
|
+
},
|
|
61
|
+
placeholder: i18next.t('title.transaction list'),
|
|
62
|
+
value: this.grist.searchText
|
|
63
|
+
},
|
|
64
|
+
filter: {
|
|
65
|
+
handler: () => {
|
|
66
|
+
this.grist.toggleHeadroom()
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
help: 'accounting/transaction',
|
|
70
|
+
actions: [
|
|
71
|
+
{
|
|
72
|
+
title: i18next.t('button.save'),
|
|
73
|
+
action: this._updateTransaction.bind(this),
|
|
74
|
+
...CommonButtonStyles.save
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: i18next.t('button.delete'),
|
|
78
|
+
action: this._deleteTransaction.bind(this),
|
|
79
|
+
...CommonButtonStyles.delete
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
exportable: {
|
|
83
|
+
name: i18next.t('title.transaction list'),
|
|
84
|
+
data: this.exportHandler.bind(this)
|
|
85
|
+
},
|
|
86
|
+
importable: {
|
|
87
|
+
handler: this.importHandler.bind(this)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
94
|
+
|
|
95
|
+
return html`
|
|
96
|
+
<ox-grist
|
|
97
|
+
.mode=${mode}
|
|
98
|
+
.config=${this.gristConfig}
|
|
99
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
100
|
+
>
|
|
101
|
+
<div slot="headroom">
|
|
102
|
+
<div id="filters">
|
|
103
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div id="sorters">
|
|
107
|
+
Sort
|
|
108
|
+
<mwc-icon
|
|
109
|
+
@click=${e => {
|
|
110
|
+
const target = e.currentTarget
|
|
111
|
+
this.sortersControl.open({
|
|
112
|
+
right: 0,
|
|
113
|
+
top: target.offsetTop + target.offsetHeight
|
|
114
|
+
})
|
|
115
|
+
}}
|
|
116
|
+
>expand_more</mwc-icon
|
|
117
|
+
>
|
|
118
|
+
<ox-popup id="sorter-control">
|
|
119
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
120
|
+
</ox-popup>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div id="modes">
|
|
124
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
125
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
126
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</ox-grist>
|
|
130
|
+
`
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async pageInitialized(lifecycle: any) {
|
|
134
|
+
this.gristConfig = {
|
|
135
|
+
list: {
|
|
136
|
+
fields: ['name', 'description'],
|
|
137
|
+
details: ['active', 'updatedAt']
|
|
138
|
+
},
|
|
139
|
+
columns: [
|
|
140
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
141
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
142
|
+
{
|
|
143
|
+
type: 'string',
|
|
144
|
+
name: 'name',
|
|
145
|
+
header: i18next.t('field.name'),
|
|
146
|
+
record: {
|
|
147
|
+
editable: true
|
|
148
|
+
},
|
|
149
|
+
filter: 'search',
|
|
150
|
+
sortable: true,
|
|
151
|
+
width: 150
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'string',
|
|
155
|
+
name: 'description',
|
|
156
|
+
header: i18next.t('field.description'),
|
|
157
|
+
record: {
|
|
158
|
+
editable: true
|
|
159
|
+
},
|
|
160
|
+
filter: 'search',
|
|
161
|
+
width: 200
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: 'checkbox',
|
|
165
|
+
name: 'active',
|
|
166
|
+
label: true,
|
|
167
|
+
header: i18next.t('field.active'),
|
|
168
|
+
record: {
|
|
169
|
+
editable: true
|
|
170
|
+
},
|
|
171
|
+
filter: true,
|
|
172
|
+
sortable: true,
|
|
173
|
+
width: 60
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: 'resource-object',
|
|
177
|
+
name: 'updater',
|
|
178
|
+
header: i18next.t('field.updater'),
|
|
179
|
+
record: {
|
|
180
|
+
editable: false
|
|
181
|
+
},
|
|
182
|
+
sortable: true,
|
|
183
|
+
width: 120
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: 'datetime',
|
|
187
|
+
name: 'updatedAt',
|
|
188
|
+
header: i18next.t('field.updated_at'),
|
|
189
|
+
record: {
|
|
190
|
+
editable: false
|
|
191
|
+
},
|
|
192
|
+
sortable: true,
|
|
193
|
+
width: 180
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
rows: {
|
|
197
|
+
selectable: {
|
|
198
|
+
multiple: true
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
sorters: [
|
|
202
|
+
{
|
|
203
|
+
name: 'name'
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async pageUpdated(changes: any, lifecycle: any) {
|
|
210
|
+
if (this.active) {
|
|
211
|
+
// do something here when this page just became as active
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
216
|
+
const response = await client.query({
|
|
217
|
+
query: gql`
|
|
218
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
219
|
+
responses: transactions(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
220
|
+
items {
|
|
221
|
+
id
|
|
222
|
+
name
|
|
223
|
+
description
|
|
224
|
+
active
|
|
225
|
+
updater {
|
|
226
|
+
id
|
|
227
|
+
name
|
|
228
|
+
}
|
|
229
|
+
updatedAt
|
|
230
|
+
}
|
|
231
|
+
total
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`,
|
|
235
|
+
variables: {
|
|
236
|
+
filters,
|
|
237
|
+
pagination: { page, limit },
|
|
238
|
+
sortings
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
total: response.data.responses.total || 0,
|
|
244
|
+
records: response.data.responses.items || []
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async _deleteTransaction() {
|
|
249
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
250
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
251
|
+
if (ids && ids.length > 0) {
|
|
252
|
+
const response = await client.mutate({
|
|
253
|
+
mutation: gql`
|
|
254
|
+
mutation ($ids: [String!]!) {
|
|
255
|
+
deleteTransactions(ids: $ids)
|
|
256
|
+
}
|
|
257
|
+
`,
|
|
258
|
+
variables: {
|
|
259
|
+
ids
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
if (!response.errors) {
|
|
264
|
+
this.grist.fetch()
|
|
265
|
+
notify({
|
|
266
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
267
|
+
})
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async _updateTransaction() {
|
|
274
|
+
let patches = this.grist.dirtyRecords
|
|
275
|
+
if (patches && patches.length) {
|
|
276
|
+
patches = patches.map(patch => {
|
|
277
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
278
|
+
const dirtyFields = patch.__dirtyfields__
|
|
279
|
+
for (let key in dirtyFields) {
|
|
280
|
+
patchField[key] = dirtyFields[key].after
|
|
281
|
+
}
|
|
282
|
+
patchField.cuFlag = patch.__dirty__
|
|
283
|
+
|
|
284
|
+
return patchField
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
const response = await client.mutate({
|
|
288
|
+
mutation: gql`
|
|
289
|
+
mutation ($patches: [TransactionPatch!]!) {
|
|
290
|
+
updateMultipleTransaction(patches: $patches) {
|
|
291
|
+
name
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
`,
|
|
295
|
+
variables: {
|
|
296
|
+
patches
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
if (!response.errors) {
|
|
301
|
+
this.grist.fetch()
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async exportHandler() {
|
|
307
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
308
|
+
const targetFieldSet = new Set([
|
|
309
|
+
'id',
|
|
310
|
+
'name',
|
|
311
|
+
'description',
|
|
312
|
+
'active'
|
|
313
|
+
])
|
|
314
|
+
|
|
315
|
+
return exportTargets.map(transaction => {
|
|
316
|
+
let tempObj = {}
|
|
317
|
+
for (const field of targetFieldSet) {
|
|
318
|
+
tempObj[field] = transaction[field]
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return tempObj
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
async importHandler(records) {
|
|
326
|
+
const popup = openPopup(
|
|
327
|
+
html`
|
|
328
|
+
<transaction-importer
|
|
329
|
+
.transactions=${records}
|
|
330
|
+
@imported=${() => {
|
|
331
|
+
history.back()
|
|
332
|
+
this.grist.fetch()
|
|
333
|
+
}}
|
|
334
|
+
></transaction-importer>
|
|
335
|
+
`,
|
|
336
|
+
{
|
|
337
|
+
backdrop: true,
|
|
338
|
+
size: 'large',
|
|
339
|
+
title: i18next.t('title.import transaction')
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
popup.onclosed = () => {
|
|
344
|
+
this.grist.fetch()
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
package/client/route.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function route(page: string) {
|
|
2
|
+
switch (page) {
|
|
3
|
+
case 'ledger-list':
|
|
4
|
+
import('./pages/ledger/ledger-list-page')
|
|
5
|
+
return page
|
|
6
|
+
|
|
7
|
+
case 'account-list':
|
|
8
|
+
import('./pages/account/account-list-page')
|
|
9
|
+
return page
|
|
10
|
+
|
|
11
|
+
case 'transaction-list':
|
|
12
|
+
import('./pages/transaction/transaction-list-page')
|
|
13
|
+
return page
|
|
14
|
+
|
|
15
|
+
case 'accounting-category-list':
|
|
16
|
+
import('./pages/accounting-category/accounting-category-list-page')
|
|
17
|
+
return page
|
|
18
|
+
|
|
19
|
+
case 'financial-statement-list':
|
|
20
|
+
import('./pages/financial-statement/financial-statement-list-page')
|
|
21
|
+
return page
|
|
22
|
+
|
|
23
|
+
case 'income-statement-list':
|
|
24
|
+
import('./pages/income-statement/income-statement-list-page')
|
|
25
|
+
return page
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../components/book-edit.js';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const ActivityBookView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
4
|
+
export declare class ActivityBookView extends ActivityBookView_base {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
input?: any;
|
|
7
|
+
output?: any;
|
|
8
|
+
book?: any;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
onChange(): Promise<void>;
|
|
11
|
+
updated(changes: any): void;
|
|
12
|
+
fetchBook(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Add the following line to clinet/bootstrap.ts so that activity editor can be registered when loading a module.
|
|
3
|
+
--
|
|
4
|
+
import './activities/book-edit.js' // refered by the activity template (activity-book) on server
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate, __metadata } from "tslib";
|
|
7
|
+
import '../components/book-edit.js';
|
|
8
|
+
import gql from 'graphql-tag';
|
|
9
|
+
import { css, html, LitElement } from 'lit';
|
|
10
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
11
|
+
import { client } from '@operato/graphql';
|
|
12
|
+
import { i18next, localize } from '@operato/i18n';
|
|
13
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
14
|
+
// import { BookView } from '../components/book-edit.js'
|
|
15
|
+
let ActivityBookView = class ActivityBookView extends localize(i18next)(LitElement) {
|
|
16
|
+
// @query('book-edit') bookView!: BookView
|
|
17
|
+
render() {
|
|
18
|
+
return html ` <book-edit .book=${this.book} .value=${this.output} @change=${this.onChange}></book-edit> `;
|
|
19
|
+
}
|
|
20
|
+
async onChange() {
|
|
21
|
+
// this.output = this.bookView.value
|
|
22
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
23
|
+
detail: this.output
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
updated(changes) {
|
|
27
|
+
if (changes.has('input')) {
|
|
28
|
+
this.fetchBook();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async fetchBook() {
|
|
32
|
+
const id = this.input.bookId;
|
|
33
|
+
if (id) {
|
|
34
|
+
const response = await client.query({
|
|
35
|
+
query: gql `
|
|
36
|
+
query ($id: String!) {
|
|
37
|
+
book(id: $id) {
|
|
38
|
+
id
|
|
39
|
+
name
|
|
40
|
+
description
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
variables: {
|
|
45
|
+
id
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.book = response.data.book;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
ActivityBookView.styles = [
|
|
53
|
+
ScrollbarStyles,
|
|
54
|
+
css `
|
|
55
|
+
:host {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
|
|
59
|
+
background-color: #fff;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
book-edit {
|
|
63
|
+
flex: 1;
|
|
64
|
+
padding: 10px;
|
|
65
|
+
overflow: auto;
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
];
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Object }),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], ActivityBookView.prototype, "input", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: Object }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], ActivityBookView.prototype, "output", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
state(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], ActivityBookView.prototype, "book", void 0);
|
|
81
|
+
ActivityBookView = __decorate([
|
|
82
|
+
customElement('activity-book-edit')
|
|
83
|
+
], ActivityBookView);
|
|
84
|
+
export { ActivityBookView };
|
|
85
|
+
//# sourceMappingURL=activity-book-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-book-edit.js","sourceRoot":"","sources":["../../client/activities/activity-book-edit.ts"],"names":[],"mappings":"AAAA;;;;EAIE;;AAEF,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,wDAAwD;AAGjD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAwBjE,0CAA0C;IAE1C,MAAM;QACJ,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,gBAAgB,CAAA;IAC1G,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,oCAAoC;QAEpC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO,CAAC,OAAO;QACb,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,CAAC,SAAS,EAAE,CAAA;SACjB;IACH,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QAE5B,IAAI,EAAE,EAAE;YACN,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;SAQT;gBACD,SAAS,EAAE;oBACT,EAAE;iBACH;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAA;SAC/B;IACH,CAAC;;AAlEM,uBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;KAaF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAY;AACvC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAa;AAExC;IAAC,KAAK,EAAE;;8CAAW;AAtBR,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAoE5B;SApEY,gBAAgB","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity editor can be registered when loading a module.\n--\nimport './activities/book-edit.js' // refered by the activity template (activity-book) on server\n*/\n\nimport '../components/book-edit.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { BookView } from '../components/book-edit.js'\n\n@customElement('activity-book-edit')\nexport class ActivityBookView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n book-edit {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() book?: any //Book\n\n // @query('book-edit') bookView!: BookView\n\n render() {\n return html` <book-edit .book=${this.book} .value=${this.output} @change=${this.onChange}></book-edit> `\n }\n\n async onChange() {\n // this.output = this.bookView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchBook()\n }\n }\n\n async fetchBook() {\n const id = this.input.bookId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n book(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.book = response.data.book\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../components/book-view.js';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const ActivityBookView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
4
|
+
export declare class ActivityBookView extends ActivityBookView_base {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
input?: any;
|
|
7
|
+
output?: any;
|
|
8
|
+
book?: any;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
onChange(): Promise<void>;
|
|
11
|
+
updated(changes: any): void;
|
|
12
|
+
fetchBook(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Add the following line to clinet/bootstrap.ts so that activity view can be registered when loading a module.
|
|
3
|
+
--
|
|
4
|
+
import './activities/book-view.js' // refered by the activity template (activity-data-collect) on server
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate, __metadata } from "tslib";
|
|
7
|
+
import '../components/book-view.js';
|
|
8
|
+
import gql from 'graphql-tag';
|
|
9
|
+
import { css, html, LitElement } from 'lit';
|
|
10
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
11
|
+
import { client } from '@operato/graphql';
|
|
12
|
+
import { i18next, localize } from '@operato/i18n';
|
|
13
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
14
|
+
// import { BookView } from '../components/book-view.js'
|
|
15
|
+
let ActivityBookView = class ActivityBookView extends localize(i18next)(LitElement) {
|
|
16
|
+
// @query('book-view') bookView!: BookView
|
|
17
|
+
render() {
|
|
18
|
+
return html ` <book-view .book=${this.book} .value=${this.output} @change=${this.onChange}></book-view> `;
|
|
19
|
+
}
|
|
20
|
+
async onChange() {
|
|
21
|
+
// this.output = this.bookView.value
|
|
22
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
23
|
+
detail: this.output
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
updated(changes) {
|
|
27
|
+
if (changes.has('input')) {
|
|
28
|
+
this.fetchBook();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async fetchBook() {
|
|
32
|
+
const id = this.input.bookId;
|
|
33
|
+
if (id) {
|
|
34
|
+
const response = await client.query({
|
|
35
|
+
query: gql `
|
|
36
|
+
query ($id: String!) {
|
|
37
|
+
book(id: $id) {
|
|
38
|
+
id
|
|
39
|
+
name
|
|
40
|
+
description
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
variables: {
|
|
45
|
+
id
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.book = response.data.book;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
ActivityBookView.styles = [
|
|
53
|
+
ScrollbarStyles,
|
|
54
|
+
css `
|
|
55
|
+
:host {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
|
|
59
|
+
background-color: #fff;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
book-view {
|
|
63
|
+
flex: 1;
|
|
64
|
+
padding: 10px;
|
|
65
|
+
overflow: auto;
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
];
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Object }),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], ActivityBookView.prototype, "input", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: Object }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], ActivityBookView.prototype, "output", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
state(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], ActivityBookView.prototype, "book", void 0);
|
|
81
|
+
ActivityBookView = __decorate([
|
|
82
|
+
customElement('activity-book-view')
|
|
83
|
+
], ActivityBookView);
|
|
84
|
+
export { ActivityBookView };
|
|
85
|
+
//# sourceMappingURL=activity-book-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-book-view.js","sourceRoot":"","sources":["../../client/activities/activity-book-view.ts"],"names":[],"mappings":"AAAA;;;;EAIE;;AAEF,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,wDAAwD;AAGjD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAwBjE,0CAA0C;IAE1C,MAAM;QACJ,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,gBAAgB,CAAA;IAC1G,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,oCAAoC;QAEpC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO,CAAC,OAAO;QACb,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,CAAC,SAAS,EAAE,CAAA;SACjB;IACH,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QAE5B,IAAI,EAAE,EAAE;YACN,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;SAQT;gBACD,SAAS,EAAE;oBACT,EAAE;iBACH;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAA;SAC/B;IACH,CAAC;;AAlEM,uBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;KAaF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAY;AACvC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAa;AAExC;IAAC,KAAK,EAAE;;8CAAW;AAtBR,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAoE5B;SApEY,gBAAgB","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity view can be registered when loading a module.\n--\nimport './activities/book-view.js' // refered by the activity template (activity-data-collect) on server\n*/\n\nimport '../components/book-view.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { BookView } from '../components/book-view.js'\n\n@customElement('activity-book-view')\nexport class ActivityBookView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n book-view {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() book?: any //Book\n\n // @query('book-view') bookView!: BookView\n\n render() {\n return html` <book-view .book=${this.book} .value=${this.output} @change=${this.onChange}></book-view> `\n }\n\n async onChange() {\n // this.output = this.bookView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchBook()\n }\n }\n\n async fetchBook() {\n const id = this.input.bookId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n book(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.book = response.data.book\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../components/expense-edit.js';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const ActivityExpenseView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
4
|
+
export declare class ActivityExpenseView extends ActivityExpenseView_base {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
input?: any;
|
|
7
|
+
output?: any;
|
|
8
|
+
expense?: any;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
onChange(): Promise<void>;
|
|
11
|
+
updated(changes: any): void;
|
|
12
|
+
fetchExpense(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|