Drobne poprawki
This commit is contained in:
parent
74d53c800e
commit
76c13be9e9
@ -276,10 +276,10 @@ $notificationConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_not
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php $result = $selectedAttempt['result'] ?? []; ?>
|
||||
<div class="d-flex justify-content-between gap-3 mb-4 align-items-start">
|
||||
<div>
|
||||
<div class="attempt-header d-flex flex-wrap justify-content-between gap-3 mb-4 align-items-start">
|
||||
<div class="attempt-identity">
|
||||
<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>
|
||||
</div>
|
||||
<div class="score-chip text-end">
|
||||
|
||||
@ -554,7 +554,7 @@ function diagnostic_default_report_copy(array $attempt): array
|
||||
'strengths' => diagnostic_report_list($strengths),
|
||||
'priorities' => diagnostic_report_list($priorities),
|
||||
'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
|
||||
{
|
||||
$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'] ?? []);
|
||||
$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>'
|
||||
. $prioritiesHtml
|
||||
. '<h2 style="font-size:18px;line-height:1.3;margin:28px 0 12px;color:#111827;">Rekomendowane kolejne kroki</h2>'
|
||||
. $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>';
|
||||
. $nextStepsHtml;
|
||||
|
||||
return diagnostic_email_document(
|
||||
(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) {
|
||||
$lines[] = '- ' . $item;
|
||||
}
|
||||
$lines[] = '';
|
||||
$lines[] = (string)($copy['closing'] ?? '');
|
||||
return diagnostic_report_limit(implode("\n", $lines), 10000);
|
||||
return diagnostic_report_limit(rtrim(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
|
||||
@ -754,14 +772,32 @@ function diagnostic_store_report_content(int $attemptId, array $package): void
|
||||
|
||||
function diagnostic_cached_report_content(array $attempt): ?array
|
||||
{
|
||||
$subject = diagnostic_report_limit((string)($attempt['report_subject'] ?? ''), 255);
|
||||
$html = (string)($attempt['report_html'] ?? '');
|
||||
$text = (string)($attempt['report_text'] ?? '');
|
||||
$package = diagnostic_strip_legacy_report_cta([
|
||||
'subject' => (string)($attempt['report_subject'] ?? ''),
|
||||
'html' => (string)($attempt['report_html'] ?? ''),
|
||||
'text' => (string)($attempt['report_text'] ?? ''),
|
||||
]);
|
||||
|
||||
$subject = $package['subject'];
|
||||
$html = $package['html'];
|
||||
$text = $package['text'];
|
||||
|
||||
if ($subject === '' || $html === '' || $text === '') {
|
||||
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 [
|
||||
'success' => true,
|
||||
'subject' => $subject,
|
||||
|
||||
@ -214,6 +214,25 @@ h6 {
|
||||
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-check-input,
|
||||
.answer-card,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user