share ticket and ticket message
This commit is contained in:
1 parent
39e64854b8
commit
79fe1cddbb
35 files changed
+1742
-95
No files matched your search
@@ -0,0 +1,254 @@
|
||||
/* Staff-only sharing controls; native details also work without JavaScript. */
|
||||
.staff-share-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
flex: 0 0 16px;
|
||||
}
|
||||
.staff-share-chevron {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
flex: 0 0 6px;
|
||||
margin-inline-start: auto;
|
||||
border-inline-end: 1.5px solid currentColor;
|
||||
border-bottom: 1.5px solid currentColor;
|
||||
transform: rotate(45deg);
|
||||
opacity: .65;
|
||||
}
|
||||
.staff-message-share[open] > summary .staff-share-chevron,
|
||||
.staff-ticket-share[open] > summary .staff-share-chevron,
|
||||
.staff-sharing-audit[open] > summary .staff-share-chevron,
|
||||
.staff-share-group[open] > summary .staff-share-chevron,
|
||||
.share-audit-row[open] > summary .staff-share-chevron {
|
||||
transform: rotate(225deg);
|
||||
}
|
||||
.staff-message-share > summary,
|
||||
.staff-ticket-share > summary,
|
||||
.staff-sharing-audit summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
color: var(--staff-text, #123a63);
|
||||
font-size: .75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.staff-message-share > summary::-webkit-details-marker,
|
||||
.staff-ticket-share > summary::-webkit-details-marker,
|
||||
.staff-sharing-audit summary::-webkit-details-marker { display: none; }
|
||||
.staff-message-share > summary:focus-visible,
|
||||
.staff-ticket-share > summary:focus-visible,
|
||||
.staff-sharing-audit summary:focus-visible,
|
||||
.staff-sharing-link:focus-visible {
|
||||
outline: 2px solid var(--color-sea, #0693e3);
|
||||
outline-offset: 3px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.staff-message-share { margin-top: 10px; min-width: 0; }
|
||||
.staff-message-share > summary {
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
min-height: 32px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid #cbd8e6;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
font-size: .6875rem;
|
||||
}
|
||||
.staff-message-share[open] > summary,
|
||||
.staff-message-share > summary:hover { background: #f0f6fc; border-color: #98b8d7; }
|
||||
.staff-share-content {
|
||||
margin-top: 8px;
|
||||
padding: 12px;
|
||||
border: 1px solid #dce5ee;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
color: var(--staff-text, #123a63);
|
||||
min-width: 0;
|
||||
}
|
||||
.staff-message-share .staff-share-hint,
|
||||
.staff-ticket-share .staff-share-hint,
|
||||
.staff-sharing-audit .staff-share-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: .6875rem;
|
||||
line-height: 1.9;
|
||||
color: var(--staff-muted, #526b85);
|
||||
white-space: normal;
|
||||
}
|
||||
.staff-share-content .staff-share-form {
|
||||
display: grid;
|
||||
gap: 7px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.staff-share-form label { font-size: .75rem; font-weight: 600; margin: 3px 0 0; }
|
||||
.staff-share-form select,
|
||||
.staff-share-form textarea {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
border: 1px solid #cbd8e6;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: var(--staff-text, #123a63);
|
||||
font-size: .75rem;
|
||||
line-height: 1.8;
|
||||
padding: 7px 9px;
|
||||
}
|
||||
.staff-share-form textarea { resize: vertical; min-height: 64px; }
|
||||
.staff-share-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; }
|
||||
.staff-share-footer small { color: var(--staff-muted, #526b85); font-size: .625rem; }
|
||||
.staff-share-form .staff-share-submit {
|
||||
width: auto;
|
||||
margin-inline-start: auto;
|
||||
padding: 7px 11px;
|
||||
border-radius: 8px;
|
||||
background: var(--color-ink, #08376b);
|
||||
color: #fff;
|
||||
font-size: .6875rem;
|
||||
line-height: 1.8;
|
||||
font-weight: 600;
|
||||
}
|
||||
.ticket-operations .staff-ticket-share { padding: 0; border: 0; border-radius: 0; margin-top: 12px; }
|
||||
.staff-ticket-share > summary { min-height: 36px; padding: 8px 10px; border: 1px solid #d2dfeb; border-radius: 9px; background: #f6f9fc; }
|
||||
.staff-ticket-share > summary:hover { background: #eef4fa; }
|
||||
.workspace-side .staff-sharing-audit { padding: 0; overflow: hidden; }
|
||||
.staff-sharing-audit > .staff-sharing-audit-toggle { padding: 12px; min-height: 54px; }
|
||||
.staff-sharing-audit-toggle > span:not(.staff-share-chevron) { display: grid; gap: 3px; }
|
||||
.staff-sharing-audit-toggle strong { font-size: .8125rem; }
|
||||
.staff-sharing-audit-toggle small { font-size: .625rem; color: var(--staff-muted, #526b85); font-weight: 400; }
|
||||
.staff-sharing-audit > summary:hover { background: #f6f9fc; }
|
||||
.staff-sharing-audit-content { padding: 0 12px 12px; }
|
||||
.staff-share-group { margin-top: 8px; border-top: 1px solid #e4ebf2; }
|
||||
.staff-share-group > summary { min-height: 40px; padding: 8px 0; }
|
||||
.staff-share-count { border-radius: 6px; background: #eef3f8; color: #526b85; padding: 1px 6px; font-size: .625rem; font-weight: 500; }
|
||||
.share-audit-row { border: 1px solid #dce5ee; border-radius: 9px; margin-top: 7px; overflow-wrap: anywhere; }
|
||||
.share-audit-row > summary { padding: 9px; gap: 6px; font-weight: 400; }
|
||||
.staff-share-person { display: grid; gap: 3px; min-width: 0; flex: 1; }
|
||||
.staff-share-person b { font-size: .6875rem; font-weight: 600; }
|
||||
.staff-share-person small { font-size: .625rem; color: var(--staff-muted, #526b85); }
|
||||
.staff-share-status { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: .5625rem; line-height: 1.6; max-width: 94px; flex-shrink: 0; }
|
||||
.staff-share-status::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
|
||||
.staff-share-status.is-seen { color: #176548; background: #edf7f1; }
|
||||
.staff-share-status.is-pending { color: #805b17; background: #fff7e8; }
|
||||
.staff-share-status.is-revoked { color: #637287; background: #f0f2f5; }
|
||||
.staff-share-row-content { display: grid; gap: 7px; padding: 10px; border-top: 1px solid #e4ebf2; }
|
||||
.staff-share-row-content small,
|
||||
.share-event-row small { font-size: .625rem; line-height: 1.9; color: var(--staff-muted, #526b85); }
|
||||
.staff-share-row-content p,
|
||||
.share-event-row p { font-size: .6875rem; line-height: 1.9; white-space: pre-wrap; }
|
||||
.staff-share-preview { color: var(--staff-text, #123a63); }
|
||||
.staff-share-note { padding: 8px; background: #f5f8fb; border-radius: 7px; }
|
||||
.staff-share-reference { overflow-wrap: anywhere; font-size: .5625rem !important; }
|
||||
.staff-share-row-content .staff-share-revoke {
|
||||
padding: 5px 9px;
|
||||
border: 1px solid #ead5d5;
|
||||
border-radius: 7px;
|
||||
background: #fff;
|
||||
color: #9c3636;
|
||||
font-size: .625rem;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.staff-share-row-content .staff-share-revoke:hover { background: #fff4f4; border-color: #cf9898; }
|
||||
.staff-sharing-audit .staff-share-empty { margin: 4px 0 8px; font-size: .6875rem; color: var(--staff-muted, #526b85); }
|
||||
.share-event-row { display: grid; gap: 4px; padding: 8px 10px; margin: 8px 0; border-inline-start: 2px solid #d2dfeb; overflow-wrap: anywhere; }
|
||||
.share-event-row b,
|
||||
.share-event-row > span { font-size: .6875rem; }
|
||||
.staff-sharing-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; margin-bottom: 12px; border-radius: 8px; color: var(--staff-text, #123a63); font-size: .75rem; }
|
||||
.staff-sharing-link:hover { background: #fff; }
|
||||
.staff-sharing-page { max-width: 960px; margin: 0 auto; display: grid; gap: 20px; }
|
||||
.staff-sharing-page > header { display: grid; gap: 8px; }
|
||||
.staff-sharing-page h1 { font-size: 1.7rem; font-weight: 800; }
|
||||
.staff-sharing-page h2 { font-weight: 700; margin-bottom: 16px; }
|
||||
.share-inbox-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid #dce5ee; }
|
||||
.share-inbox-row p { margin: 6px 0; white-space: pre-wrap; }
|
||||
.share-inbox-row small { color: #52677d; }
|
||||
.staff-sharing-page .button { display: inline-flex; justify-content: center; padding: 8px 12px; border-radius: 9px; font-size: .75rem; flex-shrink: 0; }
|
||||
.isolated-shared-message > header { display: flex; justify-content: space-between; gap: 12px; }
|
||||
.isolated-shared-message > p { margin: 18px 0; line-height: 2; overflow-wrap: anywhere; }
|
||||
.isolated-shared-message img { max-width: 100%; height: auto; }
|
||||
@media (max-width: 640px) {
|
||||
.share-inbox-row { align-items: stretch; flex-direction: column; }
|
||||
.isolated-shared-message > header { flex-direction: column; }
|
||||
.staff-sharing-page { gap: 14px; }
|
||||
.staff-message-share > summary { min-height: 40px; }
|
||||
.staff-share-form .staff-share-submit,
|
||||
.staff-share-row-content .staff-share-revoke { min-height: 40px; }
|
||||
}
|
||||
|
||||
/* One compact footer and one icon; management opens only for this message. */
|
||||
.staff-message-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
|
||||
.staff-message-footer:has(.message-receipts) { border-top: 1px solid #e4ebf2; padding-top: 4px; }
|
||||
.staff-message-footer .message-receipts { flex: 1; min-width: 0; margin: 0 !important; padding: 0; border: 0; }
|
||||
.message-bubble:has(.message-menu) .staff-message-footer { padding-inline-end: 24px; }
|
||||
.staff-message-footer .staff-message-share { margin: 0; }
|
||||
.staff-message-share[open] { flex-basis: 100%; min-width: 0; }
|
||||
.staff-message-share > summary {
|
||||
position: relative;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
min-height: 28px;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
border-radius: 7px;
|
||||
}
|
||||
.staff-message-share > summary .staff-share-icon { width: 15px; height: 15px; flex-basis: 15px; }
|
||||
.staff-share-dot { position: absolute; top: 3px; inset-inline-end: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--color-sea, #0693e3); }
|
||||
.staff-message-share .staff-share-content { max-width: 360px; padding: 10px; margin-top: 5px; }
|
||||
.staff-inline-share-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
|
||||
.staff-inline-share-heading b { font-size: .75rem; }
|
||||
.staff-inline-share-heading small { font-size: .625rem; color: var(--staff-muted, #526b85); }
|
||||
.staff-message-share .share-audit-row { margin-top: 4px; }
|
||||
.staff-message-share .share-audit-row > summary,
|
||||
.staff-inline-share-new > summary,
|
||||
.staff-inline-share-history > summary,
|
||||
.staff-share-note-field > summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
color: var(--staff-text, #123a63);
|
||||
font-size: .6875rem;
|
||||
}
|
||||
.staff-message-share .share-audit-row > summary { padding: 6px 8px; min-height: 32px; }
|
||||
.staff-message-share .share-audit-row > summary::-webkit-details-marker,
|
||||
.staff-inline-share-new > summary::-webkit-details-marker,
|
||||
.staff-inline-share-history > summary::-webkit-details-marker,
|
||||
.staff-share-note-field > summary::-webkit-details-marker { display: none; }
|
||||
.staff-inline-share-new,
|
||||
.staff-inline-share-history { margin-top: 8px; padding-top: 5px; border-top: 1px solid #e4ebf2; }
|
||||
.staff-inline-share-new > summary,
|
||||
.staff-inline-share-history > summary,
|
||||
.staff-share-note-field > summary { min-height: 28px; }
|
||||
.staff-share-note-field label { display: block; margin-bottom: 4px; }
|
||||
.staff-message-share .staff-share-footer { margin-top: 0; }
|
||||
.staff-message-share .staff-share-submit { padding: 5px 12px; min-height: 28px; }
|
||||
.staff-message-share .staff-share-row-content { padding: 8px; gap: 4px; }
|
||||
.staff-message-share .staff-share-row-content p { margin: 0; }
|
||||
.staff-inline-share-new[open] > summary .staff-share-chevron,
|
||||
.staff-inline-share-history[open] > summary .staff-share-chevron,
|
||||
.staff-share-note-field[open] > summary .staff-share-chevron { transform: rotate(225deg); }
|
||||
.staff-message-share summary:focus-visible { outline: 2px solid var(--color-sea, #0693e3); outline-offset: 2px; border-radius: 7px; }
|
||||
@media (max-width: 640px) {
|
||||
.staff-message-share > summary { width: 32px; height: 32px; min-height: 32px; }
|
||||
.staff-message-share .staff-share-submit { min-height: 32px; }
|
||||
.staff-message-share .staff-share-row-content .staff-share-revoke { min-height: 32px; }
|
||||
}
|
||||
|
||||
.staff-menu [data-share-unread-count], .staff-mobile-dock [data-share-unread-count] {
|
||||
display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
|
||||
height: 20px; border-radius: 7px; padding: 0 5px; background: #f59e0b;
|
||||
color: #08376b; font-size: 11px; font-weight: 800; font-style: normal;
|
||||
}
|
||||
.staff-menu [data-share-unread-count] { margin-inline-start: auto; }
|
||||
.staff-mobile-dock a { position: relative; }
|
||||
.staff-mobile-dock [data-share-unread-count] { position: absolute; top: 2px; inset-inline-end: 3px; min-width: 16px; height: 16px; font-size: 9px; }
|
||||
[data-share-unread-count][hidden] { display: none; }
|
||||
.received-share-attribution { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; color: #64748b; font-size: 10px; }
|
||||
.received-share-attribution svg { width: 12px; height: 12px; }
|
||||
.received-share-attribution details { max-width: 100%; }
|
||||
.received-share-attribution summary { cursor: pointer; }
|
||||
@@ -115,9 +115,11 @@ document.querySelectorAll('[data-conversation-workspace]').forEach(workspace=>{
|
||||
if(!data.changed)return;
|
||||
const wasAtBottom=atBottom();
|
||||
const fragment=document.createRange().createContextualFragment(data.html||'');
|
||||
if(data.staff_limited)scroller.querySelectorAll('[data-load-older]').forEach(item=>item.remove());
|
||||
if(data.replace)scroller.querySelectorAll('[data-message],.date-divider,.conversation-empty').forEach(item=>item.remove());
|
||||
else scroller.querySelectorAll('.conversation-empty').forEach(item=>item.remove());
|
||||
scroller.insertBefore(fragment,conversationEnd);
|
||||
if(data.staff_limited)window.htmx?.process(scroller);
|
||||
workspace.dataset.pollVersion=data.version||'';workspace.dataset.pollCursor=data.cursor||'';
|
||||
const count=workspace.querySelector('[data-conversation-count]');if(count)count.textContent=String(data.count??'');
|
||||
workspace.querySelectorAll('[data-ticket-status]').forEach(item=>item.textContent=data.status||item.textContent);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
(() => {
|
||||
const badges = document.querySelectorAll('[data-share-unread-count]');
|
||||
if (!badges.length) return;
|
||||
const workspace = document.querySelector('[data-share-read-url]');
|
||||
const scroller = workspace?.querySelector('[data-conversation]');
|
||||
const countUrl = badges[0].dataset.countUrl;
|
||||
let running = false;
|
||||
const cookie = name => document.cookie.split('; ').find(row => row.startsWith(`${name}=`))?.split('=').slice(1).join('=') || '';
|
||||
const refresh = async () => {
|
||||
if (running || document.visibilityState !== 'visible') return;
|
||||
running = true;
|
||||
try {
|
||||
const ids = [];
|
||||
if (scroller) {
|
||||
const bounds = scroller.getBoundingClientRect();
|
||||
scroller.querySelectorAll('[data-message-id]').forEach(message => {
|
||||
const box = message.getBoundingClientRect();
|
||||
if (box.bottom > Math.max(bounds.top, 0) && box.top < Math.min(bounds.bottom, innerHeight)) ids.push(message.dataset.messageId);
|
||||
});
|
||||
}
|
||||
const body = new URLSearchParams();
|
||||
ids.forEach(id => body.append('message_ids', id));
|
||||
const response = await fetch(workspace?.dataset.shareReadUrl || countUrl, workspace ? {
|
||||
method: 'POST', body, headers: {'X-CSRFToken': cookie('csrftoken')}, cache: 'no-store', credentials: 'same-origin'
|
||||
} : {cache: 'no-store', credentials: 'same-origin'});
|
||||
if (response.status === 403 && workspace) {
|
||||
scroller.querySelectorAll('[data-message], .date-divider, .conversation-empty').forEach(item => item.remove());
|
||||
const notice = document.createElement('p');
|
||||
notice.className = 'conversation-empty';
|
||||
notice.textContent = 'دسترسی به این اشتراک لغو شده است.';
|
||||
scroller.append(notice);
|
||||
workspace.removeAttribute('data-poll-url');
|
||||
const counts = await fetch(countUrl, {cache: 'no-store', credentials: 'same-origin'});
|
||||
if (counts.ok) {
|
||||
const data = await counts.json();
|
||||
badges.forEach(badge => {badge.textContent = data.unread_shares; badge.hidden = !data.unread_shares;});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!response.ok) return;
|
||||
const data = await response.json();
|
||||
badges.forEach(badge => {badge.textContent = data.unread_shares; badge.hidden = !data.unread_shares;});
|
||||
} catch (_) {
|
||||
// A failed request leaves the count and read status available for retry.
|
||||
} finally { running = false; }
|
||||
};
|
||||
scroller?.addEventListener('scroll', refresh, {passive: true});
|
||||
document.addEventListener('visibilitychange', refresh);
|
||||
window.addEventListener('pageshow', refresh);
|
||||
window.addEventListener('focus', refresh);
|
||||
document.body.addEventListener('htmx:afterSwap', refresh);
|
||||
setInterval(refresh, workspace ? 3000 : 15000);
|
||||
refresh();
|
||||
})();
|
||||
Reference in new issue
Block a user