fix: auto-select recommended logo in master workflow
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
When "Uzbrój firmę" runs automatically, logo step now picks the recommended candidate instead of showing the gallery (which would be overwritten by page reload). Manual "Szukaj logo" still shows the gallery for admin selection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6a623d2b3b
commit
c867962138
@ -973,6 +973,51 @@
|
||||
return runEnrichAction(btn, '/api/gbp/audit', {company_id: {{ company.id }}, fetch_google: true});
|
||||
}
|
||||
|
||||
function fetchLogoAuto() {
|
||||
/* Wersja logo dla trybu automatycznego — wybiera rekomendowanego kandydata */
|
||||
var btn = document.getElementById('btn-logo');
|
||||
var original = btn.innerHTML;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner"></span> Szukam logo...';
|
||||
|
||||
return fetch('/api/company/{{ company.id }}/fetch-logo', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'X-CSRFToken': csrfToken},
|
||||
body: JSON.stringify({action: 'fetch'})
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (!data.success || !data.candidates || data.candidates.length === 0) {
|
||||
btn.innerHTML = original;
|
||||
btn.disabled = false;
|
||||
showToast('Logo: brak kandydatów', 'warning');
|
||||
return false;
|
||||
}
|
||||
var pick = (data.recommended_index !== null && data.recommended_index !== undefined)
|
||||
? data.recommended_index : 0;
|
||||
btn.innerHTML = '<span class="spinner"></span> Zapisuję logo...';
|
||||
return fetch('/api/company/{{ company.id }}/fetch-logo', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'X-CSRFToken': csrfToken},
|
||||
body: JSON.stringify({action: 'confirm', index: pick})
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
btn.innerHTML = original;
|
||||
btn.disabled = false;
|
||||
if (res.success) {
|
||||
showToast('Logo zapisane automatycznie (kandydat #' + (pick + 1) + ')', 'success');
|
||||
}
|
||||
return res.success;
|
||||
});
|
||||
})
|
||||
.catch(function() {
|
||||
btn.innerHTML = original;
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function armCompany() {
|
||||
_skipReload = true;
|
||||
var masterBtn = document.getElementById('btn-arm');
|
||||
@ -984,7 +1029,7 @@
|
||||
{id: 'btn-seo', fn: runSeoAudit, skip: {{ 'true' if enrichment.seo.done else 'false' }}, requires: {{ 'true' if company.website else 'false' }} },
|
||||
{id: 'btn-social', fn: runSocialAudit, skip: {{ 'true' if enrichment.social.done else 'false' }}, requires: true },
|
||||
{id: 'btn-gbp', fn: runGbpAudit, skip: {{ 'true' if enrichment.gbp.done else 'false' }}, requires: true },
|
||||
{id: 'btn-logo', fn: fetchLogo, skip: {{ 'true' if enrichment.logo.done else 'false' }}, requires: {{ 'true' if company.website else 'false' }} }
|
||||
{id: 'btn-logo', fn: fetchLogoAuto, skip: {{ 'true' if enrichment.logo.done else 'false' }}, requires: {{ 'true' if company.website else 'false' }} }
|
||||
];
|
||||
|
||||
var pending = steps.filter(function(s) { return !s.skip && s.requires; });
|
||||
@ -993,6 +1038,7 @@
|
||||
showToast('Wszystkie kroki zostały już wykonane!', 'success');
|
||||
masterBtn.disabled = false;
|
||||
masterBtn.innerHTML = '<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="width:22px;height:22px"><path d="M13 10V3L4 14h7v7l9-11h-7z"/></svg> Uzbrój firmę';
|
||||
_skipReload = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user