fix(workspace): restore quick-menu handlers for events and docs
This commit is contained in:
@@ -200,11 +200,9 @@ const {
|
||||
commEventMode,
|
||||
commEventSaving,
|
||||
commEventError,
|
||||
createCommEvent,
|
||||
openCommEventModal,
|
||||
closeCommEventModal,
|
||||
setDefaultCommEventForm,
|
||||
buildCommEventTitle,
|
||||
createCommEvent: createCommEventInCalendar,
|
||||
openCommEventModal: openCommEventModalInCalendar,
|
||||
closeCommEventModal: closeCommEventModalInCalendar,
|
||||
eventCloseOpen,
|
||||
eventCloseDraft,
|
||||
eventCloseSaving,
|
||||
@@ -247,8 +245,7 @@ const {
|
||||
selectedDocument,
|
||||
filteredDocuments,
|
||||
updateSelectedDocumentBody,
|
||||
createCommDocument,
|
||||
buildCommDocumentTitle,
|
||||
createCommDocument: createCommDocumentInDocuments,
|
||||
deleteWorkspaceDocumentById,
|
||||
openDocumentsTab: _openDocumentsTab,
|
||||
refetchDocuments,
|
||||
@@ -833,6 +830,63 @@ function openCommDocumentModal() {
|
||||
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() {
|
||||
if (!selectedCommThread.value || commEventSaving.value) return;
|
||||
commQuickMenuOpen.value = !commQuickMenuOpen.value;
|
||||
|
||||
Reference in New Issue
Block a user