@rkosafo/cai.components 0.0.70 → 0.0.72
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.
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
toggleArchieve = async (id: string | number) => {
|
|
43
43
|
return { success: false, data: null, error: null } as any;
|
|
44
44
|
},
|
|
45
|
-
toggleAsRead = async (id: string | number) => {
|
|
45
|
+
toggleAsRead = async (id: string | number, type?: MailMarkReadToggleType) => {
|
|
46
46
|
return { success: false, data: null, error: null } as any;
|
|
47
47
|
},
|
|
48
48
|
toggleFavourite = async (id: string | number) => {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
let activeBox = $state<MailingActiveBox>('inbox');
|
|
63
63
|
let pageInfo = new PageInfo();
|
|
64
64
|
let menutItems = $state([
|
|
65
|
-
{ icon: 'bx:bxs-inbox', title: 'Inbox', count:
|
|
65
|
+
{ icon: 'bx:bxs-inbox', title: 'Inbox', count: 0, path: '' },
|
|
66
66
|
{ icon: 'bx:bxs-send', title: 'Sent', count: 0, path: '' }
|
|
67
67
|
]);
|
|
68
68
|
let openDeleteAlert = $state(false);
|
|
@@ -85,7 +85,11 @@
|
|
|
85
85
|
else return false;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
async function fetchData(
|
|
88
|
+
async function fetchData(
|
|
89
|
+
page: number,
|
|
90
|
+
params: TableFilter,
|
|
91
|
+
activeBox: MailingActiveBox = 'inbox'
|
|
92
|
+
) {
|
|
89
93
|
try {
|
|
90
94
|
let currentPage = 0;
|
|
91
95
|
if (params.search) {
|
|
@@ -193,7 +197,7 @@
|
|
|
193
197
|
const results = [];
|
|
194
198
|
|
|
195
199
|
for (const msg of selectedMessages) {
|
|
196
|
-
const res = await toggleAsRead(msg);
|
|
200
|
+
const res = await toggleAsRead(msg, val);
|
|
197
201
|
results.push(res);
|
|
198
202
|
}
|
|
199
203
|
selectedMessages = [];
|
|
@@ -321,6 +325,19 @@
|
|
|
321
325
|
pageInfo.setPageSize(1);
|
|
322
326
|
}
|
|
323
327
|
|
|
328
|
+
async function getIsRead(id: number): Promise<boolean> {
|
|
329
|
+
let status = false;
|
|
330
|
+
try {
|
|
331
|
+
const ret = await readAMessage(id);
|
|
332
|
+
if (!ret?.success) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
status = ret.data?.isRead || false;
|
|
336
|
+
return status;
|
|
337
|
+
} catch (error) {}
|
|
338
|
+
return status;
|
|
339
|
+
}
|
|
340
|
+
|
|
324
341
|
$effect(() => {
|
|
325
342
|
fetchData(pageNumber, { search: query }, activeBox);
|
|
326
343
|
});
|
|
@@ -335,7 +352,7 @@
|
|
|
335
352
|
<div class="loginbox h-14 rounded bg-white px-4">
|
|
336
353
|
<MailToolBar
|
|
337
354
|
isFavoriteActive={false}
|
|
338
|
-
isReadActive={
|
|
355
|
+
isReadActive={async () => await getIsRead(messageSelected)}
|
|
339
356
|
showBackButton={Boolean(messageSelected)}
|
|
340
357
|
{showPagination}
|
|
341
358
|
{showComposeButton}
|
|
@@ -67,7 +67,7 @@ export interface MailingModuleProps {
|
|
|
67
67
|
toggleArchieve?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
68
68
|
toggleSpam?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
69
69
|
deleteEntry?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
70
|
-
toggleAsRead?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
70
|
+
toggleAsRead?: (id: string | number, type?: MailMarkReadToggleType) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
71
71
|
toggleFavourite?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
72
72
|
toggelImportant?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
73
73
|
readAMessage: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
|
|
@@ -107,7 +107,7 @@ export interface MailingMessageCardProps extends MailingMessage {
|
|
|
107
107
|
}
|
|
108
108
|
export type MailingActiveBox = 'inbox' | 'outbox';
|
|
109
109
|
export interface MailingMessageViewerProps {
|
|
110
|
-
readMessage: (id: number) => Promise<CrudResult<MailingMessage>> | CrudResult<MailingMessage> | null;
|
|
110
|
+
readMessage: (id: number, type?: MailingActiveBox) => Promise<CrudResult<MailingMessage>> | CrudResult<MailingMessage> | null;
|
|
111
111
|
recordId: number;
|
|
112
112
|
updatePageInfo?: (val: MailPageInfo) => void;
|
|
113
113
|
showReplies?: boolean;
|