49 lines
1.8 KiB
Markdown
49 lines
1.8 KiB
Markdown
# Management Change Certificate Empty State Review
|
|
|
|
## Summary
|
|
|
|
Updated certificate preview fallback states in training records so the UI never shows a broken image, empty cell, or `-` for missing attachments. The table and certificate manager now use a shared placeholder style with the same certificate icon treatment.
|
|
|
|
## Changes
|
|
|
|
- Added shared empty-state support to `CertificatePlaceholder`
|
|
- Updated training record table preview to show:
|
|
- image preview when previewable image exists
|
|
- certificate placeholder with file type for non-previewable or broken previews
|
|
- certificate placeholder with `ไม่มีไฟล์แนบ` when no file exists
|
|
- Updated certificate manager empty state to use the same placeholder card instead of plain text
|
|
|
|
## Files
|
|
|
|
- `src/features/training-records/components/certificate-preview-utils.tsx`
|
|
- `src/features/training-records/components/training-record-tables/training-record-image-preview.tsx`
|
|
- `src/features/training-records/components/training-record-certificate-manager.tsx`
|
|
|
|
## Behavior
|
|
|
|
Case 1: Previewable image exists
|
|
|
|
- shows image preview
|
|
|
|
Case 2: File exists but is not previewable, or image preview fails
|
|
|
|
- shows certificate icon
|
|
- shows `เกียรติบัตร`
|
|
- shows file type such as `PDF`, `DOC`, `XLS`, `ZIP`
|
|
|
|
Case 3: No file attached
|
|
|
|
- shows certificate icon
|
|
- shows `ไม่มีไฟล์แนบ`
|
|
|
|
## Manual Test Checklist
|
|
|
|
- [ ] Image certificate displays preview.
|
|
- [ ] PDF certificate shows certificate icon and PDF.
|
|
- [ ] DOCX certificate shows certificate icon and DOCX.
|
|
- [ ] Broken image shows certificate icon.
|
|
- [ ] No attachment shows certificate icon and `ไม่มีไฟล์แนบ`.
|
|
- [ ] No table cell displays `-`.
|
|
- [ ] Download/open still works when file exists.
|
|
- [ ] Mobile/table layout does not break.
|