Drobne poprawki
This commit is contained in:
parent
74d53c800e
commit
76c13be9e9
@ -276,10 +276,10 @@ $notificationConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_not
|
|||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php $result = $selectedAttempt['result'] ?? []; ?>
|
<?php $result = $selectedAttempt['result'] ?? []; ?>
|
||||||
<div class="d-flex justify-content-between gap-3 mb-4 align-items-start">
|
<div class="attempt-header d-flex flex-wrap justify-content-between gap-3 mb-4 align-items-start">
|
||||||
<div>
|
<div class="attempt-identity">
|
||||||
<div class="eyebrow mb-2">Szczegóły próby #<?= (int)$selectedAttempt['id'] ?></div>
|
<div class="eyebrow mb-2">Szczegóły próby #<?= (int)$selectedAttempt['id'] ?></div>
|
||||||
<h2 class="h4 mb-1"><?= htmlspecialchars((string)$selectedAttempt['email']) ?></h2>
|
<h2 class="h4 mb-1 attempt-email"><?= htmlspecialchars((string)$selectedAttempt['email']) ?></h2>
|
||||||
<p class="text-secondary mb-0">Rozpoczęto: <?= htmlspecialchars((string)$selectedAttempt['started_at']) ?></p>
|
<p class="text-secondary mb-0">Rozpoczęto: <?= htmlspecialchars((string)$selectedAttempt['started_at']) ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="score-chip text-end">
|
<div class="score-chip text-end">
|
||||||
|
|||||||
@ -554,7 +554,7 @@ function diagnostic_default_report_copy(array $attempt): array
|
|||||||
'strengths' => diagnostic_report_list($strengths),
|
'strengths' => diagnostic_report_list($strengths),
|
||||||
'priorities' => diagnostic_report_list($priorities),
|
'priorities' => diagnostic_report_list($priorities),
|
||||||
'next_steps' => diagnostic_report_list($nextSteps),
|
'next_steps' => diagnostic_report_list($nextSteps),
|
||||||
'closing' => 'Wróć do podsumowania diagnozy, aby omówić wynik z zespołem lub zaplanować kolejny krok wdrożeniowy.',
|
'closing' => '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,9 +658,6 @@ function diagnostic_generate_ai_report_copy(array $attempt): array
|
|||||||
function diagnostic_build_report_html(array $attempt, array $copy): string
|
function diagnostic_build_report_html(array $attempt, array $copy): string
|
||||||
{
|
{
|
||||||
$result = $attempt['result'] ?? [];
|
$result = $attempt['result'] ?? [];
|
||||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
|
||||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
|
||||||
$resultUrl = $scheme . '://' . $host . '/diagnostic.php?view=result';
|
|
||||||
|
|
||||||
$strengthsHtml = diagnostic_email_list($copy['strengths'] ?? []);
|
$strengthsHtml = diagnostic_email_list($copy['strengths'] ?? []);
|
||||||
$prioritiesHtml = diagnostic_email_list($copy['priorities'] ?? []);
|
$prioritiesHtml = diagnostic_email_list($copy['priorities'] ?? []);
|
||||||
@ -686,12 +683,7 @@ function diagnostic_build_report_html(array $attempt, array $copy): string
|
|||||||
. '<h2 style="font-size:18px;line-height:1.3;margin:28px 0 12px;color:#111827;">Priorytety na teraz</h2>'
|
. '<h2 style="font-size:18px;line-height:1.3;margin:28px 0 12px;color:#111827;">Priorytety na teraz</h2>'
|
||||||
. $prioritiesHtml
|
. $prioritiesHtml
|
||||||
. '<h2 style="font-size:18px;line-height:1.3;margin:28px 0 12px;color:#111827;">Rekomendowane kolejne kroki</h2>'
|
. '<h2 style="font-size:18px;line-height:1.3;margin:28px 0 12px;color:#111827;">Rekomendowane kolejne kroki</h2>'
|
||||||
. $nextStepsHtml
|
. $nextStepsHtml;
|
||||||
. '<div style="margin:28px 0 0;padding:18px 20px;border-radius:16px;background:#111827;color:#ffffff;">'
|
|
||||||
. '<div style="font-size:16px;font-weight:700;margin-bottom:6px;">' . diagnostic_email_escape((string)($copy['closing'] ?? '')) . '</div>'
|
|
||||||
. '<div style="font-size:14px;line-height:1.7;opacity:0.88;margin-bottom:14px;">W podsumowaniu online zobaczysz pełen wynik i możesz od razu zostawić numer do kontaktu.</div>'
|
|
||||||
. '<a href="' . diagnostic_email_escape($resultUrl) . '" style="display:inline-block;padding:12px 18px;border-radius:12px;background:#ffffff;color:#111827;text-decoration:none;font-weight:700;">Otwórz podsumowanie diagnozy</a>'
|
|
||||||
. '</div>';
|
|
||||||
|
|
||||||
return diagnostic_email_document(
|
return diagnostic_email_document(
|
||||||
(string)($copy['subject'] ?? 'Raport z diagnozy dojrzałości procesowej'),
|
(string)($copy['subject'] ?? 'Raport z diagnozy dojrzałości procesowej'),
|
||||||
@ -728,9 +720,35 @@ function diagnostic_build_report_text(array $attempt, array $copy): string
|
|||||||
foreach (($copy['next_steps'] ?? []) as $item) {
|
foreach (($copy['next_steps'] ?? []) as $item) {
|
||||||
$lines[] = '- ' . $item;
|
$lines[] = '- ' . $item;
|
||||||
}
|
}
|
||||||
$lines[] = '';
|
return diagnostic_report_limit(rtrim(implode("\n", $lines)), 10000);
|
||||||
$lines[] = (string)($copy['closing'] ?? '');
|
}
|
||||||
return diagnostic_report_limit(implode("\n", $lines), 10000);
|
|
||||||
|
function diagnostic_strip_legacy_report_cta(array $package): array
|
||||||
|
{
|
||||||
|
$subject = diagnostic_report_limit((string)($package['subject'] ?? ''), 255);
|
||||||
|
$html = (string)($package['html'] ?? '');
|
||||||
|
$text = (string)($package['text'] ?? '');
|
||||||
|
|
||||||
|
if ($html !== '') {
|
||||||
|
$html = preg_replace(
|
||||||
|
'~<div style="margin:28px 0 0;padding:18px 20px;border-radius:16px;background:#111827;color:#ffffff;">.*?Otwórz podsumowanie diagnozy</a></div>~su',
|
||||||
|
'',
|
||||||
|
$html
|
||||||
|
) ?? $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($text !== '') {
|
||||||
|
$text = preg_replace('/^.*omówić wynik z zespołem.*$/miu', '', $text) ?? $text;
|
||||||
|
$text = preg_replace('/
|
||||||
|
{3,}/', "\n\n", $text) ?? $text;
|
||||||
|
$text = trim($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'subject' => $subject,
|
||||||
|
'html' => $html,
|
||||||
|
'text' => $text,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function diagnostic_store_report_content(int $attemptId, array $package): void
|
function diagnostic_store_report_content(int $attemptId, array $package): void
|
||||||
@ -754,14 +772,32 @@ function diagnostic_store_report_content(int $attemptId, array $package): void
|
|||||||
|
|
||||||
function diagnostic_cached_report_content(array $attempt): ?array
|
function diagnostic_cached_report_content(array $attempt): ?array
|
||||||
{
|
{
|
||||||
$subject = diagnostic_report_limit((string)($attempt['report_subject'] ?? ''), 255);
|
$package = diagnostic_strip_legacy_report_cta([
|
||||||
$html = (string)($attempt['report_html'] ?? '');
|
'subject' => (string)($attempt['report_subject'] ?? ''),
|
||||||
$text = (string)($attempt['report_text'] ?? '');
|
'html' => (string)($attempt['report_html'] ?? ''),
|
||||||
|
'text' => (string)($attempt['report_text'] ?? ''),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$subject = $package['subject'];
|
||||||
|
$html = $package['html'];
|
||||||
|
$text = $package['text'];
|
||||||
|
|
||||||
if ($subject === '' || $html === '' || $text === '') {
|
if ($subject === '' || $html === '' || $text === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($attempt['id']) && (
|
||||||
|
$subject !== (string)($attempt['report_subject'] ?? '')
|
||||||
|
|| $html !== (string)($attempt['report_html'] ?? '')
|
||||||
|
|| $text !== (string)($attempt['report_text'] ?? '')
|
||||||
|
)) {
|
||||||
|
diagnostic_store_report_content((int)$attempt['id'], [
|
||||||
|
'subject' => $subject,
|
||||||
|
'html' => $html,
|
||||||
|
'text' => $text,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
|
|||||||
@ -214,6 +214,25 @@ h6 {
|
|||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attempt-header {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempt-identity {
|
||||||
|
flex: 1 1 18rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempt-email {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-chip {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.form-control,
|
.form-control,
|
||||||
.form-check-input,
|
.form-check-input,
|
||||||
.answer-card,
|
.answer-card,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user