Refactor: Create shared AttachmentService and AttachmentModel

- Created common AttachmentService for all modules (app/Services/)
- Created common AttachmentModel (app/Models/)
- Created common migration (app/Database/Migrations/)
- Updated Tasks module to use shared AttachmentService
- Added Twig functions: format_filesize(), get_file_icon()
- Removed duplicate TaskAttachmentModel and task_attachments migration
- AttachmentService can be used by any module: task, deal, contact, etc.
This commit is contained in:
2026-02-08 20:34:11 +00:00
parent 9c4aacefbe
commit 052560c9b4
7 changed files with 226 additions and 74 deletions
+2 -2
View File
@@ -155,13 +155,13 @@
<ul class="list-group list-group-flush mb-3" id="attachments-list">
{% for attachment in task.attachments %}
<li class="list-group-item d-flex align-items-center gap-2" data-attachment-id="{{ attachment.id }}">
<i class="fa-solid fa-file text-muted"></i>
<i class="fa-solid {{ get_file_icon(attachment.file_type) }} text-muted"></i>
<a href="{{ base_url('/tasks/' ~ task.id ~ '/attachments/' ~ attachment.id ~ '/download') }}"
target="_blank" class="flex-grow-1 text-decoration-none">
{{ attachment.file_name }}
</a>
<small class="text-muted">
{{ attachment.file_size|filesize }}
{{ format_filesize(attachment.file_size) }}
</small>
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="deleteAttachment({{ task.id }}, {{ attachment.id }})"