diff --git a/resources/views/approvals/create.blade.php b/resources/views/approvals/create.blade.php index e772f874..3f759d55 100644 --- a/resources/views/approvals/create.blade.php +++ b/resources/views/approvals/create.blade.php @@ -172,6 +172,13 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm fon const formBodyTemplates = @json($forms->pluck('body_template', 'id')); const linesData = @json($lines); +function escapeHtml(str) { + if (!str) return ''; + const div = document.createElement('div'); + div.appendChild(document.createTextNode(str)); + return div.innerHTML; +} + function toggleEditor() { const useEditor = document.getElementById('useEditor').checked; const textarea = document.getElementById('body'); @@ -274,9 +281,9 @@ function updateApprovalLineSummary() { cards.push( '
' + - '
' + stepLabel + '
' + - (position ? '
' + position + '
' : '') + - '
' + s.user_name + '
' + + '
' + escapeHtml(stepLabel) + '
' + + (position ? '
' + escapeHtml(position) + '
' : '') + + '
' + escapeHtml(s.user_name) + '
' + '
' ); }); diff --git a/resources/views/approvals/edit.blade.php b/resources/views/approvals/edit.blade.php index d9fc7515..fed2e480 100644 --- a/resources/views/approvals/edit.blade.php +++ b/resources/views/approvals/edit.blade.php @@ -206,6 +206,13 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm fon const formBodyTemplates = @json($forms->pluck('body_template', 'id')); const linesData = @json($lines); +function escapeHtml(str) { + if (!str) return ''; + const div = document.createElement('div'); + div.appendChild(document.createTextNode(str)); + return div.innerHTML; +} + function toggleEditor() { const useEditor = document.getElementById('useEditor').checked; const textarea = document.getElementById('body'); @@ -308,9 +315,9 @@ function updateApprovalLineSummary() { cards.push( '
' + - '
' + stepLabel + '
' + - (position ? '
' + position + '
' : '') + - '
' + s.user_name + '
' + + '
' + escapeHtml(stepLabel) + '
' + + (position ? '
' + escapeHtml(position) + '
' : '') + + '
' + escapeHtml(s.user_name) + '
' + '
' ); });