@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- ## [Unreleased] -->
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 회계 모듈
|
|
2
|
+
|
|
3
|
+
회계 시스템은 회사가 경영 활동을 추적하고 재무 정보를 기록, 분석, 보고하는 데 필요한 프로세스와 도구의 집합입니다. 회계 시스템은 다음과 같이 구성됩니다.
|
|
4
|
+
|
|
5
|
+
## 재무 회계
|
|
6
|
+
|
|
7
|
+
재무 회계는 회사의 재무 상태와 수익성을 추적하는 데 사용됩니다. 이를 위해 회사는 자산, 부채, 자본과 같은 재무 상태표를 작성하며, 이익과 손실계산서를 작성하여 회사의 수익성을 파악합니다.
|
|
8
|
+
|
|
9
|
+
## 관리 회계
|
|
10
|
+
|
|
11
|
+
관리 회계는 회사의 내부 운영을 추적하고 분석하는 데 사용됩니다. 이를 위해 회사는 예산 및 비용 대비 분석, 생산성 분석 등의 보고서를 작성합니다.
|
|
12
|
+
|
|
13
|
+
## 세무 회계
|
|
14
|
+
|
|
15
|
+
세무 회계는 세무 관련 규정 및 법률을 준수하도록 회사를 지원합니다. 이를 위해 회사는 세금 신고 및 세금 부과에 필요한 보고서를 작성합니다.
|
|
16
|
+
|
|
17
|
+
## 자산 관리
|
|
18
|
+
|
|
19
|
+
자산 관리는 회사의 자산을 추적하고 관리하는 데 사용됩니다. 이를 위해 회사는 재고 및 고정 자산 등의 자산 추적 보고서를 작성합니다.
|
|
20
|
+
|
|
21
|
+
## 결제 처리
|
|
22
|
+
|
|
23
|
+
결제 처리는 고객이 지불한 금액과 회사가 지출한 금액을 추적하는 데 사용됩니다. 이를 위해 회사는 송장 및 지출 내역 등의 결제 처리 보고서를 작성합니다.
|
|
24
|
+
|
|
25
|
+
## 예산 및 예산 관리
|
|
26
|
+
|
|
27
|
+
예산 및 예산 관리는 회사의 재정 상태와 예산을 관리하는 데 사용됩니다. 이를 위해 회사는 예산 보고서 및 예산 대비 실적 분석 보고서를 작성합니다.
|
|
28
|
+
|
|
29
|
+
## 재무 분석
|
|
30
|
+
|
|
31
|
+
재무 분석은 회사의 재무 상태를 분석하고 개선 방안을 제시하는 데 사용됩니다. 이를 위해 회사는 재무 비율 및 통계 보고서를 작성합니다.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
|
|
7
|
+
import '../components/book-edit.js'
|
|
8
|
+
|
|
9
|
+
import gql from 'graphql-tag'
|
|
10
|
+
import { css, html, LitElement } from 'lit'
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
12
|
+
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
14
|
+
import { i18next, localize } from '@operato/i18n'
|
|
15
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
16
|
+
|
|
17
|
+
// import { BookView } from '../components/book-edit.js'
|
|
18
|
+
|
|
19
|
+
@customElement('activity-book-edit')
|
|
20
|
+
export class ActivityBookView extends localize(i18next)(LitElement) {
|
|
21
|
+
static styles = [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
book-edit {
|
|
32
|
+
flex: 1;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
@property({ type: Object }) input?: any
|
|
40
|
+
@property({ type: Object }) output?: any
|
|
41
|
+
|
|
42
|
+
@state() book?: any //Book
|
|
43
|
+
|
|
44
|
+
// @query('book-edit') bookView!: BookView
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
return html` <book-edit .book=${this.book} .value=${this.output} @change=${this.onChange}></book-edit> `
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async onChange() {
|
|
51
|
+
// this.output = this.bookView.value
|
|
52
|
+
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent('change', {
|
|
55
|
+
detail: this.output
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updated(changes) {
|
|
61
|
+
if (changes.has('input')) {
|
|
62
|
+
this.fetchBook()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async fetchBook() {
|
|
67
|
+
const id = this.input.bookId
|
|
68
|
+
|
|
69
|
+
if (id) {
|
|
70
|
+
const response = await client.query({
|
|
71
|
+
query: gql`
|
|
72
|
+
query ($id: String!) {
|
|
73
|
+
book(id: $id) {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
variables: {
|
|
81
|
+
id
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
this.book = response.data.book
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
|
|
7
|
+
import '../components/book-view.js'
|
|
8
|
+
|
|
9
|
+
import gql from 'graphql-tag'
|
|
10
|
+
import { css, html, LitElement } from 'lit'
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
12
|
+
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
14
|
+
import { i18next, localize } from '@operato/i18n'
|
|
15
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
16
|
+
|
|
17
|
+
// import { BookView } from '../components/book-view.js'
|
|
18
|
+
|
|
19
|
+
@customElement('activity-book-view')
|
|
20
|
+
export class ActivityBookView extends localize(i18next)(LitElement) {
|
|
21
|
+
static styles = [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
book-view {
|
|
32
|
+
flex: 1;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
@property({ type: Object }) input?: any
|
|
40
|
+
@property({ type: Object }) output?: any
|
|
41
|
+
|
|
42
|
+
@state() book?: any //Book
|
|
43
|
+
|
|
44
|
+
// @query('book-view') bookView!: BookView
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
return html` <book-view .book=${this.book} .value=${this.output} @change=${this.onChange}></book-view> `
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async onChange() {
|
|
51
|
+
// this.output = this.bookView.value
|
|
52
|
+
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent('change', {
|
|
55
|
+
detail: this.output
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updated(changes) {
|
|
61
|
+
if (changes.has('input')) {
|
|
62
|
+
this.fetchBook()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async fetchBook() {
|
|
67
|
+
const id = this.input.bookId
|
|
68
|
+
|
|
69
|
+
if (id) {
|
|
70
|
+
const response = await client.query({
|
|
71
|
+
query: gql`
|
|
72
|
+
query ($id: String!) {
|
|
73
|
+
book(id: $id) {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
variables: {
|
|
81
|
+
id
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
this.book = response.data.book
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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/expense-edit.js' // refered by the activity template (activity-expense) on server
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import '../components/expense-edit.js'
|
|
8
|
+
|
|
9
|
+
import gql from 'graphql-tag'
|
|
10
|
+
import { css, html, LitElement } from 'lit'
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
12
|
+
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
14
|
+
import { i18next, localize } from '@operato/i18n'
|
|
15
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
16
|
+
|
|
17
|
+
// import { ExpenseView } from '../components/expense-edit.js'
|
|
18
|
+
|
|
19
|
+
@customElement('activity-expense-edit')
|
|
20
|
+
export class ActivityExpenseView extends localize(i18next)(LitElement) {
|
|
21
|
+
static styles = [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
expense-edit {
|
|
32
|
+
flex: 1;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
@property({ type: Object }) input?: any
|
|
40
|
+
@property({ type: Object }) output?: any
|
|
41
|
+
|
|
42
|
+
@state() expense?: any //Expense
|
|
43
|
+
|
|
44
|
+
// @query('expense-edit') expenseView!: ExpenseView
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
return html` <expense-edit .expense=${this.expense} .value=${this.output} @change=${this.onChange}></expense-edit> `
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async onChange() {
|
|
51
|
+
// this.output = this.expenseView.value
|
|
52
|
+
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent('change', {
|
|
55
|
+
detail: this.output
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updated(changes) {
|
|
61
|
+
if (changes.has('input')) {
|
|
62
|
+
this.fetchExpense()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async fetchExpense() {
|
|
67
|
+
const id = this.input.expenseId
|
|
68
|
+
|
|
69
|
+
if (id) {
|
|
70
|
+
const response = await client.query({
|
|
71
|
+
query: gql`
|
|
72
|
+
query ($id: String!) {
|
|
73
|
+
expense(id: $id) {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
variables: {
|
|
81
|
+
id
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
this.expense = response.data.expense
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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/expense-view.js' // refered by the activity template (activity-data-collect) on server
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import '../components/expense-view.js'
|
|
8
|
+
|
|
9
|
+
import gql from 'graphql-tag'
|
|
10
|
+
import { css, html, LitElement } from 'lit'
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
12
|
+
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
14
|
+
import { i18next, localize } from '@operato/i18n'
|
|
15
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
16
|
+
|
|
17
|
+
// import { ExpenseView } from '../components/expense-view.js'
|
|
18
|
+
|
|
19
|
+
@customElement('activity-expense-view')
|
|
20
|
+
export class ActivityExpenseView extends localize(i18next)(LitElement) {
|
|
21
|
+
static styles = [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
expense-view {
|
|
32
|
+
flex: 1;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
@property({ type: Object }) input?: any
|
|
40
|
+
@property({ type: Object }) output?: any
|
|
41
|
+
|
|
42
|
+
@state() expense?: any //Expense
|
|
43
|
+
|
|
44
|
+
// @query('expense-view') expenseView!: ExpenseView
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
return html` <expense-view .expense=${this.expense} .value=${this.output} @change=${this.onChange}></expense-view> `
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async onChange() {
|
|
51
|
+
// this.output = this.expenseView.value
|
|
52
|
+
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent('change', {
|
|
55
|
+
detail: this.output
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updated(changes) {
|
|
61
|
+
if (changes.has('input')) {
|
|
62
|
+
this.fetchExpense()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async fetchExpense() {
|
|
67
|
+
const id = this.input.expenseId
|
|
68
|
+
|
|
69
|
+
if (id) {
|
|
70
|
+
const response = await client.query({
|
|
71
|
+
query: gql`
|
|
72
|
+
query ($id: String!) {
|
|
73
|
+
expense(id: $id) {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
variables: {
|
|
81
|
+
id
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
this.expense = response.data.expense
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function bootstrap() {}
|
package/client/index.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { property } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { client } from '@operato/graphql'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { isMobileDevice } from '@operato/utils'
|
|
10
|
+
|
|
11
|
+
export class AccountImporter extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ox-grist {
|
|
22
|
+
flex: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.button-container {
|
|
26
|
+
display: flex;
|
|
27
|
+
margin-left: auto;
|
|
28
|
+
padding: var(--padding-default);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
mwc-button {
|
|
32
|
+
margin-left: var(--margin-default);
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
@property({ type: Array }) accounts: any[] = []
|
|
38
|
+
@property({ type: Object }) columns = {
|
|
39
|
+
list: { fields: ['name', 'description'] },
|
|
40
|
+
pagination: { infinite: true },
|
|
41
|
+
columns: [
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
name: 'name',
|
|
45
|
+
header: i18next.t('field.name'),
|
|
46
|
+
width: 150
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'string',
|
|
50
|
+
name: 'description',
|
|
51
|
+
header: i18next.t('field.description'),
|
|
52
|
+
width: 200
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
name: 'active',
|
|
57
|
+
header: i18next.t('field.active'),
|
|
58
|
+
width: 60
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
return html`
|
|
66
|
+
<ox-grist
|
|
67
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
68
|
+
.config=${this.columns}
|
|
69
|
+
.data=${
|
|
70
|
+
{
|
|
71
|
+
records: this.accounts
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
></ox-grist>
|
|
75
|
+
|
|
76
|
+
<div class="button-container">
|
|
77
|
+
<mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
|
|
78
|
+
</div>
|
|
79
|
+
`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async save() {
|
|
83
|
+
const response = await client.mutate({
|
|
84
|
+
mutation: gql`
|
|
85
|
+
mutation importAccounts($accounts: [AccountPatch!]!) {
|
|
86
|
+
importAccounts(accounts: $accounts)
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
variables: { accounts: this.accounts }
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
if (response.errors?.length) return
|
|
93
|
+
|
|
94
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|