@things-factory/accounting 8.0.0 → 9.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
- package/dist-client/pages/bank/bank-importer.d.ts +23 -0
- package/dist-client/pages/bank/bank-importer.js +93 -0
- package/dist-client/pages/bank/bank-importer.js.map +1 -0
- package/dist-client/pages/bank/bank-list-page.d.ts +66 -0
- package/dist-client/pages/bank/bank-list-page.js +370 -0
- package/dist-client/pages/bank/bank-list-page.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
- package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
- package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
- package/dist-server/service/bank-account/bank-account-history.js +172 -0
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
- package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
- package/dist-server/service/bank-account/bank-account-query.js +79 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
- package/dist-server/service/bank-account/bank-account-type.js +153 -0
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
- package/dist-server/service/bank-account/bank-account.d.ts +38 -0
- package/dist-server/service/bank-account/bank-account.js +164 -0
- package/dist-server/service/bank-account/bank-account.js.map +1 -0
- package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
- package/dist-server/service/bank-account/event-subscriber.js +21 -0
- package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
- package/dist-server/service/bank-account/index.d.ts +7 -0
- package/dist-server/service/bank-account/index.js +12 -0
- package/dist-server/service/bank-account/index.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
- package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
- package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
- package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
- package/dist-server/service/financial-institution/financial-institution.js +137 -0
- package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
- package/dist-server/service/financial-institution/index.d.ts +6 -0
- package/dist-server/service/financial-institution/index.js +10 -0
- package/dist-server/service/financial-institution/index.js.map +1 -0
- package/dist-server/service/index.d.ts +3 -2
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -2
- package/dist-server/service/payment/payment-history.d.ts +8 -1
- package/dist-server/service/payment/payment-history.js +41 -10
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-type.d.ts +7 -1
- package/dist-server/service/payment/payment-type.js +24 -0
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +12 -0
- package/dist-server/service/payment/payment.js +36 -1
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/bank-account.md +160 -0
- package/helps/accounting/bank.md +160 -0
- package/helps/accounting/financial-institution.md +160 -0
- package/package.json +7 -7
- package/client/activities/activity-book-edit.ts +0 -88
- package/client/activities/activity-book-view.ts +0 -88
- package/client/activities/activity-expense-edit.ts +0 -88
- package/client/activities/activity-expense-view.ts +0 -88
- package/client/bootstrap.ts +0 -10
- package/client/components/accounting-category-selector.ts +0 -136
- package/client/components/accounting-category-view.ts +0 -75
- package/client/grist-editors/grist-editor-accounting-category-object.ts +0 -83
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +0 -13
- package/client/index.ts +0 -0
- package/client/pages/account/account-importer.ts +0 -97
- package/client/pages/account/account-list-page.ts +0 -364
- package/client/pages/accounting-category/accounting-category-importer.ts +0 -97
- package/client/pages/accounting-category/accounting-category-list-page.ts +0 -368
- package/client/pages/accounting-category/accounting-category-tree-page.ts +0 -338
- package/client/pages/accounting-document/accounting-document-importer.ts +0 -90
- package/client/pages/accounting-document/accounting-document-list-page.ts +0 -398
- package/client/pages/financial-statement/financial-statement-importer.ts +0 -97
- package/client/pages/financial-statement/financial-statement-list-page.ts +0 -338
- package/client/pages/fiscal-month/fiscal-month-importer.ts +0 -90
- package/client/pages/fiscal-month/fiscal-month-list-page.ts +0 -398
- package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +0 -90
- package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +0 -398
- package/client/pages/fiscal-year/fiscal-year-importer.ts +0 -90
- package/client/pages/fiscal-year/fiscal-year-list-page.ts +0 -398
- package/client/pages/income-statement/income-statement-importer.ts +0 -97
- package/client/pages/income-statement/income-statement-list-page.ts +0 -338
- package/client/pages/payment/payment-importer.ts +0 -90
- package/client/pages/payment/payment-list-page.ts +0 -398
- package/client/pages/transaction/transaction-importer.ts +0 -97
- package/client/pages/transaction/transaction-list-page.ts +0 -338
- package/client/route.ts +0 -35
- package/client/tsconfig.json +0 -13
- package/client/types/accounting-category.ts +0 -23
- package/client/types/index.ts +0 -1
- package/server/activities/activity-book.ts +0 -172
- package/server/activities/activity-expense.ts +0 -149
- package/server/activities/index.ts +0 -18
- package/server/controllers/index.ts +0 -1
- package/server/controllers/summary-statements.ts +0 -166
- package/server/index.ts +0 -6
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +0 -106
- package/server/migrations/1725201467183-seed-accounts.ts +0 -339
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -26
- package/server/service/account/account-history.ts +0 -117
- package/server/service/account/account-mutation.ts +0 -140
- package/server/service/account/account-query.ts +0 -51
- package/server/service/account/account-type.ts +0 -44
- package/server/service/account/account.ts +0 -97
- package/server/service/account/event-subscriber.ts +0 -17
- package/server/service/account/index.ts +0 -9
- package/server/service/accounting-category/accounting-category-history.ts +0 -129
- package/server/service/accounting-category/accounting-category-mutation.ts +0 -148
- package/server/service/accounting-category/accounting-category-query.ts +0 -74
- package/server/service/accounting-category/accounting-category-type.ts +0 -48
- package/server/service/accounting-category/accounting-category.ts +0 -100
- package/server/service/accounting-category/event-subscriber.ts +0 -20
- package/server/service/accounting-category/index.ts +0 -9
- package/server/service/accounting-document/accounting-document-history.ts +0 -123
- package/server/service/accounting-document/accounting-document-mutation.ts +0 -137
- package/server/service/accounting-document/accounting-document-query.ts +0 -48
- package/server/service/accounting-document/accounting-document-type.ts +0 -52
- package/server/service/accounting-document/accounting-document.ts +0 -93
- package/server/service/accounting-document/event-subscriber.ts +0 -17
- package/server/service/accounting-document/index.ts +0 -9
- package/server/service/common-type.ts +0 -12
- package/server/service/financial-statement/event-subscriber.ts +0 -17
- package/server/service/financial-statement/financial-statement-history.ts +0 -129
- package/server/service/financial-statement/financial-statement-line-item.ts +0 -82
- package/server/service/financial-statement/financial-statement-mutation.ts +0 -148
- package/server/service/financial-statement/financial-statement-query.ts +0 -53
- package/server/service/financial-statement/financial-statement-type.ts +0 -51
- package/server/service/financial-statement/financial-statement.ts +0 -116
- package/server/service/financial-statement/index.ts +0 -10
- package/server/service/fiscal-month/fiscal-month-mutation.ts +0 -145
- package/server/service/fiscal-month/fiscal-month-query.ts +0 -58
- package/server/service/fiscal-month/fiscal-month-type.ts +0 -66
- package/server/service/fiscal-month/fiscal-month.ts +0 -84
- package/server/service/fiscal-month/index.ts +0 -7
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +0 -148
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter-type.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter.ts +0 -80
- package/server/service/fiscal-quarter/index.ts +0 -7
- package/server/service/fiscal-year/fiscal-year-mutation.ts +0 -145
- package/server/service/fiscal-year/fiscal-year-query.ts +0 -53
- package/server/service/fiscal-year/fiscal-year-type.ts +0 -54
- package/server/service/fiscal-year/fiscal-year.ts +0 -76
- package/server/service/fiscal-year/index.ts +0 -7
- package/server/service/income-statement/event-subscriber.ts +0 -17
- package/server/service/income-statement/income-statement-history.ts +0 -133
- package/server/service/income-statement/income-statement-line-item.ts +0 -84
- package/server/service/income-statement/income-statement-mutation.ts +0 -147
- package/server/service/income-statement/income-statement-query.ts +0 -50
- package/server/service/income-statement/income-statement-type.ts +0 -51
- package/server/service/income-statement/income-statement.ts +0 -120
- package/server/service/income-statement/index.ts +0 -10
- package/server/service/index.ts +0 -108
- package/server/service/payment/event-subscriber.ts +0 -17
- package/server/service/payment/index.ts +0 -9
- package/server/service/payment/payment-history.ts +0 -132
- package/server/service/payment/payment-mutation.ts +0 -139
- package/server/service/payment/payment-query.ts +0 -50
- package/server/service/payment/payment-type.ts +0 -64
- package/server/service/payment/payment.ts +0 -123
- package/server/service/transaction/event-subscriber.ts +0 -17
- package/server/service/transaction/index.ts +0 -9
- package/server/service/transaction/transaction-history.ts +0 -161
- package/server/service/transaction/transaction-mutation.ts +0 -146
- package/server/service/transaction/transaction-query.ts +0 -50
- package/server/service/transaction/transaction-type.ts +0 -48
- package/server/service/transaction/transaction.ts +0 -230
- package/server/tsconfig.json +0 -10
@@ -1,338 +0,0 @@
|
|
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 { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
|
9
|
-
import { client } from '@operato/graphql'
|
10
|
-
import { i18next, localize } from '@operato/i18n'
|
11
|
-
import { notify, openPopup } from '@operato/layout'
|
12
|
-
import { OxPopup } from '@operato/popup'
|
13
|
-
import { isMobileDevice } from '@operato/utils'
|
14
|
-
|
15
|
-
import { connect } from 'pwa-helpers/connect-mixin'
|
16
|
-
import gql from 'graphql-tag'
|
17
|
-
|
18
|
-
import { TransactionImporter } from './transaction-importer'
|
19
|
-
|
20
|
-
@customElement('transaction-list-page')
|
21
|
-
export class TransactionListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
22
|
-
static styles = [
|
23
|
-
ScrollbarStyles,
|
24
|
-
CommonGristStyles,
|
25
|
-
css`
|
26
|
-
:host {
|
27
|
-
display: flex;
|
28
|
-
|
29
|
-
width: 100%;
|
30
|
-
|
31
|
-
--grid-record-emphasized-background-color: #8b0000;
|
32
|
-
--grid-record-emphasized-color: #ff6b6b;
|
33
|
-
}
|
34
|
-
|
35
|
-
ox-grist {
|
36
|
-
overflow-y: auto;
|
37
|
-
flex: 1;
|
38
|
-
}
|
39
|
-
`
|
40
|
-
]
|
41
|
-
|
42
|
-
static get scopedElements() {
|
43
|
-
return {
|
44
|
-
'transaction-importer': TransactionImporter
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
@property({ type: Object }) gristConfig: any
|
49
|
-
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
50
|
-
|
51
|
-
@query('ox-grist') private grist!: DataGrist
|
52
|
-
@query('#sorter-control') private sortersControl!: OxPopup
|
53
|
-
|
54
|
-
get context() {
|
55
|
-
return {
|
56
|
-
title: i18next.t('title.transaction list'),
|
57
|
-
search: {
|
58
|
-
handler: (search: string) => {
|
59
|
-
this.grist.searchText = search
|
60
|
-
},
|
61
|
-
value: this.grist?.searchText || '',
|
62
|
-
autofocus: true
|
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 .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
97
|
-
<div slot="headroom">
|
98
|
-
<div id="filters">
|
99
|
-
<ox-filters-form autofocus></ox-filters-form>
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<div id="sorters">
|
103
|
-
Sort
|
104
|
-
<mwc-icon
|
105
|
-
@click=${e => {
|
106
|
-
const target = e.currentTarget
|
107
|
-
this.sortersControl.open({
|
108
|
-
right: 0,
|
109
|
-
top: target.offsetTop + target.offsetHeight
|
110
|
-
})
|
111
|
-
}}
|
112
|
-
>expand_more</mwc-icon
|
113
|
-
>
|
114
|
-
<ox-popup id="sorter-control">
|
115
|
-
<ox-sorters-control> </ox-sorters-control>
|
116
|
-
</ox-popup>
|
117
|
-
</div>
|
118
|
-
|
119
|
-
<div id="modes">
|
120
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
121
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
122
|
-
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
</ox-grist>
|
126
|
-
`
|
127
|
-
}
|
128
|
-
|
129
|
-
async pageInitialized(lifecycle: any) {
|
130
|
-
this.gristConfig = {
|
131
|
-
list: {
|
132
|
-
fields: ['name', 'description'],
|
133
|
-
details: ['active', 'updatedAt']
|
134
|
-
},
|
135
|
-
columns: [
|
136
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
137
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
138
|
-
{
|
139
|
-
type: 'string',
|
140
|
-
name: 'name',
|
141
|
-
header: i18next.t('field.name'),
|
142
|
-
record: {
|
143
|
-
editable: true
|
144
|
-
},
|
145
|
-
filter: 'search',
|
146
|
-
sortable: true,
|
147
|
-
width: 150
|
148
|
-
},
|
149
|
-
{
|
150
|
-
type: 'string',
|
151
|
-
name: 'description',
|
152
|
-
header: i18next.t('field.description'),
|
153
|
-
record: {
|
154
|
-
editable: true
|
155
|
-
},
|
156
|
-
filter: 'search',
|
157
|
-
width: 200
|
158
|
-
},
|
159
|
-
{
|
160
|
-
type: 'checkbox',
|
161
|
-
name: 'active',
|
162
|
-
label: true,
|
163
|
-
header: i18next.t('field.active'),
|
164
|
-
record: {
|
165
|
-
editable: true
|
166
|
-
},
|
167
|
-
filter: true,
|
168
|
-
sortable: true,
|
169
|
-
width: 60
|
170
|
-
},
|
171
|
-
{
|
172
|
-
type: 'resource-object',
|
173
|
-
name: 'updater',
|
174
|
-
header: i18next.t('field.updater'),
|
175
|
-
record: {
|
176
|
-
editable: false
|
177
|
-
},
|
178
|
-
sortable: true,
|
179
|
-
width: 120
|
180
|
-
},
|
181
|
-
{
|
182
|
-
type: 'datetime',
|
183
|
-
name: 'updatedAt',
|
184
|
-
header: i18next.t('field.updated_at'),
|
185
|
-
record: {
|
186
|
-
editable: false
|
187
|
-
},
|
188
|
-
sortable: true,
|
189
|
-
width: 180
|
190
|
-
}
|
191
|
-
],
|
192
|
-
rows: {
|
193
|
-
selectable: {
|
194
|
-
multiple: true
|
195
|
-
}
|
196
|
-
},
|
197
|
-
sorters: [
|
198
|
-
{
|
199
|
-
name: 'name'
|
200
|
-
}
|
201
|
-
]
|
202
|
-
}
|
203
|
-
}
|
204
|
-
|
205
|
-
async pageUpdated(changes: any, lifecycle: any) {
|
206
|
-
if (this.active) {
|
207
|
-
// do something here when this page just became as active
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
212
|
-
const response = await client.query({
|
213
|
-
query: gql`
|
214
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
215
|
-
responses: transactions(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
216
|
-
items {
|
217
|
-
id
|
218
|
-
name
|
219
|
-
description
|
220
|
-
active
|
221
|
-
updater {
|
222
|
-
id
|
223
|
-
name
|
224
|
-
}
|
225
|
-
updatedAt
|
226
|
-
}
|
227
|
-
total
|
228
|
-
}
|
229
|
-
}
|
230
|
-
`,
|
231
|
-
variables: {
|
232
|
-
filters,
|
233
|
-
pagination: { page, limit },
|
234
|
-
sortings
|
235
|
-
}
|
236
|
-
})
|
237
|
-
|
238
|
-
return {
|
239
|
-
total: response.data.responses.total || 0,
|
240
|
-
records: response.data.responses.items || []
|
241
|
-
}
|
242
|
-
}
|
243
|
-
|
244
|
-
async _deleteTransaction() {
|
245
|
-
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
246
|
-
const ids = this.grist.selected.map(record => record.id)
|
247
|
-
if (ids && ids.length > 0) {
|
248
|
-
const response = await client.mutate({
|
249
|
-
mutation: gql`
|
250
|
-
mutation ($ids: [String!]!) {
|
251
|
-
deleteTransactions(ids: $ids)
|
252
|
-
}
|
253
|
-
`,
|
254
|
-
variables: {
|
255
|
-
ids
|
256
|
-
}
|
257
|
-
})
|
258
|
-
|
259
|
-
if (!response.errors) {
|
260
|
-
this.grist.fetch()
|
261
|
-
notify({
|
262
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
263
|
-
})
|
264
|
-
}
|
265
|
-
}
|
266
|
-
}
|
267
|
-
}
|
268
|
-
|
269
|
-
async _updateTransaction() {
|
270
|
-
let patches = this.grist.dirtyRecords
|
271
|
-
if (patches && patches.length) {
|
272
|
-
patches = patches.map(patch => {
|
273
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
274
|
-
const dirtyFields = patch.__dirtyfields__
|
275
|
-
for (let key in dirtyFields) {
|
276
|
-
patchField[key] = dirtyFields[key].after
|
277
|
-
}
|
278
|
-
patchField.cuFlag = patch.__dirty__
|
279
|
-
|
280
|
-
return patchField
|
281
|
-
})
|
282
|
-
|
283
|
-
const response = await client.mutate({
|
284
|
-
mutation: gql`
|
285
|
-
mutation ($patches: [TransactionPatch!]!) {
|
286
|
-
updateMultipleTransaction(patches: $patches) {
|
287
|
-
name
|
288
|
-
}
|
289
|
-
}
|
290
|
-
`,
|
291
|
-
variables: {
|
292
|
-
patches
|
293
|
-
}
|
294
|
-
})
|
295
|
-
|
296
|
-
if (!response.errors) {
|
297
|
-
this.grist.fetch()
|
298
|
-
}
|
299
|
-
}
|
300
|
-
}
|
301
|
-
|
302
|
-
async exportHandler() {
|
303
|
-
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
304
|
-
const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
|
305
|
-
|
306
|
-
return exportTargets.map(transaction => {
|
307
|
-
let tempObj = {}
|
308
|
-
for (const field of targetFieldSet) {
|
309
|
-
tempObj[field] = transaction[field]
|
310
|
-
}
|
311
|
-
|
312
|
-
return tempObj
|
313
|
-
})
|
314
|
-
}
|
315
|
-
|
316
|
-
async importHandler(records) {
|
317
|
-
const popup = openPopup(
|
318
|
-
html`
|
319
|
-
<transaction-importer
|
320
|
-
.transactions=${records}
|
321
|
-
@imported=${() => {
|
322
|
-
history.back()
|
323
|
-
this.grist.fetch()
|
324
|
-
}}
|
325
|
-
></transaction-importer>
|
326
|
-
`,
|
327
|
-
{
|
328
|
-
backdrop: true,
|
329
|
-
size: 'large',
|
330
|
-
title: i18next.t('title.import transaction')
|
331
|
-
}
|
332
|
-
)
|
333
|
-
|
334
|
-
popup.onclosed = () => {
|
335
|
-
this.grist.fetch()
|
336
|
-
}
|
337
|
-
}
|
338
|
-
}
|
package/client/route.ts
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
export default function route(page: string) {
|
2
|
-
switch (page) {
|
3
|
-
case 'account-list':
|
4
|
-
import('./pages/account/account-list-page')
|
5
|
-
return page
|
6
|
-
|
7
|
-
case 'transaction-list':
|
8
|
-
import('./pages/transaction/transaction-list-page')
|
9
|
-
return page
|
10
|
-
|
11
|
-
case 'accounting-category-list':
|
12
|
-
import('./pages/accounting-category/accounting-category-list-page')
|
13
|
-
return page
|
14
|
-
|
15
|
-
case 'financial-statement-list':
|
16
|
-
import('./pages/financial-statement/financial-statement-list-page')
|
17
|
-
return page
|
18
|
-
|
19
|
-
case 'income-statement-list':
|
20
|
-
import('./pages/income-statement/income-statement-list-page')
|
21
|
-
return page
|
22
|
-
|
23
|
-
case 'fiscal-month-list':
|
24
|
-
import('./pages/fiscal-month/fiscal-month-list-page')
|
25
|
-
return page
|
26
|
-
|
27
|
-
case 'fiscal-quarter-list':
|
28
|
-
import('./pages/fiscal-quarter/fiscal-quarter-list-page')
|
29
|
-
return page
|
30
|
-
|
31
|
-
case 'fiscal-year-list':
|
32
|
-
import('./pages/fiscal-year/fiscal-year-list-page')
|
33
|
-
return page
|
34
|
-
}
|
35
|
-
}
|
package/client/tsconfig.json
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "../../tsconfig-base.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"experimentalDecorators": true,
|
5
|
-
"skipLibCheck": true,
|
6
|
-
"strict": true,
|
7
|
-
"declaration": true,
|
8
|
-
"module": "esnext",
|
9
|
-
"outDir": "../dist-client",
|
10
|
-
"baseUrl": "./"
|
11
|
-
},
|
12
|
-
"include": ["./**/*"]
|
13
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { Domain, User } from '@operato/shell'
|
2
|
-
|
3
|
-
export class AccountingCategory {
|
4
|
-
readonly id?: string
|
5
|
-
|
6
|
-
domain?: Domain
|
7
|
-
|
8
|
-
code?: string
|
9
|
-
name?: string
|
10
|
-
description?: string
|
11
|
-
|
12
|
-
parent?: AccountingCategory
|
13
|
-
children?: AccountingCategory[]
|
14
|
-
|
15
|
-
active?: boolean
|
16
|
-
|
17
|
-
createdAt?: Date
|
18
|
-
updatedAt?: Date
|
19
|
-
deletedAt?: Date
|
20
|
-
|
21
|
-
creator?: User
|
22
|
-
updater?: User
|
23
|
-
}
|
package/client/types/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './accounting-category'
|
@@ -1,172 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Activity,
|
3
|
-
ActivityInstance,
|
4
|
-
ActivityInstanceStatus,
|
5
|
-
ActivityThread,
|
6
|
-
UpdateActivityInstanceStateAddendum
|
7
|
-
} from '@things-factory/worklist'
|
8
|
-
|
9
|
-
async function callback(
|
10
|
-
activityInstance: ActivityInstance,
|
11
|
-
addendum: UpdateActivityInstanceStateAddendum,
|
12
|
-
context: ResolverContext
|
13
|
-
) {
|
14
|
-
const { domain, tx } = context.state
|
15
|
-
const { input, output, state } = activityInstance
|
16
|
-
const { causedBy } = addendum || {}
|
17
|
-
|
18
|
-
if (state == ActivityInstanceStatus.Ended) {
|
19
|
-
const activity = (await tx.getRepository(Activity).findOneBy({
|
20
|
-
domain: { id: domain.id },
|
21
|
-
name: 'Book'
|
22
|
-
})) as Activity
|
23
|
-
|
24
|
-
/*
|
25
|
-
The Book activity is designed to be performed by a single assignee (thread).
|
26
|
-
Therefore, we take a sample from the output as data.
|
27
|
-
If it were an activity performed by multiple assignees (threads),
|
28
|
-
we would process the entire output as data.
|
29
|
-
*/
|
30
|
-
const assignees = Object.keys(output)
|
31
|
-
const data = assignees.length > 0 && output[assignees[0]]
|
32
|
-
|
33
|
-
if (activity) {
|
34
|
-
/*
|
35
|
-
Custom logic goes here.
|
36
|
-
Typically, this would involve recording the accounting transaction
|
37
|
-
or updating related data in the accounting system.
|
38
|
-
For example, you might:
|
39
|
-
1. Save the transaction to the database
|
40
|
-
2. Update account balances
|
41
|
-
3. Generate necessary reports or notifications
|
42
|
-
*/
|
43
|
-
} else {
|
44
|
-
console.error('Book Activity not installed.')
|
45
|
-
}
|
46
|
-
} else if (state == ActivityInstanceStatus.Aborted) {
|
47
|
-
// Implement logic for handling aborted activities here
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
export const ActivityBook = {
|
52
|
-
name: 'Book',
|
53
|
-
description: 'An activity that records income or expenses in the accounting system',
|
54
|
-
release: '1.0.0',
|
55
|
-
provider: 'hatiolab.com',
|
56
|
-
category: 'accounting',
|
57
|
-
activityType: 'user',
|
58
|
-
priority: 1,
|
59
|
-
searchKeys: [
|
60
|
-
// sample search keys
|
61
|
-
{
|
62
|
-
name: 'category',
|
63
|
-
description: 'expense category',
|
64
|
-
inputKey: 'category',
|
65
|
-
tKey: 'category'
|
66
|
-
}
|
67
|
-
],
|
68
|
-
/*
|
69
|
-
Setting an activity as startable means it can be manually initiated and assigned.
|
70
|
-
Users with the defined issuer role can start it, or all users if no issuer is defined.
|
71
|
-
The process of starting allows for manual adjustment of assignees and approval-line,
|
72
|
-
with activity settings as the default.
|
73
|
-
*/
|
74
|
-
startable: true,
|
75
|
-
/* (Unimplemented property)
|
76
|
-
startingType can be set to 'issue' or 'post'. 'post' type allows for start, assign, and end
|
77
|
-
to be done at once by a single user. Users only see draft and post stages for this activity.
|
78
|
-
All model properties should be 'in' or 'inout' in this case, as 'out' properties won't have
|
79
|
-
a chance for input. Assignees settings are meaningless in this case.
|
80
|
-
If an approval-line is set, it will still be processed through the approval process.
|
81
|
-
For 'issue' type, 'in' or 'inout' properties of the model are filled and assigned to the assignee,
|
82
|
-
so an assignee must be set.
|
83
|
-
*/
|
84
|
-
startingType: 'post',
|
85
|
-
/* (Unimplemented property)
|
86
|
-
The multiple property can be set to 'parallel' or 'sequential'. 'parallel' processes multiple
|
87
|
-
instances (threads) in parallel, while 'sequential' processes them in sequence.
|
88
|
-
If not set, it implies single instance execution, where only one assignee is allocated even if
|
89
|
-
multiple are set. In this case, the activity instance's result data (output) is directly applied
|
90
|
-
from the single thread's output.
|
91
|
-
*/
|
92
|
-
multiple: null,
|
93
|
-
model: [
|
94
|
-
{
|
95
|
-
name: 'name',
|
96
|
-
description: 'name',
|
97
|
-
tag: 'name',
|
98
|
-
hidden: false,
|
99
|
-
mandatory: true,
|
100
|
-
inout: 'in',
|
101
|
-
type: 'select',
|
102
|
-
options: {
|
103
|
-
options: ['KRW', 'USD', 'CNY']
|
104
|
-
},
|
105
|
-
unit: null,
|
106
|
-
quantifier: [1],
|
107
|
-
spec: {}
|
108
|
-
},
|
109
|
-
{
|
110
|
-
name: 'currency',
|
111
|
-
description: 'currency',
|
112
|
-
tag: 'currency',
|
113
|
-
hidden: false,
|
114
|
-
mandatory: true,
|
115
|
-
inout: 'in',
|
116
|
-
type: 'select',
|
117
|
-
options: {
|
118
|
-
options: ['KRW', 'USD', 'CNY']
|
119
|
-
},
|
120
|
-
unit: null,
|
121
|
-
quantifier: [1],
|
122
|
-
spec: {}
|
123
|
-
},
|
124
|
-
{
|
125
|
-
name: 'amount',
|
126
|
-
description: 'amount',
|
127
|
-
tag: 'amount',
|
128
|
-
hidden: false,
|
129
|
-
mandatory: true,
|
130
|
-
inout: 'in',
|
131
|
-
type: 'number',
|
132
|
-
options: {},
|
133
|
-
unit: null,
|
134
|
-
quantifier: [1],
|
135
|
-
spec: {}
|
136
|
-
},
|
137
|
-
{
|
138
|
-
name: 'category',
|
139
|
-
description: 'accounting category',
|
140
|
-
tag: 'category',
|
141
|
-
hidden: true,
|
142
|
-
mandatory: true,
|
143
|
-
inout: 'in',
|
144
|
-
type: 'string',
|
145
|
-
options: {},
|
146
|
-
unit: null,
|
147
|
-
quantifier: [1],
|
148
|
-
spec: {}
|
149
|
-
},
|
150
|
-
{
|
151
|
-
name: 'date',
|
152
|
-
description: 'issuance date',
|
153
|
-
tag: 'date',
|
154
|
-
hidden: true,
|
155
|
-
mandatory: true,
|
156
|
-
inout: 'in',
|
157
|
-
type: 'string',
|
158
|
-
options: {},
|
159
|
-
unit: null,
|
160
|
-
quantifier: [1],
|
161
|
-
spec: {}
|
162
|
-
}
|
163
|
-
],
|
164
|
-
uiType: 'generated',
|
165
|
-
uiSource: '',
|
166
|
-
viewType: 'generated',
|
167
|
-
viewSource: '',
|
168
|
-
reportType: 'custom-element',
|
169
|
-
reportSource: 'activity-book-report',
|
170
|
-
thumbnail: '/assets/images/book-activity.jpg',
|
171
|
-
callback /* Called when there is a change in the lifecycle of a task (activity-instance). */
|
172
|
-
}
|