fix(workspace): restore quick-menu handlers for events and docs
This commit is contained in:
@@ -200,11 +200,9 @@ const {
|
|||||||
commEventMode,
|
commEventMode,
|
||||||
commEventSaving,
|
commEventSaving,
|
||||||
commEventError,
|
commEventError,
|
||||||
createCommEvent,
|
createCommEvent: createCommEventInCalendar,
|
||||||
openCommEventModal,
|
openCommEventModal: openCommEventModalInCalendar,
|
||||||
closeCommEventModal,
|
closeCommEventModal: closeCommEventModalInCalendar,
|
||||||
setDefaultCommEventForm,
|
|
||||||
buildCommEventTitle,
|
|
||||||
eventCloseOpen,
|
eventCloseOpen,
|
||||||
eventCloseDraft,
|
eventCloseDraft,
|
||||||
eventCloseSaving,
|
eventCloseSaving,
|
||||||
@@ -247,8 +245,7 @@ const {
|
|||||||
selectedDocument,
|
selectedDocument,
|
||||||
filteredDocuments,
|
filteredDocuments,
|
||||||
updateSelectedDocumentBody,
|
updateSelectedDocumentBody,
|
||||||
createCommDocument,
|
createCommDocument: createCommDocumentInDocuments,
|
||||||
buildCommDocumentTitle,
|
|
||||||
deleteWorkspaceDocumentById,
|
deleteWorkspaceDocumentById,
|
||||||
openDocumentsTab: _openDocumentsTab,
|
openDocumentsTab: _openDocumentsTab,
|
||||||
refetchDocuments,
|
refetchDocuments,
|
||||||
@@ -833,6 +830,63 @@ function openCommDocumentModal() {
|
|||||||
commQuickMenuOpen.value = false;
|
commQuickMenuOpen.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function createCommDocument() {
|
||||||
|
if (!selectedCommThread.value) return;
|
||||||
|
if (!commDraft.value.trim()) {
|
||||||
|
commEventError.value = "Текст документа обязателен";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const created = await createCommDocumentInDocuments(
|
||||||
|
{ id: selectedCommThread.value.id, contact: selectedCommThread.value.contact },
|
||||||
|
commDraft.value,
|
||||||
|
commDocumentForm,
|
||||||
|
authDisplayName.value,
|
||||||
|
{
|
||||||
|
buildScope: (contactId: string, contactName: string) => buildContactDocumentScope(contactId, contactName),
|
||||||
|
onSuccess: () => {},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!created) {
|
||||||
|
commEventError.value = "Не удалось создать документ";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commEventError.value = "";
|
||||||
|
commDraft.value = "";
|
||||||
|
setDefaultCommDocumentForm();
|
||||||
|
commComposerMode.value = "message";
|
||||||
|
commQuickMenuOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openCommEventModal(mode: "planned" | "logged") {
|
||||||
|
if (!selectedCommThread.value) return;
|
||||||
|
openCommEventModalInCalendar(mode, true);
|
||||||
|
commComposerMode.value = mode;
|
||||||
|
commQuickMenuOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeCommEventModal() {
|
||||||
|
closeCommEventModalInCalendar();
|
||||||
|
commComposerMode.value = "message";
|
||||||
|
commQuickMenuOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createCommEvent() {
|
||||||
|
const contactName = selectedCommThread.value?.contact ?? "";
|
||||||
|
const draftText = commDraft.value;
|
||||||
|
const created = await createCommEventInCalendar(contactName, draftText);
|
||||||
|
if (!created) return;
|
||||||
|
commDraft.value = "";
|
||||||
|
commComposerMode.value = "message";
|
||||||
|
commQuickMenuOpen.value = false;
|
||||||
|
if (selectedCommThreadId.value) {
|
||||||
|
void refreshSelectedClientTimeline(selectedCommThreadId.value);
|
||||||
|
}
|
||||||
|
void refetchContacts();
|
||||||
|
}
|
||||||
|
|
||||||
function toggleCommQuickMenu() {
|
function toggleCommQuickMenu() {
|
||||||
if (!selectedCommThread.value || commEventSaving.value) return;
|
if (!selectedCommThread.value || commEventSaving.value) return;
|
||||||
commQuickMenuOpen.value = !commQuickMenuOpen.value;
|
commQuickMenuOpen.value = !commQuickMenuOpen.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user