RSNewWebUI/webui-src/app/mail/mail_attachment.js
defnax a03676c94a Improved mails page
Fixed some issues on mails reply, replay all,forward
Added sort function
Added show per page mails
2026-07-09 15:47:12 +02:00

68 lines
1.7 KiB
JavaScript

const m = require('mithril');
const rs = require('rswebui');
const util = require('mail/mail_util');
const Layout = () => {
const files = [];
let viewChanged = false;
return {
oninit: (v) => {
v.attrs.list.forEach(async (element) => {
const res = await rs.rsJsonApiRequest('/rsMail/getMessage', {
msgId: element.msgId,
});
if (res.body.retval) {
res.body.msg.files.forEach((element) => {
files.push({ ...element, from: res.body.msg.from, ts: res.body.msg.ts });
});
}
});
},
view: (v) => [
m('.widget__heading', [
m('h3', 'Attachments'),
m('.view-toggle', [
m(
'.mail-view',
{
onclick: () => (viewChanged = false),
style: { backgroundColor: viewChanged ? '#fff' : '#019DFF' },
},
m('i.fas.fa-mail-bulk')
),
m(
'.attachment-view',
{
onclick: () => (viewChanged = true),
style: { backgroundColor: viewChanged ? '#019DFF' : '#fff' },
},
m('i.fas.fa-file')
),
]),
]),
m('.widget__body', [
viewChanged
? m(util.AttachmentSection, {
files,
})
: m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
key: msg.msgId,
details: msg,
category: 'attachment',
})
)
)
),
]),
],
};
};
module.exports = Layout;