diff --git a/.gitignore b/.gitignore index 6355d00b..f98c0cff 100644 --- a/.gitignore +++ b/.gitignore @@ -37,11 +37,14 @@ testem.log # System Files .DS_Store Thumbs.db + /src/assets/meta-damsel.json -/src/app/thrift/gen-nodejs/ -/src/app/gen-damsel/ -/src/app/machinegun/gen-* -/src/app/fistful/gen-* +/src/app/thrift-services/damsel/gen-* +/src/app/thrift-services/machinegun/gen-* +/src/app/thrift-services/fistful/gen-* +/src/app/thrift-services/messages/gen-* +/src/app/thrift-services/ank/gen-* +/src/app/thrift-services/file-storage/gen-* # Sonar .scannerwork diff --git a/Makefile b/Makefile index 821bfadd..eb3d0f38 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ submodules: $(SUBTARGETS) init: npm install -compile: compile-damsel compile-machinegun compile-fistful +compile: compile-damsel compile-machinegun compile-fistful compile-messages compile-file-storage compile-ank build: check lint compile npm run build @@ -49,12 +49,12 @@ build: check lint compile clean-compile: clean compile clean: - rm -rf dist src/app/thrift/gen-* src/assets/meta-damsel.json src/app/gen-damsel src/app/machinegun/gen-* src/app/fistful/gen-* + rm -rf dist src/app/thrift/gen-* src/assets/meta-damsel.json src/app/gen-model src/app/machinegun/gen-* src/app/fistful/gen-* src/app/messages/gen-* src/app/file-storage/gen-* src/app/ank/gen-* compile-damsel: damsel-client damsel-model damsel-meta damsel-client: - @$(foreach file,domain_config payment_processing merch_stat,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift ./node_modules/damsel/proto/$(file).thrift;) + @$(foreach file,domain_config payment_processing merch_stat claim_management,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/damsel ./node_modules/damsel/proto/$(file).thrift;) damsel-meta: npm run damsel-meta @@ -65,7 +65,7 @@ damsel-model: compile-machinegun: machinegun-model machinegun-client machinegun-client: - @$(foreach file,state_processing,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/machinegun ./node_modules/machinegun_proto/proto/$(file).thrift;) + @$(foreach file,state_processing,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/machinegun ./node_modules/machinegun_proto/proto/$(file).thrift;) machinegun-model: npm run machinegun-model @@ -73,11 +73,35 @@ machinegun-model: compile-fistful: fistful-model fistful-client fistful-client: - @$(foreach file,withdrawal_session fistful_admin fistful_stat,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/fistful ./node_modules/fistful-proto/proto/$(file).thrift;) + @$(foreach file,withdrawal_session fistful_admin fistful_stat,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/fistful ./node_modules/fistful-proto/proto/$(file).thrift;) fistful-model: npm run fistful-model +compile-messages: messages-model messages-client + +messages-client: + @$(foreach file,messages,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/messages ./node_modules/messages-proto/proto/$(file).thrift;) + +messages-model: + npm run messages-model + +compile-file-storage: file-storage-model file-storage-client + +file-storage-client: + @$(foreach file,file_storage,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/file-storage ./node_modules/file-storage-proto/proto/$(file).thrift;) + +file-storage-model: + npm run file-storage-model + +compile-ank: ank-model ank-client + +ank-client: + @$(foreach file,questionary_manager,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/ank ./node_modules/ank-proto/proto/$(file).thrift;) + +ank-model: + npm run ank-model + lint: npm run lint diff --git a/package-lock.json b/package-lock.json index 8ebbbb35..11743289 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1720,6 +1720,12 @@ "@types/node": "*" } }, + "@types/humanize-duration": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/@types/humanize-duration/-/humanize-duration-3.18.0.tgz", + "integrity": "sha512-11QHl+GvEQ5TlCjA9xqQKNv4S0P8XFq5uHeZe2UPjngESBl7tA1tai/60eEYwWMFWIyQOl7ybarYF0B33K3Qtg==", + "dev": true + }, "@types/jasmine": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.8.tgz", @@ -1735,6 +1741,12 @@ "@types/jasmine": "*" } }, + "@types/jwt-decode": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@types/jwt-decode/-/jwt-decode-2.2.1.tgz", + "integrity": "sha512-aWw2YTtAdT7CskFyxEX2K21/zSDStuf/ikI3yBqmwpwJF0pS+/IX5DWv+1UFffZIbruP6cnT9/LAJV1gFwAT1A==", + "dev": true + }, "@types/lodash": { "version": "4.14.116", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", @@ -2207,6 +2219,11 @@ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "dev": true }, + "angular-file": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/angular-file/-/angular-file-1.3.2.tgz", + "integrity": "sha512-k4HGJJ/JXGmNA8iV206I5WOHbufOy6L5f2MYHiUuGjlDiWjEJmjo8sxnNJsR79FzkjbL41TWRDAH2gi4VTUYKw==" + }, "angular2-prettyjson": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/angular2-prettyjson/-/angular2-prettyjson-3.0.1.tgz", @@ -2215,6 +2232,10 @@ "tslib": "^1.7.1" } }, + "ank-proto": { + "version": "git+ssh://git@github.com/rbkmoney/ank-proto.git#9563a08d94c7691ec8f9166f78c05d68ae1e761d", + "from": "git+ssh://git@github.com/rbkmoney/ank-proto.git#9563a08d94c7691ec8f9166f78c05d68ae1e761d" + }, "ansi-colors": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", @@ -4580,8 +4601,8 @@ "dev": true }, "damsel": { - "version": "git+ssh://git@github.com/rbkmoney/damsel.git#b563890354447a5e175a9a318b33233a926a5e9c", - "from": "git+ssh://git@github.com/rbkmoney/damsel.git#b563890354447a5e175a9a318b33233a926a5e9c" + "version": "git+ssh://git@github.com/rbkmoney/damsel.git#7dd9035d89e8dab01d28e25445796c60503363a2", + "from": "git+ssh://git@github.com/rbkmoney/damsel.git#7dd9035d89e8dab01d28e25445796c60503363a2" }, "dashdash": { "version": "1.14.1", @@ -4957,9 +4978,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.273", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.273.tgz", - "integrity": "sha512-0kUppiHQvHEENHh+nTtvTt4eXMwcPyWmMaj73GPrSEm3ldKhmmHuOH6IjrmuW6YmyS/fpXcLvMQLNVpqRhpNWw==" + "version": "1.3.344", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.344.tgz", + "integrity": "sha512-tvbx2Wl8WBR+ym3u492D0L6/jH+8NoQXqe46+QhbWH3voVPauGuZYeb1QAXYoOAWuiP2dbSvlBx0kQ1F3hu/Mw==" }, "elliptic": { "version": "6.5.1", @@ -5530,6 +5551,10 @@ } } }, + "file-storage-proto": { + "version": "git+ssh://git@github.com/rbkmoney/file-storage-proto.git#281e1ca4cea9bf32229a6c389f0dcf5d49c05a0b", + "from": "git+ssh://git@github.com/rbkmoney/file-storage-proto.git#281e1ca4cea9bf32229a6c389f0dcf5d49c05a0b" + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -5665,8 +5690,8 @@ } }, "fistful-proto": { - "version": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#6e653a244e7b2106908604c4692ee5ab4496af09", - "from": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#6e653a244e7b2106908604c4692ee5ab4496af09" + "version": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#c2113c853ed71a34bb6468b9a6cf9b468967af84", + "from": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#c2113c853ed71a34bb6468b9a6cf9b468967af84" }, "flake-idgen": { "version": "1.1.0", @@ -6812,6 +6837,11 @@ } } }, + "humanize-duration": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.21.0.tgz", + "integrity": "sha512-7BLsrQZ2nMGeakmGDUl1pDne6/7iAdvwf1RtDLCOPHNFIHjkOVW7lcu7xHkIM9HhZAlSSO5crhC1dHvtl4dIQw==" + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -7935,8 +7965,8 @@ } }, "machinegun_proto": { - "version": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8", - "from": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8" + "version": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#eac772bb8446fcd2f439232bf10fa086c336aca6", + "from": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#eac772bb8446fcd2f439232bf10fa086c336aca6" }, "magic-string": { "version": "0.25.6", @@ -8121,6 +8151,10 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "messages-proto": { + "version": "git+ssh://git@github.com/rbkmoney/messages-proto.git#a177efb574136961bcd0a8236b4bfc425264de29", + "from": "git+ssh://git@github.com/rbkmoney/messages-proto.git#a177efb574136961bcd0a8236b4bfc425264de29" + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -11300,9 +11334,9 @@ } }, "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -11572,6 +11606,27 @@ "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "dev": true }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, "uglifyjs-webpack-plugin": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", @@ -11607,11 +11662,6 @@ "y18n": "^4.0.0" } }, - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" - }, "find-cache-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", @@ -11728,15 +11778,6 @@ "requires": { "safe-buffer": "^5.1.1" } - }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - } } } }, @@ -12183,22 +12224,26 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "optional": true }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "optional": true, "requires": { "delegates": "^1.0.0", @@ -12207,12 +12252,14 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "optional": true }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "optional": true, "requires": { "balanced-match": "^1.0.0", @@ -12221,32 +12268,38 @@ }, "chownr": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", + "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "optional": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "optional": true }, "debug": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "optional": true, "requires": { "ms": "^2.1.1" @@ -12254,22 +12307,26 @@ }, "deep-extend": { "version": "0.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -12277,12 +12334,14 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "optional": true, "requires": { "aproba": "^1.0.3", @@ -12297,7 +12356,8 @@ }, "glob": { "version": "7.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "optional": true, "requires": { "fs.realpath": "^1.0.0", @@ -12310,12 +12370,14 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "optional": true }, "iconv-lite": { "version": "0.4.24", - "bundled": true, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "optional": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" @@ -12323,7 +12385,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "optional": true, "requires": { "minimatch": "^3.0.4" @@ -12331,7 +12394,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "optional": true, "requires": { "once": "^1.3.0", @@ -12340,17 +12404,20 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "optional": true }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "optional": true, "requires": { "number-is-nan": "^1.0.0" @@ -12358,12 +12425,14 @@ }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "optional": true, "requires": { "brace-expansion": "^1.1.7" @@ -12371,12 +12440,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "optional": true }, "minipass": { "version": "2.3.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "optional": true, "requires": { "safe-buffer": "^5.1.2", @@ -12385,7 +12456,8 @@ }, "minizlib": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -12393,7 +12465,8 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "optional": true, "requires": { "minimist": "0.0.8" @@ -12401,12 +12474,14 @@ }, "ms": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "optional": true }, "needle": { "version": "2.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.0.tgz", + "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==", "optional": true, "requires": { "debug": "^4.1.0", @@ -12416,7 +12491,8 @@ }, "node-pre-gyp": { "version": "0.12.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", + "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", "optional": true, "requires": { "detect-libc": "^1.0.2", @@ -12433,7 +12509,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "optional": true, "requires": { "abbrev": "1", @@ -12442,12 +12519,14 @@ }, "npm-bundled": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", + "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", "optional": true }, "npm-packlist": { "version": "1.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", + "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", "optional": true, "requires": { "ignore-walk": "^3.0.1", @@ -12456,7 +12535,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "optional": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -12467,17 +12547,20 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "optional": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "optional": true, "requires": { "wrappy": "1" @@ -12485,17 +12568,20 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "optional": true, "requires": { "os-homedir": "^1.0.0", @@ -12504,17 +12590,20 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "optional": true }, "rc": { "version": "1.2.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "optional": true, "requires": { "deep-extend": "^0.6.0", @@ -12525,14 +12614,16 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "optional": true } } }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -12546,7 +12637,8 @@ }, "rimraf": { "version": "2.6.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "optional": true, "requires": { "glob": "^7.1.3" @@ -12554,37 +12646,44 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "optional": true }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "optional": true }, "semver": { "version": "5.7.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "optional": true, "requires": { "code-point-at": "^1.0.0", @@ -12594,7 +12693,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "optional": true, "requires": { "safe-buffer": "~5.1.0" @@ -12602,7 +12702,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "optional": true, "requires": { "ansi-regex": "^2.0.0" @@ -12610,12 +12711,14 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "optional": true }, "tar": { "version": "4.4.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", + "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", "optional": true, "requires": { "chownr": "^1.1.1", @@ -12629,12 +12732,14 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "optional": true }, "wide-align": { "version": "1.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "optional": true, "requires": { "string-width": "^1.0.2 || 2" @@ -12642,12 +12747,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "optional": true }, "yallist": { "version": "3.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "optional": true } } @@ -13359,7 +13466,7 @@ }, "stream-http": { "version": "2.3.1", - "resolved": "http://registry.npmjs.org/stream-http/-/stream-http-2.3.1.tgz", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.3.1.tgz", "integrity": "sha1-fh3IcQLD4xsy5mDwTKMfI929HVI=", "requires": { "builtin-status-codes": "^2.0.0", diff --git a/package.json b/package.json index ba809176..1096571f 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,13 @@ "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", - "damsel-model": "thrift-ts node_modules/damsel/proto -o src/app/gen-damsel -d false", + "damsel-model": "thrift-ts node_modules/damsel/proto -o src/app/thrift-services/damsel/gen-model -d false", "damsel-meta": "thrift-ts node_modules/damsel/proto -o src/assets/meta-damsel.json --json --pack --prettify", - "machinegun-model": "thrift-ts node_modules/machinegun_proto/proto -o src/app/machinegun/gen-model -d false", - "fistful-model": "thrift-ts node_modules/fistful-proto/proto -o src/app/fistful/gen-model -d false", + "machinegun-model": "thrift-ts node_modules/machinegun_proto/proto -o src/app/thrift-services/machinegun/gen-model -d false", + "fistful-model": "thrift-ts node_modules/fistful-proto/proto -o src/app/thrift-services/fistful/gen-model -d false", + "messages-model": "thrift-ts node_modules/messages-proto/proto -o src/app/thrift-services/messages/gen-model -d false", + "file-storage-model": "thrift-ts node_modules/file-storage-proto/proto -o src/app/thrift-services/file-storage/gen-model -d false", + "ank-model": "thrift-ts node_modules/ank-proto/proto -o src/app/thrift-services/ank/gen-model -d false", "prettier": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --write", "check": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --list-different" }, @@ -31,19 +34,24 @@ "@angular/platform-server": "~8.2.14", "@angular/router": "~8.2.14", "@rbkmoney/partial-fetcher": "~1.0.4", + "angular-file": "1.3.2", "angular2-prettyjson": "3.0.1", "core-js": "~2.5.4", - "damsel": "git+ssh://git@github.com/rbkmoney/damsel.git#b563890354447a5e175a9a318b33233a926a5e9c", - "fistful-proto": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#6e653a244e7b2106908604c4692ee5ab4496af09", + "damsel": "git+ssh://git@github.com/rbkmoney/damsel.git#7dd9035d89e8dab01d28e25445796c60503363a2", + "ank-proto": "git+ssh://git@github.com:rbkmoney/ank-proto.git#9563a08d94c7691ec8f9166f78c05d68ae1e761d", + "file-storage-proto": "git+ssh://git@github.com:rbkmoney/file-storage-proto.git#281e1ca4cea9bf32229a6c389f0dcf5d49c05a0b", + "fistful-proto": "git+ssh://git@github.com/rbkmoney/fistful-proto.git#c2113c853ed71a34bb6468b9a6cf9b468967af84", "hammerjs": "~2.0.8", + "humanize-duration": "~3.21.0", "jsonc-parser": "~2.0.2", "keycloak-angular": "6.0.0", "keycloak-js": "4.5.0", "lodash-es": "~4.17.10", - "machinegun_proto": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8", + "machinegun_proto": "git+ssh://git@github.com/rbkmoney/machinegun_proto.git#eac772bb8446fcd2f439232bf10fa086c336aca6", + "rxjs": "~6.5.4", + "messages-proto": "git+ssh://git@github.com:rbkmoney/messages-proto.git#a177efb574136961bcd0a8236b4bfc425264de29", "moment": "~2.22.2", "monaco-editor": "~0.15.6", - "rxjs": "~6.5.4", "thrift-ts": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#a5e3830ad30d5717e5e627ddcefa8f4d8918b174", "uuid": "~3.3.2", "woody_js": "git+ssh://git@github.com/rbkmoney/woody_js.git#bc2c9f86cae470a0fe99730ca4a30b204058214b", @@ -53,8 +61,10 @@ "@angular-devkit/build-angular": "~0.803.23", "@angular/cli": "~8.3.23", "@angular/compiler-cli": "~8.2.14", + "@types/humanize-duration": "~3.18.0", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", + "@types/jwt-decode": "~2.2.1", "@types/lodash-es": "~4.17.1", "@types/node": "~8.9.4", "@types/uuid": "~3.4.3", diff --git a/proxy.conf.json b/proxy.conf.json index 10a359e6..d2faa408 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -1,24 +1,30 @@ { "/v1": { - "target": "http://iddqd.rbk.test:8080", + "target": "https://iddqd.rbk.money", "secure": false, "logLevel": "debug", "changeOrigin": true }, "/stat": { - "target": "http://iddqd.rbk.test:8080", + "target": "https://iddqd.rbk.money", "secure": false, "logLevel": "debug", "changeOrigin": true }, "/fistful/stat": { - "target": "http://iddqd.rbk.test:8080", + "target": "https://iddqd.rbk.money", "secure": false, "logLevel": "debug", "changeOrigin": true }, "/papi/v1": { - "target": "http://iddqd.rbk.test:8080", + "target": "https://iddqd.rbk.money", + "secure": false, + "logLevel": "debug", + "changeOrigin": true + }, + "/file_storage": { + "target": "https://iddqd.rbk.money", "secure": false, "logLevel": "debug", "changeOrigin": true diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 28791d4f..a32f6038 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -27,6 +27,7 @@ export class AppComponent implements OnInit { { name: 'Domain config', route: '/domain', activateRole: 'dmt:checkout' }, { name: 'Payouts', route: '/payouts', activateRole: 'payout:read' }, { name: 'Claims', route: '/claims', activateRole: 'claim:get' }, + { name: 'Claim-MGT', route: '/claim-mgt', activateRole: 'claim:get' }, { name: 'Payment adjustment', route: '/payment-adjustment', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2484588b..9be359f9 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -30,6 +30,7 @@ import { PartyModule } from './party/party.module'; import { DomainModule } from './domain'; import { RepairingModule } from './repairing/repairing.module'; import { DepositsModule } from './deposits/deposits.module'; +import { ClaimMgtModule } from './claim-mgt/claim-mgt.module'; @NgModule({ declarations: [AppComponent], @@ -52,7 +53,8 @@ import { DepositsModule } from './deposits/deposits.module'; PartyModule, DomainModule, RepairingModule, - DepositsModule + DepositsModule, + ClaimMgtModule ], providers: [ { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }, diff --git a/src/app/claim-mgt/claim-mgt-routing.module.ts b/src/app/claim-mgt/claim-mgt-routing.module.ts new file mode 100644 index 00000000..8bbad362 --- /dev/null +++ b/src/app/claim-mgt/claim-mgt-routing.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { AppAuthGuardService } from '../app-auth-guard.service'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: 'claim-mgt', redirectTo: 'claim-mgt/claims', pathMatch: 'full' }, + { + path: 'claim-mgt/claims', + loadChildren: () => import('./claims').then(m => m.ClaimsModule), + canActivate: [AppAuthGuardService], + data: { + roles: ['claim:get'] + } + }, + { + path: 'claim-mgt/party', + loadChildren: () => import('./claim').then(m => m.ClaimModule), + canActivate: [AppAuthGuardService], + data: { + roles: ['claim:get'] + } + } + ]) + ], + exports: [RouterModule] +}) +export class ClaimMgtRouting {} diff --git a/src/app/claim-mgt/claim-mgt.module.ts b/src/app/claim-mgt/claim-mgt.module.ts new file mode 100644 index 00000000..78414c08 --- /dev/null +++ b/src/app/claim-mgt/claim-mgt.module.ts @@ -0,0 +1,8 @@ +import { NgModule } from '@angular/core'; + +import { ClaimMgtRouting } from './claim-mgt-routing.module'; + +@NgModule({ + imports: [ClaimMgtRouting] +}) +export class ClaimMgtModule {} diff --git a/src/app/claim-mgt/claim/claim-routing.module.ts b/src/app/claim-mgt/claim/claim-routing.module.ts new file mode 100644 index 00000000..a824864b --- /dev/null +++ b/src/app/claim-mgt/claim/claim-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { AppAuthGuardService } from '../../app-auth-guard.service'; +import { ClaimComponent } from './claim.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: ':party_id/claim/:claim_id', + component: ClaimComponent, + canActivate: [AppAuthGuardService], + data: { + roles: ['claim:get'] + } + } + ]) + ], + exports: [RouterModule] +}) +export class ClaimRoutingModule {} diff --git a/src/app/claim-mgt/claim/claim-statuses.ts b/src/app/claim-mgt/claim/claim-statuses.ts new file mode 100644 index 00000000..d932d407 --- /dev/null +++ b/src/app/claim-mgt/claim/claim-statuses.ts @@ -0,0 +1,7 @@ +export enum ClaimStatuses { + 'pending_acceptance' = 'pending_acceptance', + 'pending' = 'pending', + 'revoked' = 'revoked', + 'denied' = 'denied', + 'review' = 'review' +} diff --git a/src/app/claim-mgt/claim/claim.component.html b/src/app/claim-mgt/claim/claim.component.html new file mode 100644 index 00000000..29376eb9 --- /dev/null +++ b/src/app/claim-mgt/claim/claim.component.html @@ -0,0 +1,7 @@ + + + + diff --git a/src/app/claim-mgt/claim/claim.component.ts b/src/app/claim-mgt/claim/claim.component.ts new file mode 100644 index 00000000..166a15ca --- /dev/null +++ b/src/app/claim-mgt/claim/claim.component.ts @@ -0,0 +1,27 @@ +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import Int64 from 'thrift-ts/lib/int64'; + +import { ClaimService } from './claim.service'; + +@Component({ + templateUrl: 'claim.component.html' +}) +export class ClaimComponent { + claim$ = this.claimService.claim$; + + constructor(private route: ActivatedRoute, private claimService: ClaimService) { + this.getClaim(); + } + + conversationChanged() { + this.getClaim(); + } + + private getClaim() { + this.route.params.subscribe(params => { + const { party_id, claim_id } = params; + this.claimService.getClaim(party_id, new Int64(Number(claim_id))); + }); + } +} diff --git a/src/app/claim-mgt/claim/claim.module.ts b/src/app/claim-mgt/claim/claim.module.ts new file mode 100644 index 00000000..c87f1998 --- /dev/null +++ b/src/app/claim-mgt/claim/claim.module.ts @@ -0,0 +1,62 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FlexModule } from '@angular/flex-layout'; +import { + MatCardModule, + MatSelectModule, + MatButtonModule, + MatDialogModule, + MatProgressBarModule, + MatInputModule +} from '@angular/material'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatListModule } from '@angular/material/list'; +import { MatBottomSheetModule } from '@angular/material/bottom-sheet'; +import { MatStepperModule } from '@angular/material/stepper'; + +import { ClaimComponent } from './claim.component'; +import { ClaimRoutingModule } from './claim-routing.module'; +import { SharedModule } from '../../shared/shared.module'; +import { DetailsComponent } from './details/details.component'; +import { ConversationModule } from './conversation/conversation.module'; +import { StatusChangerComponent } from './status-changer/status-changer.component'; +import { PartyModificationTargetModule } from '../../party-modification-target'; +import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; +import { UnitActionsComponent } from './party-modification-creator/unit-actions/unit-actions.component'; +import { ContainerNamePipe } from './party-modification-creator/container-name.pipe'; +import { PartyModificationCreationModule } from './party-modification-creator/creation'; +import { CreateModificationComponent } from './party-modification-creator/create-modification.component'; +import { ClaimService } from './claim.service'; + +@NgModule({ + imports: [ + ClaimRoutingModule, + SharedModule, + CommonModule, + MatCardModule, + FlexModule, + MatSelectModule, + ConversationModule, + MatButtonModule, + MatDialogModule, + MatProgressBarModule, + ReactiveFormsModule, + MatInputModule, + MatListModule, + MatBottomSheetModule, + MatStepperModule, + PartyModificationTargetModule, + PartyModificationCreationModule + ], + declarations: [ + ClaimComponent, + DetailsComponent, + StatusChangerComponent, + CreateModificationComponent, + ContainerNamePipe, + UnitActionsComponent + ], + entryComponents: [StatusChangerComponent, CreateModificationComponent, UnitActionsComponent], + providers: [ClaimManagementService, ClaimService] +}) +export class ClaimModule {} diff --git a/src/app/claim-mgt/claim/claim.service.ts b/src/app/claim-mgt/claim/claim.service.ts new file mode 100644 index 00000000..7bb67f59 --- /dev/null +++ b/src/app/claim-mgt/claim/claim.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs'; +import { MatSnackBar } from '@angular/material'; + +import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; +import { Claim, ClaimID } from '../../thrift-services/damsel/gen-model/claim_management'; + +@Injectable() +export class ClaimService { + claim$: Subject = new Subject(); + + constructor( + private claimManagementService: ClaimManagementService, + private snackBar: MatSnackBar + ) {} + + getClaim(partyID: string, claimID: ClaimID) { + this.claimManagementService.getClaim(partyID, claimID).subscribe( + claim => this.claim$.next(claim), + e => { + console.error(e); + this.snackBar.open('Error loading the claim', 'OK'); + } + ); + } +} diff --git a/src/app/claim-mgt/claim/conversation/action-icon.pipe.ts b/src/app/claim-mgt/claim/conversation/action-icon.pipe.ts new file mode 100644 index 00000000..9c3f8baa --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/action-icon.pipe.ts @@ -0,0 +1,21 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import { TimelineAction } from './to-timeline-info/model'; + +@Pipe({ + name: 'actionIcon' +}) +export class ActionIconPipe implements PipeTransform { + transform(action: TimelineAction): string { + return ({ + [TimelineAction.statusPending]: 'visibility', + [TimelineAction.statusReview]: 'forward', + [TimelineAction.statusRevoked]: 'close', + [TimelineAction.statusDenied]: 'close', + [TimelineAction.statusAccepted]: 'done', + [TimelineAction.filesAdded]: 'attach_file', + [TimelineAction.commentAdded]: 'mode_comment', + [TimelineAction.changesAdded]: 'add' + } as const)[action]; + } +} diff --git a/src/app/claim-mgt/claim/conversation/action-name.pipe.ts b/src/app/claim-mgt/claim/conversation/action-name.pipe.ts new file mode 100644 index 00000000..aae33c70 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/action-name.pipe.ts @@ -0,0 +1,21 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import { TimelineAction } from './to-timeline-info/model'; + +@Pipe({ + name: 'actionName' +}) +export class ActionNamePipe implements PipeTransform { + transform(action: TimelineAction): string { + return ({ + [TimelineAction.statusPending]: 'Changed status to Pending', + [TimelineAction.statusReview]: 'Changed status to Review', + [TimelineAction.statusRevoked]: 'Changed status to Revoked', + [TimelineAction.statusDenied]: 'Changed status to Denied', + [TimelineAction.statusAccepted]: 'Changed status to Accepted', + [TimelineAction.filesAdded]: 'Files added', + [TimelineAction.commentAdded]: 'Comment added', + [TimelineAction.changesAdded]: 'Changes added' + } as const)[action]; + } +} diff --git a/src/app/claim-mgt/claim/conversation/comment/comment.component.html b/src/app/claim-mgt/claim/conversation/comment/comment.component.html new file mode 100644 index 00000000..1a0ed142 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/comment/comment.component.html @@ -0,0 +1,5 @@ + + + {{ conversation ? conversation.messages[0].text : "Can't load conversation" }} + + diff --git a/src/app/claim-mgt/claim/conversation/comment/comment.component.scss b/src/app/claim-mgt/claim/conversation/comment/comment.component.scss new file mode 100644 index 00000000..994f5c4c --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/comment/comment.component.scss @@ -0,0 +1,3 @@ +mat-card-content { + word-break: break-all; +} \ No newline at end of file diff --git a/src/app/claim-mgt/claim/conversation/comment/comment.component.ts b/src/app/claim-mgt/claim/conversation/comment/comment.component.ts new file mode 100644 index 00000000..bde00466 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/comment/comment.component.ts @@ -0,0 +1,12 @@ +import { Component, Input } from '@angular/core'; + +import { Conversation } from '../../../../thrift-services/messages/gen-model/messages'; + +@Component({ + selector: 'cc-conversation-comment', + templateUrl: 'comment.component.html', + styleUrls: ['comment.component.scss'] +}) +export class CommentComponent { + @Input() conversation: Conversation; +} diff --git a/src/app/claim-mgt/claim/conversation/conversation.component.html b/src/app/claim-mgt/claim/conversation/conversation.component.html new file mode 100644 index 00000000..06821f1b --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/conversation.component.html @@ -0,0 +1,74 @@ +
+ + + + + {{ item.action | actionName }} by {{ item.user_info.username }} at + {{ item.created_at | date: 'dd.MM.yyyy HH:mm:ss' }} ({{ + item.created_at | humanizedDuration: { largest: 1, hasAgoEnding: true } + }}) + + + + {{ item.action | actionIcon }} + + + + + + + + + + + + {{ getKey(modification) }} + + {{ + modification.claim_modification + ? getKey(modification.claim_modification) + : getKey(modification.party_modification) + }} + + + + + + + + +
+ + +
+
diff --git a/src/app/claim-mgt/claim/conversation/conversation.component.ts b/src/app/claim-mgt/claim/conversation/conversation.component.ts new file mode 100644 index 00000000..9f3b855f --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/conversation.component.ts @@ -0,0 +1,48 @@ +import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; + +import { Modification, Claim } from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ConversationService } from './conversation.service'; +import { extractClaimStatus } from '../../../shared/extract-claim-status'; +import { ClaimStatus } from '../../../papi/model'; +import { TimelineAction } from './to-timeline-info/model'; +import { QuestionaryService } from './questionary.service'; +import { getUnionKey } from '../../../shared/get-union-key'; + +@Component({ + selector: 'cc-claim-conversation', + templateUrl: 'conversation.component.html', + providers: [ConversationService, QuestionaryService] +}) +export class ConversationComponent implements OnChanges { + @Input() claim: Claim; + @Output() conversationChangedEvent = new EventEmitter(); + + timelineInfo$ = this.conversationService.timelineInfos$; + questionary$ = this.questionaryService.questionary$; + timelineAction = TimelineAction; + claimStatus: ClaimStatus; + claimStatuses = ClaimStatus; + + constructor( + private conversationService: ConversationService, + private questionaryService: QuestionaryService + ) {} + + ngOnChanges(changes: SimpleChanges) { + const { currentValue } = changes.claim; + if (currentValue) { + this.claimStatus = extractClaimStatus(currentValue.status); + this.conversationService.enrichWithData(currentValue.changeset); + } + } + + updateConversation(action: TimelineAction, modifications: Modification[]) { + this.conversationService + .updateConversation(this.claim.party_id, this.claim.id, action, modifications) + .subscribe(_ => this.conversationChangedEvent.emit()); + } + + getKey(modification: Modification) { + return getUnionKey(modification); + } +} diff --git a/src/app/claim-mgt/claim/conversation/conversation.module.ts b/src/app/claim-mgt/claim/conversation/conversation.module.ts new file mode 100644 index 00000000..ab6f4cc6 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/conversation.module.ts @@ -0,0 +1,67 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { + MatButtonModule, + MatExpansionModule, + MatFormFieldModule, + MatIconModule, + MatInputModule +} from '@angular/material'; +import { MatSelectModule } from '@angular/material/select'; +import { ReactiveFormsModule } from '@angular/forms'; +import { LayoutModule } from '@angular/cdk/layout'; +import { MatCardModule } from '@angular/material/card'; + +import { ConversationComponent } from './conversation.component'; +import { ActionIconPipe } from './action-icon.pipe'; +import { TimelineModule } from '../../../shared/components/timeline'; +import { SharedModule } from '../../../shared/shared.module'; +import { ActionNamePipe } from './action-name.pipe'; +import { MonacoEditorModule } from '../../../monaco-editor'; +import { HumanizeDurationModule } from '../../../shared/humanize-duration'; +import { SendCommentComponent } from './send-comment'; +import { MessagesModule } from '../../../thrift-services/messages'; +import { CommentComponent } from './comment/comment.component'; +import { ReasonComponent } from './reason/reason.component'; +import { FileContainerModule } from './file-container'; +import { FileUploaderModule } from './file-uploader/file-uploader.module'; +import { QuestionaryComponent } from './questionary'; +import { AnkModule } from '../../../thrift-services'; + +@NgModule({ + imports: [ + LayoutModule, + MatButtonModule, + FlexLayoutModule, + MatFormFieldModule, + MatInputModule, + TimelineModule, + MatIconModule, + SharedModule, + CommonModule, + ReactiveFormsModule, + SharedModule, + MatExpansionModule, + MonacoEditorModule, + HumanizeDurationModule, + MessagesModule, + MatCardModule, + HumanizeDurationModule, + MatSelectModule, + FileContainerModule, + FileUploaderModule, + AnkModule + ], + declarations: [ + ConversationComponent, + ReasonComponent, + SendCommentComponent, + ActionIconPipe, + ActionNamePipe, + CommentComponent, + QuestionaryComponent + ], + exports: [ConversationComponent] +}) +export class ConversationModule {} diff --git a/src/app/claim-mgt/claim/conversation/conversation.service.ts b/src/app/claim-mgt/claim/conversation/conversation.service.ts new file mode 100644 index 00000000..ecfb2468 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/conversation.service.ts @@ -0,0 +1,61 @@ +import { Injectable } from '@angular/core'; +import { from, Observable, Subject } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import flatten from 'lodash-es/flatten'; + +import { TimelineAction, TimelineItemInfo } from './to-timeline-info/model'; +import { + ClaimChangeset, + ClaimID, + Modification +} from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ClaimManagementService } from '../../../thrift-services/damsel/claim-management.service'; +import { toTimelineInfo } from './to-timeline-info'; +import { MessagesService } from '../../../thrift-services/messages/messages.service'; +import { ConversationId } from '../../../thrift-services/messages/gen-model/messages'; +import { addCommentsToTimelineInfos } from './to-timeline-info'; + +@Injectable() +export class ConversationService { + timelineInfos$ = new Subject(); + + constructor( + private claimManagementService: ClaimManagementService, + private messagesService: MessagesService + ) {} + + updateConversation( + party_id: string, + claim_id: ClaimID, + action: TimelineAction, + modifications: Modification[] + ): Observable { + return this.claimManagementService.updateClaim(party_id, claim_id, modifications); + } + + enrichWithData(changeset: ClaimChangeset) { + from(this.addCommentsToInfo(toTimelineInfo(changeset))).subscribe(infos => + this.timelineInfos$.next(infos) + ); + } + + private addCommentsToInfo(timelineInfos: TimelineItemInfo[]): Observable { + const commentAddedIds: ConversationId[] = flatten( + timelineInfos + .filter(info => info.action === TimelineAction.commentAdded) + .map((commentInfo: TimelineItemInfo) => + commentInfo.modifications.map(m => m.claim_modification.comment_modification.id) + ) + ); + + return this.messagesService.getConversations(commentAddedIds, {}).pipe( + map(conversationsResponse => + addCommentsToTimelineInfos(conversationsResponse.conversations, timelineInfos) + ), + catchError(e => { + console.error(e); + return [timelineInfos]; + }) + ); + } +} diff --git a/src/app/claim-mgt/claim/conversation/file-container/download.ts b/src/app/claim-mgt/claim/conversation/file-container/download.ts new file mode 100644 index 00000000..bf2ad38b --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/download.ts @@ -0,0 +1,15 @@ +/** + * https://github.com/sindresorhus/multi-download/blob/master/index.js + */ +export function download(url: string, name?: string): void { + const a = document.createElement('a'); + a.download = name; + a.href = url; + a.style.display = 'none'; + document.body.append(a); + a.click(); + // Chrome requires the timeout + setTimeout(() => { + a.remove(); + }, 100); +} diff --git a/src/app/claim-mgt/claim/conversation/file-container/file-container.component.css b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.css new file mode 100644 index 00000000..662b635c --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.css @@ -0,0 +1,7 @@ +.download-icon { + color: rgba(0, 0, 0, 0.87); +} + +.download-icon:hover { + cursor: pointer; +} diff --git a/src/app/claim-mgt/claim/conversation/file-container/file-container.component.html b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.html new file mode 100644 index 00000000..35b02137 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.html @@ -0,0 +1,6 @@ + + +
{{ fileData.file_name }}
+ cloud_download +
+
diff --git a/src/app/claim-mgt/claim/conversation/file-container/file-container.component.ts b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.ts new file mode 100644 index 00000000..04c24509 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/file-container.component.ts @@ -0,0 +1,26 @@ +import { Component, Input, OnInit } from '@angular/core'; + +import { FileContainerService } from './file-container.service'; + +@Component({ + selector: 'cc-file-container', + templateUrl: 'file-container.component.html', + styleUrls: ['file-container.component.css'], + providers: [FileContainerService] +}) +export class FileContainerComponent implements OnInit { + @Input() + fileID: string; + + fileData$ = this.fileContainerService.fileData$; + + constructor(private fileContainerService: FileContainerService) {} + + ngOnInit() { + this.fileContainerService.getFileInfo(this.fileID); + } + + downloadFile() { + this.fileContainerService.downloadFile(this.fileID); + } +} diff --git a/src/app/claim-mgt/claim/conversation/file-container/file-container.module.ts b/src/app/claim-mgt/claim/conversation/file-container/file-container.module.ts new file mode 100644 index 00000000..9ee16c13 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/file-container.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FlexModule } from '@angular/flex-layout'; +import { MatCardModule } from '@angular/material'; +import { MatIconModule } from '@angular/material/icon'; + +import { FileContainerComponent } from './file-container.component'; +import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service'; + +@NgModule({ + imports: [CommonModule, MatCardModule, FlexModule, MatIconModule], + exports: [FileContainerComponent], + declarations: [FileContainerComponent], + providers: [FileStorageService] +}) +export class FileContainerModule {} diff --git a/src/app/claim-mgt/claim/conversation/file-container/file-container.service.ts b/src/app/claim-mgt/claim/conversation/file-container/file-container.service.ts new file mode 100644 index 00000000..a3de4bd0 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/file-container.service.ts @@ -0,0 +1,56 @@ +import { Injectable } from '@angular/core'; +import { MatSnackBar } from '@angular/material'; +import { Observable, Subject } from 'rxjs'; +import { shareReplay, switchMap } from 'rxjs/operators'; +import * as moment from 'moment'; + +import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service'; +import { + FileData, + FileNotFound +} from '../../../../thrift-services/file-storage/gen-model/file_storage'; +import { booleanDelay } from '../../../../custom-operators'; +import { download } from './download'; + +@Injectable() +export class FileContainerService { + private getFileInfo$ = new Subject(); + + fileData$: Observable = this.getFileInfo$.pipe( + switchMap(fileID => this.fileStorageService.getFileData(fileID)), + shareReplay(1) + ); + + isLoading$ = this.fileData$.pipe( + booleanDelay(), + shareReplay(1) + ); + + constructor(private fileStorageService: FileStorageService, private snackBar: MatSnackBar) { + this.fileData$.subscribe(); + } + + getFileInfo(fileID: string) { + this.getFileInfo$.next(fileID); + } + + downloadFile(fileID: string) { + this.fileStorageService + .generateDownloadUrl( + fileID, + moment() + .add(1, 'h') + .toISOString() + ) + .subscribe( + url => { + if (typeof url === 'string') { + download(url); + } else { + this.snackBar.open('File not found', 'OK'); + } + }, + () => this.snackBar.open('Download error', 'OK') + ); + } +} diff --git a/src/app/claim-mgt/claim/conversation/file-container/index.ts b/src/app/claim-mgt/claim/conversation/file-container/index.ts new file mode 100644 index 00000000..a2a454fc --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-container/index.ts @@ -0,0 +1,2 @@ +export * from './file-container.module'; +export * from './file-container.component'; diff --git a/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.css b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.css new file mode 100644 index 00000000..be0f620c --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.css @@ -0,0 +1,3 @@ +.dsh-file-uploader:hover { + cursor: pointer; +} diff --git a/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.html b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.html new file mode 100644 index 00000000..ebfee715 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.html @@ -0,0 +1,5 @@ +
+ +
diff --git a/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.ts b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.ts new file mode 100644 index 00000000..5746bee8 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.component.ts @@ -0,0 +1,27 @@ +import { Component, EventEmitter, Output } from '@angular/core'; + +import { FileUploaderService } from './file-uploader.service'; +import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-file-uploader', + templateUrl: 'file-uploader.component.html', + styleUrls: ['file-uploader.component.css'] +}) +export class FileUploaderComponent { + @Output() + filesUploaded: EventEmitter = new EventEmitter(); + + startUploading$ = this.fileUploaderService.startUploading$; + inProgress$ = this.fileUploaderService.inProgress$; + + constructor(private fileUploaderService: FileUploaderService) { + this.fileUploaderService.filesUploaded$.subscribe(values => + this.filesUploaded.emit(values.map(v => this.fileUploaderService.createModification(v))) + ); + } + + startUploading(files: File[]) { + this.startUploading$.next(files); + } +} diff --git a/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.module.ts b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.module.ts new file mode 100644 index 00000000..c17d50d0 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FlexModule } from '@angular/flex-layout'; +import { ngfModule } from 'angular-file'; + +import { FileUploaderComponent } from './file-uploader.component'; +import { FileUploaderService } from './file-uploader.service'; +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; + +@NgModule({ + imports: [FlexModule, ngfModule, CommonModule, MatIconModule, MatButtonModule], + exports: [FileUploaderComponent], + declarations: [FileUploaderComponent], + providers: [FileUploaderService] +}) +export class FileUploaderModule {} diff --git a/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.service.ts b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.service.ts new file mode 100644 index 00000000..7a12feda --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/file-uploader/file-uploader.service.ts @@ -0,0 +1,92 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { forkJoin, merge, Observable, of, Subject } from 'rxjs'; +import { catchError, filter, map, shareReplay, switchMap } from 'rxjs/operators'; +import * as moment from 'moment'; +import { progress } from '@rbkmoney/partial-fetcher/dist/progress'; + +import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service'; +import { NewFileResult } from '../../../../thrift-services/file-storage/gen-model/file_storage'; +import { Value } from '../../../../thrift-services/file-storage/gen-model/msgpack'; +import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management'; + +@Injectable() +export class FileUploaderService { + startUploading$ = new Subject(); + + filesUploadingError$ = new Subject(); + + filesUploaded$: Observable = this.startUploading$.pipe( + switchMap(files => + this.uploadFiles(files).pipe( + catchError(() => { + this.filesUploadingError$.next(null); + return of([]); + }) + ) + ), + filter(v => !!v.length), + shareReplay(1) + ); + + inProgress$: Observable = progress( + this.startUploading$, + merge(this.filesUploaded$, this.filesUploadingError$) + ); + + constructor( + private fileStorageService: FileStorageService, + private snackBar: MatSnackBar, + private http: HttpClient + ) { + this.filesUploadingError$.subscribe(() => this.snackBar.open('File uploading error', 'OK')); + } + + uploadFiles(files: File[]): Observable { + return forkJoin( + files.map(file => + this.getUploadLink().pipe( + switchMap(uploadData => + forkJoin( + of(uploadData.file_data_id), + this.uploadFileToUrl(file, uploadData.upload_url) + ) + ), + map(([fileId]) => fileId) + ) + ) + ); + } + + createModification(id: string): Modification { + return { + claim_modification: { + file_modification: { + id, + modification: { + creation: {} + } + } + } + }; + } + + private getUploadLink(): Observable { + return this.fileStorageService.createNewFile( + new Map(), + moment() + .add(1, 'h') + .toISOString() + ); + } + + private uploadFileToUrl(file: File, url: string): Observable { + return this.http.put(url, file, { + headers: { + 'Content-Disposition': `attachment;filename=${file.name}`, + 'Content-Type': '' + } + }); + } +} diff --git a/src/app/claim-mgt/claim/conversation/questionary.service.ts b/src/app/claim-mgt/claim/conversation/questionary.service.ts new file mode 100644 index 00000000..1c137fdd --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/questionary.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { ConversationService } from './conversation.service'; +import { switchMap, pluck, map, publishReplay } from 'rxjs/operators'; +import { AnkService } from '../../../thrift-services/ank/ank.service'; +import { TimelineAction } from './to-timeline-info/model'; +import { ConnectableObservable } from 'rxjs'; +import { Questionary } from '../../../thrift-services/ank/gen-model/questionary_manager'; + +@Injectable() +export class QuestionaryService { + questionary$ = this.conversationService.timelineInfos$.pipe( + map(timelineInfos => timelineInfos.find(i => i.action === TimelineAction.changesAdded)), + pluck('modifications', 0, 'claim_modification', 'document_modification', 'id'), + switchMap(id => this.ankService.get(id)), + pluck('questionary'), + publishReplay(1) + ) as ConnectableObservable; + + constructor(private conversationService: ConversationService, private ankService: AnkService) { + this.questionary$.connect(); + } +} diff --git a/src/app/claim-mgt/claim/conversation/questionary/index.ts b/src/app/claim-mgt/claim/conversation/questionary/index.ts new file mode 100644 index 00000000..7d123aa3 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/questionary/index.ts @@ -0,0 +1 @@ +export * from './questionary.component'; diff --git a/src/app/claim-mgt/claim/conversation/questionary/questionary.component.html b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.html new file mode 100644 index 00000000..8aab1034 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.html @@ -0,0 +1 @@ + Questionary diff --git a/src/app/claim-mgt/claim/conversation/questionary/questionary.component.scss b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.scss new file mode 100644 index 00000000..994f5c4c --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.scss @@ -0,0 +1,3 @@ +mat-card-content { + word-break: break-all; +} \ No newline at end of file diff --git a/src/app/claim-mgt/claim/conversation/questionary/questionary.component.ts b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.ts new file mode 100644 index 00000000..2d75525b --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/questionary/questionary.component.ts @@ -0,0 +1,12 @@ +import { Component, Input } from '@angular/core'; + +import { Questionary } from '../../../../thrift-services/ank/gen-model/questionary_manager'; + +@Component({ + selector: 'cc-questionary', + templateUrl: 'questionary.component.html', + styleUrls: ['questionary.component.scss'] +}) +export class QuestionaryComponent { + @Input() questionary: Questionary; +} diff --git a/src/app/claim-mgt/claim/conversation/reason/reason.component.html b/src/app/claim-mgt/claim/conversation/reason/reason.component.html new file mode 100644 index 00000000..f52dcc70 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/reason/reason.component.html @@ -0,0 +1,8 @@ + + + {{ + statusModificationUnit.status.denied?.reason || + statusModificationUnit.status.revoked?.reason + }} + + diff --git a/src/app/claim-mgt/claim/conversation/reason/reason.component.ts b/src/app/claim-mgt/claim/conversation/reason/reason.component.ts new file mode 100644 index 00000000..80e1e79a --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/reason/reason.component.ts @@ -0,0 +1,10 @@ +import { Component, Input } from '@angular/core'; +import { StatusModificationUnit } from '../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-reason', + templateUrl: 'reason.component.html' +}) +export class ReasonComponent { + @Input() statusModificationUnit: StatusModificationUnit; +} diff --git a/src/app/claim-mgt/claim/conversation/send-comment/index.ts b/src/app/claim-mgt/claim/conversation/send-comment/index.ts new file mode 100644 index 00000000..ec71f70b --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/send-comment/index.ts @@ -0,0 +1 @@ +export * from './send-comment.component'; diff --git a/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.html b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.html new file mode 100644 index 00000000..8a726043 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.html @@ -0,0 +1,16 @@ +
+ + Write a comment... + + +
+ +
+
diff --git a/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.scss b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.scss new file mode 100644 index 00000000..1e12c607 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.scss @@ -0,0 +1,9 @@ +$cc-send-comment-action-padding: 10px 0 0 0; + +.send-comment-action { + padding: $cc-send-comment-action-padding; +} + +button { + margin-bottom: 1.25em; +} \ No newline at end of file diff --git a/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.ts b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.ts new file mode 100644 index 00000000..8a849919 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.component.ts @@ -0,0 +1,35 @@ +import { Component, Output, EventEmitter } from '@angular/core'; +import { FormGroup } from '@angular/forms'; + +import { SendCommentService } from './send-comment.service'; +import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-send-comment', + templateUrl: 'send-comment.component.html', + styleUrls: ['send-comment.component.scss'], + providers: [SendCommentService] +}) +export class SendCommentComponent { + @Output() conversationSaved: EventEmitter = new EventEmitter(); + + form: FormGroup = this.sendCommentService.form; + inProgress$ = this.sendCommentService.inProgress$; + + constructor(private sendCommentService: SendCommentService) { + this.sendCommentService.conversationSaved$.subscribe(id => + this.conversationSaved.next([sendCommentService.createModification(id)]) + ); + this.inProgress$.subscribe(inProgress => { + if (inProgress) { + this.form.controls.comment.disable(); + } else { + this.form.controls.comment.enable(); + } + }); + } + + sendComment(comment: string) { + this.sendCommentService.sendComment(comment); + } +} diff --git a/src/app/claim-mgt/claim/conversation/send-comment/send-comment.service.ts b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.service.ts new file mode 100644 index 00000000..9005e3dd --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/send-comment/send-comment.service.ts @@ -0,0 +1,96 @@ +import { Injectable } from '@angular/core'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { Subject, of, forkJoin, BehaviorSubject, Observable, merge } from 'rxjs'; +import { switchMap, filter, catchError, pluck, tap } from 'rxjs/operators'; +import * as uuid from 'uuid/v4'; +import get from 'lodash-es/get'; +import { progress } from '@rbkmoney/partial-fetcher/dist/progress'; +import { MatSnackBar } from '@angular/material/snack-bar'; + +import { ConversationId, User } from '../../../../thrift-services/messages/gen-model/messages'; +import { MessagesService } from '../../../../thrift-services/messages/messages.service'; +import { createSingleMessageConversationParams } from '../../../../thrift-services/messages/utils'; +import { KeycloakTokenInfoService } from '../../../../keycloak-token-info.service'; +import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management'; + +@Injectable() +export class SendCommentService { + private conversationId$: BehaviorSubject = new BehaviorSubject(null); + private error$: BehaviorSubject = new BehaviorSubject({ hasError: false }); + private sendComment$: Subject = new Subject(); + + form: FormGroup; + conversationSaved$: Observable = this.conversationId$.pipe(filter(id => !!id)); + errorCode$: Observable = this.error$.pipe(pluck('code')); + inProgress$: Observable = progress( + this.sendComment$, + merge(this.conversationId$, this.error$) + ); + + constructor( + private fb: FormBuilder, + private messagesService: MessagesService, + private keycloakTokenInfoService: KeycloakTokenInfoService, + private snackBar: MatSnackBar + ) { + this.form = this.fb.group({ + comment: ['', [Validators.maxLength(1000)]] + }); + + this.sendComment$ + .pipe( + tap(() => this.error$.next({ hasError: false })), + switchMap(text => { + const { name, email, sub } = this.keycloakTokenInfoService.decodedUserToken; + const user: User = { fullname: name, email, user_id: sub }; + const conversation_id = uuid(); + const conversation = createSingleMessageConversationParams( + conversation_id, + text, + sub + ); + return forkJoin( + of(conversation_id), + this.messagesService.saveConversations([conversation], user).pipe( + catchError(ex => { + console.error(ex); + this.snackBar.open( + `There was an error sending a comment: ${ex}`, + 'OK', + { duration: 5000 } + ); + const error = { hasError: true, code: 'saveConversationsFailed' }; + this.error$.next(error); + return of(error); + }) + ) + ); + }), + filter(([, res]) => get(res, ['hasError']) !== true) + ) + .subscribe(([conversation_id]) => { + this.conversationId$.next(conversation_id); + this.form.reset(); + }); + } + + sendComment(comment: string) { + if (comment.length === 0) { + return; + } + this.sendComment$.next(comment); + } + + createModification(id: ConversationId): Modification { + return { + claim_modification: { + comment_modification: { + id, + modification: { + creation: {} + } + } + } + }; + } +} diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/add-comments-to-timeline-info.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/add-comments-to-timeline-info.ts new file mode 100644 index 00000000..cec1cc93 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/add-comments-to-timeline-info.ts @@ -0,0 +1,25 @@ +import { Conversation } from '../../../../thrift-services/messages/gen-model/messages'; +import { TimelineAction, TimelineItemInfo } from './model'; + +export const addCommentsToTimelineInfos = ( + conversations: Conversation[], + infos: TimelineItemInfo[] +): TimelineItemInfo[] => + infos.map(info => { + if (info.action === TimelineAction.commentAdded) { + return { + ...info, + data: conversations + ? conversations.find(conversation => { + return !!info.modifications.find( + m => + m.claim_modification.comment_modification.id === + conversation.conversation_id + ); + }) + : null + }; + } else { + return info; + } + }); diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/get-claim-modification-timeline-action.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/get-claim-modification-timeline-action.ts new file mode 100644 index 00000000..542f3fad --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/get-claim-modification-timeline-action.ts @@ -0,0 +1,41 @@ +import { TimelineAction } from './model'; +import { + ClaimModification, + StatusModificationUnit +} from '../../../../thrift-services/damsel/gen-model/claim_management'; +import { getUnionKey } from '../../../../shared/get-union-key'; +import { ClaimStatus } from '../../../../papi/model/claim-statuses'; + +function getStatusModificationTimelineAction(unit: StatusModificationUnit): TimelineAction | null { + const Status = ClaimStatus; + switch (getUnionKey(unit.status)) { + case Status.accepted: + return TimelineAction.statusAccepted; + case Status.denied: + return TimelineAction.statusDenied; + case Status.pending: + return TimelineAction.statusPending; + case Status.review: + return TimelineAction.statusReview; + case Status.revoked: + return TimelineAction.statusRevoked; + case Status.pending_acceptance: + return null; + } +} + +export function getClaimModificationTimelineAction(m: ClaimModification): TimelineAction | null { + switch (getUnionKey(m)) { + case 'document_modification': + return TimelineAction.changesAdded; + case 'status_modification': + return getStatusModificationTimelineAction( + m.status_modification as StatusModificationUnit + ); + case 'file_modification': + return TimelineAction.filesAdded; + case 'comment_modification': + return TimelineAction.commentAdded; + } + throw new Error(`Unknown claimModification: ${m}`); +} diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/index.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/index.ts new file mode 100644 index 00000000..1e62683c --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/index.ts @@ -0,0 +1,2 @@ +export * from './to-timeline-info'; +export * from './add-comments-to-timeline-info'; diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/model/index.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/index.ts new file mode 100644 index 00000000..318b8b47 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/index.ts @@ -0,0 +1,2 @@ +export * from './timeline-item-info'; +export * from './timeline-action'; diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-action.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-action.ts new file mode 100644 index 00000000..1cd4e0e5 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-action.ts @@ -0,0 +1,10 @@ +export enum TimelineAction { + changesAdded = 'changesAdded', + filesAdded = 'filesAdded', + commentAdded = 'commentAdded', + statusReview = 'statusReview', + statusPending = 'statusPending', + statusDenied = 'statusDenied', + statusRevoked = 'statusRevoked', + statusAccepted = 'statusAccepted' +} diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-item-info.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-item-info.ts new file mode 100644 index 00000000..6c0b0538 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/model/timeline-item-info.ts @@ -0,0 +1,14 @@ +import { TimelineAction } from './timeline-action'; +import { + Modification, + UserInfo +} from '../../../../../thrift-services/damsel/gen-model/claim_management'; +import { Conversation } from '../../../../../thrift-services/messages/gen-model/messages'; + +export interface TimelineItemInfo { + action: TimelineAction; + user_info: UserInfo; + created_at: string; + modifications: Modification[]; + data?: Conversation; +} diff --git a/src/app/claim-mgt/claim/conversation/to-timeline-info/to-timeline-info.ts b/src/app/claim-mgt/claim/conversation/to-timeline-info/to-timeline-info.ts new file mode 100644 index 00000000..b5804eb9 --- /dev/null +++ b/src/app/claim-mgt/claim/conversation/to-timeline-info/to-timeline-info.ts @@ -0,0 +1,68 @@ +import { + ClaimModification, + Modification, + ModificationUnit +} from '../../../../thrift-services/damsel/gen-model/claim_management'; +import { TimelineAction, TimelineItemInfo } from './model'; +import { sortUnitsByCreatedAtAsc } from '../../../../shared/utils'; +import { getUnionKey } from '../../../../shared/get-union-key'; +import { getClaimModificationTimelineAction } from './get-claim-modification-timeline-action'; + +const isSame = (x: TimelineItemInfo, y: TimelineItemInfo): boolean => + x.action === y.action && x.user_info.type === y.user_info.type; + +const getUnitTimelineAction = (modification: Modification): TimelineAction | null => { + switch (getUnionKey(modification)) { + case 'claim_modification': + return getClaimModificationTimelineAction( + modification.claim_modification as ClaimModification + ); + case 'party_modification': + return TimelineAction.changesAdded; + } +}; + +const concatLastItem = ( + acc: TimelineItemInfo[], + updateItem: TimelineItemInfo +): TimelineItemInfo[] => + acc.map((accItem, accItemIndex) => + accItemIndex === acc.length - 1 + ? { + ...updateItem, + modifications: accItem.modifications.concat(updateItem.modifications) + } + : accItem + ); + +const acceptTimelineItem = ( + acc: TimelineItemInfo[], + { created_at, modification, user_info }: ModificationUnit +): TimelineItemInfo[] => { + const action = getUnitTimelineAction(modification); + if (action === null) { + return acc; + } + const modifications = [modification]; + const result = { + action, + user_info, + created_at: created_at as string, + modifications + }; + if (acc.length !== 0 && modifications.length !== 0) { + const lastItem = acc[acc.length - 1]; + if (isSame(result, lastItem)) { + return concatLastItem(acc, result); + } + } + return acc.concat(result); +}; + +export const toTimelineInfo = (units: ModificationUnit[]): TimelineItemInfo[] => { + if (!units || units.length === 0) { + return []; + } + const sortedUnits = sortUnitsByCreatedAtAsc(units); + return sortedUnits.reduce(acceptTimelineItem, []); +}; diff --git a/src/app/claim-mgt/claim/details/details.component.html b/src/app/claim-mgt/claim/details/details.component.html new file mode 100644 index 00000000..695ccf08 --- /dev/null +++ b/src/app/claim-mgt/claim/details/details.component.html @@ -0,0 +1,56 @@ + + Claim details + +
+
+ +
{{ claim.id }}
+
+
+ +
{{ claim.revision }}
+
+
+ +
{{ claim.status | ccClaimStatus }}
+
+
+ +
{{ claim.status.revoked?.reason || claim.status.denied?.reason }}
+
+
+
+
+ +
{{ claim.party_id }}
+
+
+ +
{{ claim.created_at | date: 'dd.MM.yyyy HH:mm:ss' }}
+
+
+ +
{{ claim.updated_at | date: 'dd.MM.yyyy HH:mm:ss' }}
+
+
+
+ +
+ +
+
+ +
+
+
diff --git a/src/app/claim-mgt/claim/details/details.component.ts b/src/app/claim-mgt/claim/details/details.component.ts new file mode 100644 index 00000000..0672cfa6 --- /dev/null +++ b/src/app/claim-mgt/claim/details/details.component.ts @@ -0,0 +1,56 @@ +import { Component, Input } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { MatBottomSheet } from '@angular/material/bottom-sheet'; +import { filter } from 'rxjs/operators'; + +import { Claim } from '../../../thrift-services/damsel/gen-model/claim_management'; +import { StatusChangerComponent } from '../status-changer/status-changer.component'; +import { getAvailableClaimStatuses } from '../status-changer/get-available-claim-statuses'; +import { ClaimService } from '../claim.service'; +import { UnitActionsComponent } from '../party-modification-creator/unit-actions/unit-actions.component'; + +@Component({ + selector: 'cc-claim-details', + templateUrl: 'details.component.html' +}) +export class DetailsComponent { + @Input() claim: Claim; + + constructor( + private dialog: MatDialog, + private claimService: ClaimService, + private bottomSheet: MatBottomSheet + ) {} + + editStatus() { + this.dialog + .open(StatusChangerComponent, { + width: '500px', + disableClose: true, + data: { + partyID: this.claim.party_id, + claimID: this.claim.id, + claimStatus: this.claim.status + } + }) + .afterClosed() + .pipe(filter(r => r)) + .subscribe(_ => { + this.claimService.getClaim(this.claim.party_id, this.claim.id); + }); + } + + canChangeStatus(): boolean { + return getAvailableClaimStatuses(this.claim.status).length > 0; + } + + addModification() { + this.bottomSheet.open(UnitActionsComponent, { + data: { + partyID: this.claim.party_id, + claimID: this.claim.id, + type: 'allActions' + } + }); + } +} diff --git a/src/app/claim-mgt/claim/index.ts b/src/app/claim-mgt/claim/index.ts new file mode 100644 index 00000000..1b27ecb4 --- /dev/null +++ b/src/app/claim-mgt/claim/index.ts @@ -0,0 +1 @@ +export * from './claim.module'; diff --git a/src/app/claim-mgt/claim/party-modification-creator/container-name.pipe.ts b/src/app/claim-mgt/claim/party-modification-creator/container-name.pipe.ts new file mode 100644 index 00000000..af93eb97 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/container-name.pipe.ts @@ -0,0 +1,66 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { ShopModificationName } from './shop-modification-name'; +import { ContractModificationName } from './contract-modification-name'; +import { ModificationGroupType } from '../../../claim/model'; + +@Pipe({ + name: 'ccContainerName' +}) +export class ContainerNamePipe implements PipeTransform { + transform(value: any, ...args: any[]): any { + if (args.length < 1) { + return value; + } + const type = args[0] as ModificationGroupType; + switch (type) { + case ModificationGroupType.ShopUnitContainer: + return this.transformShopModification(value); + case ModificationGroupType.ContractUnitContainer: + return this.transformContractModificationName(value); + default: + return value; + } + } + + private transformShopModification(value: ShopModificationName): string { + switch (value) { + case ShopModificationName.creation: + return 'Shop creation'; + case ShopModificationName.categoryModification: + return 'Shop category modification'; + case ShopModificationName.detailsModification: + return 'Shop details modification'; + case ShopModificationName.contractModification: + return 'Shop contract modification'; + case ShopModificationName.payoutToolModification: + return 'Shop payout tool modification'; + case ShopModificationName.locationModification: + return 'Shop location modification'; + case ShopModificationName.shopAccountCreation: + return 'Shop account creation'; + case ShopModificationName.payoutScheduleModification: + return 'Shop schedule modification'; + default: + return value; + } + } + + private transformContractModificationName(value: ContractModificationName): string { + switch (value) { + case ContractModificationName.creation: + return 'Contract creation'; + case ContractModificationName.termination: + return 'Contract termination'; + case ContractModificationName.adjustmentModification: + return 'Contract adjustment modification'; + case ContractModificationName.payoutToolModification: + return 'Contract payout tool modification'; + case ContractModificationName.legalAgreementBinding: + return 'Contract legal agreement binding'; + case ContractModificationName.reportPreferencesModification: + return 'Contract report preferences modification'; + default: + return value; + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/contract-modification-name.ts b/src/app/claim-mgt/claim/party-modification-creator/contract-modification-name.ts new file mode 100644 index 00000000..388d772c --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/contract-modification-name.ts @@ -0,0 +1,10 @@ +export enum ContractModificationName { + creation = 'creation', + termination = 'termination', + adjustmentModification = 'adjustment_modification', + payoutToolModification = 'payout_tool_modification', + legalAgreementBinding = 'legal_agreement_binding', + reportPreferencesModification = 'report_preferences_modification', + contractorModification = 'contractor_modification', + unknown = 'unknown' +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.html new file mode 100644 index 00000000..e0273be5 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.html @@ -0,0 +1,18 @@ +
+ {{ action.name | ccContainerName: getContainerType(action.type) }} +
+ + + + + + + + + diff --git a/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.ts new file mode 100644 index 00000000..f80eb4a7 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/create-modification.component.ts @@ -0,0 +1,88 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA } from '@angular/material'; +import { MatDialogRef } from '@angular/material/dialog'; + +import { ActionType, ModificationAction } from './modification-action'; +import { + ClaimID, + PartyModification +} from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ModificationGroupType } from '../../../claim/model'; +import { ClaimManagementService } from '../../../thrift-services/damsel/claim-management.service'; +import { ClaimService } from '../claim.service'; + +export interface CreateModificationData { + action: ModificationAction; + claimID: ClaimID; + partyID: string; +} + +@Component({ + templateUrl: 'create-modification.component.html' +}) +export class CreateModificationComponent implements OnInit { + isLoading = false; + valid = false; + initialized = false; + + values: PartyModification; + + action: ModificationAction; + + constructor( + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: CreateModificationData, + private claimManagementService: ClaimManagementService, + private claimService: ClaimService + ) {} + + ngOnInit() { + this.action = this.data.action; + this.initialized = true; + } + + valueChanges(e: any) { + this.values = e; + } + + statusChanges(status: string) { + this.valid = status === 'VALID'; + } + + apply() { + switch (this.data.action.type) { + case ActionType.shopAction: + case ActionType.contractAction: + this.addChange(); + break; + } + } + + getContainerType(type: ActionType): string { + switch (type) { + case ActionType.shopAction: + return ModificationGroupType.ShopUnitContainer; + case ActionType.contractAction: + return ModificationGroupType.ContractUnitContainer; + } + } + + private addChange() { + this.isLoading = true; + this.claimManagementService + .updateClaim(this.data.partyID, this.data.claimID, [ + { party_modification: this.values } + ]) + .subscribe( + _ => { + this.isLoading = false; + this.claimService.getClaim(this.data.partyID, this.data.claimID); + this.dialogRef.close(true); + }, + e => { + this.isLoading = false; + console.error(e); + } + ); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.html new file mode 100644 index 00000000..cc66fb36 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.html @@ -0,0 +1,6 @@ +
+ +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.ts new file mode 100644 index 00000000..1e0e648b --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-ref.component.ts @@ -0,0 +1,28 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import get from 'lodash-es/get'; +import { BusinessScheduleRef } from '../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-business-schedule-ref', + templateUrl: 'business-schedule-ref.component.html' +}) +export class BusinessScheduleRefComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: BusinessScheduleRef; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const id = get(this, 'initialValue.id', ''); + this.form.registerControl('id', this.fb.control(id, Validators.required)); + this.form.updateValueAndValidity(); + } + + scheduleIdChange(id: number) { + this.form.controls.id.setValue(id); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.html new file mode 100644 index 00000000..299a93ea --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.html @@ -0,0 +1,15 @@ +
+ + + + {{ schedule.ref.id }} {{ schedule.data.name }} + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts new file mode 100644 index 00000000..91a8df99 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts @@ -0,0 +1,45 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { MatSelectChange, MatSnackBar } from '@angular/material'; +import { tap } from 'rxjs/internal/operators'; +import { Observable } from 'rxjs'; +import { BusinessScheduleObject } from '../../../../../../thrift-services/damsel/gen-model/domain'; +import { DomainTypedManager } from '../../../../../../thrift-services'; + +@Component({ + selector: 'cc-business-schedule-selector', + templateUrl: 'business-schedule-selector.component.html' +}) +export class BusinessScheduleSelectorComponent implements OnInit { + @Input() + initialValue: string; + + @Output() + idChange = new EventEmitter(); + + schedules$: Observable; + + isLoading = true; + + hasError = false; + + constructor(private domainManager: DomainTypedManager, private snackBar: MatSnackBar) {} + + selectionChange(change: MatSelectChange) { + this.idChange.emit(change.value); + } + + ngOnInit() { + this.schedules$ = this.domainManager.getBusinessScheduleObjects().pipe( + tap( + () => { + this.isLoading = false; + }, + () => { + this.isLoading = false; + this.hasError = true; + this.snackBar.open('An error occurred while business schedule receiving', 'OK'); + } + ) + ); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.html new file mode 100644 index 00000000..39aca5e4 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.html @@ -0,0 +1,11 @@ +
+ + + +
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts new file mode 100644 index 00000000..809a35bd --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import * as uuid from 'uuid/v4'; +import get from 'lodash-es/get'; +import { ContractAdjustmentModificationUnit } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-adjustment-modification-unit', + templateUrl: 'adjustment-modification-unit.component.html' +}) +export class AdjustmentModificationUnitComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ContractAdjustmentModificationUnit; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const adjustmentId = get(this, 'initialValue.adjustment_id', ''); + this.form.registerControl( + 'adjustment_id', + this.fb.control(adjustmentId, Validators.required) + ); + this.form.registerControl('modification', this.fb.group({})); + this.form.updateValueAndValidity(); + } + + generate() { + this.form.patchValue({ adjustment_id: uuid() }); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.html new file mode 100644 index 00000000..45eaecc1 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.html @@ -0,0 +1,7 @@ +
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.ts new file mode 100644 index 00000000..bd3ed58d --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-modification/adjustment-modification.component.ts @@ -0,0 +1,22 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { ContractAdjustmentModification } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-adjustment-modification', + templateUrl: 'adjustment-modification.component.html' +}) +export class AdjustmentModificationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ContractAdjustmentModification; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('creation', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.html new file mode 100644 index 00000000..c992fbec --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.html @@ -0,0 +1,8 @@ +
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.ts new file mode 100644 index 00000000..5b6669a9 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/adjustment-params/adjustment-params.component.ts @@ -0,0 +1,22 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { ContractAdjustmentParams } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-contract-adjustment-params', + templateUrl: 'adjustment-params.component.html' +}) +export class AdjustmentParamsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ContractAdjustmentParams; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('template', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.html new file mode 100644 index 00000000..c35bcf7e --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.html @@ -0,0 +1,36 @@ +
+ + + + + + + Template + + + Payment institution + + + + + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.ts new file mode 100644 index 00000000..2460d1c0 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-params/contract-params.component.ts @@ -0,0 +1,49 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ContractParams } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-contract-params', + templateUrl: 'contract-params.component.html' +}) +export class ContractParamsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ContractParams; + + showTemplate = false; + + showPaymentInstitution = false; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('contractor', this.fb.group({})); + this.toggleTemplate(); + this.togglePaymentInstitution(); + this.form.updateValueAndValidity(); + } + + toggleCheckbox(show: boolean, controlName: string, data: object = {}) { + if (show) { + this.form.registerControl(controlName, this.fb.group(data || {})); + } else { + this.form.removeControl(controlName); + } + } + + toggleTemplate() { + const template = get(this, 'initialValue.template', null); + this.showTemplate = template !== null; + this.toggleCheckbox(this.showTemplate, 'template', template); + } + + togglePaymentInstitution() { + const paymentInstitution = get(this, 'initialValue.payment_institution', null); + this.showPaymentInstitution = paymentInstitution !== null; + this.toggleCheckbox(this.showPaymentInstitution, 'payment_institution', paymentInstitution); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.html new file mode 100644 index 00000000..eb05e2d1 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.html @@ -0,0 +1,14 @@ +
+ + + + {{ contract.id }} {{ contract.name }} + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.ts new file mode 100644 index 00000000..c83e4aef --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract-template-ref.component.ts @@ -0,0 +1,66 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatSnackBar } from '@angular/material'; +import { Observable } from 'rxjs'; +import { tap, map } from 'rxjs/internal/operators'; +import sortBy from 'lodash-es/sortBy'; +import get from 'lodash-es/get'; +import { + ContractTemplate, + ContractTemplateRef +} from '../../../../../../thrift-services/damsel/gen-model/domain'; +import { ContractService } from './contract.service'; + +@Component({ + selector: 'cc-contract-template-ref', + templateUrl: 'contract-template-ref.component.html', + providers: [ContractService] +}) +export class ContractTemplateRefComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + required: boolean; + + @Input() + initialValue: ContractTemplateRef; + + contracts$: Observable; + + isLoading = true; + + constructor( + private fb: FormBuilder, + private contractService: ContractService, + private snackBar: MatSnackBar + ) {} + + ngOnInit() { + const templateId = get(this, 'initialValue.id', ''); + this.form.registerControl( + 'id', + this.fb.control( + { + value: templateId, + disabled: templateId.length === 0 + }, + this.required ? Validators.required : null + ) + ); + this.form.updateValueAndValidity(); + this.contracts$ = this.contractService.getContractTemplates().pipe( + map(contracts => sortBy(contracts, 'id')), + tap( + () => { + this.form.controls.id.enable(); + this.isLoading = false; + }, + () => { + this.isLoading = false; + this.snackBar.open('An error occurred while contract template receiving', 'OK'); + } + ) + ); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract.service.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract.service.ts new file mode 100644 index 00000000..776b1678 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contract-template-ref/contract.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { ConfigService } from '../../../../../../core/config.service'; +import { ContractTemplate } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Injectable() +export class ContractService { + private readonly papiEndpoint = this.configService.config.papiEndpoint; + + constructor(private http: HttpClient, private configService: ConfigService) {} + + getContractTemplates(): Observable { + return this.http.get(`${this.papiEndpoint}/dmt/contract/templates`); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.html new file mode 100644 index 00000000..4e9901da --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.ts new file mode 100644 index 00000000..6c9068ae --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor-id/contractor-id.component.ts @@ -0,0 +1,18 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; + +@Component({ + selector: 'cc-contractor-id', + templateUrl: 'contractor-id.component.html' +}) +export class ContractorIdComponent implements OnInit { + @Input() + form: FormGroup; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('modification', this.fb.control('', Validators.required)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.html new file mode 100644 index 00000000..f074c8c7 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.html @@ -0,0 +1,4 @@ +
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.ts new file mode 100644 index 00000000..efe0606e --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/contractor/contractor.component.ts @@ -0,0 +1,22 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { Contractor } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-contractor', + templateUrl: 'contractor.component.html' +}) +export class ContractorComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: Contractor; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('legal_entity', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.html new file mode 100644 index 00000000..f1856b84 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.html @@ -0,0 +1,31 @@ +
+ + + + + + + + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts new file mode 100644 index 00000000..a008a833 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts @@ -0,0 +1,31 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import get from 'lodash-es/get'; +import { LegalAgreement } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-legal-agreement-binding', + templateUrl: 'legal-agreement-binding.component.html' +}) +export class LegalAgreementBindingComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: LegalAgreement; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const legalAgreementId = get(this, 'initialValue.legal_agreement_id', ''); + const signedAt = get(this, 'initialValue.signed_at', ''); + const validUntil = get(this, 'initialValue.valid_until', ''); + this.form.registerControl( + 'legal_agreement_id', + this.fb.control(legalAgreementId, Validators.required) + ); + this.form.registerControl('signed_at', this.fb.control(signedAt, Validators.required)); + this.form.registerControl('valid_until', this.fb.control(validUntil)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.html new file mode 100644 index 00000000..0ab1e741 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.html @@ -0,0 +1,24 @@ +
+
+ + + + + + + + + + + + + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts new file mode 100644 index 00000000..274fc6ac --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts @@ -0,0 +1,27 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { InternationalLegalEntity } from '../../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-international-legal-entity', + templateUrl: 'international-legal-entity.component.html' +}) +export class InternationalLegalEntityComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: InternationalLegalEntity; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('legal_name', this.fb.control('', Validators.required)); + this.form.registerControl('registered_address', this.fb.control('', Validators.required)); + + this.form.registerControl('trading_name', this.fb.control('')); + this.form.registerControl('actual_address', this.fb.control('')); + this.form.registerControl('registered_number', this.fb.control('')); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.html new file mode 100644 index 00000000..94bd26e0 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.html @@ -0,0 +1,25 @@ + +
+ + + {{ type }} + + + + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.ts new file mode 100644 index 00000000..f84f5160 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/legal-entity.component.ts @@ -0,0 +1,56 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { LegalEntity } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +enum Type { + russian_legal_entity = 'russian_legal_entity', + international_legal_entity = 'international_legal_entity' +} + +@Component({ + selector: 'cc-legal-entity', + templateUrl: 'legal-entity.component.html' +}) +export class LegalEntityComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: LegalEntity; + + types = [Type.russian_legal_entity, Type.international_legal_entity]; + + selected: Type; + + t = Type; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const russianLegalEntity = get(this, 'initialValue.russian_legal_entity', null); + const internationalLegalEntity = get(this, 'initialValue.international_legal_entity', null); + if (russianLegalEntity) { + this.selected = Type.russian_legal_entity; + this.select(); + } + if (internationalLegalEntity) { + this.selected = Type.international_legal_entity; + this.select(); + } + } + + select() { + switch (this.selected) { + case Type.russian_legal_entity: + this.form.removeControl(Type.international_legal_entity); + this.form.registerControl(Type.russian_legal_entity, this.fb.group({})); + break; + case Type.international_legal_entity: + this.form.removeControl(Type.russian_legal_entity); + this.form.registerControl(Type.international_legal_entity, this.fb.group({})); + break; + } + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.html new file mode 100644 index 00000000..c3462df5 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.html @@ -0,0 +1,69 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts new file mode 100644 index 00000000..988ad66c --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts @@ -0,0 +1,40 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import get from 'lodash-es/get'; +import { RussianLegalEntity } from '../../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-russian-legal-entity', + templateUrl: 'russian-legal-entity.component.html' +}) +export class RussianLegalEntityComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: RussianLegalEntity; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const control = value => this.fb.control(value, Validators.required); + const registeredName = get(this, 'initialValue.registered_name', ''); + const registeredNumber = get(this, 'initialValue.registered_number', ''); + const inn = get(this, 'initialValue.inn', ''); + const actualAddress = get(this, 'initialValue.actual_address', ''); + const postAddress = get(this, 'initialValue.post_address', ''); + const representativePosition = get(this, 'initialValue.representative_position', ''); + const representativeFullName = get(this, 'initialValue.representative_full_name', ''); + const representativeDocument = get(this, 'initialValue.representative_document', ''); + this.form.registerControl('registered_name', control(registeredName)); + this.form.registerControl('registered_number', control(registeredNumber)); + this.form.registerControl('inn', control(inn)); + this.form.registerControl('actual_address', control(actualAddress)); + this.form.registerControl('post_address', control(postAddress)); + this.form.registerControl('representative_position', control(representativePosition)); + this.form.registerControl('representative_full_name', control(representativeFullName)); + this.form.registerControl('representative_document', control(representativeDocument)); + this.form.registerControl('russian_bank_account', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.html new file mode 100644 index 00000000..236b1681 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.html @@ -0,0 +1,13 @@ +
+ + + + {{ paymentInstitution.ref.id }} {{ paymentInstitution.data.name }} + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.ts new file mode 100644 index 00000000..ffe47ab2 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payment-institution/payment-institution-ref.component.ts @@ -0,0 +1,46 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { map } from 'rxjs/operators'; +import sortBy from 'lodash-es/sortBy'; +import { Observable } from 'rxjs'; +import get from 'lodash-es/get'; +import { + PaymentInstitutionObject, + PaymentInstitutionRef +} from '../../../../../../thrift-services/damsel/gen-model/domain'; +import { DomainTypedManager } from '../../../../../../thrift-services'; + +@Component({ + selector: 'cc-payment-institution-ref', + templateUrl: 'payment-institution-ref.component.html' +}) +export class PaymentInstitutionRefComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + required: boolean; + + @Input() + initialValue: PaymentInstitutionRef; + + paymentInstitutions$: Observable; + + constructor(private fb: FormBuilder, private dtm: DomainTypedManager) {} + + ngOnInit() { + this.paymentInstitutions$ = this.dtm + .getPaymentInstitutions() + .pipe( + map(paymentInstitutions => + sortBy(paymentInstitutions, paymentInstitution => paymentInstitution.ref.id) + ) + ); + const paymentInstitutionId = get(this, 'initialValue.id', ''); + this.form.registerControl( + 'id', + this.fb.control(paymentInstitutionId, this.required ? Validators.required : null) + ); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.html new file mode 100644 index 00000000..2dccf5f1 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.html @@ -0,0 +1,40 @@ + +
+ + + + + + +
+
+ International bank details +
+ + +
+ Correspondent account +
+
+
+ + +
+
+
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts new file mode 100644 index 00000000..51575476 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts @@ -0,0 +1,52 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { InternationalBankAccount } from '../../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-international-bank-account', + templateUrl: 'international-bank-account.component.html' +}) +export class InternationalBankAccountComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: InternationalBankAccount; + + isBankDetails = false; + + isCorrespondentAccount = false; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const number = get(this, 'initialValue.number', ''); + const iban = get(this, 'initialValue.iban', ''); + this.form.registerControl('number', this.fb.control(number)); + this.form.registerControl('iban', this.fb.control(iban)); + const bank = get(this, 'initialValue.bank', null); + if (bank) { + this.detailsChange(true); + } + const account = get(this, 'initialValue.correspondent_account', null); + if (account) { + this.accountChange(true); + } + this.form.updateValueAndValidity(); + } + + detailsChange(showDetails: boolean) { + this.isBankDetails = showDetails; + this.isBankDetails + ? this.form.registerControl('bank', this.fb.group({})) + : this.form.removeControl('bank'); + } + + accountChange(showCorrespondentAccount: boolean) { + this.isCorrespondentAccount = showCorrespondentAccount; + this.isCorrespondentAccount + ? this.form.registerControl('correspondent_account', this.fb.group({})) + : this.form.removeControl('correspondent_account'); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.html new file mode 100644 index 00000000..9e4f8959 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.html @@ -0,0 +1,13 @@ +
+ + + + + + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts new file mode 100644 index 00000000..60e0277f --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { InternationalBankDetails } from '../../../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-international-bank-details', + templateUrl: 'international-bank-details.component.html' +}) +export class InternationalBankDetailsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: InternationalBankDetails; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const control = (data = '') => this.fb.control(data); + const bic = get(this, 'initialValue.bic', ''); + const country = get(this, 'initialValue.country', ''); + const name = get(this, 'initialValue.name', ''); + const address = get(this, 'initialValue.address', ''); + const abaRtn = get(this, 'initialValue.aba_rtn', ''); + this.form.registerControl('bic', control(bic)); + this.form.registerControl('country', control(country)); // Residence enum + this.form.registerControl('name', control(name)); + this.form.registerControl('address', control(address)); + this.form.registerControl('aba_rtn', control(abaRtn)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.html new file mode 100644 index 00000000..f6cc1d90 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.html @@ -0,0 +1,25 @@ +
+ + + {{ type }} + + + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.ts new file mode 100644 index 00000000..e60bf988 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/payout-tool-info.component.ts @@ -0,0 +1,71 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { PayoutToolInfo } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +enum Type { + russian_bank_account = 'russian_bank_account', + international_bank_account = 'international_bank_account', + wallet_info = 'wallet_info' +} + +@Component({ + selector: 'cc-payout-tool-info', + templateUrl: 'payout-tool-info.component.html' +}) +export class PayoutToolInfoComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: PayoutToolInfo; + + selected: Type; + + types = [Type.russian_bank_account, Type.international_bank_account, Type.wallet_info]; + + t = Type; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const russianBankAccount = get(this, 'initialValue.russian_bank_account', null); + const internationalBankAccount = get(this, 'initialValue.international_bank_account', null); + const walletInfo = get(this, 'initialValue.wallet_info', null); + if (russianBankAccount) { + this.selected = Type.russian_bank_account; + } + if (internationalBankAccount) { + this.selected = Type.international_bank_account; + } + if (walletInfo) { + this.selected = Type.wallet_info; + } + this.select(); + this.form.updateValueAndValidity(); + } + + select() { + switch (this.selected) { + case Type.russian_bank_account: + this.clearControl(); + this.form.registerControl(Type.russian_bank_account, this.fb.group({})); + break; + case Type.international_bank_account: + this.clearControl(); + this.form.registerControl(Type.international_bank_account, this.fb.group({})); + break; + case Type.wallet_info: + this.clearControl(); + const walletInfo = get(this, 'initialValue.wallet_info', {}); + this.form.registerControl(Type.wallet_info, this.fb.group(walletInfo)); + break; + } + } + + private clearControl() { + this.types.forEach(type => { + this.form.removeControl(type); + }); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.html new file mode 100644 index 00000000..cb9b0ec3 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.html @@ -0,0 +1,21 @@ + +
+ + + + + + + + + + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts new file mode 100644 index 00000000..0a03f86e --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts @@ -0,0 +1,31 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import get from 'lodash-es/get'; +import { RussianBankAccount } from '../../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-russian-bank-account', + templateUrl: 'russian-bank-account.component.html' +}) +export class RussianBankAccountComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: RussianBankAccount; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const control = value => this.fb.control(value, Validators.required); + const account = get(this, 'initialValue.account', ''); + const bankName = get(this, 'initialValue.bank_name', ''); + const bankPostAccount = get(this, 'initialValue.bank_post_account', ''); + const bankBik = get(this, 'initialValue.bank_bik', ''); + this.form.registerControl('account', control(account)); + this.form.registerControl('bank_name', control(bankName)); + this.form.registerControl('bank_post_account', control(bankPostAccount)); + this.form.registerControl('bank_bik', control(bankBik)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.html new file mode 100644 index 00000000..f3557715 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.html @@ -0,0 +1,7 @@ + +
+ + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.ts new file mode 100644 index 00000000..c006f25d --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-info/wallet-info/wallet-info.component.ts @@ -0,0 +1,18 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; + +@Component({ + selector: 'cc-wallet-info', + templateUrl: 'wallet-info.component.html' +}) +export class WalletInfoComponent implements OnInit { + @Input() + form: FormGroup; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('wallet_id', this.fb.control('')); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.html new file mode 100644 index 00000000..c66b3345 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.html @@ -0,0 +1,18 @@ +
+
+ + + +
+
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts new file mode 100644 index 00000000..abaf457f --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import * as uuid from 'uuid/v4'; +import get from 'lodash-es/get'; +import { PayoutToolModificationUnit } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-contract-payout-tool-modification-unit', + templateUrl: 'payout-tool-modification-unit.component.html' +}) +export class PayoutToolModificationUnitComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: PayoutToolModificationUnit; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const payoutToolId = get(this, 'initialValue.payout_tool_id', ''); + this.form.registerControl( + 'payout_tool_id', + this.fb.control(payoutToolId, Validators.required) + ); + this.form.registerControl('modification', this.fb.group({})); + this.form.updateValueAndValidity(); + } + + generate() { + this.form.patchValue({ payout_tool_id: uuid() }); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.html new file mode 100644 index 00000000..4b654ac4 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.html @@ -0,0 +1,23 @@ +
+ + + {{ type }} + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.ts new file mode 100644 index 00000000..3b267b96 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-modification/payout-tool-modification.component.ts @@ -0,0 +1,55 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { PayoutToolModification } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +enum Type { + creation = 'creation', + info_modification = 'info_modification' +} + +@Component({ + selector: 'cc-contract-payout-tool-modification', + templateUrl: 'payout-tool-modification.component.html' +}) +export class PayoutToolModificationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: PayoutToolModification; + + types = [Type.creation, Type.info_modification]; + + selected: Type; + + t = Type; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const creation = get(this, 'initialValue.creation', ''); + const infoModification = get(this, 'initialValue.info_modification', ''); + if (creation) { + this.selected = Type.creation; + } + if (infoModification) { + this.selected = Type.info_modification; + } + this.select(); + this.form.updateValueAndValidity(); + } + + select() { + switch (this.selected) { + case Type.creation: + this.form.registerControl(Type.creation, this.fb.group({})); + this.form.removeControl(Type.info_modification); + break; + case Type.info_modification: + this.form.registerControl(Type.info_modification, this.fb.group({})); + this.form.removeControl(Type.creation); + break; + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.html new file mode 100644 index 00000000..aef72c78 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.html @@ -0,0 +1,7 @@ +
+ + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.ts new file mode 100644 index 00000000..e01f9af9 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/payout-tool-params/payout-tool-params.component.ts @@ -0,0 +1,23 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { PayoutToolInfo } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-payout-tool-params', + templateUrl: 'payout-tool-params.component.html' +}) +export class PayoutToolParamsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: PayoutToolInfo; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('currency', this.fb.group({})); + this.form.registerControl('tool_info', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.html new file mode 100644 index 00000000..eee8f4cf --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.html @@ -0,0 +1,19 @@ +
+ Service acceptance act preferences + +
+ + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.ts new file mode 100644 index 00000000..e069d7c7 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/report-preferences/report-preferences.component.ts @@ -0,0 +1,58 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { ReportPreferences } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-report-preferences', + templateUrl: 'report-preferences.component.html' +}) +export class ReportPreferencesComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ReportPreferences; + + showPreferences = false; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.togglePreferences(); + this.form.updateValueAndValidity(); + } + + toggleCheckbox(show: boolean, controlName: string, data = {}) { + if (show) { + this.form.registerControl( + controlName, + this.fb.group(this.getFormGroup(controlName, data)) + ); + } else { + this.form.removeControl(controlName); + } + } + + togglePreferences() { + const preferences = get(this, 'initialValue.service_acceptance_act_preferences', null); + this.showPreferences = preferences !== null; + this.toggleCheckbox( + this.showPreferences, + 'service_acceptance_act_preferences', + preferences + ); + } + + private getFormGroup(type: string, data) { + switch (type) { + case 'service_acceptance_act_preferences': + return { + schedule: this.fb.group(data.schedule || {}), + signer: this.fb.group({}) + }; + default: + return {}; + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.html new file mode 100644 index 00000000..3ea761ec --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.html @@ -0,0 +1,17 @@ +
+ + + {{ type }} + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.ts new file mode 100644 index 00000000..fc7f536d --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative-document/representative-document.component.ts @@ -0,0 +1,56 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { RepresentativeDocument } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +enum Type { + articlesOfAssociation = 'articles_of_association', + powerOfAttorney = 'power_of_attorney' +} + +@Component({ + selector: 'cc-representative-document', + templateUrl: 'representative-document.component.html' +}) +export class RepresentativeDocumentComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: RepresentativeDocument; + + selected: Type; + + types = [Type.articlesOfAssociation, Type.powerOfAttorney]; + + t = Type; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const articlesOfAssociation = get(this, 'initialValue.articles_of_association', null); + const powerOfAttorney = get(this, 'initialValue.power_of_attorney', null); + if (articlesOfAssociation) { + this.selected = Type.articlesOfAssociation; + this.select(articlesOfAssociation); + } + if (powerOfAttorney) { + this.selected = Type.powerOfAttorney; + this.select(powerOfAttorney); + } + this.form.updateValueAndValidity(); + } + + select(data = {}) { + switch (this.selected) { + case Type.articlesOfAssociation: + this.form.registerControl(Type.articlesOfAssociation, this.fb.group(data)); + this.form.removeControl(Type.powerOfAttorney); + break; + case Type.powerOfAttorney: + this.form.registerControl(Type.powerOfAttorney, this.fb.group(data)); + this.form.removeControl(Type.articlesOfAssociation); + break; + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.html new file mode 100644 index 00000000..53757d38 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.html @@ -0,0 +1,13 @@ +
+ + + + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.ts new file mode 100644 index 00000000..c9e7eab7 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/representative/representative.component.ts @@ -0,0 +1,27 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import get from 'lodash-es/get'; +import { Representative } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-representative', + templateUrl: 'representative.component.html' +}) +export class RepresentativeComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: Representative; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const position = get(this, 'initialValue.position', ''); + const fullName = get(this, 'initialValue.full_name', ''); + this.form.registerControl('position', this.fb.control(position, Validators.required)); + this.form.registerControl('full_name', this.fb.control(fullName, Validators.required)); + this.form.registerControl('document', this.fb.group({})); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.html new file mode 100644 index 00000000..700a4fe6 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.ts new file mode 100644 index 00000000..1bbab505 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/contract/termination/termination.component.ts @@ -0,0 +1,24 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import get from 'lodash-es/get'; +import { ContractTermination } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-termination', + templateUrl: 'termination.component.html' +}) +export class TerminationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ContractTermination; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const reason = get(this, 'initialValue.reason', ''); + this.form.registerControl('reason', this.fb.control(reason)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.html new file mode 100644 index 00000000..db4671f0 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.ts new file mode 100644 index 00000000..a899b0db --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/currency-ref/currency-ref.component.ts @@ -0,0 +1,18 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; + +@Component({ + selector: 'cc-currency-ref', + templateUrl: 'currency-ref.component.html' +}) +export class CurrencyRefComponent implements OnInit { + @Input() + form: FormGroup; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form.registerControl('symbolic_code', this.fb.control('RUB', Validators.required)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/filter-empty-string-value.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/filter-empty-string-value.ts new file mode 100644 index 00000000..6560d845 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/filter-empty-string-value.ts @@ -0,0 +1,42 @@ +import isDate from 'lodash-es/isDate'; +import isArray from 'lodash-es/isArray'; +import isObject from 'lodash-es/isObject'; +import reduce from 'lodash-es/reduce'; +import * as moment from 'moment'; + +type Filter = (value: any) => boolean; + +function filterObject(object: object, filter: Filter): object { + return reduce( + object, + (result, value, key) => { + if (filter(value)) { + return { + ...result, + [key]: filterValues(value, filter) + }; + } + return result; + }, + {} + ); +} + +export function filterValues(value: any, filter: Filter): any { + if (isDate(value)) { + return value; + } + if (moment.isMoment(value)) { + return value.toISOString(); + } + if (isArray(value)) { + console.error('Array is not supported', value); + return value; + } + if (isObject(value)) { + return filterObject(value, filter); + } + return value; +} + +export const filterEmptyStringValues = (value: any) => filterValues(value, v => v !== ''); diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.html new file mode 100644 index 00000000..e4820dde --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.html @@ -0,0 +1,4 @@ +
+
{{ name }}
+ +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.ts new file mode 100644 index 00000000..4531279e --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/form-wrapper/form-wrapper.component.ts @@ -0,0 +1,10 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'cc-form-wrapper', + templateUrl: 'form-wrapper.component.html' +}) +export class FormWrapperComponent { + @Input() + name: string; +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/index.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/index.ts new file mode 100644 index 00000000..2caaa341 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/index.ts @@ -0,0 +1 @@ +export * from './party-modification-creation.module'; diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.html new file mode 100644 index 00000000..8afdc776 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.html @@ -0,0 +1,10 @@ +
+
+
{{ caption }}:
+ +
+
+
+ +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.ts new file mode 100644 index 00000000..4c8e6c1a --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/nested-form-wrapper/nested-form-wrapper.component.ts @@ -0,0 +1,10 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'cc-nested-form-wrapper', + templateUrl: 'nested-form-wrapper.component.html' +}) +export class NestedFormWrapperComponent { + @Input() + caption: string; +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.html new file mode 100644 index 00000000..ef331181 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.html @@ -0,0 +1,98 @@ +
+ + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.ts new file mode 100644 index 00000000..2e74981d --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.component.ts @@ -0,0 +1,74 @@ +import { + Component, + EventEmitter, + Input, + OnChanges, + OnInit, + Output, + SimpleChanges +} from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import * as uuid from 'uuid/v4'; + +import { toPartyModification } from './to-party-modification'; +import { filterEmptyStringValues } from './filter-empty-string-value'; +import { ActionType, ModificationAction } from '../modification-action'; +import { + ContractModification, + PartyModification, + ShopModification +} from '../../../../thrift-services/damsel/gen-model/claim_management'; +import { ShopModificationName } from '../shop-modification-name'; +import { ContractModificationName } from '../contract-modification-name'; + +@Component({ + selector: 'cc-party-modification-creation', + templateUrl: 'party-modification-creation.component.html' +}) +export class PartyModificationCreationComponent implements OnInit, OnChanges { + @Input() + action: ModificationAction; + + @Input() + modification: ShopModification | ContractModification; + + @Output() + valueChanges: EventEmitter = new EventEmitter(); + + @Output() + statusChanges: EventEmitter<'VALID' | 'INVALID'> = new EventEmitter(); + + actionTypes = ActionType; + shopModificationNames = ShopModificationName; + contractModificationNames = ContractModificationName; + + form: FormGroup; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + this.form = this.fb.group({ + unitID: [ + { + value: uuid(), + disabled: true + }, + Validators.required + ], + modification: this.fb.group({}) + }); + this.form.statusChanges.subscribe(status => this.statusChanges.emit(status)); + this.form.valueChanges.subscribe(() => { + const filtered = filterEmptyStringValues(this.form.getRawValue()); + const modification = toPartyModification(this.action, filtered); + this.valueChanges.emit(modification); + }); + } + + ngOnChanges(changes: SimpleChanges) { + const { unitID } = changes; + if (unitID && !unitID.firstChange) { + this.form.patchValue({ unitID: unitID.currentValue }); + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.module.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.module.ts new file mode 100644 index 00000000..983bf6f8 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/party-modification-creation.module.ts @@ -0,0 +1,116 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { + MatButtonModule, + MatCheckboxModule, + MatDatepickerModule, + MatDividerModule, + MatIconModule, + MatInputModule, + MatProgressBarModule, + MatRadioModule, + MatSelectModule, + MatSnackBarModule +} from '@angular/material'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { ReactiveFormsModule } from '@angular/forms'; + +import { PartyModificationCreationComponent } from './party-modification-creation.component'; +import { PayoutToolModificationUnitComponent } from './contract/payout-tool-modification-unit/payout-tool-modification-unit.component'; +import { PayoutToolModificationComponent } from './contract/payout-tool-modification/payout-tool-modification.component'; +import { PayoutToolParamsComponent } from './contract/payout-tool-params/payout-tool-params.component'; +import { CurrencyRefComponent } from './currency-ref/currency-ref.component'; +import { PayoutToolInfoComponent } from './contract/payout-tool-info/payout-tool-info.component'; +import { RussianBankAccountComponent } from './contract/payout-tool-info/russian-bank-account/russian-bank-account.component'; +import { InternationalBankAccountComponent } from './contract/payout-tool-info/international-bank-account/international-bank-account.component'; +import { InternationalBankDetailsComponent } from './contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component'; +import { LegalAgreementBindingComponent } from './contract/legal-agreement-binding/legal-agreement-binding.component'; +import { AdjustmentModificationUnitComponent } from './contract/adjustment-modification-unit/adjustment-modification-unit.component'; +import { ReportPreferencesComponent } from './contract/report-preferences/report-preferences.component'; +import { CategoryRefComponent } from './shop/category-ref/category-ref.component'; +import { ShopDetailsComponent } from './shop/shop-details/shop-details.component'; +import { ShopLocationComponent } from './shop/location-modification/shop-location.component'; +import { ShopAccountCreationComponent } from './shop/shop-account-creation/shop-account-creation.component'; +import { ShopPayoutScheduleModificationComponent } from './shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component'; +import { AdjustmentModificationComponent } from './contract/adjustment-modification/adjustment-modification.component'; +import { BusinessScheduleRefComponent } from './business-schedule-ref/business-schedule-ref.component'; +import { BusinessScheduleSelectorComponent } from './business-schedule-ref/business-schedule-selector/business-schedule-selector.component'; +import { RepresentativeComponent } from './contract/representative/representative.component'; +import { AdjustmentParamsComponent } from './contract/adjustment-params/adjustment-params.component'; +import { RepresentativeDocumentComponent } from './contract/representative-document/representative-document.component'; +import { ContractTemplateRefComponent } from './contract/contract-template-ref/contract-template-ref.component'; +import { ContractModificationComponent } from './shop/contract-modification/contract-modification.component'; +import { PayoutToolModificationComponent as ShopPayoutToolModificationComponent } from './shop/payout-tool-modification/payout-tool-modification.component'; +import { ShopParamsComponent } from './shop/shop-params/shop-params.component'; +import { TerminationComponent } from './contract/termination/termination.component'; +import { ContractorIdComponent } from './contract/contractor-id/contractor-id.component'; +import { PaymentInstitutionRefComponent } from './contract/payment-institution/payment-institution-ref.component'; +import { ContractParamsComponent } from './contract/contract-params/contract-params.component'; +import { ContractorComponent } from './contract/contractor/contractor.component'; +import { LegalEntityComponent } from './contract/legal-entity/legal-entity.component'; +import { RussianLegalEntityComponent } from './contract/legal-entity/russian-legal-entity/russian-legal-entity.component'; +import { InternationalLegalEntityComponent } from './contract/legal-entity/international-legal-entity/international-legal-entity.component'; +import { NestedFormWrapperComponent } from './nested-form-wrapper/nested-form-wrapper.component'; +import { FormWrapperComponent } from './form-wrapper/form-wrapper.component'; +import { WalletInfoComponent } from './contract/payout-tool-info/wallet-info/wallet-info.component'; + +@NgModule({ + imports: [ + CommonModule, + ReactiveFormsModule, + FlexLayoutModule, + MatButtonModule, + MatInputModule, + MatDatepickerModule, + MatSelectModule, + MatRadioModule, + MatCheckboxModule, + MatIconModule, + MatDividerModule, + MatSnackBarModule, + MatProgressBarModule + ], + declarations: [ + PartyModificationCreationComponent, + PayoutToolModificationUnitComponent, + PayoutToolModificationComponent, + PayoutToolParamsComponent, + CurrencyRefComponent, + PayoutToolInfoComponent, + RussianBankAccountComponent, + WalletInfoComponent, + InternationalBankAccountComponent, + InternationalBankDetailsComponent, + WalletInfoComponent, + LegalAgreementBindingComponent, + AdjustmentModificationUnitComponent, + ReportPreferencesComponent, + CategoryRefComponent, + ShopDetailsComponent, + ShopLocationComponent, + ShopAccountCreationComponent, + ShopPayoutScheduleModificationComponent, + AdjustmentModificationComponent, + BusinessScheduleRefComponent, + RepresentativeComponent, + AdjustmentParamsComponent, + RepresentativeDocumentComponent, + ContractTemplateRefComponent, + ContractModificationComponent, + ShopPayoutToolModificationComponent, + ShopParamsComponent, + TerminationComponent, + ContractorIdComponent, + PaymentInstitutionRefComponent, + ContractParamsComponent, + ContractorComponent, + LegalEntityComponent, + RussianLegalEntityComponent, + InternationalLegalEntityComponent, + NestedFormWrapperComponent, + FormWrapperComponent, + BusinessScheduleSelectorComponent + ], + exports: [PartyModificationCreationComponent] +}) +export class PartyModificationCreationModule {} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.html new file mode 100644 index 00000000..eacb9f90 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.html @@ -0,0 +1,14 @@ +
+ + + + {{ category.id }} {{ category.name }} + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.ts new file mode 100644 index 00000000..a6b01447 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/category-ref/category-ref.component.ts @@ -0,0 +1,62 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatSnackBar } from '@angular/material'; +import { Observable } from 'rxjs'; +import { map, tap } from 'rxjs/internal/operators'; +import sortBy from 'lodash-es/sortBy'; +import { get } from 'lodash-es'; +import { Category, CategoryRef } from '../../../../../../thrift-services/damsel/gen-model/domain'; +import { CategoryService } from '../../../../../../papi/category.service'; + +@Component({ + selector: 'cc-category-ref', + templateUrl: 'category-ref.component.html' +}) +export class CategoryRefComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + required: boolean; + + @Input() + initialValue: CategoryRef; + + categories$: Observable; + + isLoading = true; + + constructor( + private categoryService: CategoryService, + private fb: FormBuilder, + private snackBar: MatSnackBar + ) {} + + ngOnInit() { + const category = get(this, 'initialValue.id', ''); + this.form.registerControl( + 'id', + this.fb.control( + { + value: category, + disabled: category.length === 0 + }, + this.required ? Validators.required : null + ) + ); + this.categories$ = this.categoryService.getCategories().pipe( + map(categories => sortBy(categories, 'id')), + tap( + () => { + this.form.controls.id.enable(); + this.isLoading = false; + }, + () => { + this.isLoading = false; + this.snackBar.open('An error occurred while shop category receiving', 'OK'); + } + ) + ); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.html new file mode 100644 index 00000000..731b9159 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.html @@ -0,0 +1,8 @@ +
+ + + + + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.ts new file mode 100644 index 00000000..e8644b01 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/contract-modification/contract-modification.component.ts @@ -0,0 +1,29 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ShopContractModification } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-shop-contract-modification', + templateUrl: 'contract-modification.component.html' +}) +export class ContractModificationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ShopContractModification; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const contractId = get(this, 'initialValue.contract_id', ''); + const payoutToolId = get(this, 'initialValue.payout_tool_id', ''); + this.form.registerControl('contract_id', this.fb.control(contractId, Validators.required)); + this.form.registerControl( + 'payout_tool_id', + this.fb.control(payoutToolId, Validators.required) + ); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.html new file mode 100644 index 00000000..29109807 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.html @@ -0,0 +1,7 @@ + +
+ + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.ts new file mode 100644 index 00000000..eae17cba --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/location-modification/shop-location.component.ts @@ -0,0 +1,24 @@ +import { Component, Input, OnChanges } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ShopLocation } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-shop-location', + templateUrl: 'shop-location.component.html' +}) +export class ShopLocationComponent implements OnChanges { + @Input() + form: FormGroup; + + @Input() + initialValue: ShopLocation; + + constructor(private fb: FormBuilder) {} + + ngOnChanges() { + const url = get(this.initialValue, 'url', ''); + this.form.registerControl('url', this.fb.control(url)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.html new file mode 100644 index 00000000..8b144ddd --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.ts new file mode 100644 index 00000000..91815e1e --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/payout-tool-modification/payout-tool-modification.component.ts @@ -0,0 +1,24 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { get } from 'lodash-es'; +import { PayoutToolID } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-shop-payout-tool-modification', + templateUrl: 'payout-tool-modification.component.html' +}) +export class PayoutToolModificationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: PayoutToolID; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const payoutToolId = get(this, 'initialValue.modification', ''); + this.form.setControl('modification', this.fb.control(payoutToolId, Validators.required)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.html new file mode 100644 index 00000000..958b0209 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.ts new file mode 100644 index 00000000..15bd6562 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-account-creation/shop-account-creation.component.ts @@ -0,0 +1,24 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ShopAccountParams } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-shop-account-creation', + templateUrl: 'shop-account-creation.component.html' +}) +export class ShopAccountCreationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ShopAccountParams; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const currency = get(this, 'initialValue.currency', ''); + this.form.registerControl('currency', this.fb.group(currency)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.html new file mode 100644 index 00000000..9c2ac2dd --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.html @@ -0,0 +1,10 @@ + +
+ + + + + + +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.ts new file mode 100644 index 00000000..3040b920 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-details/shop-details.component.ts @@ -0,0 +1,26 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ShopDetails } from '../../../../../../thrift-services/damsel/gen-model/domain'; + +@Component({ + selector: 'cc-shop-details', + templateUrl: 'shop-details.component.html' +}) +export class ShopDetailsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ShopDetails; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const name = get(this.initialValue, 'name', ''); + const description = get(this.initialValue, 'description', ''); + this.form.registerControl('name', this.fb.control(name, Validators.required)); + this.form.registerControl('description', this.fb.control(description)); + this.form.updateValueAndValidity(); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.html new file mode 100644 index 00000000..8c58bfcb --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.html @@ -0,0 +1,30 @@ +
+ + + + + + + + + + + + + + + Category + + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.ts new file mode 100644 index 00000000..23db3ae9 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-params/shop-params.component.ts @@ -0,0 +1,48 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ShopParams } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-shop-params', + templateUrl: 'shop-params.component.html' +}) +export class ShopParamsComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ShopParams; + + showCategory = false; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + const contractId = get(this, 'initialValue.contract_id', ''); + const payoutToolId = get(this, 'initialValue.payout_tool_id', ''); + this.form.registerControl('contract_id', this.fb.control(contractId, Validators.required)); + this.form.registerControl( + 'payout_tool_id', + this.fb.control(payoutToolId, Validators.required) + ); + this.form.registerControl('details', this.fb.group({})); + this.form.registerControl('location', this.fb.group({})); + this.toggleCategory(); + this.form.updateValueAndValidity(); + } + + toggleCheckbox(show: boolean, controlName: string, data: object = {}) { + if (show) { + this.form.registerControl(controlName, this.fb.group(data)); + } else { + this.form.removeControl(controlName); + } + } + + toggleCategory() { + const category = get(this, 'initialValue.category', null); + this.showCategory = category !== null; + this.toggleCheckbox(this.showCategory, 'category', category); + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.html b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.html new file mode 100644 index 00000000..0f229047 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.html @@ -0,0 +1,10 @@ +
+ Schedule + +
diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts new file mode 100644 index 00000000..25a85f61 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts @@ -0,0 +1,45 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { get } from 'lodash-es'; +import { ScheduleModification } from '../../../../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-shop-schedule-modification', + templateUrl: 'shop-payout-schedule-modification.component.html' +}) +export class ShopPayoutScheduleModificationComponent implements OnInit { + @Input() + form: FormGroup; + + @Input() + initialValue: ScheduleModification; + + showSchedule = false; + + constructor(private fb: FormBuilder) {} + + ngOnInit() { + setTimeout(() => { + this.toggleSchedule(); + this.form.updateValueAndValidity(); + }); + } + + toggleCheckbox(e, data) { + if (e.checked) { + this.form.registerControl(data, this.fb.group({})); + } else { + this.form.removeControl(data); + } + } + + toggleSchedule() { + const schedule = get(this, 'initialValue.schedule', null); + this.showSchedule = schedule !== null; + if (this.showSchedule) { + this.form.registerControl('schedule', this.fb.group(schedule)); + } else { + this.form.removeControl('schedule'); + } + } +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/to-party-modification.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/to-party-modification.ts new file mode 100644 index 00000000..67689862 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/to-party-modification.ts @@ -0,0 +1,30 @@ +import { UnitName } from './unit-name'; +import { ShopModificationName } from '../shop-modification-name'; +import { ContractModificationName } from '../contract-modification-name'; +import { ActionType, ModificationAction } from '../modification-action'; + +const toModification = ( + unitID: string, + modification: any, + unitName: UnitName, + modificationName: ShopModificationName | ContractModificationName +) => ({ + [unitName]: { + id: unitID, + modification: { + [modificationName]: modification + } + } +}); + +export const toPartyModification = (action: ModificationAction, formValue: any) => { + const { unitID, modification } = formValue; + const toMod = toModification.bind(null, unitID, modification); + const { type, name } = action; + switch (type) { + case ActionType.shopAction: + return toMod(UnitName.shopModification, name); + case ActionType.contractAction: + return toMod(UnitName.contractModification, name); + } +}; diff --git a/src/app/claim-mgt/claim/party-modification-creator/creation/unit-name.ts b/src/app/claim-mgt/claim/party-modification-creator/creation/unit-name.ts new file mode 100644 index 00000000..0bd744c8 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/creation/unit-name.ts @@ -0,0 +1,4 @@ +export enum UnitName { + shopModification = 'shop_modification', + contractModification = 'contract_modification' +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/modification-action.ts b/src/app/claim-mgt/claim/party-modification-creator/modification-action.ts new file mode 100644 index 00000000..c3e24c33 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/modification-action.ts @@ -0,0 +1,12 @@ +import { ContractModificationName } from './contract-modification-name'; +import { ShopModificationName } from './shop-modification-name'; + +export enum ActionType { + contractAction = 'contractAction', + shopAction = 'shopAction' +} + +export interface ModificationAction { + type: ActionType; + name?: ContractModificationName | ShopModificationName; +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/shop-modification-name.ts b/src/app/claim-mgt/claim/party-modification-creator/shop-modification-name.ts new file mode 100644 index 00000000..1e7a38a1 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/shop-modification-name.ts @@ -0,0 +1,11 @@ +export enum ShopModificationName { + creation = 'creation', + categoryModification = 'category_modification', + detailsModification = 'details_modification', + contractModification = 'contract_modification', + payoutToolModification = 'payout_tool_modification', + locationModification = 'location_modification', + shopAccountCreation = 'shop_account_creation', + payoutScheduleModification = 'payout_schedule_modification', + unknown = 'unknown' +} diff --git a/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.html b/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.html new file mode 100644 index 00000000..051be721 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.html @@ -0,0 +1,22 @@ + + +
+ +
+
diff --git a/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.ts b/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.ts new file mode 100644 index 00000000..d9b61829 --- /dev/null +++ b/src/app/claim-mgt/claim/party-modification-creator/unit-actions/unit-actions.component.ts @@ -0,0 +1,87 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef, MatDialog } from '@angular/material'; +import { ContractModificationName } from '../contract-modification-name'; +import { ShopModificationName } from '../shop-modification-name'; +import { ActionType } from '../modification-action'; +import { ClaimID } from '../../../../thrift-services/damsel/gen-model/claim_management'; +import { CreateModificationComponent } from '../create-modification.component'; + +interface UnitActionData { + type: 'allActions' | 'contractActions' | 'shopActions'; + claimID: ClaimID; + partyID: string; +} + +@Component({ + templateUrl: 'unit-actions.component.html' +}) +export class UnitActionsComponent implements OnInit { + constructor( + private bottomSheetRef: MatBottomSheetRef, + private dialog: MatDialog, + @Inject(MAT_BOTTOM_SHEET_DATA) public data: UnitActionData + ) {} + + contractActions = { + type: ActionType.contractAction, + visible: false, + names: [ + ContractModificationName.legalAgreementBinding, + ContractModificationName.reportPreferencesModification, + ContractModificationName.adjustmentModification, + ContractModificationName.payoutToolModification, + ContractModificationName.termination + // ContractModificationName.contractorModification + ] + }; + + shopActions = { + type: ActionType.shopAction, + visible: false, + names: [ + ShopModificationName.detailsModification, + ShopModificationName.locationModification, + ShopModificationName.categoryModification, + ShopModificationName.shopAccountCreation, + ShopModificationName.payoutScheduleModification, + ShopModificationName.payoutToolModification, + ShopModificationName.contractModification + ] + }; + + ngOnInit() { + switch (this.data.type) { + case 'allActions': + this.contractActions.visible = true; + this.shopActions.visible = true; + this.contractActions.names = [ + ContractModificationName.creation, + ...this.contractActions.names + ]; + this.shopActions.names = [ShopModificationName.creation, ...this.shopActions.names]; + break; + case 'contractActions': + this.contractActions.visible = true; + break; + case 'shopActions': + this.shopActions.visible = true; + } + } + + select(type: ActionType, name: ContractModificationName | ShopModificationName) { + this.bottomSheetRef.dismiss(); + const config = { + data: { + action: { + type, + name + }, + claimID: this.data.claimID, + partyID: this.data.partyID + }, + width: '800px', + disableClose: true + }; + this.dialog.open(CreateModificationComponent, config); + } +} diff --git a/src/app/claim-mgt/claim/status-changer/get-available-claim-statuses.ts b/src/app/claim-mgt/claim/status-changer/get-available-claim-statuses.ts new file mode 100644 index 00000000..92a51fb9 --- /dev/null +++ b/src/app/claim-mgt/claim/status-changer/get-available-claim-statuses.ts @@ -0,0 +1,25 @@ +import { ClaimStatus } from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ClaimStatus as ClaimStatusEnum } from '../../../papi/model'; +import { ClaimStatuses } from '../claim-statuses'; +import { extractClaimStatus } from '../../../shared/extract-claim-status'; + +export const getAvailableClaimStatuses = (status: ClaimStatus): ClaimStatuses[] => { + switch (extractClaimStatus(status)) { + case ClaimStatusEnum.pending: + return [ + ClaimStatuses.pending_acceptance, + ClaimStatuses.review, + ClaimStatuses.denied, + ClaimStatuses.revoked + ]; + case ClaimStatusEnum.review: + return [ + ClaimStatuses.pending_acceptance, + ClaimStatuses.pending, + ClaimStatuses.denied, + ClaimStatuses.revoked + ]; + default: + return []; + } +}; diff --git a/src/app/claim-mgt/claim/status-changer/status-changer.component.html b/src/app/claim-mgt/claim/status-changer/status-changer.component.html new file mode 100644 index 00000000..ca62e978 --- /dev/null +++ b/src/app/claim-mgt/claim/status-changer/status-changer.component.html @@ -0,0 +1,27 @@ +
Change claim status
+ +
+ + + {{ + action + }} + + + + + +
+
+ + + + + diff --git a/src/app/claim-mgt/claim/status-changer/status-changer.component.scss b/src/app/claim-mgt/claim/status-changer/status-changer.component.scss new file mode 100644 index 00000000..f4d336fd --- /dev/null +++ b/src/app/claim-mgt/claim/status-changer/status-changer.component.scss @@ -0,0 +1,3 @@ +.hidden { + display: none; +} diff --git a/src/app/claim-mgt/claim/status-changer/status-changer.component.ts b/src/app/claim-mgt/claim/status-changer/status-changer.component.ts new file mode 100644 index 00000000..52531459 --- /dev/null +++ b/src/app/claim-mgt/claim/status-changer/status-changer.component.ts @@ -0,0 +1,45 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; + +import { StatusChangerService } from './status-changer.service'; +import { ClaimID, ClaimStatus } from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ClaimStatuses } from '../claim-statuses'; +import { getAvailableClaimStatuses } from './get-available-claim-statuses'; + +interface ActionsInterface { + partyID: string; + claimID: ClaimID; + claimStatus: ClaimStatus; +} + +@Component({ + templateUrl: 'status-changer.component.html', + providers: [StatusChangerService], + styleUrls: ['status-changer.component.scss'] +}) +export class StatusChangerComponent implements OnInit { + actions = getAvailableClaimStatuses(this.data.claimStatus); + form = this.actionsService.form; + isLoading$ = this.actionsService.isLoading$; + + constructor( + private dialogRef: MatDialogRef, + private actionsService: StatusChangerService, + @Inject(MAT_DIALOG_DATA) private data: ActionsInterface + ) {} + + confirm() { + this.actionsService.updateClaim(this.data.partyID, this.data.claimID); + } + + isReasonVisible(): boolean { + const { type } = this.form.getRawValue(); + return type === ClaimStatuses.denied || type === ClaimStatuses.revoked; + } + + ngOnInit(): void { + this.actionsService.claim$.subscribe(_ => { + this.dialogRef.close(true); + }); + } +} diff --git a/src/app/claim-mgt/claim/status-changer/status-changer.service.ts b/src/app/claim-mgt/claim/status-changer/status-changer.service.ts new file mode 100644 index 00000000..ad001be2 --- /dev/null +++ b/src/app/claim-mgt/claim/status-changer/status-changer.service.ts @@ -0,0 +1,112 @@ +import { Injectable } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; +import { ConnectableObservable, Observable, Subject } from 'rxjs'; +import { + catchError, + distinctUntilChanged, + filter, + pairwise, + pluck, + publish, + shareReplay, + switchMap +} from 'rxjs/operators'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { progress } from '@rbkmoney/partial-fetcher/dist/progress'; + +import { ClaimID } from '../../../thrift-services/damsel/gen-model/claim_management'; +import { ClaimManagementService } from '../../../thrift-services/damsel/claim-management.service'; +import { ClaimStatuses } from '../claim-statuses'; + +class UpdateClaim { + partyID: string; + claimID: ClaimID; + action: ClaimStatuses; +} + +@Injectable() +export class StatusChangerService { + private updateClaim$ = new Subject(); + + form = this.initForm(); + + claim$: Observable = this.updateClaim$.pipe( + switchMap(({ partyID, claimID, action }) => { + switch (action) { + case ClaimStatuses.denied: + return this.claimManagementService + .denyClaim(partyID, claimID, this.form.getRawValue().reason) + .pipe(catchError(e => this.handleError(e))); + case ClaimStatuses.pending: + return this.claimManagementService + .requestClaimChanges(partyID, claimID) + .pipe(catchError(e => this.handleError(e))); + case ClaimStatuses.review: + return this.claimManagementService + .requestClaimReview(partyID, claimID) + .pipe(catchError(e => this.handleError(e))); + case ClaimStatuses.pending_acceptance: + return this.claimManagementService + .acceptClaim(partyID, claimID) + .pipe(catchError(e => this.handleError(e))); + case ClaimStatuses.revoked: + return this.claimManagementService + .revokeClaim(partyID, claimID, this.form.getRawValue().reason) + .pipe(catchError(e => this.handleError(e))); + default: + throw new Error('Wrong action type!'); + } + }), + shareReplay(1) + ); + + isLoading$ = progress(this.updateClaim$, this.claim$).pipe( + shareReplay(1), + publish() + ) as ConnectableObservable; + + constructor( + private fb: FormBuilder, + private claimManagementService: ClaimManagementService, + private snackBar: MatSnackBar + ) { + this.isLoading$.connect(); + this.form.valueChanges + .pipe( + distinctUntilChanged((p, c) => { + return p.type === c.type && p.reason === c.reason; + }), + pairwise(), + filter(([prev, curr]) => prev.reason === curr.reason), + pluck(1, 'type') + ) + .subscribe(type => { + switch (type) { + case ClaimStatuses.denied: + case ClaimStatuses.revoked: + this.form.setControl('reason', this.fb.control(null, Validators.required)); + break; + default: + this.form.setControl('reason', this.fb.control(null)); + break; + } + }); + } + + updateClaim(partyID: string, claimID: ClaimID) { + this.updateClaim$.next({ partyID, claimID, action: this.form.getRawValue().type }); + } + + private handleError(e: any) { + this.snackBar.open('Status change error', 'OK', { duration: 5000 }); + console.error(e); + return []; + } + + private initForm() { + return this.fb.group({ + type: ['', Validators.required], + reason: null + }); + } +} diff --git a/src/app/claim-mgt/claims/claim-actions/claim-actions.component.html b/src/app/claim-mgt/claims/claim-actions/claim-actions.component.html new file mode 100644 index 00000000..6da93e6a --- /dev/null +++ b/src/app/claim-mgt/claims/claim-actions/claim-actions.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/app/claim-mgt/claims/claim-actions/claim-actions.component.ts b/src/app/claim-mgt/claims/claim-actions/claim-actions.component.ts new file mode 100644 index 00000000..12954674 --- /dev/null +++ b/src/app/claim-mgt/claims/claim-actions/claim-actions.component.ts @@ -0,0 +1,19 @@ +import { Component } from '@angular/core'; +import { MatDialog } from '@angular/material'; + +import { CreateClaimComponent } from '../create-claim/create-claim.component'; + +@Component({ + selector: 'cc-claim-actions', + templateUrl: 'claim-actions.component.html' +}) +export class ClaimActionsComponent { + constructor(private dialogRef: MatDialog) {} + + createClaim() { + this.dialogRef.open(CreateClaimComponent, { + width: '400px', + disableClose: true + }); + } +} diff --git a/src/app/claim-mgt/claims/claims-routing.module.ts b/src/app/claim-mgt/claims/claims-routing.module.ts new file mode 100644 index 00000000..e46b974e --- /dev/null +++ b/src/app/claim-mgt/claims/claims-routing.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { ClaimsComponent } from './claims.component'; +import { AppAuthGuardService } from '../../app-auth-guard.service'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: ClaimsComponent, + canActivate: [AppAuthGuardService], + data: { + roles: ['claim:get'] + } + } + ]) + ], + exports: [RouterModule] +}) +export class ClaimsRoutingModule {} diff --git a/src/app/claim-mgt/claims/claims-table/claims-table.component.css b/src/app/claim-mgt/claims/claims-table/claims-table.component.css new file mode 100644 index 00000000..3d384031 --- /dev/null +++ b/src/app/claim-mgt/claims/claims-table/claims-table.component.css @@ -0,0 +1,7 @@ +table { + width: 100%; +} + +.action-cell { + width: 10px; +} diff --git a/src/app/claim-mgt/claims/claims-table/claims-table.component.html b/src/app/claim-mgt/claims/claims-table/claims-table.component.html new file mode 100644 index 00000000..b8cbaf66 --- /dev/null +++ b/src/app/claim-mgt/claims/claims-table/claims-table.component.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Party ID{{ claim.party_id }}Claim ID{{ claim.id }}Status{{ claim.status | ccClaimStatus }}Revision{{ claim.revision }}Created at + {{ claim.created_at | date: 'dd.MM.yyyy HH:mm:ss' }} + Updated at + {{ claim.updated_at | date: 'dd.MM.yyyy HH:mm:ss' }} + + + + + +
diff --git a/src/app/claim-mgt/claims/claims-table/claims-table.component.ts b/src/app/claim-mgt/claims/claims-table/claims-table.component.ts new file mode 100644 index 00000000..341f4416 --- /dev/null +++ b/src/app/claim-mgt/claims/claims-table/claims-table.component.ts @@ -0,0 +1,30 @@ +import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; + +import { Claim } from '../../../thrift-services/damsel/gen-model/claim_management'; + +@Component({ + selector: 'cc-claims-table', + templateUrl: 'claims-table.component.html', + styleUrls: ['./claims-table.component.css'] +}) +export class ClaimsTableComponent { + @Input() + claims: Claim[]; + + displayedColumns = [ + 'partyID', + 'claimID', + 'status', + 'revision', + 'createdAt', + 'updatedAt', + 'actions' + ]; + + constructor(private router: Router) {} + + navigateToClaim(partyID: string, claimID: number) { + this.router.navigate([`claim-mgt/party/${partyID}/claim/${claimID}`]); + } +} diff --git a/src/app/claim-mgt/claims/claims.component.html b/src/app/claim-mgt/claims/claims.component.html new file mode 100644 index 00000000..19db750b --- /dev/null +++ b/src/app/claim-mgt/claims/claims.component.html @@ -0,0 +1,28 @@ + + + Search claims + + + + + + + + + + + + + +
+ + +
+
diff --git a/src/app/claim-mgt/claims/claims.component.ts b/src/app/claim-mgt/claims/claims.component.ts new file mode 100644 index 00000000..f523d3a9 --- /dev/null +++ b/src/app/claim-mgt/claims/claims.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; + +import { ClaimsService } from './claims.service'; +import { SearchFormValue } from './search-form/search-form-value'; +import { ClaimStatus } from '../../papi/model/claim-statuses'; + +@Component({ + templateUrl: 'claims.component.html', + styleUrls: [] +}) +export class ClaimsComponent implements OnInit { + isLoading$ = this.claimService.isLoading$; + claims$ = this.claimService.claims$; + hasMore$ = this.claimService.hasMore$; + + constructor(private claimService: ClaimsService) {} + + ngOnInit(): void { + this.search({ statuses: [ClaimStatus.pending] }); + } + + search(searchFormValue: SearchFormValue) { + this.claimService.search(searchFormValue); + } + + fetchMore() { + this.claimService.fetchMore(); + } +} diff --git a/src/app/claim-mgt/claims/claims.module.ts b/src/app/claim-mgt/claims/claims.module.ts new file mode 100644 index 00000000..849ed9b6 --- /dev/null +++ b/src/app/claim-mgt/claims/claims.module.ts @@ -0,0 +1,62 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { + MatButtonModule, + MatCardModule, + MatDialogModule, + MatFormFieldModule, + MatIconModule, + MatInputModule, + MatMenuModule, + MatProgressBarModule, + MatSelectModule, + MatSnackBarModule, + MatTableModule +} from '@angular/material'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { ReactiveFormsModule } from '@angular/forms'; +import { CdkTableModule } from '@angular/cdk/table'; + +import { PapiModule } from '../../papi/papi.module'; +import { ClaimsComponent } from './claims.component'; +import { ClaimsRoutingModule } from './claims-routing.module'; +import { SearchFormComponent } from './search-form/search-form.component'; +import { ClaimsTableComponent } from './claims-table/claims-table.component'; +import { ClaimActionsComponent } from './claim-actions/claim-actions.component'; +import { CreateClaimComponent } from './create-claim/create-claim.component'; +import { ClaimsService } from './claims.service'; +import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; +import { SharedModule } from '../../shared/shared.module'; + +@NgModule({ + imports: [ + CommonModule, + ClaimsRoutingModule, + FlexLayoutModule, + PapiModule, + ReactiveFormsModule, + MatCardModule, + MatFormFieldModule, + MatInputModule, + MatSelectModule, + MatProgressBarModule, + MatSnackBarModule, + MatTableModule, + MatButtonModule, + MatIconModule, + MatMenuModule, + MatDialogModule, + CdkTableModule, + SharedModule + ], + declarations: [ + ClaimsComponent, + SearchFormComponent, + ClaimsTableComponent, + ClaimActionsComponent, + CreateClaimComponent + ], + entryComponents: [CreateClaimComponent], + providers: [ClaimsService, ClaimManagementService] +}) +export class ClaimsModule {} diff --git a/src/app/claim-mgt/claims/claims.service.ts b/src/app/claim-mgt/claims/claims.service.ts new file mode 100644 index 00000000..c929d904 --- /dev/null +++ b/src/app/claim-mgt/claims/claims.service.ts @@ -0,0 +1,53 @@ +import { Injectable } from '@angular/core'; +import { MatSnackBar } from '@angular/material'; +import { Observable } from 'rxjs'; +import { catchError, map, shareReplay } from 'rxjs/operators'; +import { FetchResult, PartialFetcher } from '@rbkmoney/partial-fetcher'; + +import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; +import { SearchFormValue } from './search-form/search-form-value'; +import { booleanDebounceTime } from '../../shared/operators'; +import { convertFormValueToParams } from './convert-form-value-to-params'; +import { Claim } from '../../thrift-services/damsel/gen-model/claim_management'; + +@Injectable() +export class ClaimsService extends PartialFetcher { + private readonly searchLimit = 20; + + claims$: Observable = this.searchResult$.pipe( + catchError(() => { + this.snackBar.open('An error occurred while processing your search', 'OK'); + return []; + }) + ); + + isLoading$: Observable = this.doAction$.pipe( + booleanDebounceTime(), + shareReplay(1) + ); + + constructor( + private claimManagementService: ClaimManagementService, + private snackBar: MatSnackBar + ) { + super(); + } + + protected fetch( + searchFormValue: SearchFormValue, + continuationToken: string + ): Observable> { + return this.claimManagementService + .searchClaims({ + ...convertFormValueToParams(searchFormValue), + continuation_token: continuationToken, + limit: this.searchLimit + }) + .pipe( + map(r => ({ + result: r.result, + continuationToken: r.continuation_token + })) + ); + } +} diff --git a/src/app/claim-mgt/claims/convert-form-value-to-params.ts b/src/app/claim-mgt/claims/convert-form-value-to-params.ts new file mode 100644 index 00000000..5c04e015 --- /dev/null +++ b/src/app/claim-mgt/claims/convert-form-value-to-params.ts @@ -0,0 +1,19 @@ +import { SearchFormValue } from './search-form/search-form-value'; + +export const convertFormValueToParams = (params: SearchFormValue) => { + const result = {}; + for (const k in params) { + if (params.hasOwnProperty(k)) { + if (k === 'statuses') { + result[k] = (params[k] as string[]).reduce((acc, cv) => [...acc, { [cv]: {} }], []); + } else { + const v = params[k].trim(); + if (v === '') { + break; + } + result[k] = v; + } + } + } + return result; +}; diff --git a/src/app/claim-mgt/claims/create-claim/create-claim.component.html b/src/app/claim-mgt/claims/create-claim/create-claim.component.html new file mode 100644 index 00000000..f19ad8fd --- /dev/null +++ b/src/app/claim-mgt/claims/create-claim/create-claim.component.html @@ -0,0 +1,14 @@ +

Claim creation

+ +
+ + + +
+
+ + + + diff --git a/src/app/claim-mgt/claims/create-claim/create-claim.component.ts b/src/app/claim-mgt/claims/create-claim/create-claim.component.ts new file mode 100644 index 00000000..221b48c3 --- /dev/null +++ b/src/app/claim-mgt/claims/create-claim/create-claim.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialogRef } from '@angular/material'; +import { Router } from '@angular/router'; + +import { ClaimActionType } from '../../../claim/claim-action-type'; + +@Component({ + templateUrl: 'create-claim.component.html' +}) +export class CreateClaimComponent implements OnInit { + form: FormGroup; + + constructor( + private dialogRef: MatDialogRef, + private router: Router, + private fb: FormBuilder + ) {} + + ngOnInit() { + this.form = this.fb.group({ + partyId: ['', Validators.required] + }); + } + + submit() { + const partyId = this.form.value.partyId.trim(); + this.dialogRef.close(); + this.router.navigate([`/claims/${partyId}/${ClaimActionType.create}`]); + } +} diff --git a/src/app/claim-mgt/claims/index.ts b/src/app/claim-mgt/claims/index.ts new file mode 100644 index 00000000..395f398e --- /dev/null +++ b/src/app/claim-mgt/claims/index.ts @@ -0,0 +1 @@ +export * from './claims.module'; diff --git a/src/app/claim-mgt/claims/search-form/search-form-value.ts b/src/app/claim-mgt/claims/search-form/search-form-value.ts new file mode 100644 index 00000000..650c3fae --- /dev/null +++ b/src/app/claim-mgt/claims/search-form/search-form-value.ts @@ -0,0 +1,7 @@ +import * as domain from '../../../thrift-services/damsel/gen-model/domain'; +import { ClaimStatus } from '../../../papi/model/claim-statuses'; + +export interface SearchFormValue { + party_id?: domain.PartyID; + statuses?: ClaimStatus[]; +} diff --git a/src/app/claim-mgt/claims/search-form/search-form.component.html b/src/app/claim-mgt/claims/search-form/search-form.component.html new file mode 100644 index 00000000..08df6491 --- /dev/null +++ b/src/app/claim-mgt/claims/search-form/search-form.component.html @@ -0,0 +1,13 @@ +
+ + + any + {{ + status + }} + + + + + +
diff --git a/src/app/claim-mgt/claims/search-form/search-form.component.ts b/src/app/claim-mgt/claims/search-form/search-form.component.ts new file mode 100644 index 00000000..a2d311be --- /dev/null +++ b/src/app/claim-mgt/claims/search-form/search-form.component.ts @@ -0,0 +1,31 @@ +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; + +import { SearchFormService } from './search-form.service'; +import { debounceTime } from 'rxjs/internal/operators'; +import { SearchFormValue } from './search-form-value'; + +@Component({ + selector: 'cc-search-form', + templateUrl: 'search-form.component.html', + providers: [SearchFormService] +}) +export class SearchFormComponent implements OnInit { + @Output() + valueChanges: EventEmitter = new EventEmitter(); + + form: FormGroup; + + claimStatuses: string[]; + + constructor(private searchFormService: SearchFormService) {} + + ngOnInit() { + const { form, claimStatuses } = this.searchFormService; + this.claimStatuses = claimStatuses; + this.form = form; + this.form.valueChanges.pipe(debounceTime(300)).subscribe(value => { + this.valueChanges.emit(value); + }); + } +} diff --git a/src/app/claim-mgt/claims/search-form/search-form.service.ts b/src/app/claim-mgt/claims/search-form/search-form.service.ts new file mode 100644 index 00000000..8d968b01 --- /dev/null +++ b/src/app/claim-mgt/claims/search-form/search-form.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import values from 'lodash-es/values'; +import { ClaimStatus } from '../../../papi/model/claim-statuses'; + +@Injectable() +export class SearchFormService { + form: FormGroup; + + claimStatuses: string[]; + + constructor(private fb: FormBuilder) { + this.form = this.prepareForm(); + this.claimStatuses = values(ClaimStatus); + this.form.patchValue({ statuses: [ClaimStatus.pending] }); + } + + private prepareForm(): FormGroup { + return this.fb.group({ + statuses: '', + party_id: '' + }); + } +} diff --git a/src/app/claim/claim.module.ts b/src/app/claim/claim.module.ts index 331bdcdf..9a23e274 100644 --- a/src/app/claim/claim.module.ts +++ b/src/app/claim/claim.module.ts @@ -23,7 +23,6 @@ import { import { FlexLayoutModule } from '@angular/flex-layout'; import { PapiModule } from '../papi/papi.module'; -import { ThriftModule } from '../thrift/thrift.module'; import { ClaimRoutingModule } from './claim-routing.module'; import { ClaimComponent } from './claim.component'; import { ClaimInfoComponent } from './claim-info/claim-info.component'; @@ -44,11 +43,12 @@ import { PersistentContainerService } from './persistent-container.service'; import { CloneClaimComponent } from './clone-claim/clone-claim.component'; import { PartyModificationContainerService } from './party-modification-container/party-modification-container.service'; import { RemoveConfirmComponent } from './party-modification-container/remove-confirm/remove-confirm.component'; +import { DamselModule } from '../thrift-services/damsel/damsel.module'; @NgModule({ imports: [ PapiModule, - ThriftModule, + DamselModule, CommonModule, SharedModule, ReactiveFormsModule, diff --git a/src/app/claim/claim.service.ts b/src/app/claim/claim.service.ts index 6050c1cd..41e04968 100644 --- a/src/app/claim/claim.service.ts +++ b/src/app/claim/claim.service.ts @@ -17,7 +17,7 @@ import { ClaimInfo, PartyModificationUnit } from '../papi/model'; import { ClaimInfoContainer, ModificationGroup, PersistentContainer } from './model'; import { PersistentContainerService } from './persistent-container.service'; import { convert } from './party-modification-group-converter'; -import { PartyModification } from '../gen-damsel/payment_processing'; +import { PartyModification } from '../thrift-services/damsel/gen-model/payment_processing'; import { ClaimActionType } from './claim-action-type'; import { ClaimStatus } from '../papi/model/claim-statuses'; diff --git a/src/app/claim/container-name.pipe.ts b/src/app/claim/container-name.pipe.ts index 6d88bfe8..64c2ff21 100644 --- a/src/app/claim/container-name.pipe.ts +++ b/src/app/claim/container-name.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { ContractModificationName, ShopModificationName, ModificationGroupType } from './model'; +import { ContractModificationName, ModificationGroupType, ShopModificationName } from './model'; @Pipe({ name: 'ccContainerName' diff --git a/src/app/claim/create-modification/create-modification.component.ts b/src/app/claim/create-modification/create-modification.component.ts index 0f6c6bc6..dd7d4df6 100644 --- a/src/app/claim/create-modification/create-modification.component.ts +++ b/src/app/claim/create-modification/create-modification.component.ts @@ -10,7 +10,7 @@ import { ContractModificationUnit, PartyModification, ShopModificationUnit -} from '../../gen-damsel/payment_processing'; +} from '../../thrift-services/damsel/gen-model/payment_processing'; export interface CreateModificationData { action: ModificationAction; diff --git a/src/app/claim/model/modification-unit-container.ts b/src/app/claim/model/modification-unit-container.ts index 0d65b666..d91850ea 100644 --- a/src/app/claim/model/modification-unit-container.ts +++ b/src/app/claim/model/modification-unit-container.ts @@ -1,7 +1,7 @@ import { ContractModificationUnit, ShopModificationUnit -} from '../../gen-damsel/payment_processing'; +} from '../../thrift-services/damsel/gen-model/payment_processing'; export class ModificationUnitContainer { saved: boolean; diff --git a/src/app/claim/model/persistent-container.ts b/src/app/claim/model/persistent-container.ts index 600db5d8..c71b5253 100644 --- a/src/app/claim/model/persistent-container.ts +++ b/src/app/claim/model/persistent-container.ts @@ -1,4 +1,4 @@ -import { PartyModification } from '../../gen-damsel/payment_processing'; +import { PartyModification } from '../../thrift-services/damsel/gen-model/payment_processing'; export class PersistentContainer { modification: PartyModification; diff --git a/src/app/claim/party-modification-container/party-modification-container.service.ts b/src/app/claim/party-modification-container/party-modification-container.service.ts index 21ab4b44..25d057c5 100644 --- a/src/app/claim/party-modification-container/party-modification-container.service.ts +++ b/src/app/claim/party-modification-container/party-modification-container.service.ts @@ -5,7 +5,7 @@ import { ContractModificationName, ModificationGroupType, ShopModificationName } import { ContractModificationUnit, ShopModificationUnit -} from '../../gen-damsel/payment_processing'; +} from '../../thrift-services/damsel/gen-model/payment_processing'; @Injectable() export class PartyModificationContainerService { diff --git a/src/app/claim/party-modification-group-converter.ts b/src/app/claim/party-modification-group-converter.ts index 7f97d6c6..388793bc 100644 --- a/src/app/claim/party-modification-group-converter.ts +++ b/src/app/claim/party-modification-group-converter.ts @@ -6,7 +6,10 @@ import { PartyModificationUnit, PersistentContainer } from './model'; -import { ContractModificationUnit, ShopModificationUnit } from '../gen-damsel/payment_processing'; +import { + ContractModificationUnit, + ShopModificationUnit +} from '../thrift-services/damsel/gen-model/payment_processing'; import { UnitName } from '../party-modification-creation/unit-name'; interface PersistentUnit { diff --git a/src/app/claim/party-modification-units/party-modification-units.component.ts b/src/app/claim/party-modification-units/party-modification-units.component.ts index f825da05..3e2c97f8 100644 --- a/src/app/claim/party-modification-units/party-modification-units.component.ts +++ b/src/app/claim/party-modification-units/party-modification-units.component.ts @@ -1,7 +1,7 @@ import { Component, Input } from '@angular/core'; import { MatBottomSheet } from '@angular/material'; -import { PartyModificationUnit, ModificationGroupType } from '../model'; +import { ModificationGroupType, PartyModificationUnit } from '../model'; import { UnitActionsComponent } from '../unit-actions/unit-actions.component'; import { ClaimService } from '../claim.service'; diff --git a/src/app/claim/party-modifications/party-modifications.component.ts b/src/app/claim/party-modifications/party-modifications.component.ts index 9d4504d1..1b0549e6 100644 --- a/src/app/claim/party-modifications/party-modifications.component.ts +++ b/src/app/claim/party-modifications/party-modifications.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { MatSnackBar } from '@angular/material'; import { ClaimService } from '../claim.service'; -import { PartyModificationUnit, ModificationGroupType } from '../model'; +import { ModificationGroupType, PartyModificationUnit } from '../model'; @Component({ selector: 'cc-party-modifications', diff --git a/src/app/claim/persistent-container.service.ts b/src/app/claim/persistent-container.service.ts index f270e722..2751e720 100644 --- a/src/app/claim/persistent-container.service.ts +++ b/src/app/claim/persistent-container.service.ts @@ -3,7 +3,7 @@ import { Subject } from 'rxjs'; import remove from 'lodash-es/remove'; import { PersistentContainer } from './model'; -import { PartyModification } from '../gen-damsel/payment_processing'; +import { PartyModification } from '../thrift-services/damsel/gen-model/payment_processing'; @Injectable() export class PersistentContainerService { diff --git a/src/app/claims/claims.module.ts b/src/app/claims/claims.module.ts index 1ce67018..b00790c6 100644 --- a/src/app/claims/claims.module.ts +++ b/src/app/claims/claims.module.ts @@ -3,9 +3,9 @@ import { CommonModule } from '@angular/common'; import { MatButtonModule, MatCardModule, + MatDialogModule, MatFormFieldModule, MatIconModule, - MatDialogModule, MatInputModule, MatMenuModule, MatProgressBarModule, diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 1ba612d5..6195843a 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -3,31 +3,44 @@ import { CommonModule } from '@angular/common'; import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular'; import { ConfigService } from './config.service'; +import { KeycloakTokenInfoService } from '../keycloak-token-info.service'; -const initializer = (keycloak: KeycloakService, configService: ConfigService) => () => +const initializer = ( + keycloak: KeycloakService, + configService: ConfigService, + keycloakTokenInfoService: KeycloakTokenInfoService +) => () => Promise.all([ configService.load(), - keycloak.init({ - config: '/assets/authConfig.json', - initOptions: { - onLoad: 'login-required', - checkLoginIframe: true - }, - enableBearerInterceptor: true, - bearerExcludedUrls: ['/assets'], - bearerPrefix: 'Bearer' - }) + keycloak + .init({ + config: '/assets/authConfig.json', + initOptions: { + onLoad: 'login-required', + checkLoginIframe: true + }, + enableBearerInterceptor: true, + bearerExcludedUrls: ['/assets', 'https://storage.rbk.money/files'], + bearerPrefix: 'Bearer' + }) + .then(_ => { + return keycloak.getToken(); + }) + .then(token => { + return keycloakTokenInfoService.init(token); + }) ]); @NgModule({ imports: [CommonModule, KeycloakAngularModule], providers: [ ConfigService, + KeycloakTokenInfoService, { provide: APP_INITIALIZER, useFactory: initializer, multi: true, - deps: [KeycloakService, ConfigService] + deps: [KeycloakService, ConfigService, KeycloakTokenInfoService] } ] }) diff --git a/src/app/custom-operators/polling-conditions.ts b/src/app/custom-operators/polling-conditions.ts index 41cc31a8..57e3f7d1 100644 --- a/src/app/custom-operators/polling-conditions.ts +++ b/src/app/custom-operators/polling-conditions.ts @@ -1,4 +1,4 @@ -import { StatDeposit } from '../fistful/gen-model/fistful_stat'; +import { StatDeposit } from '../thrift-services/fistful/gen-model/fistful_stat'; import { depositStatus } from '../deposits/deposit-status'; export const createDepositStopPollingCondition = (deposit: StatDeposit): boolean => diff --git a/src/app/damsel-meta/definition.service.ts b/src/app/damsel-meta/definition.service.ts index 0a06b8d4..804f524c 100644 --- a/src/app/damsel-meta/definition.service.ts +++ b/src/app/damsel-meta/definition.service.ts @@ -4,7 +4,7 @@ import { Observable, of } from 'rxjs'; import { shareReplay, map } from 'rxjs/operators'; import { Field } from 'thrift-ts'; -import { Reference } from '../gen-damsel/domain'; +import { Reference } from '../thrift-services/damsel/gen-model/domain'; import { ASTDefinition } from './model'; @Injectable() diff --git a/src/app/damsel-meta/meta-builder/enrichment/meta-enricher.ts b/src/app/damsel-meta/meta-builder/enrichment/meta-enricher.ts index 26e480df..73963f89 100644 --- a/src/app/damsel-meta/meta-builder/enrichment/meta-enricher.ts +++ b/src/app/damsel-meta/meta-builder/enrichment/meta-enricher.ts @@ -157,7 +157,7 @@ export class MetaEnricher { return this.enrichTyped(found); } - private findMeta(condition: MetaTypeCondition): MetaTyped & MetaTypeDefined | null { + private findMeta(condition: MetaTypeCondition): (MetaTyped & MetaTypeDefined) | null { let found = findMeta(condition, this.shallowMetaDef); if (found) { return found; diff --git a/src/app/damsel-meta/thrift-builder/build-thrift.ts b/src/app/damsel-meta/thrift-builder/build-thrift.ts index 1063c01a..4735d701 100644 --- a/src/app/damsel-meta/thrift-builder/build-thrift.ts +++ b/src/app/damsel-meta/thrift-builder/build-thrift.ts @@ -8,7 +8,7 @@ import { MetaStruct, MetaUnion } from '../model'; -import { getThriftInstance } from '../../thrift'; +import { getThriftInstance } from '../../thrift-services'; export type ThriftType = any; diff --git a/src/app/deposits/create-deposit/create-deposit.service.ts b/src/app/deposits/create-deposit/create-deposit.service.ts index 8cb0ef97..cd2391dd 100644 --- a/src/app/deposits/create-deposit/create-deposit.service.ts +++ b/src/app/deposits/create-deposit/create-deposit.service.ts @@ -7,11 +7,11 @@ import { Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { toMajor } from '../to-major-amount'; -import { DepositParams } from '../../fistful/gen-model/fistful_admin'; -import { StatDeposit } from '../../fistful/gen-model/fistful_stat'; +import { DepositParams } from '../../thrift-services/fistful/gen-model/fistful_admin'; +import { StatDeposit } from '../../thrift-services/fistful/gen-model/fistful_stat'; import { SearchFormParams } from '../search-form/search-form-params'; -import { FistfulAdminService } from '../../fistful/fistful-admin.service'; -import { FistfulStatisticsService } from '../../fistful/fistful-stat.service'; +import { FistfulAdminService } from '../../thrift-services/fistful/fistful-admin.service'; +import { FistfulStatisticsService } from '../../thrift-services/fistful/fistful-stat.service'; import { createDepositStopPollingCondition, poll } from '../../custom-operators'; export interface CurrencySource { diff --git a/src/app/deposits/deposit-status.pipe.ts b/src/app/deposits/deposit-status.pipe.ts index a8eb4697..92e03c06 100644 --- a/src/app/deposits/deposit-status.pipe.ts +++ b/src/app/deposits/deposit-status.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { DepositStatus } from '../fistful/gen-model/fistful_stat'; +import { DepositStatus } from '../thrift-services/fistful/gen-model/fistful_stat'; import { depositStatus } from './deposit-status'; @Pipe({ diff --git a/src/app/deposits/deposit-status.ts b/src/app/deposits/deposit-status.ts index a5aa884d..981ddb5f 100644 --- a/src/app/deposits/deposit-status.ts +++ b/src/app/deposits/deposit-status.ts @@ -1,4 +1,4 @@ -import { DepositStatus } from '../fistful/gen-model/fistful_stat'; +import { DepositStatus } from '../thrift-services/fistful/gen-model/fistful_stat'; import { clearNullFields } from '../shared/thrift-utils'; export const depositStatus = (status: DepositStatus): string => diff --git a/src/app/deposits/deposits-table/deposits-table.component.ts b/src/app/deposits/deposits-table/deposits-table.component.ts index 3ddcf96e..11a7c2df 100644 --- a/src/app/deposits/deposits-table/deposits-table.component.ts +++ b/src/app/deposits/deposits-table/deposits-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core'; -import { StatDeposit } from '../../fistful/gen-model/fistful_stat'; +import { StatDeposit } from '../../thrift-services/fistful/gen-model/fistful_stat'; @Component({ selector: 'cc-deposits-table', diff --git a/src/app/deposits/deposits.module.ts b/src/app/deposits/deposits.module.ts index ba44c4f1..dcaedb7a 100644 --- a/src/app/deposits/deposits.module.ts +++ b/src/app/deposits/deposits.module.ts @@ -16,12 +16,12 @@ import { DepositsRoutingModule } from './deposits-routing.module'; import { DepositsComponent } from './deposits.component'; import { CreateDepositComponent } from './create-deposit/create-deposit.component'; import { CreateDepositService } from './create-deposit/create-deposit.service'; -import { FistfulAdminService } from '../fistful/fistful-admin.service'; +import { FistfulAdminService } from '../thrift-services/fistful/fistful-admin.service'; import { DepositsTableComponent } from './deposits-table/deposits-table.component'; import { DepositsTableService } from './deposits-table/deposits-table.service'; import { SearchFormService } from './search-form/search-form.service'; import { DepositsService } from './deposits.service'; -import { FistfulStatisticsService } from '../fistful/fistful-stat.service'; +import { FistfulStatisticsService } from '../thrift-services/fistful/fistful-stat.service'; import { SearchFormComponent } from './search-form/search-form.component'; import { DepositStatusPipe } from './deposit-status.pipe'; import { MatDialogModule } from '@angular/material/dialog'; diff --git a/src/app/deposits/deposits.service.ts b/src/app/deposits/deposits.service.ts index e6363617..cd0149fb 100644 --- a/src/app/deposits/deposits.service.ts +++ b/src/app/deposits/deposits.service.ts @@ -5,8 +5,8 @@ import { Observable } from 'rxjs'; import { filter, shareReplay } from 'rxjs/operators'; import * as moment from 'moment'; -import { StatDeposit } from '../fistful/gen-model/fistful_stat'; -import { FistfulStatisticsService } from '../fistful/fistful-stat.service'; +import { StatDeposit } from '../thrift-services/fistful/gen-model/fistful_stat'; +import { FistfulStatisticsService } from '../thrift-services/fistful/fistful-stat.service'; import { SearchFormParams } from './search-form/search-form-params'; import { booleanDelay } from '../custom-operators'; import { CreateDepositComponent } from './create-deposit/create-deposit.component'; diff --git a/src/app/domain/domain-info/domain-details.service.ts b/src/app/domain/domain-info/domain-details.service.ts index adb81e77..5c4c4d4f 100644 --- a/src/app/domain/domain-info/domain-details.service.ts +++ b/src/app/domain/domain-info/domain-details.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; -import { DomainPair } from './domain-group/domain-group'; +import { DomainPair } from './domain-group'; @Injectable() export class DomainDetailsService { diff --git a/src/app/domain/domain-info/domain-group/domain-group.module.ts b/src/app/domain/domain-info/domain-group/domain-group.module.ts index a414fbbd..fd1f0db5 100644 --- a/src/app/domain/domain-info/domain-group/domain-group.module.ts +++ b/src/app/domain/domain-info/domain-group/domain-group.module.ts @@ -1,20 +1,20 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { - MatExpansionModule, - MatTableModule, - MatPaginatorModule, - MatIconModule, MatButtonModule, - MatInputModule, MatCardModule, MatCheckboxModule, - MatSelectModule + MatExpansionModule, + MatIconModule, + MatInputModule, + MatPaginatorModule, + MatSelectModule, + MatSortModule, + MatTableModule } from '@angular/material'; import { CdkTableModule } from '@angular/cdk/table'; import { FlexLayoutModule } from '@angular/flex-layout'; import { FormsModule } from '@angular/forms'; -import { MatSortModule } from '@angular/material'; import { DomainGroupComponent } from './domain-group.component'; import { SharedModule } from '../../../shared/shared.module'; diff --git a/src/app/domain/domain-info/domain-group/domain-group.service.ts b/src/app/domain/domain-info/domain-group/domain-group.service.ts index 16264e46..95faf7ed 100644 --- a/src/app/domain/domain-info/domain-group/domain-group.service.ts +++ b/src/app/domain/domain-info/domain-group/domain-group.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable, AsyncSubject } from 'rxjs'; +import { AsyncSubject, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { group } from './group-domain-objects'; diff --git a/src/app/domain/domain-info/domain-group/domain-group.ts b/src/app/domain/domain-info/domain-group/domain-group.ts index de004446..41cf6ef2 100644 --- a/src/app/domain/domain-info/domain-group/domain-group.ts +++ b/src/app/domain/domain-info/domain-group/domain-group.ts @@ -1,4 +1,4 @@ -import { Reference } from '../../../gen-damsel/domain_config'; +import { Reference } from '../../../thrift-services/damsel/gen-model/domain_config'; export interface AbstractDomainObject { ref: any; diff --git a/src/app/domain/domain-info/domain-group/domain-objects-type-selector/domain-objects-type-selector.component.ts b/src/app/domain/domain-info/domain-group/domain-objects-type-selector/domain-objects-type-selector.component.ts index e1a519a9..cd85c381 100644 --- a/src/app/domain/domain-info/domain-group/domain-objects-type-selector/domain-objects-type-selector.component.ts +++ b/src/app/domain/domain-info/domain-group/domain-objects-type-selector/domain-objects-type-selector.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, SimpleChanges, OnChanges, Output, EventEmitter } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { NgModel } from '@angular/forms'; import { MatSelectChange } from '@angular/material'; diff --git a/src/app/domain/domain-info/domain-group/group-control/group-control.component.ts b/src/app/domain/domain-info/domain-group/group-control/group-control.component.ts index 688143aa..004e5b7d 100644 --- a/src/app/domain/domain-info/domain-group/group-control/group-control.component.ts +++ b/src/app/domain/domain-info/domain-group/group-control/group-control.component.ts @@ -1,4 +1,4 @@ -import { Component, Output, EventEmitter, Input } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { DomainGroup } from '../domain-group'; diff --git a/src/app/domain/domain-info/domain-group/group-domain-objects.ts b/src/app/domain/domain-info/domain-group/group-domain-objects.ts index 223fb56a..755bf048 100644 --- a/src/app/domain/domain-info/domain-group/group-domain-objects.ts +++ b/src/app/domain/domain-info/domain-group/group-domain-objects.ts @@ -2,7 +2,7 @@ import { Field } from 'thrift-ts'; import { clearNullFields } from '../../../shared/thrift-utils'; import { DomainGroup } from './domain-group'; -import { Domain } from '../../../gen-damsel/domain'; +import { Domain } from '../../../thrift-services/damsel/gen-model/domain'; function getTypeDef(domainObjDef: Field[]) { return domainObjDef.reduce( diff --git a/src/app/domain/domain-info/domain-group/group-table/group-table.component.ts b/src/app/domain/domain-info/domain-group/group-table/group-table.component.ts index 411be242..fc4a7516 100644 --- a/src/app/domain/domain-info/domain-group/group-table/group-table.component.ts +++ b/src/app/domain/domain-info/domain-group/group-table/group-table.component.ts @@ -1,13 +1,13 @@ -import { Component, OnInit, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; -import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material'; +import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; +import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; import { DomainGroup } from '../domain-group'; -import { DomainDetailsService } from '../../../domain-info/domain-details.service'; -import { toTableGroup, toDataSource } from './table-group'; +import { DomainDetailsService } from '../../domain-details.service'; +import { toDataSource, toTableGroup } from './table-group'; import { sortData } from './sort-table-data'; import { filterPredicate } from './filter-predicate'; import { TableDataSource, TableGroup } from './model'; -import { DetailsContainerService } from '../../../domain-info/details-container.service'; +import { DetailsContainerService } from '../../details-container.service'; @Component({ selector: 'cc-group-table', diff --git a/src/app/domain/domain-info/domain-group/group-table/table-group.ts b/src/app/domain/domain-info/domain-group/group-table/table-group.ts index 2ac343a2..f3048fb1 100644 --- a/src/app/domain/domain-info/domain-group/group-table/table-group.ts +++ b/src/app/domain/domain-info/domain-group/group-table/table-group.ts @@ -1,6 +1,6 @@ import { DomainGroup } from '../domain-group'; import { toJson } from '../../../../shared/thrift-json-converter'; -import { TableGroup, TableDataSource } from './model'; +import { TableDataSource, TableGroup } from './model'; function shorten(str: string, limit = 150): string { return str.length > limit ? str.slice(0, limit) + '...' : str; diff --git a/src/app/domain/domain-info/domain-info.module.ts b/src/app/domain/domain-info/domain-info.module.ts index abd8943a..8123159d 100644 --- a/src/app/domain/domain-info/domain-info.module.ts +++ b/src/app/domain/domain-info/domain-info.module.ts @@ -1,13 +1,13 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { - MatCardModule, - MatProgressBarModule, - MatSnackBarModule, - MatSidenavModule, MatButtonModule, + MatCardModule, MatInputModule, - MatProgressSpinnerModule + MatProgressBarModule, + MatProgressSpinnerModule, + MatSidenavModule, + MatSnackBarModule } from '@angular/material'; import { FlexLayoutModule } from '@angular/flex-layout'; @@ -15,7 +15,7 @@ import { DomainInfoComponent } from './domain-info.component'; import { DomainObjDetailsComponent } from './domain-obj-details'; import { DomainGroupModule } from './domain-group'; import { MonacoEditorModule } from '../../monaco-editor'; -import { ThriftModule } from '../../thrift/thrift.module'; +import { DamselModule } from '../../thrift-services/damsel/damsel.module'; import { SharedModule } from '../../shared/shared.module'; @NgModule({ @@ -32,7 +32,7 @@ import { SharedModule } from '../../shared/shared.module'; MatInputModule, MatProgressSpinnerModule, MonacoEditorModule, - ThriftModule, + DamselModule, SharedModule ] }) diff --git a/src/app/domain/domain-info/domain-info.service.ts b/src/app/domain/domain-info/domain-info.service.ts index 14dbb129..09d22f30 100644 --- a/src/app/domain/domain-info/domain-info.service.ts +++ b/src/app/domain/domain-info/domain-info.service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core'; -import { Observable, combineLatest, Subject, AsyncSubject } from 'rxjs'; -import { tap, map } from 'rxjs/operators'; +import { AsyncSubject, combineLatest, Observable, Subject } from 'rxjs'; +import { map, tap } from 'rxjs/operators'; import { Field } from 'thrift-ts'; import { DomainService } from '../domain.service'; import { MetadataService } from '../metadata.service'; -import { Snapshot } from '../../gen-damsel/domain_config'; +import { Snapshot } from '../../thrift-services/damsel/gen-model/domain_config'; export interface Payload { shapshot: Snapshot; diff --git a/src/app/domain/domain-info/domain-obj-details/domain-obj-details.component.ts b/src/app/domain/domain-info/domain-obj-details/domain-obj-details.component.ts index d71f384e..2bec3728 100644 --- a/src/app/domain/domain-info/domain-obj-details/domain-obj-details.component.ts +++ b/src/app/domain/domain-info/domain-obj-details/domain-obj-details.component.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { DomainDetailsService } from '../domain-details.service'; -import { MonacoFile, IEditorOptions } from '../../../monaco-editor'; +import { IEditorOptions, MonacoFile } from '../../../monaco-editor'; @Component({ selector: 'cc-domain-obj-details', diff --git a/src/app/domain/domain-modification-model.ts b/src/app/domain/domain-modification-model.ts index 8845787b..5e63011c 100644 --- a/src/app/domain/domain-modification-model.ts +++ b/src/app/domain/domain-modification-model.ts @@ -1,4 +1,4 @@ -import { Reference, DomainObject } from '../gen-damsel/domain'; +import { Reference, DomainObject } from '../thrift-services/damsel/gen-model/domain'; import { MetaStruct, MetaUnion } from '../damsel-meta'; export interface ModificationItem { diff --git a/src/app/domain/domain-obj-modification/domain-obj-code-lens-provider.ts b/src/app/domain/domain-obj-modification/domain-obj-code-lens-provider.ts index 33bbc713..c526c33e 100644 --- a/src/app/domain/domain-obj-modification/domain-obj-code-lens-provider.ts +++ b/src/app/domain/domain-obj-modification/domain-obj-code-lens-provider.ts @@ -4,7 +4,7 @@ import { CancellationToken, ICodeLensSymbol, ProviderResult -} from '../../monaco-editor/model'; +} from '../../monaco-editor'; export class DomainObjCodeLensProvider implements CodeLensProvider { get language() { diff --git a/src/app/domain/domain-obj-modification/domain-obj-modification.component.ts b/src/app/domain/domain-obj-modification/domain-obj-modification.component.ts index b53a3217..75df6339 100644 --- a/src/app/domain/domain-obj-modification/domain-obj-modification.component.ts +++ b/src/app/domain/domain-obj-modification/domain-obj-modification.component.ts @@ -3,7 +3,7 @@ import { MatSnackBar, MatDialog } from '@angular/material'; import { Router } from '@angular/router'; import { Subscription } from 'rxjs'; -import { MonacoFile, CodeLensProvider, CompletionProvider } from '../../monaco-editor/model'; +import { MonacoFile, CodeLensProvider, CompletionProvider } from '../../monaco-editor'; import { DomainObjModificationService } from './domain-obj-modification.service'; import { DomainObjCodeLensProvider } from './domain-obj-code-lens-provider'; import { DomainObjCompletionProvider } from './domain-obj-completion-provider'; diff --git a/src/app/domain/domain-obj-modification/domain-obj-modification.module.ts b/src/app/domain/domain-obj-modification/domain-obj-modification.module.ts index d0594ec7..9056e9d5 100644 --- a/src/app/domain/domain-obj-modification/domain-obj-modification.module.ts +++ b/src/app/domain/domain-obj-modification/domain-obj-modification.module.ts @@ -11,7 +11,7 @@ import { MatIconModule } from '@angular/material/icon'; import { RouterModule } from '@angular/router'; import { DomainObjModificationComponent } from './domain-obj-modification.component'; -import { MonacoEditorModule } from '../../monaco-editor/monaco-editor.module'; +import { MonacoEditorModule } from '../../monaco-editor'; import { SharedModule } from '../../shared/shared.module'; import { ResetConfirmDialogComponent } from './reset-confirm-dialog/reset-confirm-dialog.component'; diff --git a/src/app/domain/domain-obj-modification/domain-obj-modification.service.ts b/src/app/domain/domain-obj-modification/domain-obj-modification.service.ts index c2a9ce9d..29411350 100644 --- a/src/app/domain/domain-obj-modification/domain-obj-modification.service.ts +++ b/src/app/domain/domain-obj-modification/domain-obj-modification.service.ts @@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { Observable, combineLatest, Subject, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; -import { DomainObject, Reference } from '../../gen-damsel/domain'; +import { DomainObject, Reference } from '../../thrift-services/damsel/gen-model/domain'; import { MetadataService } from '../metadata.service'; import { DomainService } from '../domain.service'; import { MetaBuilder } from '../../damsel-meta/meta-builder.service'; @@ -12,7 +12,7 @@ import { toMonacoContent, parseRef } from '../utils'; import { DomainReviewService } from '../domain-review.service'; import { DomainModificationModel, ModificationItem } from '../domain-modification-model'; import { ThriftBuilderService } from '../../damsel-meta/thrift-builder.service'; -import { getThriftInstance } from '../../thrift'; +import { getThriftInstance } from '../../thrift-services'; import { ThriftType } from '../../damsel-meta/thrift-builder'; @Injectable() diff --git a/src/app/domain/domain-obj-review/domain-obj-review.component.ts b/src/app/domain/domain-obj-review/domain-obj-review.component.ts index 4c754a2f..52ffc2a0 100644 --- a/src/app/domain/domain-obj-review/domain-obj-review.component.ts +++ b/src/app/domain/domain-obj-review/domain-obj-review.component.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { MatCheckboxChange, MatSnackBar } from '@angular/material'; import { Subscription } from 'rxjs'; -import { MonacoFile, IDiffEditorOptions } from '../../monaco-editor/model'; +import { MonacoFile, IDiffEditorOptions } from '../../monaco-editor'; import { toMonacoFile } from '../utils'; import { DomainModificationModel } from '../domain-modification-model'; import { DomainObjReviewService } from './domain-obj-review.service'; diff --git a/src/app/domain/domain-obj-review/domain-obj-review.module.ts b/src/app/domain/domain-obj-review/domain-obj-review.module.ts index 2a8e0aa9..26ebc244 100644 --- a/src/app/domain/domain-obj-review/domain-obj-review.module.ts +++ b/src/app/domain/domain-obj-review/domain-obj-review.module.ts @@ -10,7 +10,7 @@ import { } from '@angular/material'; import { DomainObjReviewComponent } from './domain-obj-review.component'; -import { MonacoEditorModule } from '../../monaco-editor/monaco-editor.module'; +import { MonacoEditorModule } from '../../monaco-editor'; import { SharedModule } from '../../shared/shared.module'; @NgModule({ diff --git a/src/app/domain/domain-obj-review/domain-obj-review.service.ts b/src/app/domain/domain-obj-review/domain-obj-review.service.ts index 02e8e2a2..cd0948ab 100644 --- a/src/app/domain/domain-obj-review/domain-obj-review.service.ts +++ b/src/app/domain/domain-obj-review/domain-obj-review.service.ts @@ -4,7 +4,7 @@ import { Observable, combineLatest } from 'rxjs'; import { DomainModificationModel } from '../domain-modification-model'; import { DomainService } from '../domain.service'; -import { Version } from '../../gen-damsel/domain_config'; +import { Version } from '../../thrift-services/damsel/gen-model/domain_config'; import { DomainReviewService } from '../domain-review.service'; import { tap } from 'rxjs/operators'; diff --git a/src/app/domain/domain.service.ts b/src/app/domain/domain.service.ts index 6dc4354b..08b2b204 100644 --- a/src/app/domain/domain.service.ts +++ b/src/app/domain/domain.service.ts @@ -2,10 +2,10 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; -import { DomainService as ThriftDomainService } from '../thrift/domain.service'; -import { toGenReference, toGenCommit } from '../thrift/converters'; -import { Snapshot, Commit } from '../gen-damsel/domain_config'; -import { Reference, DomainObject } from '../gen-damsel/domain'; +import { DomainService as ThriftDomainService } from '../thrift-services/damsel/domain.service'; +import { toGenReference, toGenCommit } from '../thrift-services/converters'; +import { Snapshot, Commit } from '../thrift-services/damsel/gen-model/domain_config'; +import { Reference, DomainObject } from '../thrift-services/damsel/gen-model/domain'; import { toJson } from '../shared/thrift-json-converter'; @Injectable() diff --git a/src/app/domain/metadata.service.ts b/src/app/domain/metadata.service.ts index a1828582..1da993cf 100644 --- a/src/app/domain/metadata.service.ts +++ b/src/app/domain/metadata.service.ts @@ -4,7 +4,7 @@ import { Observable, of } from 'rxjs'; import { shareReplay, map } from 'rxjs/operators'; import { JsonAST, Field } from 'thrift-ts'; -import { Reference } from '../gen-damsel/domain'; +import { Reference } from '../thrift-services/damsel/gen-model/domain'; export interface Metadata { path: string; diff --git a/src/app/domain/utils.ts b/src/app/domain/utils.ts index 258c070f..3cfa8bd5 100644 --- a/src/app/domain/utils.ts +++ b/src/app/domain/utils.ts @@ -1,6 +1,6 @@ import * as uuid from 'uuid/v4'; -import { Reference, DomainObject } from '../gen-damsel/domain'; +import { DomainObject, Reference } from '../thrift-services/damsel/gen-model/domain'; import { MonacoFile } from '../monaco-editor'; import { toJson } from '../shared/thrift-json-converter'; import { extract } from '../shared/thrift-utils'; diff --git a/src/app/jsonc/json-parser.ts b/src/app/jsonc/json-parser.ts index 84387630..c5b9986a 100644 --- a/src/app/jsonc/json-parser.ts +++ b/src/app/jsonc/json-parser.ts @@ -1,6 +1,7 @@ import { JSONSchema } from './json-schema'; import * as Json from 'jsonc-parser'; import * as nls from './nlc'; + const localize = nls.loadMessageBundle(); export interface IRange { diff --git a/src/app/keycloak-token-info.service.ts b/src/app/keycloak-token-info.service.ts new file mode 100644 index 00000000..7b4029a3 --- /dev/null +++ b/src/app/keycloak-token-info.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@angular/core'; +import * as jwtDecode from 'jwt-decode'; + +@Injectable() +export class KeycloakTokenInfoService { + userToken: string; + decodedUserToken: any; + + init(token: string) { + this.userToken = token; + this.decodedUserToken = jwtDecode(token); + } +} diff --git a/src/app/papi/model/claim-statuses.ts b/src/app/papi/model/claim-statuses.ts index d650ef7e..3271be81 100644 --- a/src/app/papi/model/claim-statuses.ts +++ b/src/app/papi/model/claim-statuses.ts @@ -2,5 +2,7 @@ export enum ClaimStatus { accepted = 'accepted', denied = 'denied', revoked = 'revoked', - pending = 'pending' + pending = 'pending', + review = 'review', + pending_acceptance = 'pending_acceptance' } diff --git a/src/app/papi/model/index.ts b/src/app/papi/model/index.ts index 2d013827..247a9e07 100644 --- a/src/app/papi/model/index.ts +++ b/src/app/papi/model/index.ts @@ -9,3 +9,4 @@ export * from './payment'; export * from './invoice'; export * from './claim-created'; export * from './payout-types'; +export * from './claim-statuses'; diff --git a/src/app/papi/model/party-modification-unit.ts b/src/app/papi/model/party-modification-unit.ts index 93148525..e2485b67 100644 --- a/src/app/papi/model/party-modification-unit.ts +++ b/src/app/papi/model/party-modification-unit.ts @@ -1,4 +1,4 @@ -import { PartyModification } from '../../gen-damsel/payment_processing'; +import { PartyModification } from '../../thrift-services/damsel/gen-model/payment_processing'; export class PartyModificationUnit { modifications: PartyModification[]; diff --git a/src/app/papi/party.service.ts b/src/app/papi/party.service.ts index 2657bc62..a6a9c8d2 100644 --- a/src/app/papi/party.service.ts +++ b/src/app/papi/party.service.ts @@ -6,7 +6,7 @@ import { map } from 'rxjs/operators'; import { ConfigService } from '../core/config.service'; import { ContractTemplate } from './model'; import { decode } from '../shared/java-thrift-formatter'; -import { Party } from '../gen-damsel/domain'; +import { Party } from '../thrift-services/damsel/gen-model/domain'; @Injectable() export class PartyService { diff --git a/src/app/party-modification-creation/business-schedule-ref/business-schedule-ref.component.ts b/src/app/party-modification-creation/business-schedule-ref/business-schedule-ref.component.ts index ddfbf600..c4914513 100644 --- a/src/app/party-modification-creation/business-schedule-ref/business-schedule-ref.component.ts +++ b/src/app/party-modification-creation/business-schedule-ref/business-schedule-ref.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import get from 'lodash-es/get'; -import { BusinessScheduleRef } from '../../gen-damsel/domain'; +import { BusinessScheduleRef } from '../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-business-schedule-ref', diff --git a/src/app/party-modification-creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts b/src/app/party-modification-creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts index 32d52f5c..779ebd28 100644 --- a/src/app/party-modification-creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts +++ b/src/app/party-modification-creation/business-schedule-ref/business-schedule-selector/business-schedule-selector.component.ts @@ -3,8 +3,8 @@ import { MatSelectChange, MatSnackBar } from '@angular/material'; import { tap } from 'rxjs/internal/operators'; import { Observable } from 'rxjs'; -import { BusinessScheduleObject } from '../../../gen-damsel/domain'; -import { DomainTypedManager } from '../../../thrift'; +import { BusinessScheduleObject } from '../../../thrift-services/damsel/gen-model/domain'; +import { DomainTypedManager } from '../../../thrift-services'; @Component({ selector: 'cc-business-schedule-selector', diff --git a/src/app/party-modification-creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts b/src/app/party-modification-creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts index 565c7f3c..e209d4c9 100644 --- a/src/app/party-modification-creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts +++ b/src/app/party-modification-creation/contract/adjustment-modification-unit/adjustment-modification-unit.component.ts @@ -3,7 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import * as uuid from 'uuid/v4'; import get from 'lodash-es/get'; -import { ContractAdjustmentModificationUnit } from '../../../gen-damsel/payment_processing'; +import { ContractAdjustmentModificationUnit } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-adjustment-modification-unit', diff --git a/src/app/party-modification-creation/contract/adjustment-modification/adjustment-modification.component.ts b/src/app/party-modification-creation/contract/adjustment-modification/adjustment-modification.component.ts index 91bbe3d7..dd1ca577 100644 --- a/src/app/party-modification-creation/contract/adjustment-modification/adjustment-modification.component.ts +++ b/src/app/party-modification-creation/contract/adjustment-modification/adjustment-modification.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { ContractAdjustmentModification } from '../../../gen-damsel/payment_processing'; +import { ContractAdjustmentModification } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-adjustment-modification', diff --git a/src/app/party-modification-creation/contract/adjustment-params/adjustment-params.component.ts b/src/app/party-modification-creation/contract/adjustment-params/adjustment-params.component.ts index 9282c50f..52eda8b0 100644 --- a/src/app/party-modification-creation/contract/adjustment-params/adjustment-params.component.ts +++ b/src/app/party-modification-creation/contract/adjustment-params/adjustment-params.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { ContractAdjustmentParams } from '../../../gen-damsel/payment_processing'; +import { ContractAdjustmentParams } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-contract-adjustment-params', diff --git a/src/app/party-modification-creation/contract/contract-params/contract-params.component.ts b/src/app/party-modification-creation/contract/contract-params/contract-params.component.ts index c0358a12..39a7116f 100644 --- a/src/app/party-modification-creation/contract/contract-params/contract-params.component.ts +++ b/src/app/party-modification-creation/contract/contract-params/contract-params.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { get } from 'lodash-es'; -import { ContractParams } from '../../../gen-damsel/payment_processing'; +import { ContractParams } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-contract-params', diff --git a/src/app/party-modification-creation/contract/contract-template-ref/contract-template-ref.component.ts b/src/app/party-modification-creation/contract/contract-template-ref/contract-template-ref.component.ts index ed084e48..35783073 100644 --- a/src/app/party-modification-creation/contract/contract-template-ref/contract-template-ref.component.ts +++ b/src/app/party-modification-creation/contract/contract-template-ref/contract-template-ref.component.ts @@ -8,7 +8,7 @@ import get from 'lodash-es/get'; import { ContractTemplate } from '../../../papi/model'; import { ContractService } from '../../../papi/contract.service'; -import { ContractTemplateRef } from '../../../gen-damsel/domain'; +import { ContractTemplateRef } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-contract-template-ref', diff --git a/src/app/party-modification-creation/contract/contractor/contractor.component.ts b/src/app/party-modification-creation/contract/contractor/contractor.component.ts index 1c3aef46..34275060 100644 --- a/src/app/party-modification-creation/contract/contractor/contractor.component.ts +++ b/src/app/party-modification-creation/contract/contractor/contractor.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { Contractor } from '../../../gen-damsel/domain'; +import { Contractor } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-contractor', diff --git a/src/app/party-modification-creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts b/src/app/party-modification-creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts index dd478d05..907d6c41 100644 --- a/src/app/party-modification-creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts +++ b/src/app/party-modification-creation/contract/legal-agreement-binding/legal-agreement-binding.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import get from 'lodash-es/get'; -import { LegalAgreement } from '../../../gen-damsel/domain'; +import { LegalAgreement } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-legal-agreement-binding', diff --git a/src/app/party-modification-creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts b/src/app/party-modification-creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts index a601bf17..a55cb95c 100644 --- a/src/app/party-modification-creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts +++ b/src/app/party-modification-creation/contract/legal-entity/international-legal-entity/international-legal-entity.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { InternationalLegalEntity } from '../../../../gen-damsel/domain'; +import { InternationalLegalEntity } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-international-legal-entity', diff --git a/src/app/party-modification-creation/contract/legal-entity/legal-entity.component.ts b/src/app/party-modification-creation/contract/legal-entity/legal-entity.component.ts index 3bf01559..0b0bd496 100644 --- a/src/app/party-modification-creation/contract/legal-entity/legal-entity.component.ts +++ b/src/app/party-modification-creation/contract/legal-entity/legal-entity.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import get from 'lodash-es/get'; -import { LegalEntity } from '../../../gen-damsel/domain'; +import { LegalEntity } from '../../../thrift-services/damsel/gen-model/domain'; enum Type { russianLegalEntity = 'russian_legal_entity', diff --git a/src/app/party-modification-creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts b/src/app/party-modification-creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts index 5f4fbc04..701dba25 100644 --- a/src/app/party-modification-creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts +++ b/src/app/party-modification-creation/contract/legal-entity/russian-legal-entity/russian-legal-entity.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import get from 'lodash-es/get'; -import { RussianLegalEntity } from '../../../../gen-damsel/domain'; +import { RussianLegalEntity } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-russian-legal-entity', diff --git a/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts b/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts index 79ce9082..460c9176 100644 --- a/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts +++ b/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts @@ -5,8 +5,11 @@ import sortBy from 'lodash-es/sortBy'; import { Observable } from 'rxjs'; import get from 'lodash-es/get'; -import { PaymentInstitutionObject, PaymentInstitutionRef } from '../../../gen-damsel/domain'; -import { DomainTypedManager } from '../../../thrift'; +import { + PaymentInstitutionObject, + PaymentInstitutionRef +} from '../../../thrift-services/damsel/gen-model/domain'; +import { DomainTypedManager } from '../../../thrift-services'; @Component({ selector: 'cc-payment-institution-ref', diff --git a/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts b/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts index 42c9b895..21dee5bb 100644 --- a/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-account.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import get from 'lodash-es/get'; -import { InternationalBankAccount } from '../../../../gen-damsel/domain'; +import { InternationalBankAccount } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-international-bank-account', diff --git a/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts b/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts index beb4b89b..361b61f6 100644 --- a/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-info/international-bank-account/international-bank-details/international-bank-details.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import get from 'lodash-es/get'; -import { InternationalBankDetails } from '../../../../../gen-damsel/domain'; +import { InternationalBankDetails } from '../../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-international-bank-details', diff --git a/src/app/party-modification-creation/contract/payout-tool-info/payout-tool-info.component.ts b/src/app/party-modification-creation/contract/payout-tool-info/payout-tool-info.component.ts index 900eb70e..85bda5ea 100644 --- a/src/app/party-modification-creation/contract/payout-tool-info/payout-tool-info.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-info/payout-tool-info.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { PayoutToolInfo } from '../../../gen-damsel/domain'; +import { PayoutToolInfo } from '../../../thrift-services/damsel/gen-model/domain'; import get from 'lodash-es/get'; enum Type { diff --git a/src/app/party-modification-creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts b/src/app/party-modification-creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts index 0ea651ce..c8b229f2 100644 --- a/src/app/party-modification-creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-info/russian-bank-account/russian-bank-account.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import get from 'lodash-es/get'; -import { RussianBankAccount } from '../../../../gen-damsel/domain'; +import { RussianBankAccount } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-russian-bank-account', diff --git a/src/app/party-modification-creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts b/src/app/party-modification-creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts index 246e0fdc..7d139425 100644 --- a/src/app/party-modification-creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-modification-unit/payout-tool-modification-unit.component.ts @@ -3,7 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import * as uuid from 'uuid/v4'; import get from 'lodash-es/get'; -import { PayoutToolModificationUnit } from '../../../gen-damsel/payment_processing'; +import { PayoutToolModificationUnit } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-contract-payout-tool-modification-unit', diff --git a/src/app/party-modification-creation/contract/payout-tool-modification/payout-tool-modification.component.ts b/src/app/party-modification-creation/contract/payout-tool-modification/payout-tool-modification.component.ts index cd53846c..a0eceb9f 100644 --- a/src/app/party-modification-creation/contract/payout-tool-modification/payout-tool-modification.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-modification/payout-tool-modification.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import get from 'lodash-es/get'; -import { PayoutToolModification } from '../../../gen-damsel/payment_processing'; +import { PayoutToolModification } from '../../../thrift-services/damsel/gen-model/payment_processing'; enum Type { creation = 'creation', diff --git a/src/app/party-modification-creation/contract/payout-tool-params/payout-tool-params.component.ts b/src/app/party-modification-creation/contract/payout-tool-params/payout-tool-params.component.ts index 26c6a078..a6c5bfca 100644 --- a/src/app/party-modification-creation/contract/payout-tool-params/payout-tool-params.component.ts +++ b/src/app/party-modification-creation/contract/payout-tool-params/payout-tool-params.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { PayoutToolInfo } from '../../../gen-damsel/domain'; +import { PayoutToolInfo } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-payout-tool-params', diff --git a/src/app/party-modification-creation/contract/report-preferences/report-preferences.component.ts b/src/app/party-modification-creation/contract/report-preferences/report-preferences.component.ts index a3e93cde..b2e6ef9a 100644 --- a/src/app/party-modification-creation/contract/report-preferences/report-preferences.component.ts +++ b/src/app/party-modification-creation/contract/report-preferences/report-preferences.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { ReportPreferences } from '../../../gen-damsel/domain'; +import { ReportPreferences } from '../../../thrift-services/damsel/gen-model/domain'; import get from 'lodash-es/get'; @Component({ diff --git a/src/app/party-modification-creation/contract/representative-document/representative-document.component.ts b/src/app/party-modification-creation/contract/representative-document/representative-document.component.ts index 4e3a900c..747cdc24 100644 --- a/src/app/party-modification-creation/contract/representative-document/representative-document.component.ts +++ b/src/app/party-modification-creation/contract/representative-document/representative-document.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { RepresentativeDocument } from '../../../gen-damsel/domain'; +import { RepresentativeDocument } from '../../../thrift-services/damsel/gen-model/domain'; import get from 'lodash-es/get'; enum Type { diff --git a/src/app/party-modification-creation/contract/representative/representative.component.ts b/src/app/party-modification-creation/contract/representative/representative.component.ts index d9c5ff36..01a8a9a3 100644 --- a/src/app/party-modification-creation/contract/representative/representative.component.ts +++ b/src/app/party-modification-creation/contract/representative/representative.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import get from 'lodash-es/get'; -import { Representative } from '../../../gen-damsel/domain'; +import { Representative } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-representative', diff --git a/src/app/party-modification-creation/contract/termination/termination.component.ts b/src/app/party-modification-creation/contract/termination/termination.component.ts index 8f69b58e..23f5c71d 100644 --- a/src/app/party-modification-creation/contract/termination/termination.component.ts +++ b/src/app/party-modification-creation/contract/termination/termination.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import get from 'lodash-es/get'; -import { ContractTermination } from '../../../gen-damsel/payment_processing'; +import { ContractTermination } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-termination', diff --git a/src/app/party-modification-creation/party-modification-creation.component.ts b/src/app/party-modification-creation/party-modification-creation.component.ts index 99a08ab7..3f1a4ba1 100644 --- a/src/app/party-modification-creation/party-modification-creation.component.ts +++ b/src/app/party-modification-creation/party-modification-creation.component.ts @@ -17,7 +17,7 @@ import { ContractModification, PartyModification, ShopModification -} from '../gen-damsel/payment_processing'; +} from '../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-party-modification-creation', diff --git a/src/app/party-modification-creation/shop/category-ref/category-ref.component.ts b/src/app/party-modification-creation/shop/category-ref/category-ref.component.ts index ccf06a34..f63359b6 100644 --- a/src/app/party-modification-creation/shop/category-ref/category-ref.component.ts +++ b/src/app/party-modification-creation/shop/category-ref/category-ref.component.ts @@ -8,7 +8,7 @@ import { get } from 'lodash-es'; import { Category } from '../../../papi/model'; import { CategoryService } from '../../../papi/category.service'; -import { CategoryRef } from '../../../gen-damsel/domain'; +import { CategoryRef } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-category-ref', diff --git a/src/app/party-modification-creation/shop/contract-modification/contract-modification.component.ts b/src/app/party-modification-creation/shop/contract-modification/contract-modification.component.ts index 61f59ddc..fe932b93 100644 --- a/src/app/party-modification-creation/shop/contract-modification/contract-modification.component.ts +++ b/src/app/party-modification-creation/shop/contract-modification/contract-modification.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { get } from 'lodash-es'; -import { ShopContractModification } from '../../../gen-damsel/payment_processing'; +import { ShopContractModification } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-shop-contract-modification', diff --git a/src/app/party-modification-creation/shop/location-modification/shop-location.component.ts b/src/app/party-modification-creation/shop/location-modification/shop-location.component.ts index 83b8c739..124ae663 100644 --- a/src/app/party-modification-creation/shop/location-modification/shop-location.component.ts +++ b/src/app/party-modification-creation/shop/location-modification/shop-location.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { get } from 'lodash-es'; -import { ShopLocation } from '../../../gen-damsel/domain'; +import { ShopLocation } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-shop-location', diff --git a/src/app/party-modification-creation/shop/payout-tool-modification/payout-tool-modification.component.ts b/src/app/party-modification-creation/shop/payout-tool-modification/payout-tool-modification.component.ts index 8af674cf..00cf5ef6 100644 --- a/src/app/party-modification-creation/shop/payout-tool-modification/payout-tool-modification.component.ts +++ b/src/app/party-modification-creation/shop/payout-tool-modification/payout-tool-modification.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { get } from 'lodash-es'; -import { PayoutToolID } from '../../../gen-damsel/domain'; +import { PayoutToolID } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-shop-payout-tool-modification', diff --git a/src/app/party-modification-creation/shop/shop-account-creation/shop-account-creation.component.ts b/src/app/party-modification-creation/shop/shop-account-creation/shop-account-creation.component.ts index 1b995890..7e112845 100644 --- a/src/app/party-modification-creation/shop/shop-account-creation/shop-account-creation.component.ts +++ b/src/app/party-modification-creation/shop/shop-account-creation/shop-account-creation.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { get } from 'lodash-es'; -import { ShopAccountParams } from '../../../gen-damsel/payment_processing'; +import { ShopAccountParams } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-shop-account-creation', diff --git a/src/app/party-modification-creation/shop/shop-details/shop-details.component.ts b/src/app/party-modification-creation/shop/shop-details/shop-details.component.ts index c3bdb938..256d077e 100644 --- a/src/app/party-modification-creation/shop/shop-details/shop-details.component.ts +++ b/src/app/party-modification-creation/shop/shop-details/shop-details.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { get } from 'lodash-es'; -import { ShopDetails } from '../../../gen-damsel/domain'; +import { ShopDetails } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-shop-details', diff --git a/src/app/party-modification-creation/shop/shop-params/shop-params.component.ts b/src/app/party-modification-creation/shop/shop-params/shop-params.component.ts index a1017e76..47f7c76a 100644 --- a/src/app/party-modification-creation/shop/shop-params/shop-params.component.ts +++ b/src/app/party-modification-creation/shop/shop-params/shop-params.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { get } from 'lodash-es'; -import { ShopParams } from '../../../gen-damsel/payment_processing'; +import { ShopParams } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-shop-params', diff --git a/src/app/party-modification-creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts b/src/app/party-modification-creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts index f1aa5351..4d1b06ca 100644 --- a/src/app/party-modification-creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts +++ b/src/app/party-modification-creation/shop/shop-payout-schedule-modification/shop-payout-schedule-modification.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { get } from 'lodash-es'; -import { ScheduleModification } from '../../../gen-damsel/payment_processing'; +import { ScheduleModification } from '../../../thrift-services/damsel/gen-model/payment_processing'; @Component({ selector: 'cc-shop-schedule-modification', diff --git a/src/app/party-modification-target/party-target/party-target.service.ts b/src/app/party-modification-target/party-target/party-target.service.ts index 34633a09..75da22d7 100644 --- a/src/app/party-modification-target/party-target/party-target.service.ts +++ b/src/app/party-modification-target/party-target/party-target.service.ts @@ -5,7 +5,7 @@ import { map } from 'rxjs/internal/operators'; import { PartyService } from '../../papi/party.service'; import { SelectableItem } from './selectable-item'; import { PartyTarget } from '../party-target'; -import { Contract, Contractor, Party, Shop } from '../../gen-damsel/domain'; +import { Contract, Contractor, Party, Shop } from '../../thrift-services/damsel/gen-model/domain'; @Injectable() export class PartyTargetService { diff --git a/src/app/party-modification-target/party-target/selectable-item.ts b/src/app/party-modification-target/party-target/selectable-item.ts index a3d742d5..c2f2a0db 100644 --- a/src/app/party-modification-target/party-target/selectable-item.ts +++ b/src/app/party-modification-target/party-target/selectable-item.ts @@ -1,4 +1,4 @@ -import { Contract, Shop, Contractor } from '../../gen-damsel/domain'; +import { Contract, Shop, Contractor } from '../../thrift-services/damsel/gen-model/domain'; export class SelectableItem { id: string; diff --git a/src/app/party/party-details/party-details.component.ts b/src/app/party/party-details/party-details.component.ts index 4974f1ad..a960173d 100644 --- a/src/app/party/party-details/party-details.component.ts +++ b/src/app/party/party-details/party-details.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { combineLatest } from 'rxjs'; -import { Party, Shop } from '../../gen-damsel/domain'; +import { Party, Shop } from '../../thrift-services/damsel/gen-model/domain'; import { PartyService } from '../party.service'; @Component({ diff --git a/src/app/party/party-details/party-info/party-info.component.ts b/src/app/party/party-details/party-info/party-info.component.ts index b356f267..2662c32b 100644 --- a/src/app/party/party-details/party-info/party-info.component.ts +++ b/src/app/party/party-details/party-info/party-info.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core'; -import { Party } from '../../../gen-damsel/domain'; +import { Party } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-party-info', diff --git a/src/app/party/party-details/shops-table/shops-table.component.ts b/src/app/party/party-details/shops-table/shops-table.component.ts index e8e02ce3..57259d00 100644 --- a/src/app/party/party-details/shops-table/shops-table.component.ts +++ b/src/app/party/party-details/shops-table/shops-table.component.ts @@ -1,8 +1,8 @@ -import { Component, Input, OnChanges, ViewChild, SimpleChanges } from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; import { MatPaginator, MatTableDataSource } from '@angular/material'; import { ActivatedRoute, Router } from '@angular/router'; -import { Shop } from '../../../gen-damsel/domain'; +import { Shop } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-shops-table', diff --git a/src/app/party/party.service.ts b/src/app/party/party.service.ts index abe98fd8..4fc0c676 100644 --- a/src/app/party/party.service.ts +++ b/src/app/party/party.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { Contract, Party, PayoutTool, Shop } from '../gen-damsel/domain'; +import { Contract, Party, PayoutTool, Shop } from '../thrift-services/damsel/gen-model/domain'; import { PartyService as PapiPartyService } from '../papi/party.service'; import { map, tap } from 'rxjs/operators'; diff --git a/src/app/party/shop-details/add-provider/add-provider.component.ts b/src/app/party/shop-details/add-provider/add-provider.component.ts index 807d2dfa..5dfd8821 100644 --- a/src/app/party/shop-details/add-provider/add-provider.component.ts +++ b/src/app/party/shop-details/add-provider/add-provider.component.ts @@ -4,7 +4,7 @@ import { FormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; import { AddProviderService } from './add-provider.service'; -import { ProviderObject, TerminalObject } from '../../../gen-damsel/domain'; +import { ProviderObject, TerminalObject } from '../../../thrift-services/damsel/gen-model/domain'; interface AddProviderData { partyID: string; diff --git a/src/app/party/shop-details/add-provider/add-provider.service.ts b/src/app/party/shop-details/add-provider/add-provider.service.ts index 0347291c..4cebf3ba 100644 --- a/src/app/party/shop-details/add-provider/add-provider.service.ts +++ b/src/app/party/shop-details/add-provider/add-provider.service.ts @@ -7,9 +7,9 @@ import { AddDecisionToProvider, DomainTypedManager, filterProvidersByTerminalSelector -} from '../../../thrift'; -import { ProviderObject, TerminalObject } from '../../../gen-damsel/domain'; -import { filterProvidersByCategoryId } from '../../../thrift/filters'; +} from '../../../thrift-services'; +import { ProviderObject, TerminalObject } from '../../../thrift-services/damsel/gen-model/domain'; +import { filterProvidersByCategoryId } from '../../../thrift-services/filters'; @Injectable() export class AddProviderService { diff --git a/src/app/party/shop-details/add-provider/select-provider/select-provider.component.ts b/src/app/party/shop-details/add-provider/select-provider/select-provider.component.ts index aa01da16..a86808d9 100644 --- a/src/app/party/shop-details/add-provider/select-provider/select-provider.component.ts +++ b/src/app/party/shop-details/add-provider/select-provider/select-provider.component.ts @@ -11,7 +11,7 @@ import { import { MatPaginator, MatTableDataSource } from '@angular/material'; import { SelectionModel } from '@angular/cdk/collections'; -import { ProviderObject } from '../../../../gen-damsel/domain'; +import { ProviderObject } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-select-provider', diff --git a/src/app/party/shop-details/add-provider/select-terminal/create-terminal-form/create-terminal-form.service.ts b/src/app/party/shop-details/add-provider/select-terminal/create-terminal-form/create-terminal-form.service.ts index 9eb0efcf..054562c8 100644 --- a/src/app/party/shop-details/add-provider/select-terminal/create-terminal-form/create-terminal-form.service.ts +++ b/src/app/party/shop-details/add-provider/select-terminal/create-terminal-form/create-terminal-form.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { DomainTypedManager, TerminalOption } from '../../../../../thrift'; +import { DomainTypedManager, TerminalOption } from '../../../../../thrift-services'; import { Observable } from 'rxjs'; const toFormArray = (fb: FormBuilder, options: TerminalOption[]): FormArray => diff --git a/src/app/party/shop-details/add-provider/select-terminal/select-terminal.component.ts b/src/app/party/shop-details/add-provider/select-terminal/select-terminal.component.ts index 6ca7332c..3a67aea2 100644 --- a/src/app/party/shop-details/add-provider/select-terminal/select-terminal.component.ts +++ b/src/app/party/shop-details/add-provider/select-terminal/select-terminal.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { TerminalObject } from '../../../../gen-damsel/domain'; +import { TerminalObject } from '../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-select-terminal', diff --git a/src/app/party/shop-details/add-provider/select-terminal/terminals-table/terminals-table.component.ts b/src/app/party/shop-details/add-provider/select-terminal/terminals-table/terminals-table.component.ts index 9a3ac489..b30b126b 100644 --- a/src/app/party/shop-details/add-provider/select-terminal/terminals-table/terminals-table.component.ts +++ b/src/app/party/shop-details/add-provider/select-terminal/terminals-table/terminals-table.component.ts @@ -11,7 +11,7 @@ import { import { MatPaginator, MatTableDataSource } from '@angular/material'; import { SelectionModel } from '@angular/cdk/collections'; -import { TerminalObject } from '../../../../../gen-damsel/domain'; +import { TerminalObject } from '../../../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-terminals-table', diff --git a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-priority/edit-terminal-decision-priority.service.ts b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-priority/edit-terminal-decision-priority.service.ts index 58de25b5..09b50bd0 100644 --- a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-priority/edit-terminal-decision-priority.service.ts +++ b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-priority/edit-terminal-decision-priority.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { MatSnackBar } from '@angular/material'; -import { DomainTypedManager } from '../../../../thrift'; +import { DomainTypedManager } from '../../../../thrift-services'; import { EditTerminalDecision } from '../edit-terminal-decision'; @Injectable() diff --git a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-weight/edit-terminal-decision-weight.service.ts b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-weight/edit-terminal-decision-weight.service.ts index da518668..6af6d4ff 100644 --- a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-weight/edit-terminal-decision-weight.service.ts +++ b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision-weight/edit-terminal-decision-weight.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { MatSnackBar } from '@angular/material'; -import { DomainTypedManager } from '../../../../thrift'; +import { DomainTypedManager } from '../../../../thrift-services'; import { EditTerminalDecision } from '../edit-terminal-decision'; @Injectable() diff --git a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision.ts b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision.ts index 8dd6e30b..f7286230 100644 --- a/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision.ts +++ b/src/app/party/shop-details/edit-terminal-decision/edit-terminal-decision.ts @@ -3,8 +3,8 @@ import { MatSnackBar } from '@angular/material'; import { EventEmitter } from '@angular/core'; import { Subject } from 'rxjs'; -import { DomainTypedManager } from '../../../thrift'; -import { EditTerminalDecisionPropertyParams } from '../../../thrift/operations/edit-terminal-decision-property-params'; +import { DomainTypedManager } from '../../../thrift-services'; +import { EditTerminalDecisionPropertyParams } from '../../../thrift-services/damsel/operations/edit-terminal-decision-property-params'; import { EditPriorityData } from './edit-terminal-decision-priority/edit-terminal-decision-priority.component'; export interface EditTerminalDecisionFormValues { diff --git a/src/app/party/shop-details/extract-terminal-info.ts b/src/app/party/shop-details/extract-terminal-info.ts index 568bef6a..c1103537 100644 --- a/src/app/party/shop-details/extract-terminal-info.ts +++ b/src/app/party/shop-details/extract-terminal-info.ts @@ -1,7 +1,12 @@ import get from 'lodash-es/get'; import Int64 from 'thrift-ts/lib/int64'; -import { Condition, Predicate, TerminalObject, TerminalRef } from '../../gen-damsel/domain'; +import { + Condition, + Predicate, + TerminalObject, + TerminalRef +} from '../../thrift-services/damsel/gen-model/domain'; interface PredicateInfo { shopPartyContain: boolean; diff --git a/src/app/party/shop-details/shop-details.component.ts b/src/app/party/shop-details/shop-details.component.ts index 28db9457..82b43ba4 100644 --- a/src/app/party/shop-details/shop-details.component.ts +++ b/src/app/party/shop-details/shop-details.component.ts @@ -3,8 +3,8 @@ import { ActivatedRoute } from '@angular/router'; import { filter, switchMap } from 'rxjs/operators'; import { MatDialog } from '@angular/material'; -import { ShopDetailsService, ProviderInfo } from './shop-details.service'; -import { Contract, PayoutTool, Shop } from '../../gen-damsel/domain'; +import { ProviderInfo, ShopDetailsService } from './shop-details.service'; +import { Contract, PayoutTool, Shop } from '../../thrift-services/damsel/gen-model/domain'; import { AddProviderComponent } from './add-provider/add-provider.component'; @Component({ diff --git a/src/app/party/shop-details/shop-details.service.ts b/src/app/party/shop-details/shop-details.service.ts index b8962e5e..656be09c 100644 --- a/src/app/party/shop-details/shop-details.service.ts +++ b/src/app/party/shop-details/shop-details.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable, combineLatest } from 'rxjs'; +import { combineLatest, Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import get from 'lodash-es/get'; @@ -9,10 +9,10 @@ import { ProviderObject, Shop, TerminalObject -} from '../../gen-damsel/domain'; +} from '../../thrift-services/damsel/gen-model/domain'; import { extractTerminalInfo, TerminalInfo } from './extract-terminal-info'; import { PartyService } from '../party.service'; -import { DomainTypedManager } from '../../thrift'; +import { DomainTypedManager } from '../../thrift-services'; export interface ProviderInfo { provider: ProviderObject; diff --git a/src/app/party/shop-details/shop-info/category/category.component.ts b/src/app/party/shop-details/shop-info/category/category.component.ts index d52200c7..f9b52b62 100644 --- a/src/app/party/shop-details/shop-info/category/category.component.ts +++ b/src/app/party/shop-details/shop-info/category/category.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { Category } from '../../../../gen-damsel/domain'; +import { Category } from '../../../../thrift-services/damsel/gen-model/domain'; import { CategoryService } from '../../../../papi/category.service'; @Component({ diff --git a/src/app/party/shop-details/shop-info/shop-blocking.pipe.ts b/src/app/party/shop-details/shop-info/shop-blocking.pipe.ts index 3847ffcf..e7e27844 100644 --- a/src/app/party/shop-details/shop-info/shop-blocking.pipe.ts +++ b/src/app/party/shop-details/shop-info/shop-blocking.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { Blocking } from '../../../gen-damsel/domain'; +import { Blocking } from '../../../thrift-services/damsel/gen-model/domain'; @Pipe({ name: 'ccBlockingPipe' diff --git a/src/app/party/shop-details/shop-info/shop-info.component.ts b/src/app/party/shop-details/shop-info/shop-info.component.ts index 65faa911..5d076890 100644 --- a/src/app/party/shop-details/shop-info/shop-info.component.ts +++ b/src/app/party/shop-details/shop-info/shop-info.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core'; -import { Shop } from '../../../gen-damsel/domain'; +import { Shop } from '../../../thrift-services/damsel/gen-model/domain'; @Component({ selector: 'cc-shop-info', diff --git a/src/app/party/shop-details/shop-info/shop-suspension.pipe.ts b/src/app/party/shop-details/shop-info/shop-suspension.pipe.ts index 6c7afb52..759c04e3 100644 --- a/src/app/party/shop-details/shop-info/shop-suspension.pipe.ts +++ b/src/app/party/shop-details/shop-info/shop-suspension.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { Suspension } from '../../../gen-damsel/domain'; +import { Suspension } from '../../../thrift-services/damsel/gen-model/domain'; @Pipe({ name: 'ccSuspensionPipe' diff --git a/src/app/party/shop-details/terminal/terminal.component.ts b/src/app/party/shop-details/terminal/terminal.component.ts index af4780b6..d97b056d 100644 --- a/src/app/party/shop-details/terminal/terminal.component.ts +++ b/src/app/party/shop-details/terminal/terminal.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { MatSnackBar } from '@angular/material'; -import { DomainTypedManager } from '../../../thrift'; +import { DomainTypedManager } from '../../../thrift-services'; import { PredicateType, TerminalInfo } from '../extract-terminal-info'; @Component({ diff --git a/src/app/party/shop-details/terminals/terminals.component.ts b/src/app/party/shop-details/terminals/terminals.component.ts index bdc8d403..ba3d3f08 100644 --- a/src/app/party/shop-details/terminals/terminals.component.ts +++ b/src/app/party/shop-details/terminals/terminals.component.ts @@ -10,7 +10,7 @@ import { import { filter } from 'rxjs/operators'; import { MatDialog, MatSnackBar } from '@angular/material'; -import { DomainTypedManager } from '../../../thrift'; +import { DomainTypedManager } from '../../../thrift-services'; import { PredicateType, TerminalInfo } from '../extract-terminal-info'; import { EditTerminalDecisionPriorityComponent } from '../edit-terminal-decision/edit-terminal-decision-priority/edit-terminal-decision-priority.component'; import { EditTerminalDecisionWeightComponent } from '../edit-terminal-decision/edit-terminal-decision-weight/edit-terminal-decision-weight.component'; diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts index 45f56064..b1c6f6f3 100644 --- a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts @@ -4,7 +4,7 @@ import { catchError, map, tap } from 'rxjs/internal/operators'; import groupBy from 'lodash-es/groupBy'; import { ExecutorService } from '../executor.service'; -import { PaymentProcessingService } from '../../../thrift/payment-processing.service'; +import { PaymentProcessingService } from '../../../thrift-services/damsel/payment-processing.service'; import { AdjustmentOperationEvent, EventType } from './adjustment-event'; import { ExecResultGroup } from './exec-result-group'; diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts index 4383ba6a..b302a485 100644 --- a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts @@ -1,4 +1,7 @@ -import { InvoicePaymentAdjustmentParams, UserInfo } from '../../../gen-damsel/payment_processing'; +import { + InvoicePaymentAdjustmentParams, + UserInfo +} from '../../../thrift-services/damsel/gen-model/payment_processing'; export interface PaymentAdjustmentCreationParams { user: UserInfo; diff --git a/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts index 418b9b26..790bfe90 100644 --- a/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts +++ b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts @@ -11,7 +11,7 @@ import { OperationFailedPayload, PaymentAdjustmentCancelParams } from '../adjustment-operations'; -import { InvoicePaymentAdjustmentParams } from '../../../gen-damsel/payment_processing'; +import { InvoicePaymentAdjustmentParams } from '../../../thrift-services/damsel/gen-model/payment_processing'; type FailedPayload = OperationFailedPayload; diff --git a/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts index 1710338c..4fc6fe61 100644 --- a/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts +++ b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts @@ -4,8 +4,11 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; import { KeycloakService } from 'keycloak-angular'; -import { InvoicePaymentAdjustmentParams, UserInfo } from '../../gen-damsel/payment_processing'; -import { StatPayment } from '../../gen-damsel/merch_stat'; +import { + InvoicePaymentAdjustmentParams, + UserInfo +} from '../../thrift-services/damsel/gen-model/payment_processing'; +import { StatPayment } from '../../thrift-services/damsel/gen-model/merch_stat'; import { ExecutorService } from './executor.service'; import { CreateAdjustmentService, diff --git a/src/app/payment-adjustment/payment-adjustment.component.ts b/src/app/payment-adjustment/payment-adjustment.component.ts index 9917c482..5e01a426 100644 --- a/src/app/payment-adjustment/payment-adjustment.component.ts +++ b/src/app/payment-adjustment/payment-adjustment.component.ts @@ -3,7 +3,7 @@ import { MatDialog, MatSnackBar } from '@angular/material'; import { PaymentAdjustmentService } from './payment-adjustment.service'; import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component'; -import { StatPayment } from '../gen-damsel/merch_stat'; +import { StatPayment } from '../thrift-services/damsel/gen-model/merch_stat'; import { SearchFormParams } from './search-form/search-form-params'; @Component({ diff --git a/src/app/payment-adjustment/payment-adjustment.module.ts b/src/app/payment-adjustment/payment-adjustment.module.ts index d9120ac1..d0d87278 100644 --- a/src/app/payment-adjustment/payment-adjustment.module.ts +++ b/src/app/payment-adjustment/payment-adjustment.module.ts @@ -30,7 +30,7 @@ import { TableComponent } from './table/table.component'; import { SearchFormComponent } from './search-form/search-form.component'; import { PaymentAdjustmentService } from './payment-adjustment.service'; import { PapiModule } from '../papi/papi.module'; -import { ThriftModule } from '../thrift/thrift.module'; +import { DamselModule } from '../thrift-services/damsel/damsel.module'; import { ActionItemComponent } from './create-and-capture/action-item/action-item.component'; import { CreateActionsComponent } from './create-and-capture/create-actions/create-actions.component'; import { CancelActionsComponent } from './create-and-capture/cancel-actions/cancel-actions.component'; @@ -63,7 +63,7 @@ import { DomainModule } from '../domain'; MatExpansionModule, MatProgressSpinnerModule, PapiModule, - ThriftModule, + DamselModule, MatSelectModule, DomainModule ], diff --git a/src/app/payment-adjustment/payment-adjustment.service.ts b/src/app/payment-adjustment/payment-adjustment.service.ts index 4fd31dda..5b968d71 100644 --- a/src/app/payment-adjustment/payment-adjustment.service.ts +++ b/src/app/payment-adjustment/payment-adjustment.service.ts @@ -3,8 +3,8 @@ import { Observable, of, Subject } from 'rxjs'; import { mergeMap } from 'rxjs/operators'; import { SearchFormParams } from './search-form/search-form-params'; -import { MerchantStatisticsService } from '../thrift/merchant-statistics.service'; -import { StatPayment, StatResponse } from '../gen-damsel/merch_stat'; +import { MerchantStatisticsService } from '../thrift-services/damsel/merchant-statistics.service'; +import { StatPayment, StatResponse } from '../thrift-services/damsel/gen-model/merch_stat'; import { QueryDSL } from '../query-dsl'; import { DomainService } from '../domain'; diff --git a/src/app/payment-adjustment/table/table.component.ts b/src/app/payment-adjustment/table/table.component.ts index b2535c3d..e25a012e 100644 --- a/src/app/payment-adjustment/table/table.component.ts +++ b/src/app/payment-adjustment/table/table.component.ts @@ -11,7 +11,7 @@ import { import { SelectionModel } from '@angular/cdk/collections'; import { MatPaginator, MatTableDataSource } from '@angular/material'; -import { StatPayment } from '../../gen-damsel/merch_stat'; +import { StatPayment } from '../../thrift-services/damsel/gen-model/merch_stat'; import { i64ToNumber } from '../../shared/i64-to-number'; @Component({ diff --git a/src/app/query-dsl/deposit.ts b/src/app/query-dsl/deposit.ts index 20a57f08..3be97b37 100644 --- a/src/app/query-dsl/deposit.ts +++ b/src/app/query-dsl/deposit.ts @@ -1,4 +1,4 @@ -import { DepositStatus } from '../fistful/gen-model/fistful_stat'; +import { DepositStatus } from '../thrift-services/fistful/gen-model/fistful_stat'; export interface Deposit { amount_to?: number; diff --git a/src/app/query-dsl/payment.ts b/src/app/query-dsl/payment.ts index 7534091f..30d436d6 100644 --- a/src/app/query-dsl/payment.ts +++ b/src/app/query-dsl/payment.ts @@ -3,7 +3,7 @@ import { InvoicePaymentStatus, PaymentTool, TerminalPaymentProvider -} from '../gen-damsel/merch_stat'; +} from '../thrift-services/damsel/gen-model/merch_stat'; export interface Payment { payment_id?: string; diff --git a/src/app/repairing/repair-with-scenario/repair-wirh-scenario.component.ts b/src/app/repairing/repair-with-scenario/repair-wirh-scenario.component.ts index 1805fed7..9c7604ba 100644 --- a/src/app/repairing/repair-with-scenario/repair-wirh-scenario.component.ts +++ b/src/app/repairing/repair-with-scenario/repair-wirh-scenario.component.ts @@ -9,7 +9,7 @@ import { RepairWithScenarioSettingsComponent, DialogData } from './repair-with-scenario-settings/repair-with-scenario-settings.component'; -import { InvoiceRepairScenario } from '../../gen-damsel/payment_processing'; +import { InvoiceRepairScenario } from '../../thrift-services/damsel/gen-model/payment_processing'; import { RepairingStatusType } from '../repairing-status/repairing-status.component'; enum Status { diff --git a/src/app/repairing/repair/repair.component.ts b/src/app/repairing/repair/repair.component.ts index eaa4503e..f1ac38ec 100644 --- a/src/app/repairing/repair/repair.component.ts +++ b/src/app/repairing/repair/repair.component.ts @@ -6,7 +6,7 @@ import { SelectionModel } from '@angular/cdk/collections'; import { ExecStateType } from '../../shared/execute'; import { RepairingService } from '../repairing.service'; import { RepairSettingsComponent, DialogData } from './repair-settings/repair-settings.component'; -import { RepairScenario } from '../../fistful/gen-model/withdrawal_session'; +import { RepairScenario } from '../../thrift-services/fistful/gen-model/withdrawal_session'; import { RepairingStatusType } from '../repairing-status/repairing-status.component'; enum Status { diff --git a/src/app/repairing/repairing.module.ts b/src/app/repairing/repairing.module.ts index 9197ff1b..135a6707 100644 --- a/src/app/repairing/repairing.module.ts +++ b/src/app/repairing/repairing.module.ts @@ -25,10 +25,10 @@ import { RepairingComponent } from './repairing.component'; import { RepairingService } from './repairing.service'; import { RepairingRoutingModule } from './repairing-routing.module'; import { SharedModule } from '../shared/shared.module'; -import { MachinegunModule } from '../machinegun/machinegun.module'; +import { MachinegunModule } from '../thrift-services/machinegun/machinegun.module'; import { RepairWithScenarioComponent } from './repair-with-scenario/repair-wirh-scenario.component'; import { RepairWithScenarioSettingsComponent } from './repair-with-scenario/repair-with-scenario-settings/repair-with-scenario-settings.component'; -import { FistfulModule } from '../fistful/fistful.module'; +import { FistfulModule } from '../thrift-services/fistful/fistful.module'; import { RepairComponent } from './repair/repair.component'; import { RepairSettingsComponent } from './repair/repair-settings/repair-settings.component'; import { AddIdsInputComponent } from './add-ids-input/add-ids-input.component'; diff --git a/src/app/repairing/repairing.service.ts b/src/app/repairing/repairing.service.ts index 7b067080..1ef797b6 100644 --- a/src/app/repairing/repairing.service.ts +++ b/src/app/repairing/repairing.service.ts @@ -4,12 +4,15 @@ import { KeycloakService } from 'keycloak-angular'; import { Observable, BehaviorSubject } from 'rxjs'; import { map, tap } from 'rxjs/operators'; -import { UserInfo, InvoiceRepairScenario } from '../gen-damsel/payment_processing'; +import { + UserInfo, + InvoiceRepairScenario +} from '../thrift-services/damsel/gen-model/payment_processing'; import { execute } from '../shared/execute'; -import { AutomatonService } from '../machinegun/automaton.service'; -import { PaymentProcessingService } from '../thrift/payment-processing.service'; -import { RepairerService } from '../fistful/repairer.service'; -import { RepairScenario } from '../fistful/gen-model/withdrawal_session'; +import { AutomatonService } from '../thrift-services/machinegun/automaton.service'; +import { PaymentProcessingService } from '../thrift-services/damsel/payment-processing.service'; +import { RepairerService } from '../thrift-services/fistful/repairer.service'; +import { RepairScenario } from '../thrift-services/fistful/gen-model/withdrawal_session'; @Injectable() export class RepairingService { diff --git a/src/app/repairing/simple-repair/simple-repair.component.ts b/src/app/repairing/simple-repair/simple-repair.component.ts index aa77b9d8..cc21c592 100644 --- a/src/app/repairing/simple-repair/simple-repair.component.ts +++ b/src/app/repairing/simple-repair/simple-repair.component.ts @@ -4,8 +4,8 @@ import { Observable } from 'rxjs'; import { SelectionModel } from '@angular/cdk/collections'; import { ExecStateType } from '../../shared/execute'; -import { Machine } from '../../machinegun/gen-model/state_processing'; -import { Namespace } from '../../machinegun/model/namespace'; +import { Machine } from '../../thrift-services/machinegun/gen-model/state_processing'; +import { Namespace } from '../../thrift-services/machinegun/model/namespace'; import { RepairingService } from '../repairing.service'; import { RepairingStatusType } from '../repairing-status/repairing-status.component'; diff --git a/src/app/shared/components/timeline/index.ts b/src/app/shared/components/timeline/index.ts new file mode 100644 index 00000000..7766465d --- /dev/null +++ b/src/app/shared/components/timeline/index.ts @@ -0,0 +1 @@ +export * from './timeline.module'; diff --git a/src/app/shared/components/timeline/timeline-item/index.ts b/src/app/shared/components/timeline/timeline-item/index.ts new file mode 100644 index 00000000..f729af70 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/index.ts @@ -0,0 +1 @@ +export * from './timeline-item.component'; diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-badge/index.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/index.ts new file mode 100644 index 00000000..c6cded53 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/index.ts @@ -0,0 +1 @@ +export * from './timeline-item-badge.component'; diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.html b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.html new file mode 100644 index 00000000..29e716b4 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.html @@ -0,0 +1,7 @@ +
+ +
diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.scss b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.scss new file mode 100644 index 00000000..207a09d9 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.scss @@ -0,0 +1,31 @@ +@import '../timeline-item.scss'; +@import '../../../../styles/light'; + +$size: 36px; +$line-size: 2px; + +$neutral: map-get($theme, neutral); +$line-color: mat-color($neutral, 200); +.cc-timeline-item-badge { + position: absolute; + left: 0; + top: 0; + display: flex; + height: $size; + width: $size; + justify-content: center; + align-items: center; + border-radius: 50%; + z-index: 10; + + ::ng-deep > *, + ::ng-deep > * mat-icon { + height: $icons-size; + width: $icons-size; + font-size: $icons-size; + } +} + +.cc-timeline-item-badge { + background-color: $line-color; +} \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.ts new file mode 100644 index 00000000..047c62b0 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-badge/timeline-item-badge.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'cc-timeline-item-badge', + templateUrl: 'timeline-item-badge.component.html', + styleUrls: ['timeline-item-badge.component.scss'] +}) +export class TimelineItemBadgeComponent {} diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-content/index.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-content/index.ts new file mode 100644 index 00000000..43222f07 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-content/index.ts @@ -0,0 +1 @@ +export * from './timeline-item-content.component'; diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.scss b/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.scss new file mode 100644 index 00000000..c3208083 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.scss @@ -0,0 +1,5 @@ +@import '../timeline-item.scss'; + +.cc-timeline-item-content { + padding-top: $content-padding; +} \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.ts new file mode 100644 index 00000000..75b6cdc1 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-content/timeline-item-content.component.ts @@ -0,0 +1,11 @@ +import { Component, ViewEncapsulation, HostBinding } from '@angular/core'; + +@Component({ + selector: 'cc-timeline-item-content, [cc-timeline-item-content]', + template: '', + styleUrls: ['timeline-item-content.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class TimelineItemContentComponent { + @HostBinding('class.cc-timeline-item-content') rootClass = true; +} diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-title/index.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-title/index.ts new file mode 100644 index 00000000..16584b67 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-title/index.ts @@ -0,0 +1 @@ +export * from './timeline-item-title.component'; diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.html b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.html new file mode 100644 index 00000000..d521d399 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.scss b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.scss new file mode 100644 index 00000000..57678938 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.scss @@ -0,0 +1,7 @@ +@import '../timeline-item.scss'; + +.cc-timeline-item-title { + min-height: $size; + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.ts b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.ts new file mode 100644 index 00000000..37b5a2cf --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item-title/timeline-item-title.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'cc-timeline-item-title', + templateUrl: 'timeline-item-title.component.html', + styleUrls: ['timeline-item-title.component.scss'] +}) +export class TimelineItemTitleComponent {} diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item.component.html b/src/app/shared/components/timeline/timeline-item/timeline-item.component.html new file mode 100644 index 00000000..ad181173 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item.component.html @@ -0,0 +1 @@ +
diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item.component.scss b/src/app/shared/components/timeline/timeline-item/timeline-item.component.scss new file mode 100644 index 00000000..edf35dab --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item.component.scss @@ -0,0 +1,7 @@ +@import './timeline-item.scss'; + +.cc-timeline-item { + padding-bottom: 20px; + padding-left: $size + $content-padding; + position: relative; +} \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item.component.ts b/src/app/shared/components/timeline/timeline-item/timeline-item.component.ts new file mode 100644 index 00000000..7cabdbd5 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'cc-timeline-item', + templateUrl: 'timeline-item.component.html', + styleUrls: ['timeline-item.component.scss'] +}) +export class TimelineItemComponent {} diff --git a/src/app/shared/components/timeline/timeline-item/timeline-item.scss b/src/app/shared/components/timeline/timeline-item/timeline-item.scss new file mode 100644 index 00000000..79d56a09 --- /dev/null +++ b/src/app/shared/components/timeline/timeline-item/timeline-item.scss @@ -0,0 +1,4 @@ +$size: 36px; +$icons-size: 18px; +$line-size: 2px; +$content-padding: 10px; \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline.component.html b/src/app/shared/components/timeline/timeline.component.html new file mode 100644 index 00000000..48decabe --- /dev/null +++ b/src/app/shared/components/timeline/timeline.component.html @@ -0,0 +1 @@ +
diff --git a/src/app/shared/components/timeline/timeline.component.scss b/src/app/shared/components/timeline/timeline.component.scss new file mode 100644 index 00000000..1a8de017 --- /dev/null +++ b/src/app/shared/components/timeline/timeline.component.scss @@ -0,0 +1,24 @@ +@import '../../styles/light'; + +$size: 36px; +$line-size: 2px; + +$neutral: map-get($theme, neutral); +$line-color: mat-color($neutral, 200); + +.cc-timeline { + position: relative; + border-bottom: $line-size solid; + border-bottom-color: $line-color; + font-family: Roboto, "Helvetica Neue", sans-serif; + + &::after { + content: ''; + position: absolute; + top: 0; + bottom: 0; + width: $line-size; + left: $size / 2 - $line-size / 2; + background-color: $line-color; + } +} \ No newline at end of file diff --git a/src/app/shared/components/timeline/timeline.component.ts b/src/app/shared/components/timeline/timeline.component.ts new file mode 100644 index 00000000..e05b03d9 --- /dev/null +++ b/src/app/shared/components/timeline/timeline.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'cc-timeline', + templateUrl: 'timeline.component.html', + styleUrls: ['timeline.component.scss'] +}) +export class TimelineComponent {} diff --git a/src/app/shared/components/timeline/timeline.module.ts b/src/app/shared/components/timeline/timeline.module.ts new file mode 100644 index 00000000..2fe08000 --- /dev/null +++ b/src/app/shared/components/timeline/timeline.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { CommonModule } from '@angular/common'; + +import { TimelineComponent } from './timeline.component'; +import { TimelineItemComponent } from './timeline-item'; +import { TimelineItemTitleComponent } from './timeline-item/timeline-item-title'; +import { TimelineItemBadgeComponent } from './timeline-item/timeline-item-badge'; +import { TimelineItemContentComponent } from './timeline-item/timeline-item-content'; + +const EXPORTED_DECLARATIONS = [ + TimelineComponent, + TimelineItemComponent, + TimelineItemTitleComponent, + TimelineItemBadgeComponent, + TimelineItemContentComponent +]; + +@NgModule({ + imports: [FlexLayoutModule, CommonModule], + declarations: EXPORTED_DECLARATIONS, + exports: EXPORTED_DECLARATIONS +}) +export class TimelineModule {} diff --git a/src/app/shared/extract-claim-status.ts b/src/app/shared/extract-claim-status.ts new file mode 100644 index 00000000..814c53d5 --- /dev/null +++ b/src/app/shared/extract-claim-status.ts @@ -0,0 +1,15 @@ +import { ClaimStatus as UnionClaimStatus } from '../thrift-services/damsel/gen-model/claim_management'; +import { ClaimStatus } from '../papi/model/claim-statuses'; +import { getUnionKey } from './get-union-key'; + +export const claimStatusByUnionClaimStatus: { [name in keyof UnionClaimStatus]-?: ClaimStatus } = { + accepted: ClaimStatus.accepted, + denied: ClaimStatus.denied, + revoked: ClaimStatus.revoked, + pending: ClaimStatus.pending, + review: ClaimStatus.review, + pending_acceptance: ClaimStatus.pending_acceptance +}; + +export const extractClaimStatus = (status: UnionClaimStatus): ClaimStatus => + claimStatusByUnionClaimStatus[getUnionKey(status) as keyof UnionClaimStatus]; diff --git a/src/app/shared/get-union-key.ts b/src/app/shared/get-union-key.ts new file mode 100644 index 00000000..6752304a --- /dev/null +++ b/src/app/shared/get-union-key.ts @@ -0,0 +1 @@ +export const getUnionKey = (union: any) => Object.entries(union).find(([, v]) => !!v)[0]; diff --git a/src/app/shared/humanize-duration/humanize-duration.module.ts b/src/app/shared/humanize-duration/humanize-duration.module.ts new file mode 100644 index 00000000..63b4a17a --- /dev/null +++ b/src/app/shared/humanize-duration/humanize-duration.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; + +import { HumanizedDurationPipe } from './humanized-duration.pipe'; +import { HumanizeDurationService } from './humanize-duration.service'; + +@NgModule({ + declarations: [HumanizedDurationPipe], + providers: [HumanizeDurationService], + exports: [HumanizedDurationPipe] +}) +export class HumanizeDurationModule {} diff --git a/src/app/shared/humanize-duration/humanize-duration.service.ts b/src/app/shared/humanize-duration/humanize-duration.service.ts new file mode 100644 index 00000000..524c4337 --- /dev/null +++ b/src/app/shared/humanize-duration/humanize-duration.service.ts @@ -0,0 +1,70 @@ +import { Injectable } from '@angular/core'; +import * as humanizeDuration from 'humanize-duration'; +import * as moment from 'moment'; + +export type Value = number | string | moment.Moment | Date; + +export interface HumanizeConfig extends humanizeDuration.HumanizerOptions { + isShort?: boolean; + hasAgoEnding?: boolean; +} + +@Injectable() +export class HumanizeDurationService { + static HOUR_MS = 3600000; + static MIN_HUMANIZE_DURATION_UPDATE_MS = 1000; + static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_MINUTE_UPDATES_MS = 20000; + static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_HOURLY_AND_LONGER_UPDATES_MS = 600000; + static LESS_THAN_FEW_SECONDS = 3000; + + private get duration() { + return humanizeDuration.humanizer({ + language: 'en', + round: true, + delimiter: ' ' + }); + } + + get shortEnglishHumanizer(): humanizeDuration.HumanizerOptions { + return { + language: 'short' + }; + } + + getDiffMs(value: Value): number { + return Math.abs(this.isDiff(value) ? value : moment().diff(moment(value))); + } + + getDuration(value: Value, config: HumanizeConfig = {}): string { + const diffMs = this.getDiffMs(value); + let duration = this.duration(diffMs, config); + if (isNaN(diffMs)) { + return null; + } else if (diffMs < HumanizeDurationService.LESS_THAN_FEW_SECONDS) { + return 'just now'; + } else if (config.isShort) { + duration = this.duration(diffMs, { ...config, ...this.shortEnglishHumanizer }); + } else if (config.largest === 1) { + duration = moment.duration(diffMs).humanize(); + } + return config.hasAgoEnding ? `${duration} ago` : duration; + } + + getOptimalUpdateInterval(value: Value, { largest }: HumanizeConfig): number { + const diffMs = this.getDiffMs(value); + if (diffMs < HumanizeDurationService.LESS_THAN_FEW_SECONDS) { + return HumanizeDurationService.MIN_HUMANIZE_DURATION_UPDATE_MS; + } + if (largest === 1) { + if (diffMs < HumanizeDurationService.HOUR_MS) { + return HumanizeDurationService.MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_MINUTE_UPDATES_MS; + } + return HumanizeDurationService.MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_HOURLY_AND_LONGER_UPDATES_MS; + } + return HumanizeDurationService.MIN_HUMANIZE_DURATION_UPDATE_MS; + } + + isDiff(value: Value): value is number { + return typeof value === 'number'; + } +} diff --git a/src/app/shared/humanize-duration/humanized-duration.pipe.ts b/src/app/shared/humanize-duration/humanized-duration.pipe.ts new file mode 100644 index 00000000..4f0afe03 --- /dev/null +++ b/src/app/shared/humanize-duration/humanized-duration.pipe.ts @@ -0,0 +1,54 @@ +import { Pipe, PipeTransform, ChangeDetectorRef, OnDestroy } from '@angular/core'; +import { Subscription, interval } from 'rxjs'; +import { HumanizerOptions } from 'humanize-duration'; + +import { HumanizeConfig, HumanizeDurationService, Value } from './humanize-duration.service'; + +export interface HumanizeDurationConfig extends HumanizeConfig { + interval?: number; +} + +@Pipe({ name: 'humanizedDuration', pure: false }) +export class HumanizedDurationPipe implements OnDestroy, PipeTransform { + private latestValue: string; + private subscription: Subscription; + private inputValue: Value; + + constructor( + private humanizeDurationService: HumanizeDurationService, + private ref: ChangeDetectorRef + ) {} + + transform(value: Value, { interval: inpIntervalMs, ...config }: HumanizeDurationConfig = {}) { + if (value !== this.inputValue) { + this.inputValue = value; + this.latestValue = this.humanizeDurationService.getDuration(value, config); + this.dispose(); + if (!this.humanizeDurationService.isDiff(value)) { + this.subscription = interval( + inpIntervalMs || + this.humanizeDurationService.getOptimalUpdateInterval(value, config) + ).subscribe(() => this.updateValue(value, config)); + } + } + return this.latestValue; + } + + ngOnDestroy(): void { + this.dispose(); + } + + private dispose(): void { + if (this.subscription) { + this.subscription.unsubscribe(); + } + } + + private updateValue(value: Value, config: HumanizerOptions): void { + const duration = this.humanizeDurationService.getDuration(value, config); + if (duration !== this.latestValue) { + this.ref.markForCheck(); + this.latestValue = duration; + } + } +} diff --git a/src/app/shared/humanize-duration/index.ts b/src/app/shared/humanize-duration/index.ts new file mode 100644 index 00000000..2d44d136 --- /dev/null +++ b/src/app/shared/humanize-duration/index.ts @@ -0,0 +1,2 @@ +export * from './humanize-duration.module'; +export * from './humanize-duration.service'; diff --git a/src/app/shared/operators/boolean-debounce-time.ts b/src/app/shared/operators/boolean-debounce-time.ts new file mode 100644 index 00000000..c48ac4b0 --- /dev/null +++ b/src/app/shared/operators/boolean-debounce-time.ts @@ -0,0 +1,11 @@ +import { distinctUntilChanged, debounce } from 'rxjs/operators'; +import { timer, empty, Observable } from 'rxjs'; + +export const booleanDebounceTime = (timeoutMs: number = 500) => ( + s: Observable +): Observable => + s.pipe( + distinctUntilChanged(), + debounce(v => (v ? timer(timeoutMs) : empty())), + distinctUntilChanged() + ); diff --git a/src/app/shared/operators/index.ts b/src/app/shared/operators/index.ts new file mode 100644 index 00000000..48854a7a --- /dev/null +++ b/src/app/shared/operators/index.ts @@ -0,0 +1 @@ +export * from './boolean-debounce-time'; diff --git a/src/app/shared/pipes/claim-status.pipe.ts b/src/app/shared/pipes/claim-status.pipe.ts new file mode 100644 index 00000000..6d7be06b --- /dev/null +++ b/src/app/shared/pipes/claim-status.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import { extractClaimStatus } from '../extract-claim-status'; + +@Pipe({ + name: 'ccClaimStatus' +}) +export class ClaimStatusPipe implements PipeTransform { + transform(value: any): string { + return extractClaimStatus(value); + } +} diff --git a/src/app/shared/pipes/index.ts b/src/app/shared/pipes/index.ts new file mode 100644 index 00000000..3b66b467 --- /dev/null +++ b/src/app/shared/pipes/index.ts @@ -0,0 +1,4 @@ +export * from './claim-status.pipe'; +export * from './currency.pipe'; +export * from './format-amount.pipe'; +export * from './thrift-view.pipe'; diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 1dfb16ce..472071ad 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -2,10 +2,8 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { PrettyJsonModule } from 'angular2-prettyjson'; -import { CurrencyPipe } from './pipes/currency.pipe'; -import { FormatAmountPipe } from './pipes/format-amount.pipe'; +import { CurrencyPipe, FormatAmountPipe, ThriftViewPipe, ClaimStatusPipe } from './pipes'; import { ThriftInt64Pipe } from './thrift-int64.pipe'; -import { ThriftViewPipe } from './pipes/thrift-view.pipe'; import { PrettyJsonComponent } from './components/pretty-json/pretty-json.component'; import { CardContainerComponent } from './components/card-container/card-container.component'; @@ -14,6 +12,7 @@ const declarations = [ FormatAmountPipe, ThriftInt64Pipe, ThriftViewPipe, + ClaimStatusPipe, PrettyJsonComponent, CardContainerComponent ]; diff --git a/src/app/shared/styles/_fill.scss b/src/app/shared/styles/_fill.scss new file mode 100644 index 00000000..95dead92 --- /dev/null +++ b/src/app/shared/styles/_fill.scss @@ -0,0 +1,7 @@ +@mixin fill($color) { + color: $color; + + * { + fill: $color; + } +} \ No newline at end of file diff --git a/src/app/shared/styles/light.scss b/src/app/shared/styles/light.scss new file mode 100644 index 00000000..24d80aca --- /dev/null +++ b/src/app/shared/styles/light.scss @@ -0,0 +1,6 @@ +@import '~@angular/material/theming'; + +$theme: ( + name: 'light', + neutral: mat-palette($mat-grey), +); \ No newline at end of file diff --git a/src/app/shared/thrift-utils.ts b/src/app/shared/thrift-utils.ts index 63531902..a62fad4f 100644 --- a/src/app/shared/thrift-utils.ts +++ b/src/app/shared/thrift-utils.ts @@ -1,4 +1,4 @@ -import { DomainObject } from '../gen-damsel/domain'; +import { DomainObject } from '../thrift-services/damsel/gen-model/domain'; export function clearNullFields(union: object): object { if (!union) { diff --git a/src/app/shared/utils/index.ts b/src/app/shared/utils/index.ts new file mode 100644 index 00000000..fb868e1c --- /dev/null +++ b/src/app/shared/utils/index.ts @@ -0,0 +1 @@ +export * from './sort-units'; diff --git a/src/app/shared/utils/sort-units.ts b/src/app/shared/utils/sort-units.ts new file mode 100644 index 00000000..f510faad --- /dev/null +++ b/src/app/shared/utils/sort-units.ts @@ -0,0 +1,5 @@ +import * as moment from 'moment'; +import { ModificationUnit } from '../../thrift-services/damsel/gen-model/claim_management'; + +export const sortUnitsByCreatedAtAsc = (units: T[]): T[] => + units.slice().sort(({ created_at: a }, { created_at: b }) => moment(a).diff(moment(b))); diff --git a/src/app/thrift-services/ank/ank.module.ts b/src/app/thrift-services/ank/ank.module.ts new file mode 100644 index 00000000..b90de270 --- /dev/null +++ b/src/app/thrift-services/ank/ank.module.ts @@ -0,0 +1,5 @@ +import { NgModule } from '@angular/core'; +import { AnkService } from './ank.service'; + +@NgModule({ providers: [AnkService] }) +export class AnkModule {} diff --git a/src/app/thrift-services/ank/ank.service.ts b/src/app/thrift-services/ank/ank.service.ts new file mode 100644 index 00000000..9db8a219 --- /dev/null +++ b/src/app/thrift-services/ank/ank.service.ts @@ -0,0 +1,26 @@ +import { Injectable, NgZone } from '@angular/core'; + +import { ThriftService } from '../thrift-service'; +import * as QuestionaryManager from './gen-nodejs/QuestionaryManager'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; +import { + Version, + QuestionaryParams, + QuestionaryID, + Snapshot +} from './gen-model/questionary_manager'; +import { Observable } from 'rxjs'; +import { toGenReference } from '../converters'; + +@Injectable() +export class AnkService extends ThriftService { + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/questionary', QuestionaryManager); + } + + save = (params: QuestionaryParams, version: Version): Observable => + this.toObservableAction('Save')(params, version); + + get = (questionaryId: QuestionaryID, reference = toGenReference()): Observable => + this.toObservableAction('Get')(questionaryId, reference); +} diff --git a/src/app/thrift-services/ank/index.ts b/src/app/thrift-services/ank/index.ts new file mode 100644 index 00000000..650eaebd --- /dev/null +++ b/src/app/thrift-services/ank/index.ts @@ -0,0 +1 @@ +export * from './ank.module'; diff --git a/src/app/thrift/converters/index.ts b/src/app/thrift-services/converters/index.ts similarity index 100% rename from src/app/thrift/converters/index.ts rename to src/app/thrift-services/converters/index.ts diff --git a/src/app/thrift/converters/to-gen-commit.ts b/src/app/thrift-services/converters/to-gen-commit.ts similarity index 92% rename from src/app/thrift/converters/to-gen-commit.ts rename to src/app/thrift-services/converters/to-gen-commit.ts index 50d532be..2561f71e 100644 --- a/src/app/thrift/converters/to-gen-commit.ts +++ b/src/app/thrift-services/converters/to-gen-commit.ts @@ -1,5 +1,5 @@ -import * as DomainConfigTypes from '../gen-nodejs/domain_config_types'; -import { Commit, InsertOp, Operation, RemoveOp, UpdateOp } from '../../gen-damsel/domain_config'; +import * as DomainConfigTypes from '../damsel/gen-nodejs/domain_config_types'; +import { Commit, InsertOp, Operation, RemoveOp, UpdateOp } from '../damsel/gen-model/domain_config'; const toGenInsertOp = (insertOp: InsertOp) => { const insertOpGen = new DomainConfigTypes.InsertOp(); diff --git a/src/app/thrift/converters/to-gen-domain-object.ts b/src/app/thrift-services/converters/to-gen-domain-object.ts similarity index 75% rename from src/app/thrift/converters/to-gen-domain-object.ts rename to src/app/thrift-services/converters/to-gen-domain-object.ts index 1150f5ef..563a0464 100644 --- a/src/app/thrift/converters/to-gen-domain-object.ts +++ b/src/app/thrift-services/converters/to-gen-domain-object.ts @@ -1,4 +1,4 @@ -import * as DomainTypes from '../gen-nodejs/domain_types'; +import * as DomainTypes from '../damsel/gen-nodejs/domain_types'; export const toGenDomainObject = (genObject: any, field: string) => { const domainObjectGen = new DomainTypes.DomainObject(); diff --git a/src/app/thrift/converters/to-gen-reference.ts b/src/app/thrift-services/converters/to-gen-reference.ts similarity index 79% rename from src/app/thrift/converters/to-gen-reference.ts rename to src/app/thrift-services/converters/to-gen-reference.ts index 25341358..c49cfedf 100644 --- a/src/app/thrift/converters/to-gen-reference.ts +++ b/src/app/thrift-services/converters/to-gen-reference.ts @@ -1,5 +1,5 @@ -import * as DomainConfigTypes from '../gen-nodejs/domain_config_types'; -import { Reference, Version } from '../../gen-damsel/domain_config'; +import * as DomainConfigTypes from '../damsel/gen-nodejs/domain_config_types'; +import { Reference, Version } from '../damsel/gen-model/domain_config'; const toGenHead = () => { const reference = new DomainConfigTypes.Reference(); diff --git a/src/app/thrift/converters/to-gen-terminal-decision.ts b/src/app/thrift-services/converters/to-gen-terminal-decision.ts similarity index 93% rename from src/app/thrift/converters/to-gen-terminal-decision.ts rename to src/app/thrift-services/converters/to-gen-terminal-decision.ts index f2188e3e..5bb1ee26 100644 --- a/src/app/thrift/converters/to-gen-terminal-decision.ts +++ b/src/app/thrift-services/converters/to-gen-terminal-decision.ts @@ -1,13 +1,13 @@ -import * as DomainTypes from '../gen-nodejs/domain_types'; +import * as DomainTypes from '../damsel/gen-nodejs/domain_types'; import { - TerminalDecision, - Predicate, Condition, PartyCondition, PartyConditionDefinition, - TerminalSelector, - TerminalRef -} from '../../gen-damsel/domain'; + Predicate, + TerminalDecision, + TerminalRef, + TerminalSelector +} from '../damsel/gen-model/domain'; const toPartyConditionDefinitionGen = (definition: PartyConditionDefinition) => { const definitionGen = new DomainTypes.PartyConditionDefinition(); diff --git a/src/app/thrift/converters/to-gen-terminal-object.ts b/src/app/thrift-services/converters/to-gen-terminal-object.ts similarity index 82% rename from src/app/thrift/converters/to-gen-terminal-object.ts rename to src/app/thrift-services/converters/to-gen-terminal-object.ts index e121ec7f..394ae81b 100644 --- a/src/app/thrift/converters/to-gen-terminal-object.ts +++ b/src/app/thrift-services/converters/to-gen-terminal-object.ts @@ -1,5 +1,5 @@ -import * as DomainTypes from '../gen-nodejs/domain_types'; -import { Terminal, TerminalObject, TerminalRef } from '../../gen-damsel/domain'; +import * as DomainTypes from '../damsel/gen-nodejs/domain_types'; +import { Terminal, TerminalObject, TerminalRef } from '../damsel/gen-model/domain'; const toGenTerminalRef = (ref: TerminalRef) => { const terminalRef = new DomainTypes.TerminalRef(); diff --git a/src/app/thrift-services/damsel/claim-management.service.ts b/src/app/thrift-services/damsel/claim-management.service.ts new file mode 100644 index 00000000..4b47b45c --- /dev/null +++ b/src/app/thrift-services/damsel/claim-management.service.ts @@ -0,0 +1,80 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { ThriftService } from '../thrift-service'; +import * as ClaimManagement from './gen-nodejs/ClaimManagement'; +import { Modification as ModificationType } from './gen-nodejs/claim_management_types'; +import { Modification } from './gen-model/claim_management'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; +import { ClaimSearchQuery as ClaimSearchQueryType } from './gen-nodejs/claim_management_types'; +import { + Claim, + ClaimID, + ClaimSearchQuery, + ClaimSearchResponse +} from './gen-model/claim_management'; +import { switchMap } from 'rxjs/operators'; + +@Injectable() +export class ClaimManagementService extends ThriftService { + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/cm', ClaimManagement); + } + + searchClaims = (query: ClaimSearchQuery): Observable => + this.toObservableAction('SearchClaims')(new ClaimSearchQueryType(query)); + + getClaim = (partyID: string, claimID: ClaimID): Observable => + this.toObservableAction('GetClaim')(partyID, claimID); + + acceptClaim = (partyID: string, claimID: ClaimID): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('AcceptClaim')(partyID, claimID, claim.revision) + ) + ); + + requestClaimReview = (partyID: string, claimID: ClaimID): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('RequestClaimReview')(partyID, claimID, claim.revision) + ) + ); + + requestClaimChanges = (partyID: string, claimID: ClaimID): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('RequestClaimChanges')(partyID, claimID, claim.revision) + ) + ); + + denyClaim = (partyID: string, claimID: ClaimID, reason: string): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('DenyClaim')(partyID, claimID, claim.revision, reason) + ) + ); + + revokeClaim = (partyID: string, claimID: ClaimID, reason: string): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('RevokeClaim')(partyID, claimID, claim.revision, reason) + ) + ); + + updateClaim = ( + partyID: string, + claimID: ClaimID, + changeset: Modification[] + ): Observable => + this.getClaim(partyID, claimID).pipe( + switchMap(claim => + this.toObservableAction('UpdateClaim')( + claim.party_id, + claim.id, + claim.revision, + changeset.map(m => new ModificationType(m)) + ) + ) + ); +} diff --git a/src/app/thrift/thrift.module.ts b/src/app/thrift-services/damsel/damsel.module.ts similarity index 76% rename from src/app/thrift/thrift.module.ts rename to src/app/thrift-services/damsel/damsel.module.ts index 2bdf7d4c..0ce0d7c0 100644 --- a/src/app/thrift/thrift.module.ts +++ b/src/app/thrift-services/damsel/damsel.module.ts @@ -5,6 +5,7 @@ import { PaymentProcessingService } from './payment-processing.service'; import { MerchantStatisticsService } from './merchant-statistics.service'; import { DomainTypedManager } from './domain-typed-manager'; import { DomainCacheService } from './domain-cache.service'; +import { ClaimManagementService } from './claim-management.service'; @NgModule({ providers: [ @@ -12,7 +13,8 @@ import { DomainCacheService } from './domain-cache.service'; DomainTypedManager, PaymentProcessingService, MerchantStatisticsService, - DomainCacheService + DomainCacheService, + ClaimManagementService ] }) -export class ThriftModule {} +export class DamselModule {} diff --git a/src/app/thrift/domain-cache.service.ts b/src/app/thrift-services/damsel/domain-cache.service.ts similarity index 87% rename from src/app/thrift/domain-cache.service.ts rename to src/app/thrift-services/damsel/domain-cache.service.ts index 74d7884b..e45523ae 100644 --- a/src/app/thrift/domain-cache.service.ts +++ b/src/app/thrift-services/damsel/domain-cache.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { shareReplay, map } from 'rxjs/operators'; -import { Domain } from '../gen-damsel/domain'; import { DomainService } from './domain.service'; -import { toGenReference } from './converters'; +import { toGenReference } from '../converters'; +import { Domain } from './gen-model/domain'; @Injectable() export class DomainCacheService { diff --git a/src/app/thrift/domain-typed-manager.ts b/src/app/thrift-services/damsel/domain-typed-manager.ts similarity index 96% rename from src/app/thrift/domain-typed-manager.ts rename to src/app/thrift-services/damsel/domain-typed-manager.ts index 3eb487fc..62115d31 100644 --- a/src/app/thrift/domain-typed-manager.ts +++ b/src/app/thrift-services/damsel/domain-typed-manager.ts @@ -2,24 +2,24 @@ import { Injectable } from '@angular/core'; import { Observable, combineLatest } from 'rxjs'; import { map, switchMap, tap } from 'rxjs/operators'; -import { - Domain, - BusinessScheduleObject, - ProviderObject, - TerminalObject, - PaymentInstitutionObject -} from '../gen-damsel/domain'; import { findDomainObject, findDomainObjects } from './operations/utils'; import { getCreateTerminalCommit, CreateTerminalParams } from './operations'; -import { toGenReference } from './converters'; +import { toGenReference } from '../converters'; import { DomainService } from './domain.service'; import { addDecisionToProviderCommit, AddDecisionToProvider } from './operations'; import { DomainCacheService } from './domain-cache.service'; import { RemoveTerminalFromShopParams } from './operations/remove-terminal-from-shop-params'; import { createRemoveTerminalFromShopCommit } from './operations/create-remove-terminal-from-shop-commit'; -import { Version } from '../gen-damsel/domain_config'; import { editTerminalDecisionPropertyForShopCommit } from './operations/edit-terminal-decision-property-for-shop-commit'; import { EditTerminalDecisionPropertyParams } from './operations/edit-terminal-decision-property-params'; +import { + BusinessScheduleObject, + Domain, + PaymentInstitutionObject, + ProviderObject, + TerminalObject +} from './gen-model/domain'; +import { Version } from './gen-model/domain_config'; const findBusinessScheduleObjects = (domain: Domain): BusinessScheduleObject[] => findDomainObjects(domain, 'business_schedule'); diff --git a/src/app/thrift/domain.service.ts b/src/app/thrift-services/damsel/domain.service.ts similarity index 59% rename from src/app/thrift/domain.service.ts rename to src/app/thrift-services/damsel/domain.service.ts index 46400076..c0c62c5e 100644 --- a/src/app/thrift/domain.service.ts +++ b/src/app/thrift-services/damsel/domain.service.ts @@ -1,15 +1,15 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable } from 'rxjs'; -import { KeycloakService } from 'keycloak-angular'; import * as Repository from './gen-nodejs/Repository'; -import { ThriftService } from './thrift-service'; -import { Reference, Snapshot, Commit, Version, Limit } from '../gen-damsel/domain_config'; +import { ThriftService } from '../thrift-service'; +import { Commit, Limit, Reference, Snapshot, Version } from './gen-model/domain_config'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class DomainService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/v1/domain/repository', Repository); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/domain/repository', Repository); } checkout: (reference: Reference) => Observable = this.toObservableAction('Checkout'); diff --git a/src/app/thrift/get-thrift-instance.ts b/src/app/thrift-services/damsel/get-thrift-instance.ts similarity index 100% rename from src/app/thrift/get-thrift-instance.ts rename to src/app/thrift-services/damsel/get-thrift-instance.ts diff --git a/src/app/thrift/merchant-statistics.service.ts b/src/app/thrift-services/damsel/merchant-statistics.service.ts similarity index 56% rename from src/app/thrift/merchant-statistics.service.ts rename to src/app/thrift-services/damsel/merchant-statistics.service.ts index e55e234c..caf25fed 100644 --- a/src/app/thrift/merchant-statistics.service.ts +++ b/src/app/thrift-services/damsel/merchant-statistics.service.ts @@ -1,16 +1,16 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable } from 'rxjs'; -import { KeycloakService } from 'keycloak-angular'; import * as MerchantStatistics from './gen-nodejs/MerchantStatistics'; -import { ThriftService } from './thrift-service'; -import { StatRequest, StatResponse } from '../gen-damsel/merch_stat'; +import { ThriftService } from '../thrift-service'; import { StatRequest as ThriftStatRequest } from './gen-nodejs/merch_stat_types'; +import { StatRequest, StatResponse } from './gen-model/merch_stat'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class MerchantStatisticsService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/stat', MerchantStatistics); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/stat', MerchantStatistics); } getPayments = (req: StatRequest): Observable => diff --git a/src/app/thrift/operations/add-decision-to-provider-commit.ts b/src/app/thrift-services/damsel/operations/add-decision-to-provider-commit.ts similarity index 77% rename from src/app/thrift/operations/add-decision-to-provider-commit.ts rename to src/app/thrift-services/damsel/operations/add-decision-to-provider-commit.ts index 34f7be4a..1f0d8f7d 100644 --- a/src/app/thrift/operations/add-decision-to-provider-commit.ts +++ b/src/app/thrift-services/damsel/operations/add-decision-to-provider-commit.ts @@ -1,7 +1,7 @@ -import { ProviderObject } from '../../gen-damsel/domain'; -import { Commit } from '../../gen-damsel/domain_config'; -import { toGenCommit } from '../converters'; +import { toGenCommit } from '../../converters'; import { createAddTerminalToProviderOperation } from './create-add-terminal-to-provider-operation'; +import { ProviderObject } from '../gen-model/domain'; +import { Commit } from '../gen-model/domain_config'; export class AddDecisionToProvider { partyID: string; diff --git a/src/app/thrift/operations/add-terminal-decision.ts b/src/app/thrift-services/damsel/operations/add-terminal-decision.ts similarity index 94% rename from src/app/thrift/operations/add-terminal-decision.ts rename to src/app/thrift-services/damsel/operations/add-terminal-decision.ts index 715b841a..f7e9e456 100644 --- a/src/app/thrift/operations/add-terminal-decision.ts +++ b/src/app/thrift-services/damsel/operations/add-terminal-decision.ts @@ -2,9 +2,9 @@ import cloneDeep from 'lodash-es/cloneDeep'; import last from 'lodash-es/last'; import dropRight from 'lodash-es/dropRight'; -import { ProviderObject, TerminalDecision, TerminalRef } from '../../gen-damsel/domain'; -import { toGenTerminalDecision } from '../converters'; +import { toGenTerminalDecision } from '../../converters'; import { checkSelector } from './utils'; +import { ProviderObject, TerminalDecision, TerminalRef } from '../gen-model/domain'; const createDecision = (partyID: string, shopID: string, terminalID: number): TerminalDecision => ({ if_: { diff --git a/src/app/thrift/operations/create-add-terminal-to-provider-operation.ts b/src/app/thrift-services/damsel/operations/create-add-terminal-to-provider-operation.ts similarity index 74% rename from src/app/thrift/operations/create-add-terminal-to-provider-operation.ts rename to src/app/thrift-services/damsel/operations/create-add-terminal-to-provider-operation.ts index 141f578a..5c3e9349 100644 --- a/src/app/thrift/operations/create-add-terminal-to-provider-operation.ts +++ b/src/app/thrift-services/damsel/operations/create-add-terminal-to-provider-operation.ts @@ -1,8 +1,8 @@ -import { toGenDomainObject } from '../converters'; +import { toGenDomainObject } from '../../converters'; import { addTerminalDecision } from './add-terminal-decision'; -import { ProviderObject } from '../../gen-damsel/domain'; import { AddDecisionToProvider } from './add-decision-to-provider-commit'; -import { UpdateOp } from '../../gen-damsel/domain_config'; +import { ProviderObject } from '../gen-model/domain'; +import { UpdateOp } from '../gen-model/domain_config'; export const createAddTerminalToProviderOperation = ( providerObject: ProviderObject, diff --git a/src/app/thrift/operations/create-remove-terminal-from-provider-operation.ts b/src/app/thrift-services/damsel/operations/create-remove-terminal-from-provider-operation.ts similarity index 76% rename from src/app/thrift/operations/create-remove-terminal-from-provider-operation.ts rename to src/app/thrift-services/damsel/operations/create-remove-terminal-from-provider-operation.ts index 81f73eb9..83543ed0 100644 --- a/src/app/thrift/operations/create-remove-terminal-from-provider-operation.ts +++ b/src/app/thrift-services/damsel/operations/create-remove-terminal-from-provider-operation.ts @@ -1,8 +1,8 @@ -import { ProviderObject } from '../../gen-damsel/domain'; -import { UpdateOp } from '../../gen-damsel/domain_config'; -import { toGenDomainObject } from '../converters'; +import { toGenDomainObject } from '../../converters'; import { RemoveTerminalFromShopParams } from './remove-terminal-from-shop-params'; import { removeTerminalDecision } from './remove-terminal-decision'; +import { ProviderObject } from '../gen-model/domain'; +import { UpdateOp } from '../gen-model/domain_config'; export const createRemoveTerminalFromProviderOperation = ( providerObject: ProviderObject, diff --git a/src/app/thrift/operations/create-remove-terminal-from-shop-commit.ts b/src/app/thrift-services/damsel/operations/create-remove-terminal-from-shop-commit.ts similarity index 77% rename from src/app/thrift/operations/create-remove-terminal-from-shop-commit.ts rename to src/app/thrift-services/damsel/operations/create-remove-terminal-from-shop-commit.ts index 818fd033..60abeccf 100644 --- a/src/app/thrift/operations/create-remove-terminal-from-shop-commit.ts +++ b/src/app/thrift-services/damsel/operations/create-remove-terminal-from-shop-commit.ts @@ -1,8 +1,8 @@ import { RemoveTerminalFromShopParams } from './remove-terminal-from-shop-params'; -import { toGenCommit } from '../converters'; +import { toGenCommit } from '../../converters'; import { createRemoveTerminalFromProviderOperation } from './create-remove-terminal-from-provider-operation'; -import { ProviderObject } from '../../gen-damsel/domain'; -import { Commit } from '../../gen-damsel/domain_config'; +import { ProviderObject } from '../gen-model/domain'; +import { Commit } from '../gen-model/domain_config'; export const createRemoveTerminalFromShopCommit = ( providerObject: ProviderObject, diff --git a/src/app/thrift/operations/create-terminal-object.ts b/src/app/thrift-services/damsel/operations/create-terminal-object.ts similarity index 87% rename from src/app/thrift/operations/create-terminal-object.ts rename to src/app/thrift-services/damsel/operations/create-terminal-object.ts index 251fe8e9..46eb7bd7 100644 --- a/src/app/thrift/operations/create-terminal-object.ts +++ b/src/app/thrift-services/damsel/operations/create-terminal-object.ts @@ -1,7 +1,7 @@ import { CreateTerminalParams } from './create-terminal-params'; import { generateID, toMap } from './utils'; -import { TerminalObject } from '../../gen-damsel/domain'; -import { toGenTerminalObject } from '../converters'; +import { toGenTerminalObject } from '../../converters'; +import { TerminalObject } from '../gen-model/domain'; const convert = (id: number, params: CreateTerminalParams): TerminalObject => ({ ref: { diff --git a/src/app/thrift/operations/create-terminal-params.ts b/src/app/thrift-services/damsel/operations/create-terminal-params.ts similarity index 81% rename from src/app/thrift/operations/create-terminal-params.ts rename to src/app/thrift-services/damsel/operations/create-terminal-params.ts index 6f8881cb..d7fc2079 100644 --- a/src/app/thrift/operations/create-terminal-params.ts +++ b/src/app/thrift-services/damsel/operations/create-terminal-params.ts @@ -1,4 +1,4 @@ -import { RiskScore } from '../../gen-damsel/domain'; +import { RiskScore } from '../gen-model/domain'; export class TerminalOption { key: string; diff --git a/src/app/thrift/operations/edit-terminal-decision-operations.ts b/src/app/thrift-services/damsel/operations/edit-terminal-decision-operations.ts similarity index 76% rename from src/app/thrift/operations/edit-terminal-decision-operations.ts rename to src/app/thrift-services/damsel/operations/edit-terminal-decision-operations.ts index ff212038..7ca1fb7f 100644 --- a/src/app/thrift/operations/edit-terminal-decision-operations.ts +++ b/src/app/thrift-services/damsel/operations/edit-terminal-decision-operations.ts @@ -1,8 +1,8 @@ -import { ProviderObject } from '../../gen-damsel/domain'; -import { UpdateOp } from '../../gen-damsel/domain_config'; -import { toGenDomainObject } from '../converters'; +import { toGenDomainObject } from '../../converters'; import { editTerminalDecisionPropertyForShop } from './edit-terminal-decision-property-for-shop'; import { EditTerminalDecisionPropertyParams } from './edit-terminal-decision-property-params'; +import { ProviderObject } from '../gen-model/domain'; +import { UpdateOp } from '../gen-model/domain_config'; export const editTerminalDecisionPropertyForShopOperation = ( providerObject: ProviderObject, diff --git a/src/app/thrift/operations/edit-terminal-decision-property-for-shop-commit.ts b/src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop-commit.ts similarity index 77% rename from src/app/thrift/operations/edit-terminal-decision-property-for-shop-commit.ts rename to src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop-commit.ts index ed1c41dc..d34e5209 100644 --- a/src/app/thrift/operations/edit-terminal-decision-property-for-shop-commit.ts +++ b/src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop-commit.ts @@ -1,8 +1,8 @@ -import { ProviderObject } from '../../gen-damsel/domain'; -import { Commit } from '../../gen-damsel/domain_config'; -import { toGenCommit } from '../converters'; +import { toGenCommit } from '../../converters'; import { editTerminalDecisionPropertyForShopOperation } from './edit-terminal-decision-operations'; import { EditTerminalDecisionPropertyParams } from './edit-terminal-decision-property-params'; +import { ProviderObject } from '../gen-model/domain'; +import { Commit } from '../gen-model/domain_config'; export const editTerminalDecisionPropertyForShopCommit = ( providerObject: ProviderObject, diff --git a/src/app/thrift/operations/edit-terminal-decision-property-for-shop.ts b/src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop.ts similarity index 95% rename from src/app/thrift/operations/edit-terminal-decision-property-for-shop.ts rename to src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop.ts index db8038e4..93650498 100644 --- a/src/app/thrift/operations/edit-terminal-decision-property-for-shop.ts +++ b/src/app/thrift-services/damsel/operations/edit-terminal-decision-property-for-shop.ts @@ -1,9 +1,9 @@ import cloneDeep from 'lodash-es/cloneDeep'; import get from 'lodash-es/get'; -import { ProviderObject, TerminalDecision } from '../../gen-damsel/domain'; import { EditTerminalDecisionPropertyParams } from './edit-terminal-decision-property-params'; import { checkSelector } from './utils'; +import { ProviderObject, TerminalDecision } from '../gen-model/domain'; const editDecision = ( decisions: TerminalDecision[], diff --git a/src/app/thrift/operations/edit-terminal-decision-property-params.ts b/src/app/thrift-services/damsel/operations/edit-terminal-decision-property-params.ts similarity index 100% rename from src/app/thrift/operations/edit-terminal-decision-property-params.ts rename to src/app/thrift-services/damsel/operations/edit-terminal-decision-property-params.ts diff --git a/src/app/thrift/operations/get-create-terminal-commit.ts b/src/app/thrift-services/damsel/operations/get-create-terminal-commit.ts similarity index 80% rename from src/app/thrift/operations/get-create-terminal-commit.ts rename to src/app/thrift-services/damsel/operations/get-create-terminal-commit.ts index f665ff0c..c7598236 100644 --- a/src/app/thrift/operations/get-create-terminal-commit.ts +++ b/src/app/thrift-services/damsel/operations/get-create-terminal-commit.ts @@ -1,8 +1,8 @@ import { createTerminalObject } from './create-terminal-object'; import { CreateTerminalParams } from './create-terminal-params'; -import { toGenCommit, toGenDomainObject } from '../converters'; -import { TerminalObject } from '../../gen-damsel/domain'; -import { Commit } from '../../gen-damsel/domain_config'; +import { toGenCommit, toGenDomainObject } from '../../converters'; +import { TerminalObject } from '../gen-model/domain'; +import { Commit } from '../gen-model/domain_config'; export interface GetCreateTerminalCommit { commit: Commit; diff --git a/src/app/thrift/operations/index.ts b/src/app/thrift-services/damsel/operations/index.ts similarity index 100% rename from src/app/thrift/operations/index.ts rename to src/app/thrift-services/damsel/operations/index.ts diff --git a/src/app/thrift/operations/remove-terminal-decision.ts b/src/app/thrift-services/damsel/operations/remove-terminal-decision.ts similarity index 96% rename from src/app/thrift/operations/remove-terminal-decision.ts rename to src/app/thrift-services/damsel/operations/remove-terminal-decision.ts index 84597050..4a15b0b2 100644 --- a/src/app/thrift/operations/remove-terminal-decision.ts +++ b/src/app/thrift-services/damsel/operations/remove-terminal-decision.ts @@ -1,7 +1,7 @@ import cloneDeep from 'lodash-es/cloneDeep'; -import { ProviderObject, TerminalDecision } from '../../gen-damsel/domain'; import { checkSelector } from './utils'; +import { ProviderObject, TerminalDecision } from '../gen-model/domain'; const checkCondition = (condition: any, partyID: string, shopID: string): boolean => { const isPartyEquals = condition.party.id === partyID; diff --git a/src/app/thrift/operations/remove-terminal-from-shop-params.ts b/src/app/thrift-services/damsel/operations/remove-terminal-from-shop-params.ts similarity index 100% rename from src/app/thrift/operations/remove-terminal-from-shop-params.ts rename to src/app/thrift-services/damsel/operations/remove-terminal-from-shop-params.ts diff --git a/src/app/thrift/operations/utils.ts b/src/app/thrift-services/damsel/operations/utils.ts similarity index 95% rename from src/app/thrift/operations/utils.ts rename to src/app/thrift-services/damsel/operations/utils.ts index c753ed65..80bc1a19 100644 --- a/src/app/thrift/operations/utils.ts +++ b/src/app/thrift-services/damsel/operations/utils.ts @@ -1,7 +1,6 @@ import sortBy from 'lodash-es/sortBy'; import transform from 'lodash-es/transform'; - -import { Domain, TerminalSelector } from '../../gen-damsel/domain'; +import { Domain, TerminalSelector } from '../gen-model/domain'; export const generateID = (domainObjects: any[]): number => { const objWithMaxId = sortBy(domainObjects, obj => obj.ref.id)[domainObjects.length - 1]; diff --git a/src/app/thrift/payment-processing.service.ts b/src/app/thrift-services/damsel/payment-processing.service.ts similarity index 86% rename from src/app/thrift/payment-processing.service.ts rename to src/app/thrift-services/damsel/payment-processing.service.ts index 1196ce8e..ccf03959 100644 --- a/src/app/thrift/payment-processing.service.ts +++ b/src/app/thrift-services/damsel/payment-processing.service.ts @@ -1,27 +1,27 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable, timer } from 'rxjs'; import { share, switchMap, first } from 'rxjs/operators'; -import { KeycloakService } from 'keycloak-angular'; import { InvoicePaymentAdjustmentParams as InvoicePaymentAdjustmentParamsObject, UserInfo as UserInfoObject, InvoiceRepairScenario as InvoiceRepairScenarioObject } from './gen-nodejs/payment_processing_types'; +import { ThriftService } from '../thrift-service'; +import * as Invoicing from './gen-nodejs/Invoicing'; +import { InvoiceID } from './gen-model/domain'; import { InvoicePaymentAdjustment, InvoicePaymentAdjustmentParams, - UserInfo, - InvoiceRepairScenario -} from '../gen-damsel/payment_processing'; -import { ThriftService } from './thrift-service'; -import * as Invoicing from './gen-nodejs/Invoicing'; -import { InvoiceID } from '../gen-damsel/domain'; + InvoiceRepairScenario, + UserInfo +} from './gen-model/payment_processing'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class PaymentProcessingService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/v1/processing/invoicing', Invoicing); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/processing/invoicing', Invoicing); } getPaymentAdjustment = ( diff --git a/src/app/thrift-services/file-storage/file-storage.module.ts b/src/app/thrift-services/file-storage/file-storage.module.ts new file mode 100644 index 00000000..2c5ed32a --- /dev/null +++ b/src/app/thrift-services/file-storage/file-storage.module.ts @@ -0,0 +1,4 @@ +import { NgModule } from '@angular/core'; + +@NgModule({}) +export class FileStorageModule {} diff --git a/src/app/thrift-services/file-storage/file-storage.service.ts b/src/app/thrift-services/file-storage/file-storage.service.ts new file mode 100644 index 00000000..be0dfd4a --- /dev/null +++ b/src/app/thrift-services/file-storage/file-storage.service.ts @@ -0,0 +1,34 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { ThriftService } from '../thrift-service'; +import * as FileStorage from './gen-nodejs/FileStorage'; +import { + FileData, + FileDataID, + FileNotFound, + Metadata, + NewFileResult, + URL +} from './gen-model/file_storage'; +import { Timestamp } from './gen-model/base'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; + +@Injectable() +export class FileStorageService extends ThriftService { + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/file_storage', FileStorage); + } + + createNewFile = (metadata: Metadata, expires_at: Timestamp): Observable => + this.toObservableAction('CreateNewFile')(metadata, expires_at); + + generateDownloadUrl = ( + file_data_id: FileDataID, + expires_at: Timestamp + ): Observable => + this.toObservableAction('GenerateDownloadUrl')(file_data_id, expires_at); + + getFileData = (file_data_id: FileDataID): Observable => + this.toObservableAction('GetFileData')(file_data_id); +} diff --git a/src/app/thrift-services/file-storage/index.ts b/src/app/thrift-services/file-storage/index.ts new file mode 100644 index 00000000..f51ebedd --- /dev/null +++ b/src/app/thrift-services/file-storage/index.ts @@ -0,0 +1 @@ +export * from './file-storage.module'; diff --git a/src/app/thrift/filters/filter-providers-by-categories.ts b/src/app/thrift-services/filters/filter-providers-by-categories.ts similarity index 86% rename from src/app/thrift/filters/filter-providers-by-categories.ts rename to src/app/thrift-services/filters/filter-providers-by-categories.ts index 6afbaa88..3d928716 100644 --- a/src/app/thrift/filters/filter-providers-by-categories.ts +++ b/src/app/thrift-services/filters/filter-providers-by-categories.ts @@ -1,7 +1,5 @@ import get from 'lodash-es/get'; - -import { ProviderObject } from '../../gen-damsel/domain'; -import { CategoryRef } from '../../gen-damsel/domain'; +import { CategoryRef, ProviderObject } from '../damsel/gen-model/domain'; export const filterProvidersByCategories = ( objects: ProviderObject[], diff --git a/src/app/thrift/filters/filter-providers-by-category-id.ts b/src/app/thrift-services/filters/filter-providers-by-category-id.ts similarity index 88% rename from src/app/thrift/filters/filter-providers-by-category-id.ts rename to src/app/thrift-services/filters/filter-providers-by-category-id.ts index f3177a8d..08dd3c64 100644 --- a/src/app/thrift/filters/filter-providers-by-category-id.ts +++ b/src/app/thrift-services/filters/filter-providers-by-category-id.ts @@ -1,5 +1,5 @@ -import { ProviderObject } from '../../gen-damsel/domain'; import get from 'lodash-es/get'; +import { ProviderObject } from '../damsel/gen-model/domain'; export const filterProvidersByCategoryId = ( objects: ProviderObject[], diff --git a/src/app/thrift/filters/filter-providers-by-terminal-selector.ts b/src/app/thrift-services/filters/filter-providers-by-terminal-selector.ts similarity index 87% rename from src/app/thrift/filters/filter-providers-by-terminal-selector.ts rename to src/app/thrift-services/filters/filter-providers-by-terminal-selector.ts index 4ab85503..6e606a1f 100644 --- a/src/app/thrift/filters/filter-providers-by-terminal-selector.ts +++ b/src/app/thrift-services/filters/filter-providers-by-terminal-selector.ts @@ -1,4 +1,4 @@ -import { ProviderObject } from '../../gen-damsel/domain'; +import { ProviderObject } from '../damsel/gen-model/domain'; export const filterProvidersByTerminalSelector = ( objects: ProviderObject[], diff --git a/src/app/thrift/filters/index.ts b/src/app/thrift-services/filters/index.ts similarity index 100% rename from src/app/thrift/filters/index.ts rename to src/app/thrift-services/filters/index.ts diff --git a/src/app/fistful/fistful-admin.service.ts b/src/app/thrift-services/fistful/fistful-admin.service.ts similarity index 65% rename from src/app/fistful/fistful-admin.service.ts rename to src/app/thrift-services/fistful/fistful-admin.service.ts index 7daf06cc..f75fbf83 100644 --- a/src/app/fistful/fistful-admin.service.ts +++ b/src/app/thrift-services/fistful/fistful-admin.service.ts @@ -1,16 +1,16 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable } from 'rxjs'; -import { KeycloakService } from 'keycloak-angular'; import { DepositParams } from './gen-model/fistful_admin'; import { DepositParams as DepositParamsObject } from './gen-nodejs/fistful_admin_types'; -import { ThriftService } from '../thrift'; +import { ThriftService } from '../thrift-service'; import * as FistfulAdmin from './gen-nodejs/FistfulAdmin'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class FistfulAdminService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/v1/admin', FistfulAdmin); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/admin', FistfulAdmin); } createDeposit(params: DepositParams): Observable { diff --git a/src/app/fistful/fistful-stat.service.ts b/src/app/thrift-services/fistful/fistful-stat.service.ts similarity index 84% rename from src/app/fistful/fistful-stat.service.ts rename to src/app/thrift-services/fistful/fistful-stat.service.ts index a8d3e144..84acd44c 100644 --- a/src/app/fistful/fistful-stat.service.ts +++ b/src/app/thrift-services/fistful/fistful-stat.service.ts @@ -2,21 +2,21 @@ import { Injectable, NgZone } from '@angular/core'; import { FetchResult } from '@rbkmoney/partial-fetcher'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { KeycloakService } from 'keycloak-angular'; -import { ThriftService } from '../thrift'; +import { ThriftService } from '../thrift-service'; import * as FistfulStatistics from './gen-nodejs/FistfulStatistics'; import { StatRequest as ThriftStatRequest } from './gen-nodejs/fistful_stat_types'; import { StatDeposit, StatRequest } from './gen-model/fistful_stat'; -import { SearchFormParams } from '../deposits/search-form/search-form-params'; -import { QueryDSL } from '../query-dsl'; +import { SearchFormParams } from '../../deposits/search-form/search-form-params'; +import { QueryDSL } from '../../query-dsl'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class FistfulStatisticsService extends ThriftService { private readonly searchLimit = 20; - constructor(keycloakService: KeycloakService, zone: NgZone) { - super(zone, keycloakService, '/fistful/stat', FistfulStatistics); + constructor(keycloakTokenInfoService: KeycloakTokenInfoService, zone: NgZone) { + super(zone, keycloakTokenInfoService, '/fistful/stat', FistfulStatistics); } getDeposits( diff --git a/src/app/fistful/fistful.module.ts b/src/app/thrift-services/fistful/fistful.module.ts similarity index 100% rename from src/app/fistful/fistful.module.ts rename to src/app/thrift-services/fistful/fistful.module.ts diff --git a/src/app/fistful/repairer.service.ts b/src/app/thrift-services/fistful/repairer.service.ts similarity index 64% rename from src/app/fistful/repairer.service.ts rename to src/app/thrift-services/fistful/repairer.service.ts index c850b4fe..cb2b3516 100644 --- a/src/app/fistful/repairer.service.ts +++ b/src/app/thrift-services/fistful/repairer.service.ts @@ -1,16 +1,16 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable } from 'rxjs'; -import { KeycloakService } from 'keycloak-angular'; -import { ThriftService } from '../thrift'; +import { ThriftService } from '../thrift-service'; import { RepairScenario, SessionID } from './gen-model/withdrawal_session'; import { RepairScenario as RepairScenarioObject } from './gen-nodejs/withdrawal_session_types'; import * as Repairer from './gen-nodejs/Repairer'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class RepairerService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/v1/repair/withdrawal/session', Repairer); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/repair/withdrawal/session', Repairer); } repair = (id: SessionID, scenario: RepairScenario): Observable => diff --git a/src/app/thrift-services/index.ts b/src/app/thrift-services/index.ts new file mode 100644 index 00000000..143124dd --- /dev/null +++ b/src/app/thrift-services/index.ts @@ -0,0 +1,9 @@ +export * from './damsel/domain-typed-manager'; +export * from './damsel/domain.service'; +export * from './thrift-service'; +export * from './damsel/operations'; +export * from './filters'; +export * from './damsel/get-thrift-instance'; +export * from './ank'; +export * from './file-storage'; +export * from './messages'; diff --git a/src/app/machinegun/automaton.service.ts b/src/app/thrift-services/machinegun/automaton.service.ts similarity index 73% rename from src/app/machinegun/automaton.service.ts rename to src/app/thrift-services/machinegun/automaton.service.ts index 6ed76ee4..df11caae 100644 --- a/src/app/machinegun/automaton.service.ts +++ b/src/app/thrift-services/machinegun/automaton.service.ts @@ -1,20 +1,20 @@ import { Injectable, NgZone } from '@angular/core'; import { Observable } from 'rxjs'; -import { KeycloakService } from 'keycloak-angular'; import * as Automaton from './gen-nodejs/Automaton'; import { Reference as ReferenceObject, MachineDescriptor as MachineDescriptorObject } from './gen-nodejs/state_processing_types'; -import { ThriftService } from '../thrift'; +import { ThriftService } from '../thrift-service'; import { Namespace } from './gen-model/base'; import { Reference, MachineDescriptor, Machine } from './gen-model/state_processing'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; @Injectable() export class AutomatonService extends ThriftService { - constructor(zone: NgZone, keycloakService: KeycloakService) { - super(zone, keycloakService, '/v1/automaton', Automaton); + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/automaton', Automaton); } simpleRepair = (ns: Namespace, ref: Reference): Observable => diff --git a/src/app/machinegun/machinegun.module.ts b/src/app/thrift-services/machinegun/machinegun.module.ts similarity index 100% rename from src/app/machinegun/machinegun.module.ts rename to src/app/thrift-services/machinegun/machinegun.module.ts diff --git a/src/app/machinegun/model/namespace.ts b/src/app/thrift-services/machinegun/model/namespace.ts similarity index 100% rename from src/app/machinegun/model/namespace.ts rename to src/app/thrift-services/machinegun/model/namespace.ts diff --git a/src/app/thrift-services/messages/index.ts b/src/app/thrift-services/messages/index.ts new file mode 100644 index 00000000..76243f37 --- /dev/null +++ b/src/app/thrift-services/messages/index.ts @@ -0,0 +1 @@ +export * from './messages.module'; diff --git a/src/app/thrift-services/messages/messages.module.ts b/src/app/thrift-services/messages/messages.module.ts new file mode 100644 index 00000000..3f05170e --- /dev/null +++ b/src/app/thrift-services/messages/messages.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core'; +import { MessagesService } from './messages.service'; + +@NgModule({ + providers: [MessagesService] +}) +export class MessagesModule {} diff --git a/src/app/thrift-services/messages/messages.service.ts b/src/app/thrift-services/messages/messages.service.ts new file mode 100644 index 00000000..8b622037 --- /dev/null +++ b/src/app/thrift-services/messages/messages.service.ts @@ -0,0 +1,37 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { ThriftService } from '../thrift-service'; +import * as MessageServiceClient from './gen-nodejs/MessageService'; +import { + ConversationFilter as ConversationFilterType, + User as UserType, + Conversation as ConversationType +} from './gen-nodejs/messages_types'; +import { + Conversation, + ConversationFilter, + ConversationId, + GetConversationResponse, + User +} from './gen-model/messages'; +import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; + +@Injectable() +export class MessagesService extends ThriftService { + constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { + super(zone, keycloakTokenInfoService, '/v1/messages', MessageServiceClient); + } + + getConversations = ( + ids: ConversationId[], + filter: ConversationFilter + ): Observable => + this.toObservableAction('GetConversations')(ids, new ConversationFilterType(filter)); + + saveConversations = (conversations: Conversation[], user: User): Observable => + this.toObservableAction('SaveConversations')( + conversations.map(c => new ConversationType(c)), + new UserType(user) + ); +} diff --git a/src/app/thrift-services/messages/utils/create-single-message-conversation-params.ts b/src/app/thrift-services/messages/utils/create-single-message-conversation-params.ts new file mode 100644 index 00000000..233ae12f --- /dev/null +++ b/src/app/thrift-services/messages/utils/create-single-message-conversation-params.ts @@ -0,0 +1,14 @@ +import * as uuid from 'uuid/v4'; +import * as moment from 'moment'; + +import { Conversation, ConversationStatus } from '../gen-model/messages'; + +export const createSingleMessageConversationParams = ( + conversation_id: string, + text: string, + user_id: string +): Conversation => ({ + conversation_id, + messages: [{ message_id: uuid(), text, user_id, timestamp: moment().toISOString() }], + status: ConversationStatus.ACTUAL +}); diff --git a/src/app/thrift-services/messages/utils/index.ts b/src/app/thrift-services/messages/utils/index.ts new file mode 100644 index 00000000..1ffbf96b --- /dev/null +++ b/src/app/thrift-services/messages/utils/index.ts @@ -0,0 +1 @@ +export * from './create-single-message-conversation-params'; diff --git a/src/app/thrift-services/thrift-service.ts b/src/app/thrift-services/thrift-service.ts new file mode 100644 index 00000000..c2838d10 --- /dev/null +++ b/src/app/thrift-services/thrift-service.ts @@ -0,0 +1,71 @@ +import { NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; +import { timeout } from 'rxjs/operators'; +import connectClient from 'woody_js'; + +import { KeycloakTokenInfoService } from '../keycloak-token-info.service'; + +type Exception = { + name: N; + message: string; +} & T; + +export class ThriftService { + protected endpoint: string; + protected service: any; + protected realm = 'internal'; + + constructor( + private zone: NgZone, + private keycloakTokenInfoService: KeycloakTokenInfoService, + endpoint: string, + thriftService: any + ) { + this.endpoint = endpoint; + this.service = thriftService; + } + + protected toObservableAction Observable>(name: string): T { + return ((...args) => + Observable.create(observer => { + const cb = msg => { + observer.error(msg); + observer.complete(); + }; + this.zone.run(() => { + try { + const client = this.createClient(cb); + client[name](...args, (ex: Exception, result) => { + ex ? observer.error(ex) : observer.next(result); + observer.complete(); + }); + } catch (e) { + cb(e); + } + }); + }).pipe(timeout(60000))) as any; + } + + private createClient(errorCb: Function) { + const { email, preferred_username, sub } = this.keycloakTokenInfoService.decodedUserToken; + return connectClient( + location.hostname, + location.port, + this.endpoint, + this.service, + { + headers: { + 'woody.meta-user-identity.email': email, + 'woody.meta-user-identity.realm': this.realm, + 'woody.meta-user-identity.username': preferred_username, + 'woody.meta-user-identity.id': sub, + 'x-rbk-meta-user-identity.email': email, + 'x-rbk-meta-user-identity.realm': this.realm, + 'x-rbk-meta-user-identity.username': preferred_username, + 'x-rbk-meta-user-identity.id': sub + } + }, + errorCb + ); + } +} diff --git a/src/app/thrift/index.ts b/src/app/thrift/index.ts deleted file mode 100644 index c7fbe9e8..00000000 --- a/src/app/thrift/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './domain-typed-manager'; -export * from './domain.service'; -export * from './thrift-service'; -export * from './operations'; -export * from './filters'; -export * from './get-thrift-instance'; diff --git a/src/app/thrift/thrift-service.ts b/src/app/thrift/thrift-service.ts deleted file mode 100644 index 1601003e..00000000 --- a/src/app/thrift/thrift-service.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { NgZone } from '@angular/core'; -import { Observable, from } from 'rxjs'; -import { map, timeout } from 'rxjs/operators'; -import connectClient from 'woody_js'; -import { KeycloakService } from 'keycloak-angular'; -import * as jwtDecode from 'jwt-decode'; - -type Exception = { - name: N; - message: string; -} & T; - -export class ThriftService { - protected endpoint: string; - protected service: any; - protected realm = 'internal'; - - constructor( - private zone: NgZone, - private keycloakService: KeycloakService, - endpoint: string, - thriftService: any - ) { - this.endpoint = endpoint; - this.service = thriftService; - } - - protected toObservableAction Observable>(name: string): T { - return ((...args) => - Observable.create(observer => { - const cb = msg => { - observer.error(msg); - observer.complete(); - }; - this.zone.run(() => { - try { - this.createClient(cb).subscribe(client => - client[name](...args, (ex: Exception, result) => { - ex ? observer.error(ex) : observer.next(result); - observer.complete(); - }) - ); - } catch (e) { - cb(e); - } - }); - }).pipe(timeout(60000))) as any; - } - - private createClient(errorCb: Function) { - return from(this.keycloakService.getToken()).pipe( - map(token => { - const { email, preferred_username, sub } = jwtDecode(token); - return connectClient( - location.hostname, - location.port, - this.endpoint, - this.service, - { - headers: { - 'woody.meta-user-identity.email': email, - 'woody.meta-user-identity.realm': this.realm, - 'woody.meta-user-identity.username': preferred_username, - 'woody.meta-user-identity.id': sub, - 'x-rbk-meta-user-identity.email': email, - 'x-rbk-meta-user-identity.realm': this.realm, - 'x-rbk-meta-user-identity.username': preferred_username, - 'x-rbk-meta-user-identity.id': sub - } - }, - errorCb - ); - }) - ); - } -} diff --git a/tsconfig.json b/tsconfig.json index 271de998..a7241345 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, - "module": "es2015", + "module": "esnext", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true,