@props([ 'label', 'name', 'value' => '', 'required' => false, 'editor' => false, 'aiAssist' => false, 'attachments' => false, 'attachmentsName' => 'attachments[]', 'attachmentsAccept' => '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx', 'attachmentsHint' => 'Allowed: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX. Max 5MB per file.', 'info' => '', ]) @php $maxAttachmentSizeBytes = 5 * 1024 * 1024; // Always fall back to $name so fields like financial_benefits get a stable id for AI / Summernote hooks. $textareaId = $attributes->get('id') ?? $name; $useEditor = filter_var($editor, FILTER_VALIDATE_BOOLEAN); $aiAssistOn = filter_var($aiAssist, FILTER_VALIDATE_BOOLEAN); // Use truthy check, not has(): :readonly="false" still leaves the key in the bag and would hide AI incorrectly. $aiFieldLocked = filter_var($attributes->get('readonly'), FILTER_VALIDATE_BOOLEAN) || filter_var($attributes->get('disabled'), FILTER_VALIDATE_BOOLEAN); $aiModalId = 'textarea-ai-modal-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $textareaId); $aiPromptInputId = $aiModalId . '-prompt'; $textareaClass = 'form-control' . ($errors->has($name) ? ' is-invalid' : '') . ($useEditor ? ' textarea' : ''); $showAttachments = filter_var($attachments, FILTER_VALIDATE_BOOLEAN); $attachmentsInputId = 'attachments-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $name); $attachmentsListId = 'fileList-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $name); $annexuresName = str_replace(['_attachments[]', '[attachments][]'], ['_annexures[]', '[annexures][]'], $attachmentsName); $annexureAccept = '.jpg,.jpeg,.png'; $annexureContainerId = 'annexure-container-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $name); $annexureInputId = 'annexure-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $name); $annexureListId = 'fileList-annexures-' . preg_replace('/[^a-zA-Z0-9_-]/', '-', $name); @endphp