solid-panes 3.7.3-61993d3f → 3.7.3-d53b7f89
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/dist/RDFXMLPane.js +58 -0
- package/dist/RDFXMLPane.js.map +1 -0
- package/{lib → dist}/argument/argumentPane.js +14 -15
- package/dist/argument/argumentPane.js.map +1 -0
- package/{lib → dist}/attach/attachPane.js +83 -93
- package/dist/attach/attachPane.js.map +1 -0
- package/{lib → dist}/audio/audioPane.js +49 -50
- package/dist/audio/audioPane.js.map +1 -0
- package/{lib → dist}/classInstancePane.js +23 -24
- package/dist/classInstancePane.js.map +1 -0
- package/dist/dashboard/basicPreferences.js +147 -0
- package/dist/dashboard/basicPreferences.js.map +1 -0
- package/{lib → dist}/dashboard/dashboardPane.js +17 -21
- package/dist/dashboard/dashboardPane.js.map +1 -0
- package/dist/dashboard/homepage.js +54 -0
- package/dist/dashboard/homepage.js.map +1 -0
- package/{lib → dist}/dataContentPane.js +63 -63
- package/dist/dataContentPane.js.map +1 -0
- package/{lib → dist}/defaultPane.js +14 -15
- package/dist/defaultPane.js.map +1 -0
- package/{lib → dist}/dokieli/dokieliPane.js +49 -53
- package/dist/dokieli/dokieliPane.js.map +1 -0
- package/{src → dist}/dokieli/new.js +9 -3
- package/dist/dokieli/new.js.map +1 -0
- package/{lib → dist}/form/pane.js +44 -45
- package/dist/form/pane.js.map +1 -0
- package/dist/home/homePane.js +73 -0
- package/dist/home/homePane.js.map +1 -0
- package/dist/humanReadablePane.js +135 -0
- package/dist/humanReadablePane.js.map +1 -0
- package/dist/imagePane.js +70 -0
- package/dist/imagePane.js.map +1 -0
- package/{lib → dist}/index.js +17 -20
- package/dist/index.js.map +1 -0
- package/{lib → dist}/internal/internalPane.js +41 -41
- package/dist/internal/internalPane.js.map +1 -0
- package/{lib → dist}/mainPage/footer.js +2 -2
- package/{lib → dist}/mainPage/footer.js.map +1 -1
- package/dist/mainPage/header.js +85 -0
- package/dist/mainPage/header.js.map +1 -0
- package/{lib → dist}/mainPage/index.d.ts.map +1 -1
- package/dist/mainPage/index.js +25 -0
- package/dist/mainPage/index.js.map +1 -0
- package/{lib → dist}/microblogPane/microblogPane.js +261 -262
- package/dist/microblogPane/microblogPane.js.map +1 -0
- package/dist/n3Pane.js +56 -0
- package/dist/n3Pane.js.map +1 -0
- package/{lib → dist}/outline/context.js +4 -4
- package/{lib → dist}/outline/context.js.map +1 -1
- package/dist/outline/manager.js +1997 -0
- package/dist/outline/manager.js.map +1 -0
- package/{lib → dist}/outline/outlineIcons.js +2 -3
- package/dist/outline/outlineIcons.js.map +1 -0
- package/{lib → dist}/outline/propertyViews.js +4 -4
- package/dist/outline/propertyViews.js.map +1 -0
- package/{lib → dist}/outline/queryByExample.js +30 -31
- package/dist/outline/queryByExample.js.map +1 -0
- package/{lib → dist}/outline/userInput.js +262 -260
- package/dist/outline/userInput.js.map +1 -0
- package/dist/outline/viewAsImage.js +15 -0
- package/dist/outline/viewAsImage.js.map +1 -0
- package/dist/outline/viewAsMbox.js +22 -0
- package/dist/outline/viewAsMbox.js.map +1 -0
- package/{lib → dist}/pad/padPane.js +90 -96
- package/dist/pad/padPane.js.map +1 -0
- package/{lib → dist}/playlist/playlistPane.js +36 -37
- package/dist/playlist/playlistPane.js.map +1 -0
- package/{lib → dist}/registerPanes.js +29 -29
- package/dist/registerPanes.js.map +1 -0
- package/{lib → dist}/schedule/schedulePane.js +171 -178
- package/dist/schedule/schedulePane.js.map +1 -0
- package/{lib → dist}/sharing/sharingPane.js +12 -12
- package/dist/sharing/sharingPane.js.map +1 -0
- package/dist/slideshow/slideshowPane.js +80 -0
- package/dist/slideshow/slideshowPane.js.map +1 -0
- package/{lib → dist}/socialPane.js +141 -142
- package/dist/socialPane.js.map +1 -0
- package/dist/tabbed/tabbedPane.js +58 -0
- package/dist/tabbed/tabbedPane.js.map +1 -0
- package/{lib → dist}/tableViewPane.js +8 -9
- package/dist/tableViewPane.js.map +1 -0
- package/{lib → dist}/transaction/pane.js +117 -118
- package/dist/transaction/pane.js.map +1 -0
- package/{lib → dist}/transaction/period.js +82 -83
- package/dist/transaction/period.js.map +1 -0
- package/{lib → dist}/trip/tripPane.js +47 -48
- package/dist/trip/tripPane.js.map +1 -0
- package/dist/trustedApplications/trustedApplications.dom.js +146 -0
- package/dist/trustedApplications/trustedApplications.dom.js.map +1 -0
- package/dist/trustedApplications/trustedApplications.utils.js +24 -0
- package/dist/trustedApplications/trustedApplications.utils.js.map +1 -0
- package/dist/trustedApplications/trustedApplications.view.js +56 -0
- package/dist/trustedApplications/trustedApplications.view.js.map +1 -0
- package/dist/types.js.map +1 -0
- package/{lib → dist}/ui/pane.js +30 -31
- package/dist/ui/pane.js.map +1 -0
- package/dist/versionInfo.js +37 -0
- package/dist/versionInfo.js.map +1 -0
- package/dist/video/videoPane.js +43 -0
- package/dist/video/videoPane.js.map +1 -0
- package/package.json +27 -14
- package/Documentation/VisualLanguage.html +0 -538
- package/Documentation/conventions.md +0 -333
- package/coverage/clover.xml +0 -152
- package/coverage/coverage-final.json +0 -6
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/outline/index.html +0 -161
- package/coverage/lcov-report/outline/outlineIcons.js.html +0 -565
- package/coverage/lcov-report/outline/propertyViews.ts.html +0 -196
- package/coverage/lcov-report/outline/viewAsImage.ts.html +0 -121
- package/coverage/lcov-report/outline/viewAsMbox.ts.html +0 -127
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/trustedApplications/index.html +0 -116
- package/coverage/lcov-report/trustedApplications/trustedApplications.utils.ts.html +0 -238
- package/coverage/lcov.info +0 -204
- package/dev/index.html +0 -28
- package/dev/loader.ts +0 -91
- package/dev/pane/index.ts +0 -10
- package/doc/images/panes-for-classes.epgz +0 -0
- package/doc/images/panes-for-classes.svg +0 -609
- package/eslint.config.mjs +0 -34
- package/jest.config.js +0 -27
- package/jest.setup.ts +0 -4
- package/lib/RDFXMLPane.js +0 -59
- package/lib/RDFXMLPane.js.map +0 -1
- package/lib/argument/argumentPane.js.map +0 -1
- package/lib/attach/attachPane.js.map +0 -1
- package/lib/audio/audioPane.js.map +0 -1
- package/lib/classInstancePane.js.map +0 -1
- package/lib/dashboard/basicPreferences.js +0 -229
- package/lib/dashboard/basicPreferences.js.map +0 -1
- package/lib/dashboard/dashboardPane.js.map +0 -1
- package/lib/dashboard/homepage.js +0 -86
- package/lib/dashboard/homepage.js.map +0 -1
- package/lib/dataContentPane.js.map +0 -1
- package/lib/defaultPane.js.map +0 -1
- package/lib/dokieli/dokieliPane.js.map +0 -1
- package/lib/dokieli/new.js +0 -9
- package/lib/dokieli/new.js.map +0 -1
- package/lib/form/pane.js.map +0 -1
- package/lib/home/homePane.js +0 -91
- package/lib/home/homePane.js.map +0 -1
- package/lib/humanReadablePane.js +0 -138
- package/lib/humanReadablePane.js.map +0 -1
- package/lib/imagePane.js +0 -71
- package/lib/imagePane.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/internal/internalPane.js.map +0 -1
- package/lib/mainPage/header.js +0 -152
- package/lib/mainPage/header.js.map +0 -1
- package/lib/mainPage/index.js +0 -42
- package/lib/mainPage/index.js.map +0 -1
- package/lib/microblogPane/microblogPane.js.map +0 -1
- package/lib/n3Pane.js +0 -57
- package/lib/n3Pane.js.map +0 -1
- package/lib/outline/manager.js +0 -2264
- package/lib/outline/manager.js.map +0 -1
- package/lib/outline/manager.test.d.ts +0 -2
- package/lib/outline/manager.test.d.ts.map +0 -1
- package/lib/outline/manager.test.js +0 -210
- package/lib/outline/manager.test.js.map +0 -1
- package/lib/outline/outlineIcons.js.map +0 -1
- package/lib/outline/propertyViews.js.map +0 -1
- package/lib/outline/propertyViews.test.d.ts +0 -2
- package/lib/outline/propertyViews.test.d.ts.map +0 -1
- package/lib/outline/propertyViews.test.js +0 -27
- package/lib/outline/propertyViews.test.js.map +0 -1
- package/lib/outline/queryByExample.js.map +0 -1
- package/lib/outline/userInput.js.map +0 -1
- package/lib/outline/viewAsImage.js +0 -17
- package/lib/outline/viewAsImage.js.map +0 -1
- package/lib/outline/viewAsMbox.js +0 -23
- package/lib/outline/viewAsMbox.js.map +0 -1
- package/lib/pad/padPane.js.map +0 -1
- package/lib/playlist/playlistPane.js.map +0 -1
- package/lib/registerPanes.js.map +0 -1
- package/lib/schedule/formsForSchedule.js +0 -8
- package/lib/schedule/formsForSchedule.js.map +0 -1
- package/lib/schedule/schedulePane.js.map +0 -1
- package/lib/sharing/sharingPane.js.map +0 -1
- package/lib/slideshow/slideshowPane.js +0 -84
- package/lib/slideshow/slideshowPane.js.map +0 -1
- package/lib/socialPane.js.map +0 -1
- package/lib/tabbed/tabbedPane.js +0 -72
- package/lib/tabbed/tabbedPane.js.map +0 -1
- package/lib/tableViewPane.js.map +0 -1
- package/lib/test-import-export/common.js +0 -12
- package/lib/test-import-export/common.js.map +0 -1
- package/lib/test-import-export/edit-importer.js +0 -25
- package/lib/test-import-export/edit-importer.js.map +0 -1
- package/lib/test-import-export/testImportExport.js +0 -2
- package/lib/test-import-export/testImportExport.js.map +0 -1
- package/lib/transaction/pane.js.map +0 -1
- package/lib/transaction/period.js.map +0 -1
- package/lib/trip/tripPane.js.map +0 -1
- package/lib/trustedApplications/trustedApplications.dom.js +0 -177
- package/lib/trustedApplications/trustedApplications.dom.js.map +0 -1
- package/lib/trustedApplications/trustedApplications.test.d.ts +0 -2
- package/lib/trustedApplications/trustedApplications.test.d.ts.map +0 -1
- package/lib/trustedApplications/trustedApplications.test.js +0 -64
- package/lib/trustedApplications/trustedApplications.test.js.map +0 -1
- package/lib/trustedApplications/trustedApplications.utils.js +0 -34
- package/lib/trustedApplications/trustedApplications.utils.js.map +0 -1
- package/lib/trustedApplications/trustedApplications.view.js +0 -87
- package/lib/trustedApplications/trustedApplications.view.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/ui/pane.js.map +0 -1
- package/lib/versionInfo.d.ts +0 -32
- package/lib/versionInfo.d.ts.map +0 -1
- package/lib/versionInfo.js +0 -37
- package/lib/versionInfo.js.map +0 -1
- package/lib/video/videoPane.js +0 -44
- package/lib/video/videoPane.js.map +0 -1
- package/src/RDFXMLPane.js +0 -60
- package/src/argument/argumentPane.js +0 -65
- package/src/argument/argument_icon_v04.jpg +0 -0
- package/src/argument/icon_argument.png +0 -0
- package/src/argument/transparentyingyang.png +0 -0
- package/src/attach/attachPane.js +0 -508
- package/src/attach/tbl-paperclip-128.png +0 -0
- package/src/attach/tbl-paperclip-22.png +0 -0
- package/src/attach/tbl-paperclip-22a.png +0 -0
- package/src/audio/audioPane.js +0 -197
- package/src/chatPreferencesForm.ttl +0 -12
- package/src/classInstancePane.js +0 -110
- package/src/dashboard/basicPreferences.ts +0 -201
- package/src/dashboard/dashboardPane.ts +0 -83
- package/src/dashboard/homepage.ts +0 -72
- package/src/dashboard/languages/codes.html +0 -8611
- package/src/dashboard/languages/codes.xml +0 -3563
- package/src/dashboard/languages/codes2.txt +0 -170
- package/src/dashboard/languages/foo +0 -70
- package/src/dashboard/languages/foo.ttl +0 -0
- package/src/dashboard/languages/get-language-names.sh +0 -12
- package/src/dashboard/ontologyData.ttl +0 -35
- package/src/dashboard/preferencesFormText.ttl +0 -18
- package/src/dataContentPane.js +0 -290
- package/src/defaultPane.js +0 -102
- package/src/dokieli/Makefile +0 -6
- package/src/dokieli/dokieliPane.js +0 -190
- package/src/dokieli/new.html +0 -30
- package/src/form/form-22.png +0 -0
- package/src/form/form-b-22.png +0 -0
- package/src/form/form.graffle +0 -0
- package/src/form/form.png +0 -0
- package/src/form/pane.js +0 -217
- package/src/form/psuedocode-notes.txt +0 -57
- package/src/global.d.ts +0 -4
- package/src/home/homePane.ts +0 -72
- package/src/humanReadablePane.js +0 -150
- package/src/imagePane.js +0 -75
- package/src/index.ts +0 -71
- package/src/internal/internalPane.ts +0 -263
- package/src/mainPage/footer.ts +0 -19
- package/src/mainPage/header.ts +0 -79
- package/src/mainPage/index.ts +0 -20
- package/src/meeting/Makefile +0 -3
- package/src/meeting/test/meeting1/Actions/actions.ttl +0 -14
- package/src/meeting/test/meeting1/Actions/config.ttl +0 -16
- package/src/meeting/test/meeting1/Actions/state.ttl +0 -30
- package/src/meeting/test/meeting1/Schedule/details.ttl +0 -34
- package/src/meeting/test/meeting1/Schedule/details.ttl.acl +0 -20
- package/src/meeting/test/meeting1/Schedule/forms.ttl +0 -75
- package/src/meeting/test/meeting1/Schedule/forms.ttl.acl +0 -20
- package/src/meeting/test/meeting1/Schedule/index.html +0 -72
- package/src/meeting/test/meeting1/Schedule/index.html.acl +0 -20
- package/src/meeting/test/meeting1/Schedule/results.ttl +0 -15
- package/src/meeting/test/meeting1/Schedule/results.ttl.acl +0 -20
- package/src/meeting/test/meeting1/SharedNotes/pad.ttl +0 -23
- package/src/meeting/test/meeting1/chat/chat.ttl +0 -1
- package/src/meeting/test/meeting1/details.ttl +0 -35
- package/src/meeting/test/meeting1/pad/pad.ttl +0 -16
- package/src/microblogPane/mbStyle.css +0 -267
- package/src/microblogPane/microblogPane.js +0 -1412
- package/src/n3Pane.js +0 -56
- package/src/outline/context.ts +0 -21
- package/src/outline/manager.js +0 -2384
- package/src/outline/manager.test.ts +0 -189
- package/src/outline/outlineIcons.js +0 -160
- package/src/outline/propertyViews.test.ts +0 -36
- package/src/outline/propertyViews.ts +0 -37
- package/src/outline/queryByExample.js +0 -296
- package/src/outline/userInput.js +0 -2373
- package/src/outline/viewAsImage.ts +0 -12
- package/src/outline/viewAsMbox.ts +0 -14
- package/src/pad/images/ColourOff.ai +2 -872
- package/src/pad/images/ColourOff.png +0 -0
- package/src/pad/images/ColourOn.ai +1 -935
- package/src/pad/images/ColourOn.png +0 -0
- package/src/pad/padPane.ts +0 -559
- package/src/playlist/playlistPane.js +0 -161
- package/src/registerPanes.js +0 -147
- package/src/schedule/Makefile +0 -6
- package/src/schedule/formsForSchedule.js +0 -117
- package/src/schedule/formsForSchedule.ttl +0 -115
- package/src/schedule/schedulePane.js +0 -1201
- package/src/sharing/sharingPane.ts +0 -49
- package/src/slideshow/slideshowPane.js +0 -80
- package/src/socialPane.js +0 -523
- package/src/style/tabbedtab.css +0 -1347
- package/src/tabbed/tabbedPane.ts +0 -60
- package/src/tableViewPane.js +0 -51
- package/src/test-import-export/common.js +0 -6
- package/src/test-import-export/edit-importer.js +0 -20
- package/src/test-import-export/testImportExport.js +0 -0
- package/src/transaction/068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/075988-3d-transparent-glass-icon-business-currency-british-pound-sc35.png +0 -0
- package/src/transaction/22-pixel-068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/pane.js +0 -629
- package/src/transaction/period.js +0 -374
- package/src/transaction/thumbs_075987-3d-transparent-glass-icon-business-creditcard2.png +0 -0
- package/src/transaction/thumbs_075989-3d-transparent-glass-icon-business-currency-cent-sc35.png +0 -0
- package/src/trip/tripPane.js +0 -176
- package/src/trustedApplications/__snapshots__/trustedApplications.test.ts.snap +0 -176
- package/src/trustedApplications/trustedApplications.dom.ts +0 -276
- package/src/trustedApplications/trustedApplications.test.ts +0 -82
- package/src/trustedApplications/trustedApplications.utils.ts +0 -51
- package/src/trustedApplications/trustedApplications.view.ts +0 -80
- package/src/types.ts +0 -34
- package/src/ui/22-builder.png +0 -0
- package/src/ui/builder.graffle +0 -0
- package/src/ui/builder.png +0 -0
- package/src/ui/builder2.png +0 -0
- package/src/ui/pane.js +0 -226
- package/src/versionInfo.ts +0 -30
- package/src/video/videoPane.js +0 -44
- package/timestamp.sh +0 -13
- package/travis/bumpversion.js +0 -29
- package/tsconfig.json +0 -78
- package/typings/raw-loader.d.ts +0 -4
- package/typings/solid-namespace/index.d.ts +0 -9
- package/webpack.config.js +0 -41
- /package/{lib → dist}/dashboard/basicPreferences.d.ts +0 -0
- /package/{lib → dist}/dashboard/basicPreferences.d.ts.map +0 -0
- /package/{lib → dist}/dashboard/dashboardPane.d.ts +0 -0
- /package/{lib → dist}/dashboard/dashboardPane.d.ts.map +0 -0
- /package/{lib → dist}/dashboard/homepage.d.ts +0 -0
- /package/{lib → dist}/dashboard/homepage.d.ts.map +0 -0
- /package/{lib → dist}/global.d.js +0 -0
- /package/{lib → dist}/global.d.js.map +0 -0
- /package/{lib → dist}/home/homePane.d.ts +0 -0
- /package/{lib → dist}/home/homePane.d.ts.map +0 -0
- /package/{lib → dist}/index.d.ts +0 -0
- /package/{lib → dist}/index.d.ts.map +0 -0
- /package/{lib → dist}/internal/internalPane.d.ts +0 -0
- /package/{lib → dist}/internal/internalPane.d.ts.map +0 -0
- /package/{lib → dist}/mainPage/footer.d.ts +0 -0
- /package/{lib → dist}/mainPage/footer.d.ts.map +0 -0
- /package/{lib → dist}/mainPage/header.d.ts +0 -0
- /package/{lib → dist}/mainPage/header.d.ts.map +0 -0
- /package/{lib → dist}/mainPage/index.d.ts +0 -0
- /package/{lib → dist}/outline/context.d.ts +0 -0
- /package/{lib → dist}/outline/context.d.ts.map +0 -0
- /package/{lib → dist}/outline/propertyViews.d.ts +0 -0
- /package/{lib → dist}/outline/propertyViews.d.ts.map +0 -0
- /package/{lib → dist}/outline/viewAsImage.d.ts +0 -0
- /package/{lib → dist}/outline/viewAsImage.d.ts.map +0 -0
- /package/{lib → dist}/outline/viewAsMbox.d.ts +0 -0
- /package/{lib → dist}/outline/viewAsMbox.d.ts.map +0 -0
- /package/{lib → dist}/pad/padPane.d.ts +0 -0
- /package/{lib → dist}/pad/padPane.d.ts.map +0 -0
- /package/{lib → dist}/sharing/sharingPane.d.ts +0 -0
- /package/{lib → dist}/sharing/sharingPane.d.ts.map +0 -0
- /package/{lib → dist}/tabbed/tabbedPane.d.ts +0 -0
- /package/{lib → dist}/tabbed/tabbedPane.d.ts.map +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.dom.d.ts +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.dom.d.ts.map +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.utils.d.ts +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.utils.d.ts.map +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.view.d.ts +0 -0
- /package/{lib → dist}/trustedApplications/trustedApplications.view.d.ts.map +0 -0
- /package/{lib → dist}/types.d.ts +0 -0
- /package/{lib → dist}/types.d.ts.map +0 -0
- /package/{lib → dist}/types.js +0 -0
package/src/transaction/pane.js
DELETED
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
/* Financial Transaction Pane
|
|
2
|
-
**
|
|
3
|
-
** This outline pane allows a user to interact with a transaction
|
|
4
|
-
** downloaded from a bank statement, annotting it with classes and comments,
|
|
5
|
-
** trips, etc
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as UI from 'solid-ui'
|
|
9
|
-
import * as $rdf from 'rdflib'
|
|
10
|
-
const ns = UI.ns
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
// icon: (module.__dirname || __dirname) + '22-pixel-068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png',
|
|
14
|
-
icon: UI.icons.iconBase + 'noun_106746.svg',
|
|
15
|
-
|
|
16
|
-
name: 'transaction',
|
|
17
|
-
|
|
18
|
-
audience: [ns.solid('PowerUser')],
|
|
19
|
-
|
|
20
|
-
// Does the subject deserve this pane?
|
|
21
|
-
label: function (subject, context) {
|
|
22
|
-
const kb = context.session.store
|
|
23
|
-
const t = kb.findTypeURIs(subject)
|
|
24
|
-
if (t['http://www.w3.org/2000/10/swap/pim/qif#Transaction']) return '$$'
|
|
25
|
-
if (kb.any(subject, UI.ns.qu('amount'))) return '$$$' // In case schema not picked up
|
|
26
|
-
|
|
27
|
-
// if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) return "period $"
|
|
28
|
-
|
|
29
|
-
if (t['http://www.w3.org/ns/pim/trip#Trip']) return 'Trip $'
|
|
30
|
-
|
|
31
|
-
return null // No under other circumstances (while testing at least!)
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
render: function (subject, context) {
|
|
35
|
-
const dom = context.dom
|
|
36
|
-
const kb = context.session.store
|
|
37
|
-
const fetcher = kb.fetcher
|
|
38
|
-
const Q = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
|
|
39
|
-
const TRIP = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')
|
|
40
|
-
|
|
41
|
-
const div = dom.createElement('div')
|
|
42
|
-
div.setAttribute('class', 'transactionPane')
|
|
43
|
-
|
|
44
|
-
const mention = function mention (message, style) {
|
|
45
|
-
if (style === undefined) style = 'color: grey'
|
|
46
|
-
const pre = dom.createElement('pre')
|
|
47
|
-
pre.setAttribute('style', style)
|
|
48
|
-
div.appendChild(pre)
|
|
49
|
-
pre.appendChild(dom.createTextNode(message))
|
|
50
|
-
}
|
|
51
|
-
const complain = function complain (message) {
|
|
52
|
-
return mention(message, 'color: #100; background-color: #fee')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/*
|
|
56
|
-
var thisPane = this
|
|
57
|
-
var rerender = function (div) {
|
|
58
|
-
var parent = div.parentNode
|
|
59
|
-
var div2 = thisPane.render(subject, dom)
|
|
60
|
-
parent.replaceChild(div2, div)
|
|
61
|
-
}
|
|
62
|
-
*/
|
|
63
|
-
// //////////////////////////////////////////////////////////////////////////////
|
|
64
|
-
|
|
65
|
-
const plist = kb.statementsMatching(subject)
|
|
66
|
-
const qlist = kb.statementsMatching(undefined, undefined, subject)
|
|
67
|
-
|
|
68
|
-
const t = kb.findTypeURIs(subject)
|
|
69
|
-
|
|
70
|
-
// var me = authn.currentUser()
|
|
71
|
-
const predicateURIsDone = {}
|
|
72
|
-
const donePredicate = function (pred) {
|
|
73
|
-
predicateURIsDone[pred.uri] = true
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const setPaneStyle = function (account) {
|
|
77
|
-
let mystyle = 'padding: 0.5em 1.5em 1em 1.5em; '
|
|
78
|
-
if (account) {
|
|
79
|
-
const backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'))
|
|
80
|
-
if (backgroundColor) {
|
|
81
|
-
mystyle += 'background-color: ' + backgroundColor.value + '; '
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
div.setAttribute('style', mystyle)
|
|
85
|
-
}
|
|
86
|
-
// setPaneStyle()
|
|
87
|
-
|
|
88
|
-
// Functions for displaying lists of transactions
|
|
89
|
-
// Click on the transaction line to expand it into a pane
|
|
90
|
-
// Shift-click to expand without collapsing others
|
|
91
|
-
|
|
92
|
-
const d2 = function (n) {
|
|
93
|
-
if (n === undefined) return ''
|
|
94
|
-
const s = '' + n
|
|
95
|
-
if (s.indexOf('.') >= 0) {
|
|
96
|
-
return s.split('.')[0] + '.' + (s.split('.')[1] + '00').slice(0, 2)
|
|
97
|
-
}
|
|
98
|
-
return s + '.00'
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const numericCell = function numericCell (amount, suppressZero) {
|
|
102
|
-
const td = dom.createElement('td')
|
|
103
|
-
if (!(0.0 + amount === 0.0 && suppressZero)) {
|
|
104
|
-
td.textContent = d2(amount)
|
|
105
|
-
}
|
|
106
|
-
td.setAttribute('style', 'width: 6em; text-align: right; ')
|
|
107
|
-
return td
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const headerCell = function headerCell (str) {
|
|
111
|
-
const td = dom.createElement('th')
|
|
112
|
-
td.textContent = str
|
|
113
|
-
td.setAttribute('style', 'text-align: right; ')
|
|
114
|
-
return td
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const oderByDate = function (x, y) {
|
|
118
|
-
const dx = kb.any(x, ns.qu('date'))
|
|
119
|
-
const dy = kb.any(y, ns.qu('date'))
|
|
120
|
-
if (dx !== undefined && dy !== undefined) {
|
|
121
|
-
if (dx.value < dy.value) return -1
|
|
122
|
-
if (dx.value > dy.value) return 1
|
|
123
|
-
}
|
|
124
|
-
if (x.uri < y.uri) return -1 // Arbitrary but repeatable
|
|
125
|
-
if (x.uri > y.uri) return 1
|
|
126
|
-
return 0
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const insertedPane = function (context, subject, paneName) {
|
|
130
|
-
const p = context.session.paneRegistry.byName(paneName)
|
|
131
|
-
const d = p.render(subject, context)
|
|
132
|
-
d.setAttribute('style', 'border: 0.1em solid green;')
|
|
133
|
-
return d
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const expandAfterRow = function (dom, row, subject, paneName, solo) {
|
|
137
|
-
const siblings = row.parentNode.children
|
|
138
|
-
if (solo) {
|
|
139
|
-
for (let j = siblings.length - 1; j >= 0; j--) {
|
|
140
|
-
if (siblings[j].expanded) {
|
|
141
|
-
siblings[j].parentNode.removeChild(siblings[j].expanded)
|
|
142
|
-
siblings[j].expanded = false
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
const tr = dom.createElement('tr')
|
|
147
|
-
const td = tr.appendChild(dom.createElement('td'))
|
|
148
|
-
td.setAttribute(
|
|
149
|
-
'style',
|
|
150
|
-
'width: 98%; padding: 1em; border: 0.1em solid grey;'
|
|
151
|
-
)
|
|
152
|
-
const cols = row.children.length
|
|
153
|
-
if (row.nextSibling) {
|
|
154
|
-
row.parentNode.insertBefore(tr, row.nextSibling)
|
|
155
|
-
} else {
|
|
156
|
-
row.parentNode.appendChild(tr)
|
|
157
|
-
}
|
|
158
|
-
row.expanded = tr
|
|
159
|
-
td.setAttribute('colspan', '' + cols)
|
|
160
|
-
td.appendChild(insertedPane(context, subject, paneName))
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const expandAfterRowOrCollapse = function (
|
|
164
|
-
dom,
|
|
165
|
-
row,
|
|
166
|
-
subject,
|
|
167
|
-
paneName,
|
|
168
|
-
solo
|
|
169
|
-
) {
|
|
170
|
-
if (row.expanded) {
|
|
171
|
-
row.parentNode.removeChild(row.expanded)
|
|
172
|
-
row.expanded = false
|
|
173
|
-
} else {
|
|
174
|
-
expandAfterRow(dom, row, subject, paneName, solo)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const transactionTable = function (dom, list, filter) {
|
|
179
|
-
const table = dom.createElement('table')
|
|
180
|
-
table.setAttribute(
|
|
181
|
-
'style',
|
|
182
|
-
'padding-left: 0.5em; padding-right: 0.5em; font-size: 9pt; width: 85%;'
|
|
183
|
-
)
|
|
184
|
-
const transactionRow = function (dom, x) {
|
|
185
|
-
const tr = dom.createElement('tr')
|
|
186
|
-
|
|
187
|
-
const setTRStyle = function (tr, account) {
|
|
188
|
-
// var mystyle = "padding: 0.5em 1.5em 1em 1.5em; "
|
|
189
|
-
let mystyle =
|
|
190
|
-
"'padding-left: 0.5em; padding-right: 0.5em; padding-top: 0.1em;"
|
|
191
|
-
if (account) {
|
|
192
|
-
const backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'))
|
|
193
|
-
if (backgroundColor) {
|
|
194
|
-
mystyle += 'background-color: ' + backgroundColor.value + '; '
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
tr.setAttribute('style', mystyle)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const account = kb.any(x, ns.qu('toAccount'))
|
|
201
|
-
setTRStyle(tr, account)
|
|
202
|
-
|
|
203
|
-
const c0 = tr.appendChild(dom.createElement('td'))
|
|
204
|
-
const date = kb.any(x, ns.qu('date'))
|
|
205
|
-
c0.textContent = date ? date.value.slice(0, 10) : '???'
|
|
206
|
-
c0.setAttribute('style', 'width: 7em;')
|
|
207
|
-
|
|
208
|
-
const c1 = tr.appendChild(dom.createElement('td'))
|
|
209
|
-
c1.setAttribute('style', 'width: 36em;')
|
|
210
|
-
const payee = kb.any(x, ns.qu('payee'))
|
|
211
|
-
c1.textContent = payee ? payee.value : '???'
|
|
212
|
-
const a1 = c1.appendChild(dom.createElement('a'))
|
|
213
|
-
a1.textContent = ' ➜'
|
|
214
|
-
a1.setAttribute('href', x.uri)
|
|
215
|
-
|
|
216
|
-
const c3 = tr.appendChild(dom.createElement('td'))
|
|
217
|
-
const amount = kb.any(x, ns.qu('in_USD'))
|
|
218
|
-
c3.textContent = amount ? d2(amount.value) : '???'
|
|
219
|
-
c3.setAttribute('style', 'width: 6em; text-align: right; ') // @@ decimal alignment?
|
|
220
|
-
tr.addEventListener(
|
|
221
|
-
'click',
|
|
222
|
-
function (e) {
|
|
223
|
-
// solo unless shift key
|
|
224
|
-
expandAfterRowOrCollapse(dom, tr, x, 'transaction', !e.shiftKey)
|
|
225
|
-
},
|
|
226
|
-
false
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
return tr
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const list2 = filter ? list.filter(filter) : list.slice() // don't sort a paramater passed in place
|
|
233
|
-
list2.sort(oderByDate)
|
|
234
|
-
|
|
235
|
-
for (let i = 0; i < list2.length; i++) {
|
|
236
|
-
table.appendChild(transactionRow(dom, list2[i]))
|
|
237
|
-
}
|
|
238
|
-
return table
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Render a single transaction
|
|
242
|
-
|
|
243
|
-
// This works only if enough metadata about the properties can drive the RDFS
|
|
244
|
-
// (or actual type statements whichtypically are NOT there on)
|
|
245
|
-
if (
|
|
246
|
-
t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] ||
|
|
247
|
-
kb.any(subject, ns.qu('toAccount'))
|
|
248
|
-
) {
|
|
249
|
-
// var trip = kb.any(subject, WF('trip'))
|
|
250
|
-
donePredicate(ns.rdf('type'))
|
|
251
|
-
|
|
252
|
-
const account = kb.any(subject, UI.ns.qu('toAccount'))
|
|
253
|
-
setPaneStyle(account)
|
|
254
|
-
if (!account) {
|
|
255
|
-
complain(
|
|
256
|
-
'(Error: There is no bank account known for this transaction <' +
|
|
257
|
-
subject.uri +
|
|
258
|
-
'>,\n -- every transaction needs one.)'
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
let store = null
|
|
263
|
-
const statement = kb.any(subject, UI.ns.qu('accordingTo'))
|
|
264
|
-
if (statement === undefined) {
|
|
265
|
-
complain(
|
|
266
|
-
'(Error: There is no back link to the original data source foir this transaction <' +
|
|
267
|
-
subject.uri +
|
|
268
|
-
">,\nso I can't tell how to annotate it.)"
|
|
269
|
-
)
|
|
270
|
-
} else {
|
|
271
|
-
store =
|
|
272
|
-
statement !== undefined
|
|
273
|
-
? kb.any(statement, UI.ns.qu('annotationStore'))
|
|
274
|
-
: null
|
|
275
|
-
if (store === undefined) {
|
|
276
|
-
complain(
|
|
277
|
-
'(There is no annotation document for this statement\n<' +
|
|
278
|
-
statement.uri +
|
|
279
|
-
'>,\nso you cannot classify this transaction.)'
|
|
280
|
-
)
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const nav = dom.createElement('div')
|
|
285
|
-
nav.setAttribute('style', 'float:right')
|
|
286
|
-
div.appendChild(nav)
|
|
287
|
-
|
|
288
|
-
const navLink = function (pred, label) {
|
|
289
|
-
donePredicate(pred)
|
|
290
|
-
const obj = kb.any(subject, pred)
|
|
291
|
-
if (!obj) return
|
|
292
|
-
const a = dom.createElement('a')
|
|
293
|
-
a.setAttribute('href', obj.uri)
|
|
294
|
-
a.setAttribute('style', 'float:right')
|
|
295
|
-
nav.appendChild(a).textContent = label || UI.utils.label(obj)
|
|
296
|
-
nav.appendChild(dom.createElement('br'))
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
navLink(UI.ns.qu('toAccount'))
|
|
300
|
-
navLink(UI.ns.qu('accordingTo'), 'Statement')
|
|
301
|
-
navLink(TRIP('trip'))
|
|
302
|
-
|
|
303
|
-
// Basic data:
|
|
304
|
-
const table = dom.createElement('table')
|
|
305
|
-
div.appendChild(table)
|
|
306
|
-
const preds = ['date', 'payee', 'amount', 'in_USD', 'currency'].map(Q)
|
|
307
|
-
const inner = preds
|
|
308
|
-
.map(function (p) {
|
|
309
|
-
donePredicate(p)
|
|
310
|
-
const value = kb.any(subject, p)
|
|
311
|
-
const s = value ? UI.utils.labelForXML(value) : ''
|
|
312
|
-
return (
|
|
313
|
-
'<tr><td style="text-align: right; padding-right: 0.6em">' +
|
|
314
|
-
UI.utils.labelForXML(p) +
|
|
315
|
-
'</td><td style="font-weight: bold;">' +
|
|
316
|
-
s +
|
|
317
|
-
'</td></tr>'
|
|
318
|
-
)
|
|
319
|
-
})
|
|
320
|
-
.join('\n')
|
|
321
|
-
table.innerHTML = inner
|
|
322
|
-
|
|
323
|
-
const complainIfBad = function (ok, body) {
|
|
324
|
-
if (ok) {
|
|
325
|
-
// setModifiedDate(store, kb, store)
|
|
326
|
-
// rerender(div) // deletes the new trip form
|
|
327
|
-
} else complain('Sorry, failed to save your change:\n' + body)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// What trips do we know about?
|
|
331
|
-
|
|
332
|
-
// Classify:
|
|
333
|
-
if (store) {
|
|
334
|
-
kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
|
|
335
|
-
if (!ok) complain('Cannot load store ' + store + ' ' + body)
|
|
336
|
-
|
|
337
|
-
const calendarYear = kb.any(store, ns.qu('calendarYear'))
|
|
338
|
-
|
|
339
|
-
const renderCatgorySelectors = function () {
|
|
340
|
-
div.insertBefore(
|
|
341
|
-
UI.widgets.makeSelectForNestedCategory(
|
|
342
|
-
dom,
|
|
343
|
-
kb,
|
|
344
|
-
subject,
|
|
345
|
-
UI.ns.qu('Classified'),
|
|
346
|
-
store,
|
|
347
|
-
complainIfBad
|
|
348
|
-
),
|
|
349
|
-
table.nextSibling
|
|
350
|
-
)
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
if (kb.any(undefined, ns.rdfs('subClassOf'), ns.qu.Classified)) {
|
|
354
|
-
renderCatgorySelectors()
|
|
355
|
-
} else if (calendarYear) {
|
|
356
|
-
fetcher
|
|
357
|
-
.load(calendarYear)
|
|
358
|
-
.then(function (_xhrs) {
|
|
359
|
-
fetcher
|
|
360
|
-
.load(kb.each(calendarYear, ns.rdfs('seeAlso')))
|
|
361
|
-
.then(function () {
|
|
362
|
-
renderCatgorySelectors()
|
|
363
|
-
})
|
|
364
|
-
.catch(function (e) {
|
|
365
|
-
console.log('Error loading background data: ' + e)
|
|
366
|
-
})
|
|
367
|
-
})
|
|
368
|
-
.catch(function (e) {
|
|
369
|
-
console.log('Error loading calendarYear: ' + e)
|
|
370
|
-
})
|
|
371
|
-
} else {
|
|
372
|
-
console.log("Can't get categories, because no calendarYear")
|
|
373
|
-
}
|
|
374
|
-
div.appendChild(
|
|
375
|
-
UI.widgets.makeDescription(
|
|
376
|
-
dom,
|
|
377
|
-
kb,
|
|
378
|
-
subject,
|
|
379
|
-
UI.ns.rdfs('comment'),
|
|
380
|
-
store,
|
|
381
|
-
complainIfBad
|
|
382
|
-
)
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
let trips = kb
|
|
386
|
-
.statementsMatching(undefined, TRIP('trip'), undefined, store)
|
|
387
|
-
.map(function (st) {
|
|
388
|
-
return st.object
|
|
389
|
-
}) // @@ Use rdfs
|
|
390
|
-
const trips2 = kb.each(undefined, UI.ns.rdf('type'), TRIP('Trip'))
|
|
391
|
-
trips = trips.concat(trips2).sort() // @@ Unique
|
|
392
|
-
|
|
393
|
-
const sortedBy = function (kb, list, pred, reverse) {
|
|
394
|
-
const l2 = list.map(function (x) {
|
|
395
|
-
let key = kb.any(x, pred)
|
|
396
|
-
key = key ? key.value : '9999-12-31'
|
|
397
|
-
return [key, x]
|
|
398
|
-
})
|
|
399
|
-
l2.sort()
|
|
400
|
-
if (reverse) l2.reverse()
|
|
401
|
-
return l2.map(function (pair) {
|
|
402
|
-
return pair[1]
|
|
403
|
-
})
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
trips = sortedBy(kb, trips, UI.ns.cal('dtstart'), true) // Reverse chron
|
|
407
|
-
|
|
408
|
-
if (trips.length > 1) {
|
|
409
|
-
div.appendChild(
|
|
410
|
-
UI.widgets.makeSelectForOptions(
|
|
411
|
-
dom,
|
|
412
|
-
kb,
|
|
413
|
-
subject,
|
|
414
|
-
TRIP('trip'),
|
|
415
|
-
trips,
|
|
416
|
-
{
|
|
417
|
-
multiple: false,
|
|
418
|
-
nullLabel: '-- what trip? --',
|
|
419
|
-
mint: 'New Trip *',
|
|
420
|
-
mintClass: TRIP('Trip'),
|
|
421
|
-
mintStatementsFun: function (trip) {
|
|
422
|
-
const is = []
|
|
423
|
-
is.push(
|
|
424
|
-
$rdf.st(trip, UI.ns.rdf('type'), TRIP('Trip'), trip.doc())
|
|
425
|
-
)
|
|
426
|
-
return is
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
store,
|
|
430
|
-
complainIfBad
|
|
431
|
-
)
|
|
432
|
-
)
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
div.appendChild(dom.createElement('br'))
|
|
436
|
-
|
|
437
|
-
// Add in simple comments about the transaction
|
|
438
|
-
|
|
439
|
-
const outliner = context.getOutliner(dom)
|
|
440
|
-
|
|
441
|
-
donePredicate(ns.rdfs('comment')) // Done above
|
|
442
|
-
|
|
443
|
-
UI.widgets.attachmentList(dom, subject, div)
|
|
444
|
-
donePredicate(ns.wf('attachment'))
|
|
445
|
-
|
|
446
|
-
div
|
|
447
|
-
.appendChild(dom.createElement('tr'))
|
|
448
|
-
.setAttribute('style', 'height: 1em') // spacer
|
|
449
|
-
|
|
450
|
-
// Remaining properties
|
|
451
|
-
outliner.appendPropertyTRs(div, plist, false, function (
|
|
452
|
-
pred,
|
|
453
|
-
_inverse
|
|
454
|
-
) {
|
|
455
|
-
return !(pred.uri in predicateURIsDone)
|
|
456
|
-
})
|
|
457
|
-
outliner.appendPropertyTRs(div, qlist, true, function (
|
|
458
|
-
pred,
|
|
459
|
-
_inverse
|
|
460
|
-
) {
|
|
461
|
-
return !(pred.uri in predicateURIsDone)
|
|
462
|
-
})
|
|
463
|
-
}) // fetch
|
|
464
|
-
}
|
|
465
|
-
// end of render tranasaction instance
|
|
466
|
-
|
|
467
|
-
// ////////////////////////////////////////////////////////////////////
|
|
468
|
-
//
|
|
469
|
-
// Render the transactions in a Trip
|
|
470
|
-
//
|
|
471
|
-
} else if (t['http://www.w3.org/ns/pim/trip#Trip']) {
|
|
472
|
-
/*
|
|
473
|
-
var query = new $rdf.Query(UI.utils.label(subject))
|
|
474
|
-
var vars = [ 'date', 'transaction', 'comment', 'type', 'in_USD']
|
|
475
|
-
var v = {}
|
|
476
|
-
vars.map(function(x){query.vars.push(v[x]=$rdf.variable(x))}) // Only used by UI
|
|
477
|
-
query.pat.add(v['transaction'], TRIP('trip'), subject)
|
|
478
|
-
|
|
479
|
-
var opt = kb.formula()
|
|
480
|
-
opt.add(v['transaction'], ns.rdf('type'), v['type']); // Issue: this will get stored supertypes too
|
|
481
|
-
query.pat.optional.push(opt)
|
|
482
|
-
|
|
483
|
-
query.pat.add(v['transaction'], UI.ns.qu('date'), v['date'])
|
|
484
|
-
|
|
485
|
-
var opt = kb.formula()
|
|
486
|
-
opt.add(v['transaction'], ns.rdfs('comment'), v['comment'])
|
|
487
|
-
query.pat.optional.push(opt)
|
|
488
|
-
|
|
489
|
-
//opt = kb.formula()
|
|
490
|
-
query.pat.add(v['transaction'], UI.ns.qu('in_USD'), v['in_USD'])
|
|
491
|
-
|
|
492
|
-
//query.pat.optional.push(opt)
|
|
493
|
-
|
|
494
|
-
var tableDiv = UI.widgets.renderTableViewPane(dom, {'query': query, 'onDone': calculations} )
|
|
495
|
-
div.appendChild(tableDiv)
|
|
496
|
-
|
|
497
|
-
*/
|
|
498
|
-
const calculations = function () {
|
|
499
|
-
const total = {}
|
|
500
|
-
const yearTotal = {}
|
|
501
|
-
const yearCategoryTotal = {}
|
|
502
|
-
const trans = kb.each(undefined, TRIP('trip'), subject)
|
|
503
|
-
const bankStatements = trans.map(function (t) {
|
|
504
|
-
return t.doc()
|
|
505
|
-
})
|
|
506
|
-
kb.fetcher
|
|
507
|
-
.load(bankStatements)
|
|
508
|
-
.then(function () {
|
|
509
|
-
trans.forEach(function (t) {
|
|
510
|
-
const date = kb.the(t, ns.qu('date'))
|
|
511
|
-
const year = date ? ('' + date.value).slice(0, 4) : '????'
|
|
512
|
-
let ty = kb.the(t, ns.rdf('type')) // @@ find most specific type
|
|
513
|
-
// complain(" -- one trans: "+t.uri + ' -> '+kb.any(t, UI.ns.qu('in_USD')))
|
|
514
|
-
if (!ty) ty = UI.ns.qu('ErrorNoType')
|
|
515
|
-
if (ty && ty.uri) {
|
|
516
|
-
const tyuri = ty.uri
|
|
517
|
-
if (!yearTotal[year]) yearTotal[year] = 0.0
|
|
518
|
-
if (!yearCategoryTotal[year]) yearCategoryTotal[year] = {}
|
|
519
|
-
if (!total[tyuri]) total[tyuri] = 0.0
|
|
520
|
-
if (!yearCategoryTotal[year][tyuri]) {
|
|
521
|
-
yearCategoryTotal[year][tyuri] = 0.0
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
const lit = kb.any(t, UI.ns.qu('in_USD'))
|
|
525
|
-
if (!lit) {
|
|
526
|
-
complain('@@ No amount in USD: ' + lit + ' for ' + t)
|
|
527
|
-
}
|
|
528
|
-
if (lit) {
|
|
529
|
-
const amount = parseFloat(lit.value)
|
|
530
|
-
total[tyuri] += amount
|
|
531
|
-
yearCategoryTotal[year][tyuri] += amount
|
|
532
|
-
yearTotal[year] += amount
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
})
|
|
536
|
-
|
|
537
|
-
const types = []
|
|
538
|
-
let grandTotal = 0.0
|
|
539
|
-
const years = []
|
|
540
|
-
let i
|
|
541
|
-
|
|
542
|
-
for (const y in yearCategoryTotal) {
|
|
543
|
-
// @@ TODO: Write away the need for exception on next line
|
|
544
|
-
|
|
545
|
-
if (yearCategoryTotal.hasOwnProperty(y)) {
|
|
546
|
-
years.push(y)
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
years.sort()
|
|
550
|
-
const ny = years.length
|
|
551
|
-
let cell
|
|
552
|
-
|
|
553
|
-
const table = div.appendChild(dom.createElement('table'))
|
|
554
|
-
table.setAttribute(
|
|
555
|
-
'style',
|
|
556
|
-
'font-size: 120%; margin-left:auto; margin-right:1em; margin-top: 1em; border: 0.05em solid gray; padding: 1em;'
|
|
557
|
-
)
|
|
558
|
-
|
|
559
|
-
if (ny > 1) {
|
|
560
|
-
const header = table.appendChild(dom.createElement('tr'))
|
|
561
|
-
header.appendChild(headerCell(''))
|
|
562
|
-
for (i = 0; i < ny; i++) {
|
|
563
|
-
header.appendChild(headerCell(years[i]))
|
|
564
|
-
}
|
|
565
|
-
header.appendChild(headerCell('total'))
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
for (const uri in total) {
|
|
569
|
-
// @@ TODO: Write away the need for exception on next line
|
|
570
|
-
|
|
571
|
-
if (total.hasOwnProperty(uri)) {
|
|
572
|
-
types.push(uri)
|
|
573
|
-
grandTotal += total[uri]
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
types.sort()
|
|
577
|
-
let row, label, z
|
|
578
|
-
for (let j = 0; j < types.length; j++) {
|
|
579
|
-
const cat = kb.sym(types[j])
|
|
580
|
-
row = table.appendChild(dom.createElement('tr'))
|
|
581
|
-
label = row.appendChild(dom.createElement('td'))
|
|
582
|
-
label.textContent = UI.utils.label(cat)
|
|
583
|
-
if (ny > 1) {
|
|
584
|
-
for (i = 0; i < ny; i++) {
|
|
585
|
-
z = yearCategoryTotal[years[i]][types[j]]
|
|
586
|
-
cell = row.appendChild(numericCell(z, true))
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
row.appendChild(numericCell(total[types[j]], true))
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
// Trailing totals
|
|
593
|
-
if (types.length > 1) {
|
|
594
|
-
row = table.appendChild(dom.createElement('tr'))
|
|
595
|
-
row.appendChild(headerCell('total'))
|
|
596
|
-
if (ny > 1) {
|
|
597
|
-
for (i = 0; i < ny; i++) {
|
|
598
|
-
z = yearTotal[years[i]]
|
|
599
|
-
cell = row.appendChild(numericCell(z ? d2(z) : ''))
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
cell = row.appendChild(numericCell(grandTotal))
|
|
603
|
-
cell.setAttribute(
|
|
604
|
-
'style',
|
|
605
|
-
'font-weight: bold; text-align: right;'
|
|
606
|
-
)
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
const tab = transactionTable(dom, trans)
|
|
610
|
-
tab.setAttribute(
|
|
611
|
-
'style',
|
|
612
|
-
'margin-left:auto; margin-right:1em; margin-top: 1em; border: padding: 1em;'
|
|
613
|
-
)
|
|
614
|
-
div.appendChild(tab)
|
|
615
|
-
|
|
616
|
-
UI.widgets.attachmentList(dom, subject, div)
|
|
617
|
-
})
|
|
618
|
-
.catch(function (e) {
|
|
619
|
-
complain('Error loading transactions: ' + e)
|
|
620
|
-
})
|
|
621
|
-
}
|
|
622
|
-
calculations()
|
|
623
|
-
} // if
|
|
624
|
-
|
|
625
|
-
return div
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
// ends
|