Giao diện
Cấu hình nâng cao
Cú pháp Carbone placeholder
Template sử dụng cú pháp Carbone cho placeholder. Dữ liệu được truyền vào object d:
Field đơn giản
{d.customerName}
{d.email}
{d.phone}Loop qua mảng
{d.items[i].productName}
{d.items[i].quantity}
{d.items[i].price:formatN(2)}Carbone tự động lặp dòng/hàng trong bảng Word/Excel khi gặp syntax [i].
Format dữ liệu
| Cú pháp | Mô tả | Ví dụ |
|---|---|---|
:formatN(n) | Format số với n chữ số thập phân | {d.total:formatN(2)} → 1,234.56 |
:formatD(pattern) | Format ngày | {d.createdAt:formatD(DD/MM/YYYY)} → 08/04/2026 |
:upper | Chữ hoa | {d.name:upper} → NGUYỄN VĂN A |
:lower | Chữ thường | {d.code:lower} |
Điều kiện
{d.status:ifEQ(approved)}
Nội dung chỉ hiện khi status = approved
{d.status:showEnd}Xử lý hình ảnh và attachment
Plugin tự động resolve attachment field thành hình ảnh nhúng trong template:
- Attachment field chứa URL → server tải file từ storage.
- Hình ảnh được nhúng trực tiếp vào file DOCX/XLSX kết quả.
- Hỗ trợ các format: JPEG, PNG, GIF.
QR code
Plugin tích hợp thư viện qrcode để tạo QR code:
- Đặt placeholder QR trong template.
- Server tạo QR code từ dữ liệu bản ghi (VD: URL, mã đơn hàng).
- QR code được nhúng dưới dạng hình ảnh trong file kết quả.
File storage
Template file được lưu tại storage/print-templates/ trên server filesystem:
| Thao tác | Mô tả |
|---|---|
| Upload | File được copy vào thư mục với tên duy nhất |
| Download | Trả file gốc (chưa render) cho admin |
| Render | Đọc file gốc, render bằng Carbone, trả file kết quả |
ACL — Chi tiết phân quyền
| Quyền | Role | Mô tả |
|---|---|---|
ui.templatePrint | Admin | Snippet cho phép truy cập UI quản lý template |
templatePrint | Admin + Member | Action cho phép thực hiện in |
CRUD printingTemplates | Admin | Quản trị metadata template (upload, xóa, sửa) |
Strategy cài đặt
Khi plugin install, tự động thêm:
templatePrintvào admin role strategy.templatePrintvào member role strategy (user thường cũng có thể in).- CRUD
printingTemplateschỉ cho admin.