feat(branding): v2.7.0 logo specifique optionnel pour UCP avec repli sur logo principal ou NexusPBX
This commit is contained in:
1 parent
ddbaabb657
commit
ba04af32bb
7 files changed
+130
-32
No files matched your search
+40
-4
@@ -243,6 +243,7 @@ function renderAll() {
|
||||
function renderCompanyBranding() {
|
||||
const s = appState.settings || {};
|
||||
const logo = (s.company_logo || '').trim();
|
||||
const ucpLogo = (s.ucp_logo || '').trim();
|
||||
const name = (s.company_name || '').trim();
|
||||
|
||||
const emptyBox = document.getElementById('sidebar-company-empty');
|
||||
@@ -270,6 +271,21 @@ function renderCompanyBranding() {
|
||||
}
|
||||
}
|
||||
|
||||
const ucpPreviewImg = document.getElementById('settings-ucp-preview-img');
|
||||
const ucpPreviewEmpty = document.getElementById('settings-ucp-preview-empty');
|
||||
if (ucpPreviewImg && ucpPreviewEmpty) {
|
||||
if (ucpLogo) {
|
||||
ucpPreviewImg.src = ucpLogo;
|
||||
ucpPreviewImg.classList.remove('hidden');
|
||||
ucpPreviewEmpty.classList.add('hidden');
|
||||
} else {
|
||||
ucpPreviewImg.src = '';
|
||||
ucpPreviewImg.classList.add('hidden');
|
||||
ucpPreviewEmpty.textContent = logo ? 'Hérite du logo principal' : 'NexusPBX par défaut';
|
||||
ucpPreviewEmpty.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
if (logo || name) {
|
||||
emptyBox?.classList.add('hidden');
|
||||
filledBox?.classList.remove('hidden');
|
||||
@@ -321,7 +337,11 @@ function triggerCompanyLogoPicker() {
|
||||
document.getElementById('company-logo-file-input')?.click();
|
||||
}
|
||||
|
||||
function handleCompanyLogoUpload(input) {
|
||||
function triggerUcpLogoPicker() {
|
||||
document.getElementById('ucp-logo-file-input')?.click();
|
||||
}
|
||||
|
||||
function uploadBrandingLogo(input, fieldName) {
|
||||
const file = input?.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
@@ -335,7 +355,7 @@ function handleCompanyLogoUpload(input) {
|
||||
reader.onload = async (ev) => {
|
||||
const dataUrl = String(ev.target?.result || '');
|
||||
try {
|
||||
const res = await apiCall('save_company_branding', { company_logo: dataUrl });
|
||||
const res = await apiCall('save_company_branding', { [fieldName]: dataUrl });
|
||||
showToast(res.message, 'success');
|
||||
await loadState();
|
||||
} catch (err) {
|
||||
@@ -347,9 +367,17 @@ function handleCompanyLogoUpload(input) {
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
async function clearCompanyLogo() {
|
||||
function handleCompanyLogoUpload(input) {
|
||||
uploadBrandingLogo(input, 'company_logo');
|
||||
}
|
||||
|
||||
function handleUcpLogoUpload(input) {
|
||||
uploadBrandingLogo(input, 'ucp_logo');
|
||||
}
|
||||
|
||||
async function clearBrandingLogo(fieldName) {
|
||||
try {
|
||||
const res = await apiCall('save_company_branding', { company_logo: '' });
|
||||
const res = await apiCall('save_company_branding', { [fieldName]: '' });
|
||||
showToast(res.message, 'info');
|
||||
await loadState();
|
||||
} catch (err) {
|
||||
@@ -357,6 +385,14 @@ async function clearCompanyLogo() {
|
||||
}
|
||||
}
|
||||
|
||||
function clearCompanyLogo() {
|
||||
clearBrandingLogo('company_logo');
|
||||
}
|
||||
|
||||
function clearUcpLogo() {
|
||||
clearBrandingLogo('ucp_logo');
|
||||
}
|
||||
|
||||
function renderSummaryCards() {
|
||||
const exts = appState.extensions || [];
|
||||
const grps = appState.groups || [];
|
||||
|
||||
Reference in new issue
Block a user