odant-work 1.0.91 → 1.0.92
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/#system/certs/russian_trusted_root_ca.pem +32 -32
- package/#system/mail.json.example +9 -9
- package/#system/package-manifest.json +332 -373
- package/#system/settings.json.example +3 -3
- package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
- package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
- package/$server/$folder/$class/$domain/class.js +4 -4
- package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
- package/$server/$folder/$class/$handler/class.js +9 -9
- package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
- package/$server/$folder/$class/$handler/readme.md +23 -23
- package/$server/$folder/$class/$module/handlers/pages/form/system/{$handler/tabs/mcp/$handler/mcp.js → mcp/$handler/class.js} +251 -210
- package/$server/$folder/$class/$module/handlers/pages/form/system/{$handler/tabs/modules → modules}/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/$organization/handlers/pages/site/$handler/{site.js → class.js} +351 -364
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/{$handler/tabs/license/$handler/license.js → license/$handler/class.js} +104 -103
- package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
- package/$server/$folder/$class/$structure/$user/class.js +2 -2
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/{$handler/tabs/profile/$handler/profile.js → profile/$handler/class.js} +6 -2
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +308 -5
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +14 -3
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/agent/$handler/agent.js → agent/$handler/class.js} +329 -320
- package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/database/$handler/database.js → database/$handler/class.js} +510 -577
- package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/messengers/$handler/messengers.js → messengers/$handler/class.js} +142 -143
- package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
- package/$server/$folder/$class/ai/config.js +19 -19
- package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
- package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
- package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
- package/$server/$folder/$class/ai/skills/computer.md +27 -27
- package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
- package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
- package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
- package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
- package/$server/$folder/$class/ai/system.md +1 -1
- package/$server/$folder/$class/class.js +0 -3
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
- package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
- package/$server/$folder/$class/handlers/pages/form/system/{$handler/tabs/files → files}/$handler/class.js +2 -0
- package/$server/$folder/$class/handlers/pages/form/system/{$handler/tabs/requisites/$handler/requisites.js → requisites/$handler/class.js} +43 -36
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
- package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
- package/$server/$folder/$file/$call/class.js +10 -10
- package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
- package/$server/$folder/$file/$data/class.js +16 -16
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +31 -4
- package/$server/$folder/$file/$devs/$js/class.js +2 -2
- package/$server/$folder/$file/$devs/$json/class.js +2 -2
- package/$server/$folder/$file/$devs/$ts/class.js +2 -2
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +30 -2
- package/$server/$folder/$file/$eml/class.js +17 -17
- package/$server/$folder/$file/$ics/class.js +44 -44
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +10 -2
- package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
- package/$server/$folder/$file/$ics/readme.md +21 -21
- package/$server/$folder/$file/$image/$svg/class.js +11 -11
- package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +82 -2
- package/$server/$folder/$file/$logs/class.js +39 -39
- package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +60 -2
- package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
- package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +1 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +17 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/panel.js +7 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js +1 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-policy.js +6 -2
- package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$task/readme.md +32 -32
- package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
- package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
- package/$server/$folder/$file/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
- package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +32 -2
- package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
- package/$server/$folder/$file/readme.md +31 -31
- package/$server/$folder/class.js +11 -11
- package/$server/$folder/handlers/pages/form/$handler/class.js +2469 -5
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
- package/$server/$folder/lib/chat-item/chat-item.js +2 -2
- package/$server/$folder/lib/email/settings.js +82 -82
- package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
- package/$server/$folder/lib/icon/user/user.js +6 -6
- package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
- package/$server/$folder/lib/item-form/item-form.js +84 -84
- package/$server/$folder/lib/menu/menu.js +3 -2
- package/$server/$folder/lib/menu/readme.md +29 -29
- package/$server/$folder/lib/node/readme.md +29 -29
- package/$server/$folder/lib/pack/pack.js +4 -4
- package/$server/$folder/lib/site-loc/readme.md +16 -16
- package/.github/workflows/ci.yml +39 -39
- package/AGENTS.md +1 -1
- package/{models/$ai/$folder/$class/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → MODELS/$ai/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +383 -430
- package/{models/$ai/$folder/$class/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → MODELS/$ai/$folder/$class/$provider/handlers/pages/form/system/ai/$handler/class.js} +155 -166
- package/{models → MODELS}/$ai/$folder/$class/$provider/readme.md +16 -16
- package/{models/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → MODELS/$ai/handlers/pages/form/system/ai/$handler/class.js} +34 -33
- package/{models → MODELS}/GigaChat/$provider/readme.md +24 -24
- package/{models/Local/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → MODELS/Local/$provider/handlers/pages/form/system/ai/$handler/class.js} +569 -626
- package/MODULES/$domain/handlers/pages/form/system/{$handler/tabs/mcp → mcp}/$handler/class.js +1 -0
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +648 -20
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +140 -6
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +305 -5
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +241 -5
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +515 -15
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js +3 -0
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js +422 -5
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +40 -40
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +56 -56
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/analysis/$handler/class.js +13 -7
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/postings/$handler/class.js +1791 -7
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/turnovers/$handler/class.js +13 -7
- package/MODULES/Register/REGISTER/$register/handlers/pages/form/journal/$handler/class.js +776 -5
- package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +807 -5
- package/MODULES/Register/REGISTER/68/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/68/02/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/320/265/321/200/320/262/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js +1 -1
- package/MODULES/Register/STRUCTS/$struct/class.js +4 -4
- package/NODES/$node/$folder/$class/$node/class.js +35 -35
- package/NODES/$node/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +121 -4
- package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
- package/oda/benchmarks/dbmon/lib/ga.js +11 -11
- package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
- package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
- package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
- package/oda/components/editors/code-editor/code-editor.js +387 -387
- package/oda/components/editors/code-editor/src/ace.js +16 -16
- package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
- package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
- package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
- package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
- package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
- package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
- package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
- package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
- package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
- package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
- package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
- package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-options.js +7 -7
- package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
- package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
- package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
- package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
- package/oda/components/editors/code-editor/src/ext-split.js +7 -7
- package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
- package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
- package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
- package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
- package/oda/components/editors/code-editor/src/mode-css.js +7 -7
- package/oda/components/editors/code-editor/src/mode-html.js +7 -7
- package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
- package/oda/components/editors/code-editor/src/mode-json.js +7 -7
- package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
- package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
- package/oda/components/editors/code-editor/src/mode-text.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
- package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
- package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
- package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
- package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
- package/oda/components/editors/markdown/markdown.js +76 -76
- package/oda/components/inputs/block/readme.md +39 -39
- package/oda/components/inputs/checkbox/checkbox.js +92 -92
- package/oda/components/inputs/color/color.js +83 -83
- package/oda/components/inputs/date/date.js +40 -40
- package/oda/components/inputs/input/input.js +219 -219
- package/oda/components/inputs/link/link.js +1 -1
- package/oda/components/inputs/link/readme.md +42 -42
- package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
- package/oda/components/inputs/numeric/numeric.js +141 -141
- package/oda/components/inputs/table-input/readme.md +39 -39
- package/oda/components/inputs/text/text.js +88 -88
- package/oda/components/inputs/toggle/toggle.js +101 -101
- package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
- package/oda/components/menus/menu/index_old.html +140 -140
- package/oda/components/structure/controls-map.js +56 -56
- package/oda/components/structure/controls.js +29 -29
- package/oda/components/structure/readme.md +31 -31
- package/oda/components/structure/structure.js +64 -64
- package/oda/components/table/index.html +210 -210
- package/oda/components/table/lib/coerce.js +68 -68
- package/oda/components/table/lib/column.js +568 -568
- package/oda/components/table/readme.md +120 -120
- package/oda/components/table/router.js +86 -86
- package/oda/components/table/settings.js +89 -89
- package/oda/index.html +159 -159
- package/oda/tools/icons/icons-set/icons-set.js +60 -60
- package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
- package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
- package/oda/tools/icons/lib/svg/info.json +46 -46
- package/oda/tools/jupyter/demo.ipynb +160 -160
- package/oda/tools/jupyter/lib/print_elements.js +73 -73
- package/oda/tools/jupyter/test-2.ipynb +305 -305
- package/oda/tools/jupyter/test.ipynb +603 -603
- package/oda/tools/styles/adoptedStyleSheets.js +333 -333
- package/oda/tools/tester/device-preview/devices.json +9 -9
- package/package.json +1 -1
- package/rules/rules.md +445 -445
- package/scripts/SYNC-README.md +107 -107
- package/scripts/agent-eval.mjs +223 -223
- package/scripts/dump-svn-chat.mjs +9 -9
- package/scripts/extract-chat-day.mjs +21 -21
- package/scripts/rag-bench.mjs +166 -166
- package/scripts/restore-chat.mjs +166 -166
- package/scripts/sync-svn-git.bat +129 -129
- package/scripts/test-merge.mjs +75 -75
- package/scripts/work-desktop-bridge.mjs +101 -101
- package/sources/client/class.js +3 -0
- package/sources/client/field.js +168 -168
- package/sources/client/handler.js +68 -32
- package/sources/client/index.js +32 -32
- package/sources/client/readme.md +16 -16
- package/sources/client.js +12 -0
- package/sources/core.js +91 -91
- package/sources/data/choices.js +125 -125
- package/sources/host/babel-merge.js +398 -353
- package/sources/host/config.js +48 -48
- package/sources/host/index-db.js +94 -94
- package/sources/host/net-guard.js +228 -228
- package/sources/host/package-install.js +63 -63
- package/sources/host/push.js +86 -86
- package/sources/host/readme.md +41 -41
- package/sources/host/secret-box.js +93 -93
- package/sources/host/server-id.js +26 -26
- package/sources/host/stun.js +33 -33
- package/sources/host/tls-ca.js +60 -60
- package/sources/host/vapid.js +14 -14
- package/sources/index.html +1 -1
- package/sources/modules/a2a/server.js +608 -608
- package/sources/modules/agent/connections.js +442 -442
- package/sources/modules/agent/diff.js +69 -69
- package/sources/modules/agent/eval.js +222 -222
- package/sources/modules/agent/hooks.js +131 -131
- package/sources/modules/agent/index.js +6 -3
- package/sources/modules/agent/log.js +43 -43
- package/sources/modules/agent/loop.js +65 -0
- package/sources/modules/agent/mcp-pool.js +253 -253
- package/sources/modules/agent/recovery.js +89 -89
- package/sources/modules/agent/scope.js +387 -0
- package/sources/modules/agent/session.js +350 -15
- package/sources/modules/agent/taint.js +100 -100
- package/sources/modules/agent/tools/branch.js +311 -311
- package/sources/modules/agent/tools/browser.js +254 -254
- package/sources/modules/agent/tools/computer.js +120 -120
- package/sources/modules/agent/tools/connect.js +316 -316
- package/sources/modules/agent/tools/dev/lsp.js +334 -334
- package/sources/modules/agent/tools/dev/patch.js +564 -564
- package/sources/modules/agent/tools/memory.js +153 -153
- package/sources/modules/agent/tools/meta.js +60 -0
- package/sources/modules/agent/tools/os-files.js +358 -358
- package/sources/modules/agent/tools/plugins.js +80 -80
- package/sources/modules/agent/tools/sandbox.js +268 -268
- package/sources/modules/agent/types.d.ts +183 -183
- package/sources/modules/agent/undo.js +254 -254
- package/sources/modules/agent/util.js +179 -179
- package/sources/modules/contacts/contacts.js +200 -200
- package/sources/modules/contacts/index.html +546 -546
- package/sources/modules/lan/discovery.js +192 -192
- package/sources/modules/lan/store.js +62 -62
- package/sources/modules/mcp/readme.md +70 -70
- package/sources/modules/mcp/server.js +525 -525
- package/sources/modules/mcp/tokens.js +140 -140
- package/sources/modules/nodes/identity.js +123 -123
- package/sources/modules/nodes/outbound.js +105 -105
- package/sources/modules/nodes/signing.js +71 -71
- package/sources/modules/rag/embed-worker.js +36 -36
- package/sources/modules/rag/readme.md +70 -70
- package/sources/modules/readme.md +21 -21
- package/sources/modules/sandbox/config.js +74 -74
- package/sources/modules/sandbox/driver.js +100 -100
- package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
- package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
- package/sources/modules/sandbox/manager.js +1089 -1089
- package/sources/modules/sandbox/readme.md +63 -63
- package/sources/modules/sandbox/vnc-proxy.js +296 -296
- package/sources/server/access/audit.js +138 -138
- package/sources/server/access/refs.js +106 -106
- package/sources/server/assert-class-id.js +23 -23
- package/sources/server/chat-threads.js +16 -5
- package/sources/server/class.js +4 -1
- package/sources/server/external-source.js +90 -90
- package/sources/server/file.js +1 -1
- package/sources/server/folder.js +75 -33
- package/sources/server/handler.js +25 -12
- package/sources/server/index.js +12 -12
- package/sources/server/memory-mark.js +34 -34
- package/sources/server/readme.md +110 -110
- package/sources/server/safe-node-name.js +67 -67
- package/sources/server/server.js +6 -6
- package/sources/server/upload-mark.js +24 -24
- package/sources/server/zip-guard.js +81 -81
- package/whitepaper.md +568 -568
- package/$server/$folder/$class/$module/handlers/pages/form/system/$handler/tabs/mcp/$handler/class.js +0 -9
- package/$server/$folder/$class/$module/handlers/pages/form/system/$handler/tabs/modules/$handler/modules.js +0 -1
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/$handler/tabs/license/$handler/class.js +0 -6
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/agent/$handler/class.js +0 -3
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/messengers/$handler/class.js +0 -3
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/modules/$handler/class.js +0 -3
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/profile/$handler/class.js +0 -5
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2095
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/agent/$handler/class.js +0 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/database/$handler/class.js +0 -9
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/messengers/$handler/class.js +0 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/modules/$handler/class.js +0 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/modules/$handler/modules.js +0 -281
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff/$handler/class.js +0 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff/$handler/staff.js +0 -2126
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
- package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -32
- package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -32
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
- package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -309
- package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/files/$handler/files.js +0 -17
- package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/requisites/$handler/class.js +0 -16
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -760
- package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
- package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
- package/MODULES/$domain/handlers/pages/form/system/$handler/tabs/mcp/$handler/mcp.js +0 -1
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +0 -623
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +0 -134
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +0 -293
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +0 -234
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +0 -406
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/virtual/$handler/virtual.js +0 -399
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/analysis/$handler/analysis.js +0 -9
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/postings/$handler/postings.js +0 -1700
- package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/turnovers/$handler/turnovers.js +0 -9
- package/MODULES/Register/REGISTER/$register/handlers/pages/form/journal/$handler/journal.js +0 -723
- package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
- package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
- package/models/$ai/$folder/$class/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
- package/models/$ai/$folder/$class/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
- package/models/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
- package/models/Local/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
- /package/$server/$folder/$class/$structure/$organization/handlers/pages/form/system/{$handler/tabs/requisites → requisites}/$handler/class.js +0 -0
- /package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/{$handler/tabs/database → database}/$handler/class.js +0 -0
- /package/{models → MODELS}/$ai/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/$ai/$folder/$class/$ai/methods/chat/$method/class.js +0 -0
- /package/{models → MODELS}/$ai/$folder/$class/$provider/class.js +0 -0
- /package/{models → MODELS}/$ai/class.js +0 -0
- /package/{models → MODELS}/$ai/readme.md +0 -0
- /package/{models → MODELS}/GigaChat/$provider/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/GigaChat/$provider/class.js +0 -0
- /package/{models → MODELS}/GigaChat/GigaChat 2 Lite/$ai/class.js +0 -0
- /package/{models → MODELS}/GigaChat/GigaChat 2 Max/$ai/class.js +0 -0
- /package/{models → MODELS}/GigaChat/GigaChat 2 Pro/$ai/class.js +0 -0
- /package/{models → MODELS}/GigaChat/GigaChat Embeddings/$ai/class.js +0 -0
- /package/{models → MODELS}/Local/$provider/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/Local/$provider/class.js +0 -0
- /package/{models → MODELS}/Local/$provider/handlers/methods/transfer/$handler/class.js +0 -0
- /package/{models → MODELS}/MTS-AI/$provider/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/MTS-AI/$provider/class.js +0 -0
- /package/{models → MODELS}/MTS-AI/Cotype Lite/$ai/class.js +0 -0
- /package/{models → MODELS}/MTS-AI/Cotype Pro 2/$ai/class.js +0 -0
- /package/{models → MODELS}/MTS-AI/Cotype Vision/$ai/class.js +0 -0
- /package/{models → MODELS}/T-Bank/$provider/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/T-Bank/$provider/class.js +0 -0
- /package/{models → MODELS}/T-Bank/T-Lite 2.0/$ai/class.js +0 -0
- /package/{models → MODELS}/T-Bank/T-Pro 2.0/$ai/class.js +0 -0
- /package/{models → MODELS}/T-Bank/T-VoiceKit ASR/$ai/class.js +0 -0
- /package/{models → MODELS}/T-Bank/T-VoiceKit TTS/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/$provider/$folder/$class/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/$provider/class.js +0 -0
- /package/{models → MODELS}/Yandex/Alice AI (YandexGPT 5 Pro)/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/Yandex Embeddings/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/Yandex SpeechKit ASR/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/Yandex SpeechKit TTS/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/YandexART/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/YandexGPT 5 Lite/$ai/class.js +0 -0
- /package/{models → MODELS}/Yandex/YandexGPT Reasoning/$ai/class.js +0 -0
- /package/{users → USERS}/$users/class.js +0 -0
|
@@ -1,1371 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* form/object — стандартная вьюха редактора объекта/документа на стандартной форме work-form (Скрин 6).
|
|
3
|
-
* Верхний тулбар хендлеров отключён через allowTools: false у хендлера.
|
|
4
|
-
* Сервисные действия (Провести / Проведен / Отменить, Печать, Удалить / Восстановить) выводятся
|
|
5
|
-
* в левой части подвала формы (#focusedTools), а кнопки OK / Сохранить / Закрыть и вкладки — в правой.
|
|
6
|
-
*/
|
|
7
|
-
import objectsProto from '../../objects/$handler/objects.js';
|
|
8
|
-
|
|
9
|
-
function _day(d) {
|
|
10
|
-
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
11
|
-
}
|
|
12
|
-
const _today = () => _day(new Date());
|
|
13
|
-
|
|
14
|
-
const proto = Object.defineProperties({}, Object.getOwnPropertyDescriptors(objectsProto));
|
|
15
|
-
|
|
16
|
-
Object.defineProperties(proto, Object.getOwnPropertyDescriptors({
|
|
17
|
-
imports: 'oda//button, oda//icon, ~/lib//editor-form, ~/lib//class-picker',
|
|
18
|
-
isObjectView: true,
|
|
19
|
-
allowSave: true,
|
|
20
|
-
hasSettings: true,
|
|
21
|
-
designMode: false,
|
|
22
|
-
binderParents: null,
|
|
23
|
-
binderChildren: null,
|
|
24
|
-
_basisId: '',
|
|
25
|
-
_basisTitle: '',
|
|
26
|
-
_dirtyTick: 0,
|
|
27
|
-
get isReadonly() {
|
|
28
|
-
void this._dirtyTick;
|
|
29
|
-
if (!this.editing)
|
|
30
|
-
return true;
|
|
31
|
-
if (this.status === 'deleted')
|
|
32
|
-
return true;
|
|
33
|
-
if (this.isOperation && this.status === 'registered')
|
|
34
|
-
return true;
|
|
35
|
-
return false;
|
|
36
|
-
},
|
|
37
|
-
get canSave() {
|
|
38
|
-
return Boolean(this.editing && !this.isReadonly);
|
|
39
|
-
},
|
|
40
|
-
get canRemove() {
|
|
41
|
-
return Boolean(this.editing?.id && (!this.isOperation || this.status === 'draft' || this.status === 'cancelled') && this.status !== 'deleted');
|
|
42
|
-
},
|
|
43
|
-
get canRegister() {
|
|
44
|
-
return Boolean(this.isOperation && this.editing && (!this.editing.id || this.status === 'draft' || this.status === 'cancelled'));
|
|
45
|
-
},
|
|
46
|
-
get canCancel() {
|
|
47
|
-
return Boolean(this.isOperation && this.status === 'registered');
|
|
48
|
-
},
|
|
49
|
-
get isChanged() {
|
|
50
|
-
void this._dirtyTick;
|
|
51
|
-
return Boolean(this.canSave && (!this.editing?.id || this.isDirty()));
|
|
52
|
-
},
|
|
53
|
-
snapshot() {
|
|
54
|
-
objectsProto.snapshot.call(this);
|
|
55
|
-
this._dirtyTick++;
|
|
56
|
-
this._notifyForm();
|
|
57
|
-
},
|
|
58
|
-
get layoutKey() {
|
|
59
|
-
return this.activeSchema?.path || this.schema?.path || this.$item?.short || this.$item?.path || this.activeSchema?.cid || '';
|
|
60
|
-
},
|
|
61
|
-
get documentTitle() {
|
|
62
|
-
void this._dirtyTick;
|
|
63
|
-
const clsTitle = this.activeSchema?.title || this.schema?.title || this.$item?.DATA?.label || this.$item?.label || '';
|
|
64
|
-
const fields = typeof this.fieldList === 'function' ? this.fieldList() : [];
|
|
65
|
-
const nameField = fields.find(f => ['name', 'label', 'title'].includes(f.id));
|
|
66
|
-
const explicitName = nameField ? String(this.editing?.[nameField.id] ?? '').trim() : '';
|
|
67
|
-
if (explicitName) {
|
|
68
|
-
if (!clsTitle || explicitName === clsTitle || explicitName.startsWith(clsTitle))
|
|
69
|
-
return explicitName;
|
|
70
|
-
return `${clsTitle} · ${explicitName}`;
|
|
71
|
-
}
|
|
72
|
-
if (this.isOperation && this.editing) {
|
|
73
|
-
const num = String(this.editing?.num ?? this.editing?.doc_number ?? this.editing?.order_number ?? this.editing?.number ?? this.editing?.doc_num ?? '').trim();
|
|
74
|
-
const hasManualNum = Boolean(num && num !== this._autoGeneratedNum);
|
|
75
|
-
const rawTime = String(this.editing?.time ?? '').trim();
|
|
76
|
-
let dateStr = rawTime;
|
|
77
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(rawTime)) {
|
|
78
|
-
const [y, m, d] = rawTime.split('-');
|
|
79
|
-
dateStr = `${d}.${m}.${y}`;
|
|
80
|
-
}
|
|
81
|
-
let partyName = '';
|
|
82
|
-
const partyKeys = ['recipient_name', 'payer_name', 'counterparty_name', 'recipient', 'payer', 'counterparty', 'client', 'supplier', 'customer', 'employee', 'person', 'agent'];
|
|
83
|
-
for (const pk of partyKeys) {
|
|
84
|
-
const val = String(this.editing?.[pk] ?? '').trim();
|
|
85
|
-
if (!val)
|
|
86
|
-
continue;
|
|
87
|
-
const resolved = this.names?.[val] || this.entryNames?.objects?.[val] || (!/^\d+\.[A-Za-z0-9]+$/.test(val) ? val : '');
|
|
88
|
-
if (resolved) {
|
|
89
|
-
partyName = resolved;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (!partyName) {
|
|
94
|
-
for (const f of fields) {
|
|
95
|
-
if (f.type === 'Link') {
|
|
96
|
-
const val = String(this.editing?.[f.id] ?? '').trim();
|
|
97
|
-
if (!val)
|
|
98
|
-
continue;
|
|
99
|
-
const resolved = this.names?.[val] || this.entryNames?.objects?.[val];
|
|
100
|
-
if (resolved) {
|
|
101
|
-
partyName = resolved;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (this.editing?.id || hasManualNum || partyName || (rawTime && rawTime !== _today())) {
|
|
108
|
-
const numPart = num ? ` №${num}` : '';
|
|
109
|
-
const datePart = dateStr ? ` от ${dateStr}` : '';
|
|
110
|
-
const partyPart = partyName ? ` - ${partyName}` : '';
|
|
111
|
-
if (numPart || datePart || partyPart)
|
|
112
|
-
return `${clsTitle}${numPart}${datePart}${partyPart}`;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (!this.editing?.id) {
|
|
116
|
-
const fmtNew = globalThis.__workClassPicker?.formatNewObjectLabel || globalThis.WORK?.formatNewObjectLabel;
|
|
117
|
-
if (typeof fmtNew === 'function' && clsTitle)
|
|
118
|
-
return fmtNew(clsTitle);
|
|
119
|
-
}
|
|
120
|
-
return this.editorTitle;
|
|
121
|
-
},
|
|
122
|
-
toggleDesignMode() {
|
|
123
|
-
this.designMode = !this.designMode;
|
|
124
|
-
},
|
|
125
|
-
showSettings() {
|
|
126
|
-
this.designMode = !this.designMode;
|
|
127
|
-
},
|
|
128
|
-
template: /*html*/`
|
|
129
|
-
<style>
|
|
130
|
-
:host {
|
|
131
|
-
@apply --vertical;
|
|
132
|
-
@apply --flex;
|
|
133
|
-
background: var(--content-background, #fff);
|
|
134
|
-
color: var(--content-color, #222);
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
font-size: 13px;
|
|
137
|
-
}
|
|
138
|
-
.obj-header {
|
|
139
|
-
@apply --horizontal;
|
|
140
|
-
align-items: center;
|
|
141
|
-
justify-content: space-between;
|
|
142
|
-
gap: 12px;
|
|
143
|
-
padding: 8px 16px 4px;
|
|
144
|
-
flex-shrink: 0;
|
|
145
|
-
}
|
|
146
|
-
.obj-title {
|
|
147
|
-
font-size: 16px;
|
|
148
|
-
font-weight: 700;
|
|
149
|
-
color: var(--accent-color);
|
|
150
|
-
overflow: hidden;
|
|
151
|
-
text-overflow: ellipsis;
|
|
152
|
-
white-space: nowrap;
|
|
153
|
-
}
|
|
154
|
-
.obj-header-right {
|
|
155
|
-
display: inline-flex;
|
|
156
|
-
flex-direction: row;
|
|
157
|
-
align-items: center;
|
|
158
|
-
gap: 8px;
|
|
159
|
-
flex-shrink: 0;
|
|
160
|
-
}
|
|
161
|
-
.design-toggle-btn {
|
|
162
|
-
display: inline-flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
gap: 4px;
|
|
165
|
-
padding: 3px 9px;
|
|
166
|
-
font-size: 12px;
|
|
167
|
-
font-weight: 600;
|
|
168
|
-
border: 1px solid var(--border-color);
|
|
169
|
-
border-radius: var(--radius-xs, 4px);
|
|
170
|
-
background: var(--subtle-background);
|
|
171
|
-
color: var(--content-color);
|
|
172
|
-
cursor: pointer;
|
|
173
|
-
user-select: none;
|
|
174
|
-
}
|
|
175
|
-
.design-toggle-btn.active, .design-toggle-btn:hover {
|
|
176
|
-
border-color: var(--accent-color);
|
|
177
|
-
background: var(--accent-soft);
|
|
178
|
-
color: var(--accent-color);
|
|
179
|
-
}
|
|
180
|
-
.context {
|
|
181
|
-
@apply --horizontal;
|
|
182
|
-
align-items: center;
|
|
183
|
-
gap: 6px;
|
|
184
|
-
font-size: 12px;
|
|
185
|
-
flex-shrink: 0;
|
|
186
|
-
}
|
|
187
|
-
.context select {
|
|
188
|
-
padding: 2px 6px;
|
|
189
|
-
font-size: 12px;
|
|
190
|
-
border: 1px solid var(--border-color);
|
|
191
|
-
border-radius: 3px;
|
|
192
|
-
background: var(--content-background);
|
|
193
|
-
color: var(--content-color);
|
|
194
|
-
}
|
|
195
|
-
.obj-scroll {
|
|
196
|
-
@apply --vertical;
|
|
197
|
-
flex: 1;
|
|
198
|
-
min-height: 0;
|
|
199
|
-
overflow-y: auto;
|
|
200
|
-
padding-bottom: 8px;
|
|
201
|
-
}
|
|
202
|
-
oda-editor-form {
|
|
203
|
-
flex-shrink: 0;
|
|
204
|
-
}
|
|
205
|
-
.error {
|
|
206
|
-
padding: 6px 16px;
|
|
207
|
-
color: var(--error-color);
|
|
208
|
-
background: var(--error-soft);
|
|
209
|
-
border-top: 1px solid var(--error-color);
|
|
210
|
-
border-bottom: 1px solid var(--error-color);
|
|
211
|
-
white-space: break-spaces;
|
|
212
|
-
font-size: 12.5px;
|
|
213
|
-
}
|
|
214
|
-
.entries {
|
|
215
|
-
@apply --vertical;
|
|
216
|
-
gap: 3px;
|
|
217
|
-
margin: 6px 16px 0;
|
|
218
|
-
padding: 8px 10px;
|
|
219
|
-
font-size: 12px;
|
|
220
|
-
background: var(--subtle-background);
|
|
221
|
-
border: 1px solid var(--border-color);
|
|
222
|
-
border-radius: var(--radius-xs, 4px);
|
|
223
|
-
}
|
|
224
|
-
.entries-title {
|
|
225
|
-
font-weight: 700;
|
|
226
|
-
color: var(--content-color);
|
|
227
|
-
margin-bottom: 2px;
|
|
228
|
-
}
|
|
229
|
-
.trajectory {
|
|
230
|
-
@apply --vertical;
|
|
231
|
-
gap: 4px;
|
|
232
|
-
margin: 6px 16px 0;
|
|
233
|
-
padding: 8px 10px;
|
|
234
|
-
font-size: 12px;
|
|
235
|
-
background: var(--subtle-background);
|
|
236
|
-
border: 1px solid var(--border-color);
|
|
237
|
-
border-radius: var(--radius-xs, 4px);
|
|
238
|
-
}
|
|
239
|
-
.trajectory-title {
|
|
240
|
-
font-weight: 700;
|
|
241
|
-
color: var(--content-color);
|
|
242
|
-
}
|
|
243
|
-
.traj-row {
|
|
244
|
-
@apply --horizontal;
|
|
245
|
-
gap: 8px;
|
|
246
|
-
align-items: center;
|
|
247
|
-
}
|
|
248
|
-
.traj-link {
|
|
249
|
-
cursor: pointer;
|
|
250
|
-
text-decoration: underline;
|
|
251
|
-
color: var(--accent-color);
|
|
252
|
-
}
|
|
253
|
-
.traj-num {
|
|
254
|
-
margin-left: auto;
|
|
255
|
-
text-align: right;
|
|
256
|
-
font-variant-numeric: tabular-nums;
|
|
257
|
-
}
|
|
258
|
-
</style>
|
|
259
|
-
<div class="obj-header">
|
|
260
|
-
<div class="obj-title" :title="documentTitle">{{documentTitle}}</div>
|
|
261
|
-
<div class="obj-header-right">
|
|
262
|
-
<label class="context" ~if="showContext && !editing?.id">От места:
|
|
263
|
-
<select @change="contextKey = $this.value">
|
|
264
|
-
<option ~for="contexts" :value="contextKeyOf($for.item)"
|
|
265
|
-
:selected="contextKeyOf($for.item) === contextKeyOf(context)">{{contextTitle($for.item)}}</option>
|
|
266
|
-
</select>
|
|
267
|
-
</label>
|
|
268
|
-
<button type="button" class="design-toggle-btn" ~class="{active: designMode}" title="Дизайн расположения и кастомизация полей формы" @tap="toggleDesignMode()">
|
|
269
|
-
<oda-icon icon="icons:settings" icon-size="15"></oda-icon>
|
|
270
|
-
<span>{{designMode ? 'Готово' : 'Поля'}}</span>
|
|
271
|
-
</button>
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
<div class="error" ~if="error">{{error}}</div>
|
|
275
|
-
<div class="obj-scroll">
|
|
276
|
-
<oda-editor-form ~if="editing" hide-title ::design-mode="designMode" :layout-key="layoutKey" :readonly="isReadonly"
|
|
277
|
-
:metadata="activeSchema" :data="editing" :field-errors="fieldErrors"
|
|
278
|
-
@input="onFormInput" @change="onFormInput" @cell-changed="onFormInput"></oda-editor-form>
|
|
279
|
-
<div class="entries" ~if="entries?.length">
|
|
280
|
-
<div class="entries-title">Проводки:</div>
|
|
281
|
-
<div class="entry" ~for="entries">{{entryText($for.item)}}</div>
|
|
282
|
-
</div>
|
|
283
|
-
<div class="entries" ~if="binderParents?.length || binderChildren?.length || _basisTitle">
|
|
284
|
-
<div class="entries-title" style="display:flex; align-items:center; justify-content:space-between;">
|
|
285
|
-
<span>Подшивка документов:</span>
|
|
286
|
-
<span class="traj-link" style="font-weight:500;" ~if="editing?.id" @tap="openBinderDialog()">Управление подшивкой…</span>
|
|
287
|
-
</div>
|
|
288
|
-
<div class="traj-row" ~if="_basisTitle && !editing?.id">
|
|
289
|
-
<span style="color:var(--muted-color);">На основании:</span>
|
|
290
|
-
<span style="font-weight:600;">{{_basisTitle}}</span>
|
|
291
|
-
</div>
|
|
292
|
-
<div class="traj-row" ~for="binderParents">
|
|
293
|
-
<span style="color:var(--muted-color); min-width:82px;">Основание:</span>
|
|
294
|
-
<span class="traj-link" @tap="openBinderItem($for.item)">{{$for.item.title}}</span>
|
|
295
|
-
<span style="color:var(--muted-color);">{{formatBinderDate($for.item.date)}}</span>
|
|
296
|
-
<span class="traj-num" ~if="$for.item.sum">{{formatBinderMoney($for.item.sum)}} ₽</span>
|
|
297
|
-
</div>
|
|
298
|
-
<div class="traj-row" ~for="binderChildren">
|
|
299
|
-
<span style="color:var(--muted-color); min-width:82px;">Следствие:</span>
|
|
300
|
-
<span class="traj-link" @tap="openBinderItem($for.item)">{{$for.item.title}}</span>
|
|
301
|
-
<span style="color:var(--muted-color);">{{formatBinderDate($for.item.date)}}</span>
|
|
302
|
-
<span class="traj-num" ~if="$for.item.sum">{{formatBinderMoney($for.item.sum)}} ₽</span>
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
<div class="trajectory" ~if="objectBalances?.length || trajectory?.length">
|
|
306
|
-
<div class="trajectory-title" ~if="objectBalances?.length">Остатки по счетам</div>
|
|
307
|
-
<div class="traj-row" ~for="objectBalances">
|
|
308
|
-
<span class="traj-link" @tap="openBalanceAccount($for.item)">{{$for.item.label}}</span>
|
|
309
|
-
<span class="traj-num">{{$for.item.balance}}{{$for.item.qty ? ' (' + $for.item.qty + ')' : ''}}</span>
|
|
310
|
-
</div>
|
|
311
|
-
<div class="trajectory-title" ~if="trajectory?.length">Движения ({{trajectory.length}})</div>
|
|
312
|
-
<div class="traj-row" ~for="trajectory">
|
|
313
|
-
<span>{{$for.item.date}}</span>
|
|
314
|
-
<span class="traj-link" @tap="openTrajectoryOp($for.item)">{{$for.item.op}}</span>
|
|
315
|
-
<span>{{$for.item.account}}</span>
|
|
316
|
-
<span class="traj-num">{{$for.item.debit ? '+' + $for.item.debit : ($for.item.credit ? '−' + $for.item.credit : $for.item.qty)}} → {{$for.item.balance}}</span>
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
</div>
|
|
320
|
-
`,
|
|
321
|
-
mountToolbarSlots() {
|
|
322
|
-
// У формы объекта верхнего тулбара нет (allowTools: false)
|
|
323
|
-
},
|
|
324
|
-
getItemButtons() {
|
|
325
|
-
return [];
|
|
326
|
-
},
|
|
327
|
-
getFocusedButtons() {
|
|
328
|
-
return [];
|
|
329
|
-
},
|
|
330
|
-
getFocusedServices() {
|
|
331
|
-
const list = [];
|
|
332
|
-
if (this.isOperation) {
|
|
333
|
-
if (this.canRegister) {
|
|
334
|
-
list.push({
|
|
335
|
-
id: 'post',
|
|
336
|
-
label: 'Провести',
|
|
337
|
-
icon: 'icons:settings',
|
|
338
|
-
isService: true,
|
|
339
|
-
service: true,
|
|
340
|
-
order: 1,
|
|
341
|
-
disabled: this.busy,
|
|
342
|
-
execute: async () => {
|
|
343
|
-
await this.post();
|
|
344
|
-
this._notifyForm();
|
|
345
|
-
},
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
else if (this.canCancel) {
|
|
349
|
-
list.push({
|
|
350
|
-
id: 'cancel',
|
|
351
|
-
label: 'Проведен (Отменить)',
|
|
352
|
-
icon: 'icons:settings',
|
|
353
|
-
isService: true,
|
|
354
|
-
service: true,
|
|
355
|
-
order: 1,
|
|
356
|
-
disabled: this.busy,
|
|
357
|
-
execute: async () => {
|
|
358
|
-
await this.cancelOperation();
|
|
359
|
-
this._notifyForm();
|
|
360
|
-
},
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
if (this.editing?.id) {
|
|
364
|
-
const binderCount = (this.binderParents?.length || 0) + (this.binderChildren?.length || 0);
|
|
365
|
-
list.push({
|
|
366
|
-
id: 'binder',
|
|
367
|
-
label: binderCount > 0 ? `Подшивка (${binderCount})` : 'Подшивка',
|
|
368
|
-
icon: 'icons:folder-open',
|
|
369
|
-
isService: true,
|
|
370
|
-
service: true,
|
|
371
|
-
order: 2,
|
|
372
|
-
disabled: this.busy,
|
|
373
|
-
execute: () => this.openBinderDialog(),
|
|
374
|
-
});
|
|
375
|
-
const singlePrint = (this.printForms || []).length === 1 ? this.printForms[0] : null;
|
|
376
|
-
list.push({
|
|
377
|
-
id: 'print',
|
|
378
|
-
label: 'Печать',
|
|
379
|
-
icon: 'icons:print',
|
|
380
|
-
isService: true,
|
|
381
|
-
service: true,
|
|
382
|
-
order: 3,
|
|
383
|
-
disabled: this.busy,
|
|
384
|
-
execute: () => this.openPrintDialog(singlePrint?.name || ''),
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (this.canRemove) {
|
|
389
|
-
list.push({
|
|
390
|
-
id: 'remove',
|
|
391
|
-
label: 'Удалить',
|
|
392
|
-
icon: 'icons:delete',
|
|
393
|
-
isService: true,
|
|
394
|
-
service: true,
|
|
395
|
-
order: 10,
|
|
396
|
-
disabled: this.busy,
|
|
397
|
-
execute: async () => {
|
|
398
|
-
if (await this.removeObject()) {
|
|
399
|
-
this._findFormHost()?.closeActiveTab?.(true);
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
if (this.canRestore) {
|
|
405
|
-
list.push({
|
|
406
|
-
id: 'restore',
|
|
407
|
-
label: 'Восстановить',
|
|
408
|
-
icon: 'icons:restore',
|
|
409
|
-
isService: true,
|
|
410
|
-
service: true,
|
|
411
|
-
order: 11,
|
|
412
|
-
disabled: this.busy,
|
|
413
|
-
execute: async () => {
|
|
414
|
-
await this.restoreObject();
|
|
415
|
-
this._notifyForm();
|
|
416
|
-
},
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
return list;
|
|
420
|
-
},
|
|
421
|
-
onFormInput(e) {
|
|
422
|
-
const rawDetail = e?.detail;
|
|
423
|
-
const d = (rawDetail && typeof rawDetail.value === 'object' && rawDetail.value !== null) ? rawDetail.value : rawDetail;
|
|
424
|
-
if (d && typeof d === 'object' && d.value && d.label && d.label !== d.value) {
|
|
425
|
-
this.names = { ...(this.names || {}), [d.value]: d.label };
|
|
426
|
-
}
|
|
427
|
-
if (d && typeof d === 'object' && d.id === 'time' && this.isOperation && !this.editing?.id) {
|
|
428
|
-
const nextPeriodKey = this._periodKeyForNumerator?.(this.editing?.time);
|
|
429
|
-
if (nextPeriodKey && nextPeriodKey !== this._autoNumPeriodKey) {
|
|
430
|
-
this._assignAutoNumber?.(false);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (this.fieldErrors && Object.keys(this.fieldErrors).length)
|
|
434
|
-
this.fieldErrors = {};
|
|
435
|
-
this._dirtyTick++;
|
|
436
|
-
this.schedulePreview?.();
|
|
437
|
-
const host = this._findFormHost();
|
|
438
|
-
host?.updateActiveTabLabel?.(this.documentTitle);
|
|
439
|
-
this._notifyForm();
|
|
440
|
-
},
|
|
441
|
-
async attached() {
|
|
442
|
-
if (this._attachedDone && !this._initialNav && !this._pendingNav)
|
|
443
|
-
return;
|
|
444
|
-
const initNav = this._initialNav || this._pendingNav;
|
|
445
|
-
this._initialNav = null;
|
|
446
|
-
this._pendingNav = null;
|
|
447
|
-
try {
|
|
448
|
-
await Promise.all([this.loadSchema(), this.loadScope()]);
|
|
449
|
-
}
|
|
450
|
-
catch (e) {
|
|
451
|
-
this.error = String(e?.message || e);
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
if (initNav) {
|
|
455
|
-
await this.initFromNav(initNav);
|
|
456
|
-
}
|
|
457
|
-
else if (!this.editing) {
|
|
458
|
-
await this.initFromNav({});
|
|
459
|
-
}
|
|
460
|
-
this._attachedDone = true;
|
|
461
|
-
},
|
|
462
|
-
async applyNav(nav = {}) {
|
|
463
|
-
if (!this.schema) {
|
|
464
|
-
this._pendingNav = nav;
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
await this.initFromNav(nav);
|
|
468
|
-
},
|
|
469
|
-
async initFromNav(nav = {}) {
|
|
470
|
-
this.clearError();
|
|
471
|
-
this._basisId = String(nav.basisId || '');
|
|
472
|
-
this._basisTitle = String(nav.basisTitle || '');
|
|
473
|
-
this.binderParents = [];
|
|
474
|
-
this.binderChildren = [];
|
|
475
|
-
if (nav.leafCid) {
|
|
476
|
-
await this.loadLeafSchema(nav.leafCid);
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
this.leafCid = '';
|
|
480
|
-
this.leafSchema = null;
|
|
481
|
-
}
|
|
482
|
-
if (nav.id) {
|
|
483
|
-
await this.select({ id: String(nav.id), cid: nav.leafCid || '' });
|
|
484
|
-
}
|
|
485
|
-
else if (nav.copyFrom) {
|
|
486
|
-
const found = await this.$item.fetch('db_read', { id: String(nav.copyFrom) });
|
|
487
|
-
if (found?.names && typeof found.names === 'object')
|
|
488
|
-
this.names = { ...(this.names || {}), ...found.names };
|
|
489
|
-
await this.loadLeafSchema(found?.cid || nav.leafCid || '');
|
|
490
|
-
const baseBody = { ...(found?.body || {}) };
|
|
491
|
-
delete baseBody.id;
|
|
492
|
-
delete baseBody.version;
|
|
493
|
-
delete baseBody.status;
|
|
494
|
-
const nf = this._numeratorFieldId?.() || '';
|
|
495
|
-
if (nf)
|
|
496
|
-
delete baseBody[nf];
|
|
497
|
-
this.editing = this.isOperation ? { ...baseBody, time: _today() } : baseBody;
|
|
498
|
-
await this._assignAutoNumber?.(true);
|
|
499
|
-
this.entries = [];
|
|
500
|
-
this.entryNames = { objects: {}, classes: {} };
|
|
501
|
-
this.objectBalances = [];
|
|
502
|
-
this.trajectory = [];
|
|
503
|
-
this.printForms = [];
|
|
504
|
-
if (this.isOperation)
|
|
505
|
-
this.schedulePreview();
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
if (nav.names && typeof nav.names === 'object')
|
|
509
|
-
this.names = { ...(this.names || {}), ...nav.names };
|
|
510
|
-
if (nav.unit && Array.isArray(this.contexts) && this.contexts.length) {
|
|
511
|
-
const match = this.contexts.find(c => c.unit === nav.unit);
|
|
512
|
-
if (match)
|
|
513
|
-
this.contextKey = `${match.unit}|${match.place ?? ''}`;
|
|
514
|
-
}
|
|
515
|
-
this.editing = this.isOperation ? { time: _today(), ...(nav.initialData || {}) } : { ...(nav.initialData || {}) };
|
|
516
|
-
await this._assignAutoNumber?.(true);
|
|
517
|
-
this.entries = [];
|
|
518
|
-
this.entryNames = { objects: {}, classes: {} };
|
|
519
|
-
this.objectBalances = [];
|
|
520
|
-
this.trajectory = [];
|
|
521
|
-
this.printForms = [];
|
|
522
|
-
if (this.isOperation)
|
|
523
|
-
this.schedulePreview();
|
|
524
|
-
}
|
|
525
|
-
this.focusedItem = this.editing || { id: nav.id || 'new' };
|
|
526
|
-
this.snapshot();
|
|
527
|
-
this.async?.(() => {
|
|
528
|
-
if (this.isConnected)
|
|
529
|
-
this.snapshot();
|
|
530
|
-
});
|
|
531
|
-
const host = this._findFormHost();
|
|
532
|
-
host?.updateActiveTabLabel?.(this.documentTitle);
|
|
533
|
-
this._notifyForm();
|
|
534
|
-
},
|
|
535
|
-
async select(row) {
|
|
536
|
-
await objectsProto.select.call(this, row);
|
|
537
|
-
if (this.isOperation && this.editing?.id) {
|
|
538
|
-
await this.loadBinder();
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
|
-
writeParams(extra = {}) {
|
|
542
|
-
const p = objectsProto.writeParams.call(this, extra);
|
|
543
|
-
if (!this.editing?.id && this._basisId) {
|
|
544
|
-
p.basis_id = this._basisId;
|
|
545
|
-
}
|
|
546
|
-
return p;
|
|
547
|
-
},
|
|
548
|
-
formatBinderDate(d) {
|
|
549
|
-
const s = String(d || '').slice(0, 10);
|
|
550
|
-
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
551
|
-
return m ? `${m[3]}.${m[2]}.${m[1]}` : s;
|
|
552
|
-
},
|
|
553
|
-
formatBinderMoney(v) {
|
|
554
|
-
return (Number(v) || 0).toLocaleString('ru-RU', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
555
|
-
},
|
|
556
|
-
async loadBinder() {
|
|
557
|
-
this.binderParents = [];
|
|
558
|
-
this.binderChildren = [];
|
|
559
|
-
if (!this.isOperation || !this.editing?.id)
|
|
560
|
-
return;
|
|
561
|
-
try {
|
|
562
|
-
const target = await this.targetItem();
|
|
563
|
-
const res = await target.fetch('db_binder', { id: this.editing.id });
|
|
564
|
-
this.binderParents = Array.isArray(res?.parents) ? res.parents : [];
|
|
565
|
-
this.binderChildren = Array.isArray(res?.children) ? res.children : [];
|
|
566
|
-
this._notifyForm();
|
|
567
|
-
}
|
|
568
|
-
catch {
|
|
569
|
-
this.binderParents = [];
|
|
570
|
-
this.binderChildren = [];
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
async openBinderItem(item) {
|
|
574
|
-
if (!item?.id)
|
|
575
|
-
return;
|
|
576
|
-
const path = item.path || item.cid || '';
|
|
577
|
-
if (!path || typeof WORK?.get_item !== 'function')
|
|
578
|
-
return;
|
|
579
|
-
try {
|
|
580
|
-
const target = await WORK.get_item(path);
|
|
581
|
-
if (!target)
|
|
582
|
-
return;
|
|
583
|
-
const nav = { view: 'object', id: item.id, leafCid: item.cid || '', label: item.title || item.id };
|
|
584
|
-
const formHost = this._findFormHost();
|
|
585
|
-
if (formHost && typeof formHost.openInForm === 'function')
|
|
586
|
-
await formHost.openInForm(target, nav);
|
|
587
|
-
else if (typeof window !== 'undefined' && typeof window.execute === 'function')
|
|
588
|
-
window.execute(target, nav);
|
|
589
|
-
}
|
|
590
|
-
catch (e) {
|
|
591
|
-
this.error = String(e?.message || e);
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
async openBinderDialog() {
|
|
595
|
-
if (!this.editing?.id || typeof WORK?.showModal !== 'function' || typeof document === 'undefined')
|
|
596
|
-
return;
|
|
597
|
-
const dlg = ODA.createComponent('oda-doc-binder', {
|
|
598
|
-
owner: this,
|
|
599
|
-
docId: this.editing.id,
|
|
600
|
-
docTitle: this.documentTitle,
|
|
601
|
-
});
|
|
602
|
-
try {
|
|
603
|
-
await WORK.showModal(dlg, {
|
|
604
|
-
TITLE: { label: `Подшивка · ${this.documentTitle}` },
|
|
605
|
-
allowClose: true,
|
|
606
|
-
width: Math.min(760, (window.innerWidth || 800) - 32),
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
catch { /* ignore */ }
|
|
610
|
-
await this.loadBinder();
|
|
611
|
-
},
|
|
612
|
-
async createBasedOnOperation() {
|
|
613
|
-
if (!this.editing?.id)
|
|
614
|
-
return;
|
|
615
|
-
const curPath = String(this.$item?.short || this.$item?.path || '');
|
|
616
|
-
const rootMatch = curPath.match(/^(\/(?:ORGANIZATIONS|PROJECTS)\/[^/]+\/MODULES\/[^/]+\/OPERATIONS|\/MODULES\/[^/]+\/OPERATIONS)/);
|
|
617
|
-
const opRootPath = rootMatch ? rootMatch[1] : curPath;
|
|
618
|
-
let rootItem = this.$item;
|
|
619
|
-
if (opRootPath && typeof WORK?.get_item === 'function') {
|
|
620
|
-
rootItem = (await WORK.get_item(opRootPath).catch(() => null)) || this.$item;
|
|
621
|
-
}
|
|
622
|
-
let classesMap = this.classes;
|
|
623
|
-
let leavesList = this.leaves;
|
|
624
|
-
try {
|
|
625
|
-
const schemaRes = await rootItem.fetch('db_schema');
|
|
626
|
-
if (schemaRes?.classes)
|
|
627
|
-
classesMap = schemaRes.classes;
|
|
628
|
-
if (Array.isArray(schemaRes?.leaves) && schemaRes.leaves.length)
|
|
629
|
-
leavesList = schemaRes.leaves;
|
|
630
|
-
}
|
|
631
|
-
catch { /* ignore */ }
|
|
632
|
-
|
|
633
|
-
const pickFn = globalThis.__workClassPicker?.pickClassFromTree || globalThis.WORK?.pickClassFromTree;
|
|
634
|
-
let chosen = null;
|
|
635
|
-
if (typeof pickFn === 'function' && Array.isArray(leavesList) && leavesList.length > 1) {
|
|
636
|
-
chosen = await pickFn({
|
|
637
|
-
classes: classesMap,
|
|
638
|
-
leaves: leavesList,
|
|
639
|
-
rootCid: opRootPath,
|
|
640
|
-
rootLabel: 'Операции',
|
|
641
|
-
title: `Создать на основании «${this.documentTitle}»`,
|
|
642
|
-
defaultIcon: 'carbon:task-complete',
|
|
643
|
-
defaultType: '$operation',
|
|
644
|
-
});
|
|
645
|
-
if (!chosen)
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
else if (Array.isArray(leavesList) && leavesList.length === 1) {
|
|
649
|
-
chosen = leavesList[0];
|
|
650
|
-
}
|
|
651
|
-
const targetPath = chosen?.path || chosen?.cid || curPath;
|
|
652
|
-
const targetItem = (typeof WORK?.get_item === 'function' ? await WORK.get_item(targetPath).catch(() => null) : null) || this.$item;
|
|
653
|
-
let targetFields = [];
|
|
654
|
-
try {
|
|
655
|
-
const ts = await targetItem.fetch('db_schema');
|
|
656
|
-
targetFields = Array.isArray(ts?.schema?.fields) ? ts.schema.fields : [];
|
|
657
|
-
}
|
|
658
|
-
catch { /* ignore */ }
|
|
659
|
-
|
|
660
|
-
const src = this.editing || {};
|
|
661
|
-
const initialData = {};
|
|
662
|
-
const targetFieldIds = new Set(targetFields.map(f => f.id));
|
|
663
|
-
const copyDirect = ['sum', 'amount', 'total', 'nds', 'sum_n', 'nds_sum', 'vat_sum', 'recipient', 'recipient_name', 'payer', 'payer_name', 'counterparty', 'counterparty_name', 'client', 'supplier', 'customer', 'employee', 'person', 'contract', 'acct', 'acct_r'];
|
|
664
|
-
for (const k of copyDirect) {
|
|
665
|
-
if (src[k] !== undefined && src[k] !== null && src[k] !== '' && (!targetFieldIds.size || targetFieldIds.has(k))) {
|
|
666
|
-
initialData[k] = src[k];
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
// Если в исходном документе контрагент в client/supplier/counterparty, а в целевом — в recipient/payer
|
|
670
|
-
const srcPartyId = src.recipient || src.payer || src.counterparty || src.client || src.supplier || src.customer || src.employee || '';
|
|
671
|
-
const srcPartyName = src.recipient_name || src.payer_name || src.counterparty_name || (srcPartyId && this.names?.[srcPartyId]) || '';
|
|
672
|
-
if (srcPartyId) {
|
|
673
|
-
for (const pk of ['recipient', 'payer', 'counterparty', 'client', 'supplier', 'customer', 'employee']) {
|
|
674
|
-
if (targetFieldIds.has(pk) && !initialData[pk])
|
|
675
|
-
initialData[pk] = srcPartyId;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
if (srcPartyName) {
|
|
679
|
-
for (const nk of ['recipient_name', 'payer_name', 'counterparty_name']) {
|
|
680
|
-
if (targetFieldIds.has(nk) && !initialData[nk])
|
|
681
|
-
initialData[nk] = srcPartyName;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
const basisText = `По документу: ${this.documentTitle}`;
|
|
685
|
-
for (const dk of ['descript', 'purpose', 'base', 'comment']) {
|
|
686
|
-
if (targetFieldIds.has(dk) && !initialData[dk]) {
|
|
687
|
-
initialData[dk] = src.descript || src.purpose || basisText;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
const nav = {
|
|
692
|
-
view: 'object',
|
|
693
|
-
create: true,
|
|
694
|
-
leafCid: chosen?.cid || targetPath,
|
|
695
|
-
basisId: this.editing.id,
|
|
696
|
-
basisTitle: this.documentTitle,
|
|
697
|
-
initialData,
|
|
698
|
-
names: { ...(this.names || {}) },
|
|
699
|
-
};
|
|
700
|
-
const formHost = this._findFormHost();
|
|
701
|
-
if (formHost && typeof formHost.openInForm === 'function') {
|
|
702
|
-
await formHost.openInForm(targetItem, nav);
|
|
703
|
-
}
|
|
704
|
-
},
|
|
705
|
-
async openPrintDialog(name = '') {
|
|
706
|
-
if (!this.editing?.id)
|
|
707
|
-
return;
|
|
708
|
-
if (typeof WORK?.showModal !== 'function' || typeof document === 'undefined') {
|
|
709
|
-
return this.printForm(name);
|
|
710
|
-
}
|
|
711
|
-
const target = await this.targetItem();
|
|
712
|
-
const dlg = ODA.createComponent('oda-print-dialog', {
|
|
713
|
-
owner: this,
|
|
714
|
-
targetItem: target,
|
|
715
|
-
docId: this.editing.id,
|
|
716
|
-
docTitle: this.documentTitle,
|
|
717
|
-
selectedName: name || (this.printForms?.[0]?.name ?? ''),
|
|
718
|
-
forms: Array.isArray(this.printForms) ? [...this.printForms] : [],
|
|
719
|
-
});
|
|
720
|
-
try {
|
|
721
|
-
await WORK.showModal(dlg, {
|
|
722
|
-
TITLE: { label: `Печать · ${this.documentTitle}` },
|
|
723
|
-
allowClose: true,
|
|
724
|
-
width: Math.min(880, (window.innerWidth || 920) - 24),
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
catch { /* ignore */ }
|
|
728
|
-
await this.loadPrints();
|
|
729
|
-
this._notifyForm();
|
|
730
|
-
},
|
|
731
|
-
async save() {
|
|
732
|
-
const ok = await objectsProto.save.call(this);
|
|
733
|
-
if (ok) {
|
|
734
|
-
this._basisId = '';
|
|
735
|
-
this._basisTitle = '';
|
|
736
|
-
this.focusedItem = this.editing || this.focusedItem;
|
|
737
|
-
this._dirtyTick++;
|
|
738
|
-
if (this.editing?.id) {
|
|
739
|
-
await this.loadEntries();
|
|
740
|
-
await this.loadPrints();
|
|
741
|
-
await this.loadBinder();
|
|
742
|
-
await this.loadTrajectory();
|
|
743
|
-
}
|
|
744
|
-
const host = this._findFormHost();
|
|
745
|
-
host?.updateActiveTabLabel?.(this.documentTitle);
|
|
746
|
-
await host?.reloadSiblingLists?.();
|
|
747
|
-
this._notifyForm();
|
|
748
|
-
}
|
|
749
|
-
return ok;
|
|
750
|
-
},
|
|
751
|
-
async saveAndStay() {
|
|
752
|
-
return this.save();
|
|
753
|
-
},
|
|
754
|
-
async saveAndClose() {
|
|
755
|
-
if (this.canSave && (this.isDirty() || !this.editing?.id)) {
|
|
756
|
-
const ok = await this.save();
|
|
757
|
-
if (!ok)
|
|
758
|
-
return false;
|
|
759
|
-
}
|
|
760
|
-
this._findFormHost()?.closeActiveTab?.(true);
|
|
761
|
-
return true;
|
|
762
|
-
},
|
|
763
|
-
}));
|
|
764
|
-
|
|
765
|
-
if (typeof ODA === 'function') {
|
|
766
|
-
ODA({
|
|
767
|
-
is: 'oda-doc-binder',
|
|
768
|
-
template: /*html*/`
|
|
769
|
-
<style>
|
|
770
|
-
:host {
|
|
771
|
-
@apply --vertical;
|
|
772
|
-
min-width: min(680px, calc(100vw - 24px));
|
|
773
|
-
max-width: 100%;
|
|
774
|
-
max-height: 78dvh;
|
|
775
|
-
background: var(--content-background, #fff);
|
|
776
|
-
color: var(--content-color, #1f2937);
|
|
777
|
-
font-size: 13px;
|
|
778
|
-
box-sizing: border-box;
|
|
779
|
-
}
|
|
780
|
-
.binder-body {
|
|
781
|
-
@apply --vertical;
|
|
782
|
-
flex: 1 1 auto;
|
|
783
|
-
min-height: min(200px, 32dvh);
|
|
784
|
-
max-height: 64dvh;
|
|
785
|
-
overflow-y: auto;
|
|
786
|
-
padding: 10px 14px;
|
|
787
|
-
gap: 12px;
|
|
788
|
-
}
|
|
789
|
-
.sec-box {
|
|
790
|
-
@apply --vertical;
|
|
791
|
-
border: 1px solid var(--border-color);
|
|
792
|
-
border-radius: 4px;
|
|
793
|
-
overflow: hidden;
|
|
794
|
-
}
|
|
795
|
-
.sec-head {
|
|
796
|
-
@apply --horizontal;
|
|
797
|
-
align-items: center;
|
|
798
|
-
justify-content: space-between;
|
|
799
|
-
padding: 6px 10px;
|
|
800
|
-
background: var(--header-background, #f3f4f6);
|
|
801
|
-
font-weight: 700;
|
|
802
|
-
font-size: 12.5px;
|
|
803
|
-
border-bottom: 1px solid var(--border-color);
|
|
804
|
-
}
|
|
805
|
-
.doc-row {
|
|
806
|
-
@apply --horizontal;
|
|
807
|
-
flex-wrap: wrap;
|
|
808
|
-
align-items: center;
|
|
809
|
-
gap: 6px 10px;
|
|
810
|
-
padding: 6px 10px;
|
|
811
|
-
border-bottom: 1px solid var(--subtle-border, #e5e7eb);
|
|
812
|
-
}
|
|
813
|
-
.doc-row:last-child {
|
|
814
|
-
border-bottom: none;
|
|
815
|
-
}
|
|
816
|
-
.doc-link {
|
|
817
|
-
color: var(--accent-color, #2563eb);
|
|
818
|
-
text-decoration: underline;
|
|
819
|
-
cursor: pointer;
|
|
820
|
-
font-weight: 600;
|
|
821
|
-
flex: 1;
|
|
822
|
-
min-width: 0;
|
|
823
|
-
overflow: hidden;
|
|
824
|
-
text-overflow: ellipsis;
|
|
825
|
-
white-space: nowrap;
|
|
826
|
-
}
|
|
827
|
-
.doc-meta {
|
|
828
|
-
font-size: 12px;
|
|
829
|
-
color: var(--muted-color, #6b7280);
|
|
830
|
-
white-space: nowrap;
|
|
831
|
-
}
|
|
832
|
-
.doc-sum {
|
|
833
|
-
font-weight: 600;
|
|
834
|
-
font-variant-numeric: tabular-nums;
|
|
835
|
-
white-space: nowrap;
|
|
836
|
-
}
|
|
837
|
-
.empty-sec {
|
|
838
|
-
padding: 10px;
|
|
839
|
-
color: var(--muted-color, #6b7280);
|
|
840
|
-
font-size: 12px;
|
|
841
|
-
}
|
|
842
|
-
.add-panel {
|
|
843
|
-
@apply --vertical;
|
|
844
|
-
gap: 8px;
|
|
845
|
-
padding: 10px;
|
|
846
|
-
border: 1px solid var(--border-color);
|
|
847
|
-
border-radius: 4px;
|
|
848
|
-
background: var(--subtle-background, #f9fafb);
|
|
849
|
-
}
|
|
850
|
-
.add-controls {
|
|
851
|
-
@apply --horizontal;
|
|
852
|
-
align-items: center;
|
|
853
|
-
gap: 8px;
|
|
854
|
-
flex-wrap: wrap;
|
|
855
|
-
}
|
|
856
|
-
.search-box {
|
|
857
|
-
flex: 1;
|
|
858
|
-
min-width: 180px;
|
|
859
|
-
padding: 4px 8px;
|
|
860
|
-
font-size: 13px;
|
|
861
|
-
border: 1px solid var(--border-color);
|
|
862
|
-
border-radius: 3px;
|
|
863
|
-
background: var(--content-background, #fff);
|
|
864
|
-
color: var(--content-color, #111);
|
|
865
|
-
}
|
|
866
|
-
.cand-list {
|
|
867
|
-
@apply --vertical;
|
|
868
|
-
max-height: 210px;
|
|
869
|
-
overflow-y: auto;
|
|
870
|
-
border: 1px solid var(--border-color);
|
|
871
|
-
border-radius: 3px;
|
|
872
|
-
background: var(--content-background, #fff);
|
|
873
|
-
}
|
|
874
|
-
.cand-row {
|
|
875
|
-
@apply --horizontal;
|
|
876
|
-
align-items: center;
|
|
877
|
-
gap: 8px;
|
|
878
|
-
padding: 5px 8px;
|
|
879
|
-
border-bottom: 1px solid var(--subtle-border, #e5e7eb);
|
|
880
|
-
cursor: pointer;
|
|
881
|
-
}
|
|
882
|
-
.cand-row:hover {
|
|
883
|
-
background: var(--hover-background, rgba(37, 99, 235, 0.06));
|
|
884
|
-
}
|
|
885
|
-
.btn {
|
|
886
|
-
padding: 4px 10px;
|
|
887
|
-
font-size: 12.5px;
|
|
888
|
-
font-weight: 600;
|
|
889
|
-
border: 1px solid var(--border-color);
|
|
890
|
-
border-radius: 3px;
|
|
891
|
-
background: var(--content-background, #fff);
|
|
892
|
-
color: var(--content-color, #222);
|
|
893
|
-
cursor: pointer;
|
|
894
|
-
white-space: nowrap;
|
|
895
|
-
}
|
|
896
|
-
.btn:hover:not(:disabled) {
|
|
897
|
-
border-color: var(--accent-color);
|
|
898
|
-
color: var(--accent-color);
|
|
899
|
-
}
|
|
900
|
-
.btn.primary {
|
|
901
|
-
background: var(--accent-color, #2563eb);
|
|
902
|
-
border-color: var(--accent-color, #2563eb);
|
|
903
|
-
color: #fff;
|
|
904
|
-
}
|
|
905
|
-
.binder-footer {
|
|
906
|
-
@apply --horizontal;
|
|
907
|
-
align-items: center;
|
|
908
|
-
justify-content: space-between;
|
|
909
|
-
gap: 8px;
|
|
910
|
-
padding: 8px 14px;
|
|
911
|
-
border-top: 1px solid var(--border-color);
|
|
912
|
-
background: var(--header-background, #f3f4f6);
|
|
913
|
-
}
|
|
914
|
-
</style>
|
|
915
|
-
<div class="binder-body">
|
|
916
|
-
<div class="sec-box">
|
|
917
|
-
<div class="sec-head">
|
|
918
|
-
<span>Документы-основания (исходные документы, например Счёт или Договор)</span>
|
|
919
|
-
<span>{{parents.length}}</span>
|
|
920
|
-
</div>
|
|
921
|
-
<div class="empty-sec" ~if="!parents.length">Нет подшитых документов-оснований</div>
|
|
922
|
-
<div class="doc-row" ~for="parents">
|
|
923
|
-
<span class="doc-meta">{{fmtDate($for.item.date)}}</span>
|
|
924
|
-
<span class="doc-link" @tap="openDoc($for.item)" :title="$for.item.title">{{$for.item.title}}</span>
|
|
925
|
-
<span class="doc-meta" ~if="$for.item.party">{{$for.item.party}}</span>
|
|
926
|
-
<span class="doc-sum" ~if="$for.item.sum">{{fmtMoney($for.item.sum)}} ₽</span>
|
|
927
|
-
<button type="button" class="btn" ~if="!$for.item.viaRef" title="Открепить из подшивки" @tap="unlinkDoc($for.item.id)">✕</button>
|
|
928
|
-
</div>
|
|
929
|
-
</div>
|
|
930
|
-
|
|
931
|
-
<div class="sec-box">
|
|
932
|
-
<div class="sec-head">
|
|
933
|
-
<span>Документы-следствия (порождённые на основании текущего документа)</span>
|
|
934
|
-
<span>{{children.length}}</span>
|
|
935
|
-
</div>
|
|
936
|
-
<div class="empty-sec" ~if="!children.length">Нет подшитых документов-следствий</div>
|
|
937
|
-
<div class="doc-row" ~for="children">
|
|
938
|
-
<span class="doc-meta">{{fmtDate($for.item.date)}}</span>
|
|
939
|
-
<span class="doc-link" @tap="openDoc($for.item)" :title="$for.item.title">{{$for.item.title}}</span>
|
|
940
|
-
<span class="doc-meta" ~if="$for.item.party">{{$for.item.party}}</span>
|
|
941
|
-
<span class="doc-sum" ~if="$for.item.sum">{{fmtMoney($for.item.sum)}} ₽</span>
|
|
942
|
-
<button type="button" class="btn" ~if="!$for.item.viaRef" title="Открепить из подшивки" @tap="unlinkDoc($for.item.id)">✕</button>
|
|
943
|
-
</div>
|
|
944
|
-
</div>
|
|
945
|
-
|
|
946
|
-
<div class="add-panel" ~if="addingExisting">
|
|
947
|
-
<div class="add-controls">
|
|
948
|
-
<label style="font-weight:600; display:inline-flex; align-items:center; gap:6px;">
|
|
949
|
-
Подшить как:
|
|
950
|
-
<select :value="linkDirection" @change="linkDirection = $event.target.value" style="padding:3px 6px; font-size:12.5px;">
|
|
951
|
-
<option value="parent">Документ-основание (причина)</option>
|
|
952
|
-
<option value="child">Документ-следствие</option>
|
|
953
|
-
</select>
|
|
954
|
-
</label>
|
|
955
|
-
<label ~if="partyName" style="display:inline-flex; align-items:center; gap:4px; font-size:12px; cursor:pointer;">
|
|
956
|
-
<input type="checkbox" :checked="samePartyOnly" @change="toggleSameParty($event.target.checked)">
|
|
957
|
-
<span>Только по «{{partyName}}»</span>
|
|
958
|
-
</label>
|
|
959
|
-
<input class="search-box" type="search" placeholder="Поиск по номеру, классу, контрагенту, сумме…" :value="searchQuery" @input="onSearchInput($event.target.value)">
|
|
960
|
-
</div>
|
|
961
|
-
<div class="cand-list">
|
|
962
|
-
<div class="empty-sec" ~if="!candidates.length">Подходящие операции не найдены</div>
|
|
963
|
-
<div class="cand-row" ~for="candidates" @dblclick="linkCandidate($for.item)">
|
|
964
|
-
<span class="doc-meta">{{fmtDate($for.item.date)}}</span>
|
|
965
|
-
<span style="flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500;">{{$for.item.title}}</span>
|
|
966
|
-
<span class="doc-meta" ~if="$for.item.party">{{$for.item.party}}</span>
|
|
967
|
-
<span class="doc-sum" ~if="$for.item.sum">{{fmtMoney($for.item.sum)}} ₽</span>
|
|
968
|
-
<button type="button" class="btn primary" @tap.stop="linkCandidate($for.item)">Подшить</button>
|
|
969
|
-
</div>
|
|
970
|
-
</div>
|
|
971
|
-
</div>
|
|
972
|
-
</div>
|
|
973
|
-
<div class="binder-footer">
|
|
974
|
-
<div style="display:flex; gap:6px; flex-wrap:wrap;">
|
|
975
|
-
<button type="button" class="btn" @tap="toggleAddExisting()">{{addingExisting ? 'Скрыть подбор' : '+ Подшить существующий документ…'}}</button>
|
|
976
|
-
<button type="button" class="btn primary" @tap="createOnBasis()">+ Создать на основании…</button>
|
|
977
|
-
</div>
|
|
978
|
-
<button type="button" class="btn" @tap="closeModal()">Закрыть</button>
|
|
979
|
-
</div>
|
|
980
|
-
`,
|
|
981
|
-
owner: null,
|
|
982
|
-
docId: '',
|
|
983
|
-
docTitle: '',
|
|
984
|
-
parents: [],
|
|
985
|
-
children: [],
|
|
986
|
-
addingExisting: false,
|
|
987
|
-
linkDirection: 'parent',
|
|
988
|
-
samePartyOnly: true,
|
|
989
|
-
partyName: '',
|
|
990
|
-
searchQuery: '',
|
|
991
|
-
candidates: [],
|
|
992
|
-
attached() {
|
|
993
|
-
this.reloadBinder();
|
|
994
|
-
},
|
|
995
|
-
fmtDate(d) {
|
|
996
|
-
return this.owner?.formatBinderDate ? this.owner.formatBinderDate(d) : String(d || '');
|
|
997
|
-
},
|
|
998
|
-
fmtMoney(v) {
|
|
999
|
-
return this.owner?.formatBinderMoney ? this.owner.formatBinderMoney(v) : String(v || 0);
|
|
1000
|
-
},
|
|
1001
|
-
async reloadBinder() {
|
|
1002
|
-
if (!this.owner || !this.docId)
|
|
1003
|
-
return;
|
|
1004
|
-
const target = await this.owner.targetItem();
|
|
1005
|
-
const res = await target.fetch('db_binder', { id: this.docId }).catch(() => null);
|
|
1006
|
-
this.parents = Array.isArray(res?.parents) ? res.parents : [];
|
|
1007
|
-
this.children = Array.isArray(res?.children) ? res.children : [];
|
|
1008
|
-
if (this.addingExisting)
|
|
1009
|
-
await this.loadCandidates();
|
|
1010
|
-
},
|
|
1011
|
-
async toggleAddExisting() {
|
|
1012
|
-
this.addingExisting = !this.addingExisting;
|
|
1013
|
-
if (this.addingExisting)
|
|
1014
|
-
await this.loadCandidates();
|
|
1015
|
-
},
|
|
1016
|
-
async toggleSameParty(checked) {
|
|
1017
|
-
this.samePartyOnly = Boolean(checked);
|
|
1018
|
-
await this.loadCandidates();
|
|
1019
|
-
},
|
|
1020
|
-
onSearchInput(v) {
|
|
1021
|
-
this.searchQuery = v;
|
|
1022
|
-
this.debounce('binder-cand-search', () => this.loadCandidates(), 220);
|
|
1023
|
-
},
|
|
1024
|
-
async loadCandidates() {
|
|
1025
|
-
if (!this.owner || !this.docId)
|
|
1026
|
-
return;
|
|
1027
|
-
const target = await this.owner.targetItem();
|
|
1028
|
-
let res = await target.fetch('db_binder_candidates', {
|
|
1029
|
-
id: this.docId,
|
|
1030
|
-
search: this.searchQuery,
|
|
1031
|
-
samePartyOnly: this.samePartyOnly,
|
|
1032
|
-
limit: 60,
|
|
1033
|
-
}).catch(() => null);
|
|
1034
|
-
if (this.samePartyOnly && (!res?.items || !res.items.length) && !this.searchQuery) {
|
|
1035
|
-
this.samePartyOnly = false;
|
|
1036
|
-
res = await target.fetch('db_binder_candidates', {
|
|
1037
|
-
id: this.docId,
|
|
1038
|
-
search: this.searchQuery,
|
|
1039
|
-
samePartyOnly: false,
|
|
1040
|
-
limit: 60,
|
|
1041
|
-
}).catch(() => null);
|
|
1042
|
-
}
|
|
1043
|
-
this.partyName = String(res?.partyName || '');
|
|
1044
|
-
this.candidates = Array.isArray(res?.items) ? res.items : [];
|
|
1045
|
-
},
|
|
1046
|
-
async linkCandidate(item) {
|
|
1047
|
-
if (!item?.id || !this.owner || !this.docId)
|
|
1048
|
-
return;
|
|
1049
|
-
const target = await this.owner.targetItem();
|
|
1050
|
-
const res = await target.fetch('db_binder_link', {
|
|
1051
|
-
id: this.docId,
|
|
1052
|
-
targetId: item.id,
|
|
1053
|
-
direction: this.linkDirection,
|
|
1054
|
-
});
|
|
1055
|
-
this.parents = Array.isArray(res?.parents) ? res.parents : [];
|
|
1056
|
-
this.children = Array.isArray(res?.children) ? res.children : [];
|
|
1057
|
-
await this.loadCandidates();
|
|
1058
|
-
},
|
|
1059
|
-
async unlinkDoc(targetId) {
|
|
1060
|
-
if (!targetId || !this.owner || !this.docId)
|
|
1061
|
-
return;
|
|
1062
|
-
const target = await this.owner.targetItem();
|
|
1063
|
-
const res = await target.fetch('db_binder_unlink', {
|
|
1064
|
-
id: this.docId,
|
|
1065
|
-
targetId,
|
|
1066
|
-
});
|
|
1067
|
-
this.parents = Array.isArray(res?.parents) ? res.parents : [];
|
|
1068
|
-
this.children = Array.isArray(res?.children) ? res.children : [];
|
|
1069
|
-
if (this.addingExisting)
|
|
1070
|
-
await this.loadCandidates();
|
|
1071
|
-
},
|
|
1072
|
-
async openDoc(item) {
|
|
1073
|
-
if (!item?.id || !this.owner)
|
|
1074
|
-
return;
|
|
1075
|
-
this.closeModal();
|
|
1076
|
-
await this.owner.openBinderItem(item);
|
|
1077
|
-
},
|
|
1078
|
-
async createOnBasis() {
|
|
1079
|
-
if (!this.owner)
|
|
1080
|
-
return;
|
|
1081
|
-
this.closeModal();
|
|
1082
|
-
await this.owner.createBasedOnOperation();
|
|
1083
|
-
},
|
|
1084
|
-
closeModal() {
|
|
1085
|
-
for (let p = this.parentElement || this.domHost; p; p = p.parentElement || p.domHost) {
|
|
1086
|
-
if (typeof p.close === 'function') {
|
|
1087
|
-
p.close('ok');
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
});
|
|
1093
|
-
|
|
1094
|
-
ODA({
|
|
1095
|
-
is: 'oda-print-dialog',
|
|
1096
|
-
template: /*html*/`
|
|
1097
|
-
<style>
|
|
1098
|
-
:host {
|
|
1099
|
-
@apply --vertical;
|
|
1100
|
-
min-width: min(840px, 95vw);
|
|
1101
|
-
height: min(82vh, 780px);
|
|
1102
|
-
background: var(--content-background, #fff);
|
|
1103
|
-
color: var(--content-color, #1f2937);
|
|
1104
|
-
font-size: 13px;
|
|
1105
|
-
box-sizing: border-box;
|
|
1106
|
-
}
|
|
1107
|
-
.print-toolbar {
|
|
1108
|
-
@apply --horizontal;
|
|
1109
|
-
align-items: center;
|
|
1110
|
-
gap: 8px;
|
|
1111
|
-
padding: 8px 12px;
|
|
1112
|
-
border-bottom: 1px solid var(--border-color);
|
|
1113
|
-
background: var(--header-background, #f3f4f6);
|
|
1114
|
-
flex-shrink: 0;
|
|
1115
|
-
flex-wrap: wrap;
|
|
1116
|
-
}
|
|
1117
|
-
.print-select {
|
|
1118
|
-
padding: 4px 8px;
|
|
1119
|
-
font-size: 13px;
|
|
1120
|
-
border: 1px solid var(--border-color);
|
|
1121
|
-
border-radius: 3px;
|
|
1122
|
-
background: var(--content-background, #fff);
|
|
1123
|
-
color: var(--content-color, #111);
|
|
1124
|
-
}
|
|
1125
|
-
.btn {
|
|
1126
|
-
display: inline-flex;
|
|
1127
|
-
align-items: center;
|
|
1128
|
-
gap: 5px;
|
|
1129
|
-
padding: 4px 11px;
|
|
1130
|
-
font-size: 12.5px;
|
|
1131
|
-
font-weight: 600;
|
|
1132
|
-
border: 1px solid var(--border-color);
|
|
1133
|
-
border-radius: 3px;
|
|
1134
|
-
background: var(--content-background, #fff);
|
|
1135
|
-
color: var(--content-color, #222);
|
|
1136
|
-
cursor: pointer;
|
|
1137
|
-
white-space: nowrap;
|
|
1138
|
-
}
|
|
1139
|
-
.btn:hover:not(:disabled) {
|
|
1140
|
-
border-color: var(--accent-color);
|
|
1141
|
-
color: var(--accent-color);
|
|
1142
|
-
}
|
|
1143
|
-
.btn.primary {
|
|
1144
|
-
background: var(--accent-color, #2563eb);
|
|
1145
|
-
border-color: var(--accent-color, #2563eb);
|
|
1146
|
-
color: #fff;
|
|
1147
|
-
}
|
|
1148
|
-
.print-main {
|
|
1149
|
-
@apply --horizontal;
|
|
1150
|
-
flex: 1;
|
|
1151
|
-
min-height: 0;
|
|
1152
|
-
overflow: hidden;
|
|
1153
|
-
background: #e5e7eb;
|
|
1154
|
-
}
|
|
1155
|
-
.preview-pane {
|
|
1156
|
-
@apply --vertical;
|
|
1157
|
-
flex: 1;
|
|
1158
|
-
min-width: 0;
|
|
1159
|
-
height: 100%;
|
|
1160
|
-
padding: 12px;
|
|
1161
|
-
overflow: auto;
|
|
1162
|
-
align-items: center;
|
|
1163
|
-
box-sizing: border-box;
|
|
1164
|
-
}
|
|
1165
|
-
iframe.sheet-frame {
|
|
1166
|
-
width: 100%;
|
|
1167
|
-
max-width: 210mm;
|
|
1168
|
-
height: 100%;
|
|
1169
|
-
min-height: 520px;
|
|
1170
|
-
border: 1px solid #9ca3af;
|
|
1171
|
-
background: #ffffff;
|
|
1172
|
-
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
|
|
1173
|
-
}
|
|
1174
|
-
.editor-pane {
|
|
1175
|
-
@apply --vertical;
|
|
1176
|
-
width: 46%;
|
|
1177
|
-
min-width: 320px;
|
|
1178
|
-
height: 100%;
|
|
1179
|
-
border-right: 1px solid var(--border-color);
|
|
1180
|
-
background: var(--content-background, #fff);
|
|
1181
|
-
padding: 8px 10px;
|
|
1182
|
-
gap: 6px;
|
|
1183
|
-
box-sizing: border-box;
|
|
1184
|
-
}
|
|
1185
|
-
.tpl-textarea {
|
|
1186
|
-
flex: 1;
|
|
1187
|
-
width: 100%;
|
|
1188
|
-
resize: none;
|
|
1189
|
-
font: 12px/1.4 Consolas, "Courier New", monospace;
|
|
1190
|
-
padding: 8px;
|
|
1191
|
-
border: 1px solid var(--border-color);
|
|
1192
|
-
border-radius: 3px;
|
|
1193
|
-
background: var(--content-background, #fff);
|
|
1194
|
-
color: var(--content-color, #111);
|
|
1195
|
-
box-sizing: border-box;
|
|
1196
|
-
}
|
|
1197
|
-
.hint-bar {
|
|
1198
|
-
font-size: 11px;
|
|
1199
|
-
color: var(--muted-color, #6b7280);
|
|
1200
|
-
line-height: 1.35;
|
|
1201
|
-
}
|
|
1202
|
-
.err-bar {
|
|
1203
|
-
padding: 6px 12px;
|
|
1204
|
-
font-size: 12px;
|
|
1205
|
-
color: var(--error-color, #dc2626);
|
|
1206
|
-
background: var(--error-soft, #fef2f2);
|
|
1207
|
-
border-bottom: 1px solid var(--error-color, #dc2626);
|
|
1208
|
-
}
|
|
1209
|
-
.print-footer {
|
|
1210
|
-
@apply --horizontal;
|
|
1211
|
-
align-items: center;
|
|
1212
|
-
justify-content: flex-end;
|
|
1213
|
-
gap: 8px;
|
|
1214
|
-
padding: 6px 12px;
|
|
1215
|
-
border-top: 1px solid var(--border-color);
|
|
1216
|
-
background: var(--header-background, #f3f4f6);
|
|
1217
|
-
flex-shrink: 0;
|
|
1218
|
-
}
|
|
1219
|
-
</style>
|
|
1220
|
-
<div class="print-toolbar">
|
|
1221
|
-
<span style="font-weight:600;">Форма:</span>
|
|
1222
|
-
<select class="print-select" ~if="forms.length > 1" :value="selectedName" @change="onSelectForm($event.target.value)">
|
|
1223
|
-
<option ~for="forms" :value="$for.item.name" :selected="$for.item.name === selectedName">{{$for.item.label || $for.item.name}}</option>
|
|
1224
|
-
</select>
|
|
1225
|
-
<span ~if="forms.length <= 1" style="font-weight:700; color:var(--accent-color);">{{currentLabel}}</span>
|
|
1226
|
-
<button type="button" class="btn primary" @tap="printNow()">
|
|
1227
|
-
<oda-icon icon="icons:print" icon-size="16" style="fill:currentColor;"></oda-icon>
|
|
1228
|
-
<span>Печать</span>
|
|
1229
|
-
</button>
|
|
1230
|
-
<button type="button" class="btn" @tap="openInNewTab()">Открыть в отдельном окне</button>
|
|
1231
|
-
<div style="flex:1;"></div>
|
|
1232
|
-
<button type="button" class="btn" @tap="toggleEditTemplate()">
|
|
1233
|
-
<oda-icon icon="icons:settings" icon-size="15"></oda-icon>
|
|
1234
|
-
<span>{{editingTemplate ? 'Скрыть шаблон' : 'Настроить шаблон'}}</span>
|
|
1235
|
-
</button>
|
|
1236
|
-
</div>
|
|
1237
|
-
<div class="err-bar" ~if="errorMsg">{{errorMsg}}</div>
|
|
1238
|
-
<div class="print-main">
|
|
1239
|
-
<div class="editor-pane" ~if="editingTemplate">
|
|
1240
|
-
<div style="display:flex; align-items:center; gap:6px;">
|
|
1241
|
-
<span style="font-weight:600; font-size:12px;">Имя шаблона:</span>
|
|
1242
|
-
<input type="text" :value="templateName" @input="templateName = $event.target.value" style="flex:1; padding:3px 6px; font-size:12.5px; border:1px solid var(--border-color); border-radius:3px;">
|
|
1243
|
-
<button type="button" class="btn" @tap="previewCustomTemplate()">Обновить</button>
|
|
1244
|
-
<button type="button" class="btn primary" @tap="saveTemplate()">Сохранить</button>
|
|
1245
|
-
</div>
|
|
1246
|
-
<div class="hint-bar">
|
|
1247
|
-
Переменные: <code>{{doc.number}}</code>, <code>{{doc.date}}</code>, <code>{{org.name}}</code>, <code>{{org.inn}}</code>, <code>{{party.name}}</code>, <code>{{party.inn}}</code>, <code>{{money(sum)}}</code>, <code>{{words(sum)}}</code>
|
|
1248
|
-
</div>
|
|
1249
|
-
<textarea class="tpl-textarea" :value="templateHtml" @input="onTemplateInput($event.target.value)"></textarea>
|
|
1250
|
-
</div>
|
|
1251
|
-
<div class="preview-pane">
|
|
1252
|
-
<iframe id="printFrame" class="sheet-frame" :srcdoc="renderedHtml"></iframe>
|
|
1253
|
-
</div>
|
|
1254
|
-
</div>
|
|
1255
|
-
<div class="print-footer">
|
|
1256
|
-
<button type="button" class="btn" @tap="closeModal()">Закрыть</button>
|
|
1257
|
-
</div>
|
|
1258
|
-
`,
|
|
1259
|
-
owner: null,
|
|
1260
|
-
targetItem: null,
|
|
1261
|
-
docId: '',
|
|
1262
|
-
docTitle: '',
|
|
1263
|
-
selectedName: '',
|
|
1264
|
-
forms: [],
|
|
1265
|
-
currentLabel: '',
|
|
1266
|
-
renderedHtml: '',
|
|
1267
|
-
templateHtml: '',
|
|
1268
|
-
templateName: '',
|
|
1269
|
-
editingTemplate: false,
|
|
1270
|
-
errorMsg: '',
|
|
1271
|
-
attached() {
|
|
1272
|
-
this.loadForm(this.selectedName);
|
|
1273
|
-
},
|
|
1274
|
-
async loadForm(name = '') {
|
|
1275
|
-
if (!this.targetItem || !this.docId)
|
|
1276
|
-
return;
|
|
1277
|
-
this.errorMsg = '';
|
|
1278
|
-
try {
|
|
1279
|
-
const res = await this.targetItem.fetch('db_print', {
|
|
1280
|
-
id: this.docId,
|
|
1281
|
-
name: name || '',
|
|
1282
|
-
fallback: true,
|
|
1283
|
-
});
|
|
1284
|
-
this.selectedName = res?.name || name || '';
|
|
1285
|
-
this.currentLabel = res?.label || res?.name || 'Печатная форма';
|
|
1286
|
-
this.templateName = res?.name || 'Печатная форма';
|
|
1287
|
-
this.renderedHtml = res?.html || '';
|
|
1288
|
-
this.templateHtml = res?.templateHtml || res?.html || '';
|
|
1289
|
-
}
|
|
1290
|
-
catch (e) {
|
|
1291
|
-
this.errorMsg = String(e?.message || e);
|
|
1292
|
-
}
|
|
1293
|
-
},
|
|
1294
|
-
onSelectForm(val) {
|
|
1295
|
-
this.selectedName = val;
|
|
1296
|
-
this.loadForm(val);
|
|
1297
|
-
},
|
|
1298
|
-
toggleEditTemplate() {
|
|
1299
|
-
this.editingTemplate = !this.editingTemplate;
|
|
1300
|
-
},
|
|
1301
|
-
onTemplateInput(val) {
|
|
1302
|
-
this.templateHtml = val;
|
|
1303
|
-
this.debounce('tpl-live-preview', () => this.previewCustomTemplate(), 400);
|
|
1304
|
-
},
|
|
1305
|
-
async previewCustomTemplate() {
|
|
1306
|
-
if (!this.targetItem || !this.docId || !this.templateHtml.trim())
|
|
1307
|
-
return;
|
|
1308
|
-
this.errorMsg = '';
|
|
1309
|
-
try {
|
|
1310
|
-
const res = await this.targetItem.fetch('db_print', {
|
|
1311
|
-
id: this.docId,
|
|
1312
|
-
name: this.templateName || this.selectedName,
|
|
1313
|
-
fallback: true,
|
|
1314
|
-
}, { customHtml: this.templateHtml });
|
|
1315
|
-
if (res?.html)
|
|
1316
|
-
this.renderedHtml = res.html;
|
|
1317
|
-
}
|
|
1318
|
-
catch (e) {
|
|
1319
|
-
this.errorMsg = String(e?.message || e);
|
|
1320
|
-
}
|
|
1321
|
-
},
|
|
1322
|
-
async saveTemplate() {
|
|
1323
|
-
if (!this.targetItem || !this.templateHtml.trim())
|
|
1324
|
-
return;
|
|
1325
|
-
this.errorMsg = '';
|
|
1326
|
-
try {
|
|
1327
|
-
const saved = await this.targetItem.fetch('db_print_save', {
|
|
1328
|
-
name: this.templateName || this.selectedName || 'Документ',
|
|
1329
|
-
}, {
|
|
1330
|
-
name: this.templateName || this.selectedName || 'Документ',
|
|
1331
|
-
html: this.templateHtml,
|
|
1332
|
-
});
|
|
1333
|
-
const list = await this.targetItem.fetch('db_print_list', { id: this.docId }).catch(() => []);
|
|
1334
|
-
if (Array.isArray(list) && list.length)
|
|
1335
|
-
this.forms = list;
|
|
1336
|
-
await this.loadForm(saved?.name || this.templateName);
|
|
1337
|
-
this.editingTemplate = false;
|
|
1338
|
-
}
|
|
1339
|
-
catch (e) {
|
|
1340
|
-
this.errorMsg = String(e?.message || e);
|
|
1341
|
-
}
|
|
1342
|
-
},
|
|
1343
|
-
printNow() {
|
|
1344
|
-
const frame = this.$?.('#printFrame');
|
|
1345
|
-
const win = frame?.contentWindow;
|
|
1346
|
-
if (win) {
|
|
1347
|
-
win.focus();
|
|
1348
|
-
win.print();
|
|
1349
|
-
}
|
|
1350
|
-
},
|
|
1351
|
-
openInNewTab() {
|
|
1352
|
-
const win = window.open('', '_blank');
|
|
1353
|
-
if (!win)
|
|
1354
|
-
return;
|
|
1355
|
-
win.document.open();
|
|
1356
|
-
win.document.write(this.renderedHtml || '');
|
|
1357
|
-
win.document.close();
|
|
1358
|
-
win.focus();
|
|
1359
|
-
},
|
|
1360
|
-
closeModal() {
|
|
1361
|
-
for (let p = this.parentElement || this.domHost; p; p = p.parentElement || p.domHost) {
|
|
1362
|
-
if (typeof p.close === 'function') {
|
|
1363
|
-
p.close('ok');
|
|
1364
|
-
return;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
},
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
export default proto;
|