@coopenomics/desktop 2.2.10 → 2025.4.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env-example +6 -1
- package/.env-testnet +8 -0
- package/Dockerfile +12 -0
- package/extensions/market/install.ts +78 -0
- package/extensions/market-admin/install.ts +42 -0
- package/extensions/participant/install.ts +125 -0
- package/extensions/powerup/install.ts +20 -0
- package/extensions/soviet/install.ts +83 -0
- package/package.json +6 -5
- package/quasar.config.cjs +5 -12
- package/src/app/App.vue +44 -73
- package/src/app/layouts/default.vue +40 -0
- package/src/app/layouts/useDefaultLayoutLogic.ts +59 -0
- package/src/app/providers/routes/index.ts +19 -34
- package/src/app/styles/style.css +4 -0
- package/src/boot/init.ts +6 -0
- package/src/boot/sentry.ts +1 -2
- package/src/desktops/index.ts +0 -6
- package/src/entities/Account/model/index.ts +1 -1
- package/src/entities/Agenda/api/index.ts +20 -0
- package/src/entities/Agenda/index.ts +2 -0
- package/src/entities/Agenda/model/index.ts +2 -0
- package/src/entities/Agenda/model/store.ts +36 -0
- package/src/entities/Agenda/model/types.ts +4 -0
- package/src/entities/Branch/model/index.ts +1 -1
- package/src/entities/Desktop/api/index.ts +16 -1
- package/src/entities/Desktop/model/store.ts +112 -106
- package/src/entities/Desktop/model/types.ts +14 -1
- package/src/entities/Document/api/index.ts +24 -0
- package/src/entities/Document/index.ts +2 -0
- package/src/entities/Document/model/store.ts +117 -0
- package/src/entities/Document/model/types.ts +18 -0
- package/src/entities/Meet/api/index.ts +58 -0
- package/src/entities/Meet/index.ts +2 -0
- package/src/entities/Meet/model/store.ts +72 -0
- package/src/entities/Meet/types/index.ts +7 -0
- package/src/entities/Payment/api/index.ts +20 -0
- package/src/entities/Payment/model/index.ts +2 -0
- package/src/entities/Payment/model/store.ts +62 -0
- package/src/entities/Payment/model/types.ts +7 -0
- package/src/entities/Session/model/store.ts +3 -3
- package/src/entities/System/model/store.ts +1 -1
- package/src/entities/User/model/stores.ts +3 -1
- package/src/entities/Wallet/api/index.ts +15 -33
- package/src/entities/Wallet/model/stores.ts +3 -23
- package/src/entities/Wallet/model/types.ts +2 -3
- package/src/features/Agreementer/SignAgreementDialog/ui/SignAgreementDialog.vue +1 -1
- package/src/features/Branch/SelectBranch/index.ts +2 -0
- package/src/features/Branch/SelectBranch/ui/SelectBranchOverlay.vue +52 -105
- package/src/features/Decision/CreateProject/ui/CreateProjectFreeDecisionButton.vue +1 -1
- package/src/features/Decision/ParticipantApplication/model/index.ts +38 -0
- package/src/features/FreeDecision/CreateProject/model/index.ts +92 -0
- package/src/features/FreeDecision/CreateProject/ui/CreateProjectFreeDecisionButton.vue +51 -0
- package/src/features/FreeDecision/CreateProject/ui/index.ts +1 -0
- package/src/features/FreeDecision/GenerateDecision/index.ts +1 -0
- package/src/features/FreeDecision/GenerateDecision/model/index.ts +36 -0
- package/src/features/FreeDecision/index.ts +2 -0
- package/src/features/Meet/CloseMeetWithDecision/index.ts +1 -0
- package/src/features/Meet/CloseMeetWithDecision/model/index.ts +92 -0
- package/src/features/Meet/CreateMeet/index.ts +2 -0
- package/src/features/Meet/CreateMeet/model/index.ts +65 -0
- package/src/features/Meet/CreateMeet/ui/CreateMeet.vue +34 -0
- package/src/features/Meet/CreateMeet/ui/CreateMeetForm.vue +136 -0
- package/src/features/Meet/CreateMeet/ui/index.ts +2 -0
- package/src/features/Meet/GenerateAgenda/index.ts +1 -0
- package/src/features/Meet/GenerateAgenda/model/index.ts +18 -0
- package/src/features/Meet/GenerateBallot/index.ts +1 -0
- package/src/features/Meet/GenerateBallot/model/index.ts +18 -0
- package/src/features/Meet/GenerateNotification/index.ts +1 -0
- package/src/features/Meet/GenerateNotification/model/index.ts +18 -0
- package/src/features/Meet/GenerateSovietDecision/index.ts +1 -0
- package/src/features/Meet/GenerateSovietDecision/model/index.ts +48 -0
- package/src/features/Meet/MeetDetailsManagement/index.ts +1 -0
- package/src/features/Meet/MeetDetailsManagement/model/index.ts +121 -0
- package/src/features/Meet/RestartMeet/index.ts +2 -0
- package/src/features/Meet/RestartMeet/model/index.ts +54 -0
- package/src/features/Meet/RestartMeet/ui/RestartMeet.vue +46 -0
- package/src/features/Meet/RestartMeet/ui/RestartMeetForm.vue +92 -0
- package/src/features/Meet/RestartMeet/ui/index.ts +2 -0
- package/src/features/Meet/VoteOnMeet/index.ts +1 -0
- package/src/features/Meet/VoteOnMeet/model/index.ts +18 -0
- package/src/features/Payment/SetStatus/api/index.ts +20 -0
- package/src/features/Payment/SetStatus/index.ts +1 -0
- package/src/features/Payment/SetStatus/model/index.ts +30 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderPaidStatusButton/SetOrderPaidStatusButton.vue +7 -3
- package/src/features/PaymentMethod/AddPaymentMethod/model/index.ts +2 -2
- package/src/features/PaymentMethod/AddPaymentMethod/ui/AddPaymentButton.vue +1 -1
- package/src/features/PaymentMethod/DeletePaymentMethod/model/index.ts +1 -1
- package/src/features/PaymentMethod/DeletePaymentMethod/ui/DeletePaymentMethodButton.vue +3 -1
- package/src/features/Request/CancelRequest/ui/CancelButton.vue +1 -1
- package/src/features/Request/ConfirmRecieveOnRequest/ui/ConfirmRecieveOnRequest.vue +1 -1
- package/src/features/Request/CreateParentOffer/ui/CreateParentOfferForm/CreateParentOfferForm.vue +3 -5
- package/src/features/Request/CreateParentOffer/ui/ImageUploaderWithPreview/ImageUploaderWithPreview.vue +4 -3
- package/src/features/Request/DisputeOnRequest/ui/DisputeOnRequestButton.vue +1 -1
- package/src/features/Request/ModerateRequest/ui/ModerateRequestButton.vue +2 -2
- package/src/features/Request/PublishRequest/ui/PublishRequestButton.vue +1 -1
- package/src/features/Request/RecieveOnRequest/ui/RecieveOnRequestButton.vue +1 -1
- package/src/features/Request/UnpublishRequest/ui/UnpublishRequestButton.vue +1 -1
- package/src/features/Union/AddCooperative/model/index.ts +4 -5
- package/src/features/Union/AddCooperative/ui/AddCooperativeForm.vue +5 -6
- package/src/features/User/AddUser/ui/AddUserDialog/AddUserDialog.vue +4 -4
- package/src/features/User/LoginUser/model/index.ts +3 -3
- package/src/features/User/LoginUser/ui/LoginForm/LoginForm.vue +0 -6
- package/src/features/User/Logout/model/index.ts +2 -0
- package/src/features/Wallet/DepositToWallet/ui/DepositButton/DepositButton.vue +8 -7
- package/src/features/Wallet/WithdrawFromWallet/ui/withdrawButton.vue +6 -7
- package/src/pages/Blank/index.ts +1 -0
- package/src/pages/Contacts/ContactsPage.vue +64 -0
- package/src/{widgets/Cooperative/Contacts → pages/Cooperative/ChangeContacts}/ui/index.ts +0 -1
- package/src/{widgets/Cooperative/Contributions/ui/ChangeContributions.vue → pages/Cooperative/ChangeRegisterPayments/ui/ChangeRegisterPayments.vue} +10 -11
- package/src/pages/Cooperative/ChangeRegisterPayments/ui/index.ts +1 -0
- package/src/pages/Cooperative/ListOfAgenda/index.ts +1 -0
- package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +118 -0
- package/src/pages/Cooperative/ListOfAgenda/ui/index.ts +1 -0
- package/src/pages/Cooperative/ListOfDocuments/ListOfDocumentsPage.vue +24 -0
- package/src/pages/Cooperative/ListOfMeets/model/index.ts +1 -0
- package/src/pages/Cooperative/ListOfMeets/model/model.ts +117 -0
- package/src/pages/Cooperative/ListOfMeets/ui/ListOfMeetsPage.vue +90 -0
- package/src/pages/Cooperative/ListOfMeets/ui/index.ts +1 -0
- package/src/pages/Cooperative/ListOfOrders/index.ts +1 -1
- package/src/pages/Cooperative/ListOfOrders/ui/ListOfOrdersPage.vue +0 -4
- package/src/pages/Cooperative/ListOfParticipants/ui/ListOfParticipantsPage.vue +61 -10
- package/src/pages/Cooperative/ListOfParticipants/ui/index.ts +1 -1
- package/src/pages/Cooperative/MeetDetails/ui/MeetDetailsPage.vue +88 -0
- package/src/pages/Cooperative/MeetDetails/ui/index.ts +1 -0
- package/src/pages/Cooperative/MemberBranchList/ui/index.ts +1 -0
- package/src/pages/Cooperative/Payments/index.ts +1 -0
- package/src/pages/Cooperative/Payments/ui/PaymentsPage.vue +7 -0
- package/src/pages/{ExtStore → ExtensionStore}/ExtensionPage/ExtensionPage.vue +35 -20
- package/src/pages/{ExtStore → ExtensionStore}/ExtensionsShowcase/ExtensionsShowcase.vue +2 -2
- package/src/pages/{ExtStore → ExtensionStore}/InstalledExtensions/InstalledExtensions.vue +2 -2
- package/src/pages/Marketplace/OfferPage/ui/OfferPage.vue +1 -1
- package/src/pages/Marketplace/Showcase/ui/ShowcasePage.vue +1 -1
- package/src/pages/Marketplace/SuppliesList/ui/SuppliesListPage.vue +1 -1
- package/src/pages/Marketplace/UserParentOffers/ui/UserParentOffersPage.vue +1 -1
- package/src/pages/Marketplace/UserSuppliesList/ui/UserSuppliesListPage.vue +1 -1
- package/src/pages/PermissionDenied/index.ts +1 -0
- package/src/pages/Registrator/SignUp/EmailInput.vue +2 -3
- package/src/pages/Registrator/SignUp/GenerateAccount.vue +2 -3
- package/src/pages/Registrator/SignUp/PayInitial.vue +1 -1
- package/src/pages/Registrator/SignUp/ReadStatement.vue +2 -2
- package/src/pages/Registrator/SignUp/SelectBranch.vue +2 -2
- package/src/pages/Registrator/SignUp/SignStatement.vue +2 -2
- package/src/pages/Registrator/SignUp/SignUp.vue +5 -12
- package/src/pages/Registrator/SignUp/WaitingRegistration.vue +1 -5
- package/src/pages/Registrator/SignUp/Welcome.vue +4 -3
- package/src/pages/Union/ConnectionAgreement/index.ts +1 -0
- package/src/pages/Union/ListOfCooperatives/ui/UnionPageListOfCooperatives.vue +139 -6
- package/src/pages/User/DocumentsPage/UserDocumentsPage.vue +23 -0
- package/src/pages/User/DocumentsPage/index.ts +1 -0
- package/src/pages/User/PaymentsPage/ui/UserPayments.vue +11 -0
- package/src/pages/User/PaymentsPage/ui/index.ts +1 -0
- package/src/pages/User/ProfilePage/index.ts +1 -0
- package/src/pages/User/ProfilePage/ui/ProfilePage.vue +114 -0
- package/src/pages/User/ProfilePage/ui/index.ts +1 -0
- package/src/pages/User/SettingsPage/ui/index.ts +1 -1
- package/src/pages/User/WalletPage/index.ts +1 -0
- package/src/pages/User/WalletPage/ui/WalletPage.vue +72 -0
- package/src/pages/User/WalletPage/ui/index.ts +1 -0
- package/src/processes/init-app/index.ts +28 -0
- package/src/processes/init-installed-extensions/index.ts +25 -0
- package/src/processes/init-wallet/index.ts +40 -0
- package/src/processes/navigation-guard-setup/index.ts +45 -0
- package/src/processes/process-decisions/index.ts +275 -0
- package/src/processes/select-branch/index.ts +80 -0
- package/src/processes/watch-branch-overlay/index.ts +38 -0
- package/src/processes/watch-desktop-health/index.ts +33 -0
- package/src/shared/api/alerts.ts +2 -6
- package/src/shared/api/axios.ts +4 -5
- package/src/shared/api/client.ts +3 -4
- package/src/shared/api/eosio.ts +1 -2
- package/src/shared/api/utils.ts +1 -3
- package/src/shared/config/index.ts +0 -1
- package/src/shared/hooks/index.ts +2 -0
- package/src/shared/hooks/useAgendaPoints.ts +24 -0
- package/src/shared/hooks/useWindowSize.ts +13 -0
- package/src/shared/lib/composables/useDisplayName.ts +34 -0
- package/src/shared/lib/navigation/index.ts +2 -0
- package/src/shared/lib/navigation/routeUtils.ts +51 -0
- package/src/shared/lib/navigation/useBackButton.ts +63 -0
- package/src/shared/lib/utils/dates/validateDateWithinRange.ts +23 -0
- package/src/shared/ui/BaseDocument/BaseDocument.vue +120 -90
- package/src/{components/menu/blockchainStatus.vue → shared/ui/BlockchainStatusBar/BlockchainStatusBar.vue} +1 -0
- package/src/shared/ui/BlockchainStatusBar/index.ts +1 -0
- package/src/shared/ui/CardStyles/index.scss +61 -0
- package/src/shared/ui/ComplexDocument/ComplexDocument.vue +31 -8
- package/src/shared/ui/CopyableInput/index.ts +1 -0
- package/src/shared/ui/CopyableInput/ui/CopyableInput.vue +62 -0
- package/src/shared/ui/EditableEntrepreneurCard/EditableEntrepreneurCard.vue +9 -8
- package/src/shared/ui/EditableIndividualCard/EditableIndividualCard.vue +10 -10
- package/src/shared/ui/EditableOrganizationCard/EditableOrganizationCard.vue +57 -47
- package/src/shared/ui/Form/Form.vue +3 -1
- package/src/shared/ui/InputStyles/index.scss +29 -0
- package/src/shared/ui/TabStyles/index.scss +53 -0
- package/src/shared/ui/index.ts +1 -0
- package/src/{components/history/AccountEvents.vue → widgets/AccountActions/AccountActionsPage.vue} +2 -2
- package/src/widgets/AccountActions/index.ts +1 -0
- package/src/widgets/BankDetailsCard/ui/BankDetailsCard.vue +2 -2
- package/src/widgets/BranchCard/ui/BranchCard.vue +2 -2
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/DocumentCard.vue +48 -0
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/DocumentsTable.vue +162 -0
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/ListOfDocumentsWidget.vue +77 -120
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/index.ts +3 -1
- package/src/widgets/Cooperative/Orders/ListOfOrders/ui/ListOfOrdersWidget.vue +135 -128
- package/src/widgets/Cooperative/Orders/ListOfOrders/ui/OrderCard.vue +74 -0
- package/src/widgets/Cooperative/Orders/ListOfOrders/ui/index.ts +2 -1
- package/src/widgets/Cooperative/Payments/ListOfPayments/ui/ListOfPaymentsWidget.vue +216 -0
- package/src/widgets/Cooperative/Payments/ListOfPayments/ui/PaymentCard.vue +73 -0
- package/src/widgets/Cooperative/Payments/ListOfPayments/ui/index.ts +2 -0
- package/src/widgets/Cooperative/Payments/index.ts +1 -0
- package/src/widgets/Desktop/LeftDrawerMenu/LeftDrawerMenu.vue +3 -2
- package/src/widgets/Desktop/SecondLevelMenuList/SecondLevelMenuList.vue +58 -91
- package/src/widgets/Desktop/WorkspaceMenu/WorkspaceMenu.vue +114 -59
- package/src/widgets/{ExtStore/ExtensionCard → ExtensionCard}/ExtensionCard.vue +12 -7
- package/src/widgets/Header/BackButton/BackButton.vue +25 -0
- package/src/widgets/Header/BackButton/index.ts +1 -0
- package/src/widgets/Header/CommonHeader/CooperativeSettingsHeader.vue +34 -0
- package/src/widgets/Header/CommonHeader/ExtstoreHeader.vue +41 -0
- package/src/widgets/Header/CommonHeader/Header.vue +33 -198
- package/src/widgets/Header/CommonHeader/HeaderStyles.scss +22 -0
- package/src/widgets/Header/CommonHeader/MainHeader.vue +87 -0
- package/src/widgets/Header/CommonHeader/UserSettingsHeader.vue +29 -0
- package/src/widgets/Header/CommonHeader/index.ts +1 -1
- package/src/widgets/Header/SettingsDropdown/SettingsDropdown.vue +0 -6
- package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Base/Base.vue +1 -2
- package/src/widgets/Meets/MeetDetailsActions/MeetDetailsActions.vue +51 -0
- package/src/widgets/Meets/MeetDetailsActions/index.ts +1 -0
- package/src/widgets/Meets/MeetDetailsActions/model.ts +46 -0
- package/src/widgets/Meets/MeetDetailsAgenda/MeetDetailsAgenda.vue +29 -0
- package/src/widgets/Meets/MeetDetailsAgenda/index.ts +1 -0
- package/src/widgets/Meets/MeetDetailsHeader/MeetDetailsHeader.vue +40 -0
- package/src/widgets/Meets/MeetDetailsHeader/index.ts +1 -0
- package/src/widgets/Meets/MeetDetailsVoting/MeetDetailsVoting.vue +77 -0
- package/src/widgets/Meets/MeetDetailsVoting/index.ts +1 -0
- package/src/widgets/Meets/MeetDetailsVoting/model.ts +117 -0
- package/src/widgets/Meets/MeetInfoCard/ui/MeetInfoCard.vue +38 -0
- package/src/widgets/Meets/MeetInfoCard/ui/index.ts +1 -0
- package/src/widgets/Meets/MeetsTable/ui/MeetsTable.vue +118 -0
- package/src/widgets/Meets/MeetsTable/ui/index.ts +1 -0
- package/src/widgets/Participants/index.ts +1 -0
- package/src/widgets/Participants/ui/ParticipantCard.vue +89 -0
- package/src/widgets/Participants/ui/ParticipantDetails.vue +79 -0
- package/src/widgets/Participants/ui/ParticipantsTable.vue +129 -0
- package/src/widgets/Participants/ui/index.ts +4 -0
- package/src/widgets/Questions/index.ts +3 -0
- package/src/widgets/Questions/ui/QuestionCard/QuestionCard.vue +109 -0
- package/src/widgets/Questions/ui/QuestionCard/index.ts +1 -0
- package/src/widgets/Questions/ui/QuestionsTable/QuestionsTable.vue +177 -0
- package/src/widgets/Questions/ui/QuestionsTable/index.ts +1 -0
- package/src/widgets/Questions/ui/VotingButtons/VotingButtons.vue +75 -0
- package/src/widgets/Questions/ui/VotingButtons/index.ts +1 -0
- package/src/widgets/Questions/ui/index.ts +3 -0
- package/src/widgets/RequireAgreements/index.ts +1 -0
- package/src/widgets/User/PaymentMethods/ui/PaymentMethods.vue +81 -85
- package/tsconfig.json +1 -1
- package/extensions/powerup/boot.ts +0 -17
- package/src/app/providers/card/store.ts +0 -42
- package/src/boot/branch-selector.ts +0 -40
- package/src/boot/init-stores.ts +0 -51
- package/src/boot/navigation-guards.ts +0 -46
- package/src/components/menu/footerMobileMenu.vue +0 -79
- package/src/components/soviet/index.vue +0 -76
- package/src/components/soviet/staff.vue +0 -274
- package/src/desktops/User/index.ts +0 -1
- package/src/desktops/User/model/index.ts +0 -329
- package/src/entities/Menu/model/store.ts +0 -69
- package/src/entities/Menu/model/types.ts +0 -11
- package/src/entities/Menu/ui/index.ts +0 -1
- package/src/entities/Order/api/index.ts +0 -14
- package/src/entities/Order/model/store.ts +0 -87
- package/src/features/Order/SetStatus/api/index.ts +0 -7
- package/src/features/Order/SetStatus/model/index.ts +0 -23
- package/src/pages/Cooperative/Contacts/ui/ContactsPage.vue +0 -7
- package/src/pages/Cooperative/ListOfBranches/ui/index.ts +0 -1
- package/src/pages/Documentor/ListOfDocuments/ListOfDocumentsPage.vue +0 -12
- package/src/pages/Union/Connection/index.ts +0 -1
- package/src/pages/_layouts/blank.vue +0 -24
- package/src/pages/_layouts/default.vue +0 -79
- package/src/types/index.ts +0 -3
- package/src/widgets/Commutator/Commutator.vue +0 -7
- package/src/widgets/Commutator/index.ts +0 -1
- package/src/widgets/Cooperative/Agenda/ListOfQuestions/ui/ListOfQuestions.vue +0 -273
- package/src/widgets/Cooperative/Agenda/ListOfQuestions/ui/index.ts +0 -1
- package/src/widgets/Cooperative/Contacts/ui/Contacts.vue +0 -52
- package/src/widgets/Cooperative/Contributions/ui/index.ts +0 -1
- package/src/widgets/Cooperative/Description/ui/SetDescription.vue +0 -4
- package/src/widgets/Cooperative/Description/ui/index.ts +0 -1
- package/src/widgets/Cooperative/Participants/ListOfParticipants/ui/ListOfParticipantsWidget.vue +0 -186
- package/src/widgets/Cooperative/Participants/ListOfParticipants/ui/index.ts +0 -1
- package/src/widgets/Desktop/SecondLevelMenu/SecondLevelMenu.vue +0 -59
- package/src/widgets/Desktop/SecondLevelMenu/index.ts +0 -1
- package/src/widgets/IndividualCard/ui/IndividualCard.vue +0 -170
- package/src/widgets/IndividualCard/ui/index.ts +0 -1
- package/src/widgets/OrganizationCard/ui/OrganizationCard.vue +0 -44
- package/src/widgets/OrganizationCard/ui/index.ts +0 -1
- package/src/widgets/Union/ListOfCooperatives/ui/UnionListOfCooperatives.vue +0 -136
- package/src/widgets/Union/ListOfCooperatives/ui/index.ts +0 -1
- package/src/entities/{Menu → Document}/model/index.ts +0 -0
- package/src/entities/{Order → Meet}/model/index.ts +0 -0
- package/src/entities/{Order → Payment}/index.ts +0 -0
- package/src/features/{Order/SetStatus → Decision/ParticipantApplication}/index.ts +0 -0
- package/src/{widgets/Request/SupplyOrderRequestCard → features/FreeDecision/CreateProject}/index.ts +0 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderCompletedStatusButton/SetOrderCompletedStatusButton.vue +0 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderCompletedStatusButton/index.ts +0 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderPaidStatusButton/index.ts +0 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderRefundedStatusButton/SetOrderRefundedStatusButton.vue +0 -0
- package/src/features/{Order → Payment}/SetStatus/ui/SetOrderRefundedStatusButton/index.ts +0 -0
- package/src/pages/{blank/blank.vue → Blank/BlankPage.vue} +0 -0
- package/src/pages/{Cooperative/Contacts/ui → Contacts}/index.ts +0 -0
- package/src/pages/Cooperative/{Contacts → ChangeContacts}/index.ts +0 -0
- package/src/{widgets/Cooperative/Contacts → pages/Cooperative/ChangeContacts}/ui/ChangeContacts.vue +0 -0
- package/src/pages/Cooperative/{ListOfBranches → ChangeRegisterPayments}/index.ts +0 -0
- package/src/pages/{Documentor → Cooperative}/ListOfDocuments/index.ts +0 -0
- package/src/pages/{Installer → Cooperative/ListOfMeets}/index.ts +0 -0
- package/src/{widgets/Cooperative/Agenda/ListOfQuestions → pages/Cooperative/MeetDetails}/index.ts +0 -0
- package/src/{widgets/Cooperative/Contacts → pages/Cooperative/MemberBranchList}/index.ts +0 -0
- package/src/pages/Cooperative/{ListOfBranches/ui/ListOfBranchesPage.vue → MemberBranchList/ui/MemberBranchListPage.vue} +0 -0
- package/src/pages/{ExtStore → ExtensionStore}/BaseRoute/ExtensionStoreBase.vue +0 -0
- package/src/pages/{ExtStore → ExtensionStore}/BaseRoute/index.ts +0 -0
- package/src/pages/{ExtStore → ExtensionStore}/ExtensionPage/index.ts +0 -0
- package/src/pages/{ExtStore → ExtensionStore}/ExtensionsShowcase/index.ts +0 -0
- package/src/pages/{ExtStore → ExtensionStore}/InstalledExtensions/index.ts +0 -0
- package/src/pages/{_layouts/permissionDenied.vue → PermissionDenied/PermissionDenied.vue} +0 -0
- package/src/pages/Union/{Connection/ConnectionPage.vue → ConnectionAgreement/ConnectionAgreementPage.vue} +0 -0
- package/src/{widgets/Cooperative/Contributions → pages/Union/InstallCooperative}/index.ts +0 -0
- package/src/pages/{Installer → Union/InstallCooperative}/ui/InstallCooperativePage.vue +0 -0
- package/src/pages/{Installer → Union/InstallCooperative}/ui/index.ts +0 -0
- package/src/{widgets/Cooperative/Participants/ListOfParticipants → pages/User/PaymentsPage}/index.ts +0 -0
- package/src/{components/history → widgets/AccountActions}/AccountLink.vue +0 -0
- package/src/{components/history → widgets/AccountActions}/ActionCell.vue +0 -0
- package/src/{components/history → widgets/AccountActions}/DataCell.vue +0 -0
- package/src/widgets/{IndividualCard → Cooperative/Payments/ListOfPayments}/index.ts +0 -0
- package/src/widgets/{ExtStore/ExtensionCard → ExtensionCard}/index.ts +0 -0
- package/src/widgets/{Request → Marketplace}/CreateChildOrderCard/CreateChildOrderCard.vue +0 -0
- package/src/widgets/{Request → Marketplace}/CreateChildOrderCard/index.ts +0 -0
- package/src/widgets/{Request → Marketplace}/RequestCard/RequestCard.vue +0 -0
- package/src/widgets/{Request → Marketplace}/RequestCard/index.ts +0 -0
- package/src/{entities/Menu → widgets/Marketplace/SupplyOrderRequestCard}/index.ts +1 -1
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/model/index.ts +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/model/types.ts +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Base/index.ts +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/EightStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/FifthStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/FirstStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/FourthStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/SecondStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/SeventhStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/SixthStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/ThirdStep.vue +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/Steps/index.ts +0 -0
- /package/src/widgets/{Request → Marketplace}/SupplyOrderRequestCard/ui/index.ts +0 -0
- /package/src/widgets/{OrganizationCard → Meets/MeetInfoCard}/index.ts +0 -0
- /package/src/widgets/{Union/ListOfCooperatives → Meets/MeetsTable}/index.ts +0 -0
- /package/src/widgets/{Agreementer/RequireAgreements → RequireAgreements}/ui/RequireAgreements.vue +0 -0
- /package/src/widgets/{Agreementer/RequireAgreements → RequireAgreements}/ui/index.ts +0 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
<template lang="pug">
|
2
|
+
div.q-pa-md
|
3
|
+
div.row
|
4
|
+
div.col-md-12.col-xs-12
|
5
|
+
q-card(flat class="card-container q-pa-md")
|
6
|
+
div.row
|
7
|
+
div.col-12.col-md-3.flex.justify-center.align-start
|
8
|
+
AutoAvatar(class="profile-avatar" :username="currentUser.userAccount?.username || 'user'")
|
9
|
+
|
10
|
+
div.col-12.col-md-9
|
11
|
+
div.row
|
12
|
+
div.col-12.info-card
|
13
|
+
div.row.q-mb-md
|
14
|
+
div.col-12
|
15
|
+
div.text-h4.q-mb-xs
|
16
|
+
span(v-if="isIP").q-mr-sm ИП
|
17
|
+
| {{displayName}}
|
18
|
+
q-badge(color="primary" class="user-role") {{role}}
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
CopyableInput(
|
23
|
+
label="Имя аккаунта"
|
24
|
+
standout="bg-teal text-white"
|
25
|
+
dense
|
26
|
+
:model-value="currentUser.userAccount?.username || ''"
|
27
|
+
input-class="q-mt-md"
|
28
|
+
).q-mb-md
|
29
|
+
|
30
|
+
EditableIndividualCard(
|
31
|
+
v-if="userType === 'individual' && individualProfile"
|
32
|
+
:participantData="individualProfile"
|
33
|
+
:readonly="true"
|
34
|
+
)
|
35
|
+
EditableEntrepreneurCard(
|
36
|
+
v-if="userType === 'entrepreneur' && entrepreneurProfile"
|
37
|
+
:participantData="entrepreneurProfile"
|
38
|
+
:readonly="true"
|
39
|
+
)
|
40
|
+
EditableOrganizationCard(
|
41
|
+
v-if="userType === 'organization' && organizationProfile"
|
42
|
+
:participantData="organizationProfile"
|
43
|
+
:readonly="true"
|
44
|
+
)
|
45
|
+
</template>
|
46
|
+
|
47
|
+
<script lang="ts" setup>
|
48
|
+
import { AutoAvatar } from 'src/shared/ui/AutoAvatar';
|
49
|
+
import { useCurrentUserStore } from 'src/entities/User';
|
50
|
+
import type { IEntrepreneurData, IIndividualData, IOrganizationData } from 'src/shared/lib/types/user/IUserData';
|
51
|
+
import { computed } from 'vue';
|
52
|
+
import { EditableIndividualCard } from 'src/shared/ui/EditableIndividualCard';
|
53
|
+
import { EditableEntrepreneurCard } from 'src/shared/ui/EditableEntrepreneurCard';
|
54
|
+
import { EditableOrganizationCard } from 'src/shared/ui/EditableOrganizationCard';
|
55
|
+
import { useDisplayName } from 'src/shared/lib/composables/useDisplayName';
|
56
|
+
import { CopyableInput } from 'src/shared/ui/CopyableInput';
|
57
|
+
import 'src/shared/ui/CardStyles/index.scss';
|
58
|
+
|
59
|
+
const currentUser = useCurrentUserStore();
|
60
|
+
|
61
|
+
const userType = computed(() => currentUser.userAccount?.type);
|
62
|
+
|
63
|
+
const userProfile = computed(() => {
|
64
|
+
return currentUser.userAccount?.private_data as IEntrepreneurData | IIndividualData | IOrganizationData | null;
|
65
|
+
});
|
66
|
+
|
67
|
+
const individualProfile = computed(() => {
|
68
|
+
if (userType.value === 'individual') {
|
69
|
+
return userProfile.value as IIndividualData;
|
70
|
+
}
|
71
|
+
return null;
|
72
|
+
});
|
73
|
+
|
74
|
+
const entrepreneurProfile = computed(() => {
|
75
|
+
if (userType.value === 'entrepreneur') {
|
76
|
+
return userProfile.value as IEntrepreneurData;
|
77
|
+
}
|
78
|
+
return null;
|
79
|
+
});
|
80
|
+
|
81
|
+
const organizationProfile = computed(() => {
|
82
|
+
if (userType.value === 'organization') {
|
83
|
+
return userProfile.value as IOrganizationData;
|
84
|
+
}
|
85
|
+
return null;
|
86
|
+
});
|
87
|
+
|
88
|
+
const { displayName, isIP } = useDisplayName(userProfile.value);
|
89
|
+
|
90
|
+
const role = computed(() => {
|
91
|
+
if (currentUser.userAccount?.role === 'user')
|
92
|
+
return 'Пайщик';
|
93
|
+
else if (currentUser.userAccount?.role === 'member')
|
94
|
+
return 'Член совета';
|
95
|
+
else if (currentUser.userAccount?.role === 'chairman')
|
96
|
+
return 'Председатель совета';
|
97
|
+
else return '';
|
98
|
+
});
|
99
|
+
|
100
|
+
</script>
|
101
|
+
|
102
|
+
<style lang="scss" scoped>
|
103
|
+
.profile-avatar {
|
104
|
+
width: 180px;
|
105
|
+
height: 180px;
|
106
|
+
border-radius: 50%;
|
107
|
+
object-fit: cover;
|
108
|
+
}
|
109
|
+
|
110
|
+
.user-role {
|
111
|
+
font-size: 14px;
|
112
|
+
padding: 4px 8px;
|
113
|
+
}
|
114
|
+
</style>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as ProfilePage } from './ProfilePage.vue';
|
@@ -1 +1 @@
|
|
1
|
-
export {default as UserSettingsPage} from './UserSettingsPage.vue'
|
1
|
+
export { default as UserSettingsPage } from './UserSettingsPage.vue'
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './ui';
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<template lang="pug">
|
2
|
+
div.q-pa-md
|
3
|
+
div.row
|
4
|
+
div.col-md-12.col-xs-12
|
5
|
+
q-card(flat class="card-container q-pa-md")
|
6
|
+
div.row.items-center.q-mb-md
|
7
|
+
div.col-12
|
8
|
+
div.text-h4.q-mb-xs Кошелёк
|
9
|
+
q-badge(color="primary" class="user-role") {{ role }}
|
10
|
+
|
11
|
+
div.row.q-mb-md
|
12
|
+
div.col-12
|
13
|
+
div.info-card
|
14
|
+
div.card-title Неснижаемый остаток
|
15
|
+
div.card-label Заблокировано
|
16
|
+
div.card-value {{ currentUser.participantAccount?.minimum_amount || '0' }}
|
17
|
+
|
18
|
+
div.row
|
19
|
+
div.col-12
|
20
|
+
div.text-h6.q-mb-sm Целевые Программы
|
21
|
+
|
22
|
+
div.row
|
23
|
+
div.col-6.q-pr-sm
|
24
|
+
DepositButton.full-width.card-action-btn
|
25
|
+
div.col-6.q-pl-sm
|
26
|
+
WithdrawButton.full-width.card-action-btn
|
27
|
+
|
28
|
+
div.row.q-mb-md
|
29
|
+
div.col-12
|
30
|
+
div
|
31
|
+
div.info-card.hover(v-for="program_wallet of walletStore.program_wallets" :key="program_wallet.id")
|
32
|
+
div.card-title {{ program_wallet.program_details.title }}
|
33
|
+
div.row
|
34
|
+
div.col-6
|
35
|
+
div.card-label Доступно
|
36
|
+
div.card-value {{program_wallet.available || '0'}}
|
37
|
+
div.col-6
|
38
|
+
div.card-label Заблокировано
|
39
|
+
div.card-value {{program_wallet.blocked || '0'}}
|
40
|
+
|
41
|
+
</template>
|
42
|
+
|
43
|
+
<script lang="ts" setup>
|
44
|
+
import { DepositButton } from 'src/features/Wallet/DepositToWallet';
|
45
|
+
import { WithdrawButton } from 'src/features/Wallet/WithdrawFromWallet';
|
46
|
+
import { useWalletStore } from 'src/entities/Wallet';
|
47
|
+
import { useCurrentUserStore } from 'src/entities/User';
|
48
|
+
import { computed } from 'vue';
|
49
|
+
import 'src/shared/ui/CardStyles/index.scss';
|
50
|
+
|
51
|
+
const walletStore = useWalletStore();
|
52
|
+
const currentUser = useCurrentUserStore();
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
const role = computed(() => {
|
57
|
+
if (currentUser.userAccount?.role === 'user')
|
58
|
+
return 'Пайщик';
|
59
|
+
else if (currentUser.userAccount?.role === 'member')
|
60
|
+
return 'Член совета';
|
61
|
+
else if (currentUser.userAccount?.role === 'chairman')
|
62
|
+
return 'Председатель совета';
|
63
|
+
else return '';
|
64
|
+
});
|
65
|
+
</script>
|
66
|
+
|
67
|
+
<style lang="scss" scoped>
|
68
|
+
.user-role {
|
69
|
+
font-size: 14px;
|
70
|
+
padding: 4px 8px;
|
71
|
+
}
|
72
|
+
</style>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as WalletPage } from './WalletPage.vue';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { useDesktopStore } from 'src/entities/Desktop/model'
|
2
|
+
import { useSystemStore } from 'src/entities/System/model'
|
3
|
+
import { useInitWalletProcess } from 'src/processes/init-wallet'
|
4
|
+
import type { Router } from 'vue-router'
|
5
|
+
import { useBranchOverlayProcess } from '../watch-branch-overlay'
|
6
|
+
import { setupNavigationGuard } from '../navigation-guard-setup'
|
7
|
+
import { useInitExtensionsProcess } from 'src/processes/init-installed-extensions'
|
8
|
+
|
9
|
+
export async function useInitAppProcess(router: Router) {
|
10
|
+
const system = useSystemStore()
|
11
|
+
await system.loadSystemInfo()
|
12
|
+
|
13
|
+
const desktops = useDesktopStore()
|
14
|
+
await desktops.healthCheck()
|
15
|
+
await desktops.loadDesktop()
|
16
|
+
|
17
|
+
// Выбираем активный рабочий стол (например, participant)
|
18
|
+
desktops.selectWorkspace('participant')
|
19
|
+
|
20
|
+
useBranchOverlayProcess()
|
21
|
+
await useInitWalletProcess().run()
|
22
|
+
|
23
|
+
// Регистрируем маршруты рабочего стола
|
24
|
+
desktops.registerWorkspaceMenus(router)
|
25
|
+
setupNavigationGuard(router)
|
26
|
+
|
27
|
+
await useInitExtensionsProcess(router)
|
28
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { Router } from 'vue-router'
|
2
|
+
import { useDesktopStore } from 'src/entities/Desktop/model'
|
3
|
+
|
4
|
+
export async function useInitExtensionsProcess(router: Router) {
|
5
|
+
const store = useDesktopStore()
|
6
|
+
// Загружаем все модули расширений
|
7
|
+
const modules = import.meta.glob('../../../extensions/**/install.{ts,js}')
|
8
|
+
|
9
|
+
for (const path in modules) {
|
10
|
+
const mod = await modules[path]()
|
11
|
+
if (mod?.default) {
|
12
|
+
// Ожидаем, что расширение возвращает объект { workspace, routes }
|
13
|
+
const result = await mod.default()
|
14
|
+
if (result?.workspace && result?.routes?.length) {
|
15
|
+
// Записываем маршруты в соответствующий workspace
|
16
|
+
store.setRoutes(result.workspace, result.routes)
|
17
|
+
// Регистрируем маршруты в router, добавляя их в базовый родительский маршрут (например, "base")
|
18
|
+
const baseRoute = router.getRoutes().find(r => r.name === 'base')
|
19
|
+
if (baseRoute) {
|
20
|
+
result.routes.forEach((r: any) => router.addRoute('base', r))
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// processes/init-wallet/index.ts
|
2
|
+
import { useSessionStore } from 'src/entities/Session'
|
3
|
+
import { useCurrentUserStore } from 'src/entities/User'
|
4
|
+
import { useWalletStore } from 'src/entities/Wallet'
|
5
|
+
import { useSystemStore } from 'src/entities/System/model'
|
6
|
+
import { useAccountStore } from 'src/entities/Account/model'
|
7
|
+
|
8
|
+
export function useInitWalletProcess() {
|
9
|
+
const session = useSessionStore()
|
10
|
+
const user = useCurrentUserStore()
|
11
|
+
const wallet = useWalletStore()
|
12
|
+
const { info } = useSystemStore()
|
13
|
+
const account = useAccountStore()
|
14
|
+
|
15
|
+
const run = async () => {
|
16
|
+
await session.init()
|
17
|
+
|
18
|
+
if (!session.isAuth) return
|
19
|
+
|
20
|
+
try {
|
21
|
+
await account.getAccount(session.username)
|
22
|
+
|
23
|
+
await user.loadProfile(session.username, info.coopname)
|
24
|
+
|
25
|
+
await wallet.loadUserWallet({
|
26
|
+
coopname: info.coopname,
|
27
|
+
username: session.username,
|
28
|
+
})
|
29
|
+
|
30
|
+
session.loadComplete = true
|
31
|
+
} catch (e) {
|
32
|
+
console.error(e)
|
33
|
+
}
|
34
|
+
|
35
|
+
// фоновая проверка каждые 10 сек
|
36
|
+
setTimeout(run, 10_000)
|
37
|
+
}
|
38
|
+
|
39
|
+
return { run }
|
40
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Router } from 'vue-router'
|
2
|
+
import { useSessionStore } from 'src/entities/Session'
|
3
|
+
import { useCurrentUserStore } from 'src/entities/User'
|
4
|
+
import { useDesktopStore } from 'src/entities/Desktop/model'
|
5
|
+
import { useSystemStore } from 'src/entities/System/model'
|
6
|
+
|
7
|
+
function hasAccess(to, userAccount) {
|
8
|
+
if (!to.meta?.roles || to.meta?.roles.length === 0) return true
|
9
|
+
return userAccount && to.meta?.roles.includes(userAccount.role)
|
10
|
+
}
|
11
|
+
|
12
|
+
export function setupNavigationGuard(router: Router) {
|
13
|
+
const desktops = useDesktopStore()
|
14
|
+
const session = useSessionStore()
|
15
|
+
const currentUser = useCurrentUserStore()
|
16
|
+
const { info } = useSystemStore()
|
17
|
+
|
18
|
+
router.beforeEach(async (to, from, next) => {
|
19
|
+
await desktops.healthCheck()
|
20
|
+
|
21
|
+
// если требуется установка
|
22
|
+
if (desktops.health?.status === 'install' && to.name !== 'install') {
|
23
|
+
next({ name: 'install', params: { coopname: info.coopname } })
|
24
|
+
return
|
25
|
+
}
|
26
|
+
|
27
|
+
// редирект с index
|
28
|
+
if (to.name === 'index') {
|
29
|
+
const homePage =
|
30
|
+
session.isAuth && currentUser.isRegistrationComplete
|
31
|
+
? desktops.currentDesktop?.authorizedHome
|
32
|
+
: desktops.currentDesktop?.nonAuthorizedHome
|
33
|
+
|
34
|
+
next({ name: homePage, params: { coopname: info.coopname } })
|
35
|
+
return
|
36
|
+
}
|
37
|
+
|
38
|
+
// проверка по ролям
|
39
|
+
if (hasAccess(to, currentUser.userAccount)) {
|
40
|
+
next()
|
41
|
+
} else {
|
42
|
+
next({ name: 'permissionDenied' })
|
43
|
+
}
|
44
|
+
})
|
45
|
+
}
|
@@ -0,0 +1,275 @@
|
|
1
|
+
import { Cooperative, SovietContract } from 'cooptypes'
|
2
|
+
import { useGenerateFreeDecision } from 'src/features/FreeDecision/GenerateDecision'
|
3
|
+
import { useGenerateParticipantApplicationDecision } from 'src/features/Decision/ParticipantApplication'
|
4
|
+
import { useGenerateSovietDecisionOnAnnualMeet } from 'src/features/Meet/GenerateSovietDecision/model'
|
5
|
+
import { useSystemStore } from 'src/entities/System/model'
|
6
|
+
import { useSessionStore } from 'src/entities/Session'
|
7
|
+
import { useGlobalStore } from 'src/shared/store'
|
8
|
+
import { useVoteForDecision } from 'src/features/Decision/VoteForDecision'
|
9
|
+
import { useVoteAgainstDecision } from 'src/features/Decision/VoteAgainstDecision'
|
10
|
+
import { computed } from 'vue'
|
11
|
+
import { useAgendaStore } from 'src/entities/Agenda/model'
|
12
|
+
import type { IAgenda } from 'src/entities/Agenda/model'
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Процесс обработки решений
|
16
|
+
* Координирует работу различных фич для генерации и обработки решений различных типов
|
17
|
+
*/
|
18
|
+
export function useDecisionProcessor() {
|
19
|
+
const { info } = useSystemStore()
|
20
|
+
const session = useSessionStore()
|
21
|
+
const agendaStore = useAgendaStore()
|
22
|
+
|
23
|
+
// Данные повестки и состояние загрузки
|
24
|
+
const decisions = computed(() => agendaStore.agenda)
|
25
|
+
const loading = computed(() => agendaStore.loading)
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Форматирует заголовок вопроса
|
29
|
+
*/
|
30
|
+
function formatDecisionTitle(title: string, user: any) {
|
31
|
+
let result = 'Вопрос на голосование'
|
32
|
+
|
33
|
+
if (user.first_name) {
|
34
|
+
result = `${title} от ${user.last_name} ${user.first_name} ${user.middle_name}`
|
35
|
+
} else {
|
36
|
+
result = `${title} от ${user.short_name}`
|
37
|
+
}
|
38
|
+
|
39
|
+
return result
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Получает заголовок документа из агрегата
|
44
|
+
*/
|
45
|
+
function getDocumentTitle(row: IAgenda) {
|
46
|
+
// Используем только агрегаты документов
|
47
|
+
if (row.documents?.statement?.documentAggregate?.rawDocument?.full_title) {
|
48
|
+
return row.documents.statement.documentAggregate.rawDocument.full_title
|
49
|
+
}
|
50
|
+
|
51
|
+
if (row.documents?.decision?.documentAggregate?.rawDocument?.full_title) {
|
52
|
+
return row.documents.decision.documentAggregate.rawDocument.full_title
|
53
|
+
}
|
54
|
+
|
55
|
+
// Поддержка исходного формата для таблицы
|
56
|
+
if (row.table?.statement?.meta && typeof row.table.statement.meta === 'string') {
|
57
|
+
try {
|
58
|
+
const meta = JSON.parse(row.table.statement.meta)
|
59
|
+
if (meta.title) return meta.title
|
60
|
+
} catch (e) {
|
61
|
+
// Игнорируем ошибку парсинга JSON
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return 'Вопрос без заголовка'
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Загружает список вопросов на повестке
|
70
|
+
*/
|
71
|
+
async function loadDecisions(coopname: string, hidden = false) {
|
72
|
+
try {
|
73
|
+
const result = await agendaStore.loadAgenda({ coopname }, hidden)
|
74
|
+
return result
|
75
|
+
} catch (error) {
|
76
|
+
throw error
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Получает хеш документа из агрегата
|
82
|
+
*/
|
83
|
+
function getDocumentHash(row: IAgenda) {
|
84
|
+
// Используем только агрегаты документов
|
85
|
+
if (row.documents?.statement?.documentAggregate?.rawDocument?.hash) {
|
86
|
+
return row.documents.statement.documentAggregate.rawDocument.hash
|
87
|
+
}
|
88
|
+
|
89
|
+
if (row.documents?.decision?.documentAggregate?.rawDocument?.hash) {
|
90
|
+
return row.documents.decision.documentAggregate.rawDocument.hash
|
91
|
+
}
|
92
|
+
|
93
|
+
// Поддержка исходного формата для таблицы
|
94
|
+
if (row.table?.statement?.hash) {
|
95
|
+
return row.table.statement.hash
|
96
|
+
}
|
97
|
+
|
98
|
+
return null
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Генерирует документ решения в зависимости от его типа
|
103
|
+
*/
|
104
|
+
async function generateDecisionDocument(row: IAgenda) {
|
105
|
+
if (!row.table?.id || !row.table?.username || !row.table?.type) {
|
106
|
+
throw new Error('Некорректные данные решения')
|
107
|
+
}
|
108
|
+
|
109
|
+
const decision_id = Number(row.table.id)
|
110
|
+
const username = row.table.username
|
111
|
+
const type = row.table.type
|
112
|
+
const registry_id = Cooperative.Document.decisionsRegistry[type]
|
113
|
+
|
114
|
+
// Генерация документа в зависимости от типа решения
|
115
|
+
let document
|
116
|
+
|
117
|
+
if (registry_id === Cooperative.Registry.FreeDecision.registry_id) {
|
118
|
+
const unparsedDocumentMeta = row.table.statement.meta == '' ? '{}' : row.table.statement.meta
|
119
|
+
const parsedDocumentMeta = JSON.parse(unparsedDocumentMeta) as Cooperative.Registry.FreeDecision.Action
|
120
|
+
const project_id = parsedDocumentMeta.project_id
|
121
|
+
|
122
|
+
const { generateFreeDecision } = useGenerateFreeDecision()
|
123
|
+
document = await generateFreeDecision({
|
124
|
+
username: username,
|
125
|
+
decision_id: decision_id,
|
126
|
+
project_id: project_id
|
127
|
+
})
|
128
|
+
}
|
129
|
+
else if (registry_id === Cooperative.Registry.DecisionOfParticipantApplication.registry_id) {
|
130
|
+
const { generateParticipantApplicationDecision } = useGenerateParticipantApplicationDecision()
|
131
|
+
document = await generateParticipantApplicationDecision({
|
132
|
+
username: username,
|
133
|
+
decision_id: decision_id
|
134
|
+
})
|
135
|
+
}
|
136
|
+
else if (registry_id === Cooperative.Registry.AnnualGeneralMeetingSovietDecision.registry_id) {
|
137
|
+
const { generateSovietDecisionOnAnnualMeet } = useGenerateSovietDecisionOnAnnualMeet()
|
138
|
+
document = await generateSovietDecisionOnAnnualMeet({
|
139
|
+
username: username,
|
140
|
+
})
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
throw new Error('Неизвестный тип решения')
|
144
|
+
}
|
145
|
+
|
146
|
+
if (!document) {
|
147
|
+
throw new Error('Ошибка при генерации документа решения')
|
148
|
+
}
|
149
|
+
|
150
|
+
return document
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Авторизует и выполняет решение
|
155
|
+
*/
|
156
|
+
async function authorizeAndExecuteDecision(row: IAgenda) {
|
157
|
+
if (!row.table?.id) {
|
158
|
+
throw new Error('Некорректные данные решения')
|
159
|
+
}
|
160
|
+
|
161
|
+
const decision_id = Number(row.table.id)
|
162
|
+
|
163
|
+
// Генерируем документ решения
|
164
|
+
const document = await generateDecisionDocument(row)
|
165
|
+
|
166
|
+
// Подписываем документ
|
167
|
+
const signed_hash_of_document = useGlobalStore().signDigest(document.hash)
|
168
|
+
const chainDocument: Cooperative.Document.IChainDocument = {
|
169
|
+
hash: document.hash,
|
170
|
+
meta: JSON.stringify(document.meta),
|
171
|
+
signature: signed_hash_of_document.signature,
|
172
|
+
public_key: signed_hash_of_document.public_key,
|
173
|
+
}
|
174
|
+
|
175
|
+
// Подготавливаем данные для транзакций
|
176
|
+
const authorizeData: SovietContract.Actions.Decisions.Authorize.IAuthorize = {
|
177
|
+
coopname: info.coopname,
|
178
|
+
chairman: session.username,
|
179
|
+
decision_id,
|
180
|
+
document: chainDocument,
|
181
|
+
}
|
182
|
+
|
183
|
+
const execData: SovietContract.Actions.Decisions.Exec.IExec = {
|
184
|
+
executer: session.username,
|
185
|
+
coopname: info.coopname,
|
186
|
+
decision_id: decision_id,
|
187
|
+
}
|
188
|
+
|
189
|
+
// Выполняем транзакции
|
190
|
+
await useGlobalStore().transact([
|
191
|
+
{
|
192
|
+
account: SovietContract.contractName.production,
|
193
|
+
name: SovietContract.Actions.Decisions.Authorize.actionName,
|
194
|
+
authorization: [
|
195
|
+
{
|
196
|
+
actor: session.username,
|
197
|
+
permission: 'active',
|
198
|
+
},
|
199
|
+
],
|
200
|
+
data: authorizeData,
|
201
|
+
},
|
202
|
+
{
|
203
|
+
account: SovietContract.contractName.production,
|
204
|
+
name: SovietContract.Actions.Decisions.Exec.actionName,
|
205
|
+
authorization: [
|
206
|
+
{
|
207
|
+
actor: session.username,
|
208
|
+
permission: 'active',
|
209
|
+
},
|
210
|
+
],
|
211
|
+
data: execData,
|
212
|
+
},
|
213
|
+
])
|
214
|
+
|
215
|
+
return true
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Голосовать "за" решение
|
220
|
+
*/
|
221
|
+
async function voteForDecision(decision_id: number) {
|
222
|
+
const { voteForDecision: vote } = useVoteForDecision()
|
223
|
+
await vote(decision_id)
|
224
|
+
return true
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Голосовать "против" решения
|
229
|
+
*/
|
230
|
+
async function voteAgainstDecision(decision_id: number) {
|
231
|
+
await useVoteAgainstDecision().voteAgainstDecision({
|
232
|
+
coopname: info.coopname,
|
233
|
+
member: session.username,
|
234
|
+
decision_id,
|
235
|
+
})
|
236
|
+
return true
|
237
|
+
}
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Проверяет, проголосовал ли текущий пользователь "за" решение
|
241
|
+
*/
|
242
|
+
function isVotedFor(decision: SovietContract.Tables.Decisions.IDecision) {
|
243
|
+
return decision.votes_for.includes(session.username)
|
244
|
+
}
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Проверяет, проголосовал ли текущий пользователь "против" решения
|
248
|
+
*/
|
249
|
+
function isVotedAgainst(decision: SovietContract.Tables.Decisions.IDecision) {
|
250
|
+
return decision.votes_against.includes(session.username)
|
251
|
+
}
|
252
|
+
|
253
|
+
/**
|
254
|
+
* Проверяет, проголосовал ли текущий пользователь за решение каким-либо образом
|
255
|
+
*/
|
256
|
+
function isVotedAny(decision: SovietContract.Tables.Decisions.IDecision) {
|
257
|
+
return isVotedAgainst(decision) || isVotedFor(decision)
|
258
|
+
}
|
259
|
+
|
260
|
+
return {
|
261
|
+
decisions,
|
262
|
+
loading,
|
263
|
+
loadDecisions,
|
264
|
+
generateDecisionDocument,
|
265
|
+
authorizeAndExecuteDecision,
|
266
|
+
voteForDecision,
|
267
|
+
voteAgainstDecision,
|
268
|
+
isVotedFor,
|
269
|
+
isVotedAgainst,
|
270
|
+
isVotedAny,
|
271
|
+
formatDecisionTitle,
|
272
|
+
getDocumentTitle,
|
273
|
+
getDocumentHash
|
274
|
+
}
|
275
|
+
}
|