Fix 3 loi nghiem trong: eval() -> safe parser, Contract::saved() infinite loop, DB Transaction for schedule generation

This commit is contained in:
2026-04-28 08:04:30 +00:00
parent 49aa20a634
commit e229da5e8c
7 changed files with 361 additions and 78 deletions

View File

@@ -17,8 +17,9 @@ class FormTemplateForm
{
return $schema
->components([
// BLOCK 1: Thông tin cơ bản
// SECTION 1: Full width, field chia 3 cột
Section::make('Thông tin biểu mẫu')
->columnSpanFull()
->schema([
Grid::make(3)
->schema([
@@ -39,10 +40,7 @@ class FormTemplateForm
'App\Models\Customer' => 'Khách hàng',
])
->required(),
]),
Grid::make(3)
->schema([
Select::make('paper_size')
->label('Khổ giấy')
->options([
@@ -55,8 +53,9 @@ class FormTemplateForm
]),
]),
// BLOCK 2: Danh sách trường dữ liệu
// SECTION 2: Full width, Repeater item chia 3 cột
Section::make('Danh sách trường dữ liệu (Merge Fields)')
->columnSpanFull()
->schema([
Repeater::make('fields')
->relationship('fields')
@@ -84,10 +83,7 @@ class FormTemplateForm
])
->required()
->live(),
]),
Grid::make(3)
->schema([
KeyValue::make('source_config')
->label('Cấu hình nguồn')
->keyLabel('Tham số')
@@ -117,13 +113,13 @@ class FormTemplateForm
->numeric()
->default(0)
->visible(fn ($get) => in_array($get('format'), ['number', 'currency', 'percent'])),
]),
TextInput::make('display_order')
->label('Thứ tự')
->numeric()
->default(0)
->hidden(),
TextInput::make('display_order')
->label('Thứ tự')
->numeric()
->default(0)
->hidden(),
]),
])
->addActionLabel('Thêm trường dữ liệu')
->reorderable()
@@ -133,15 +129,17 @@ class FormTemplateForm
->columnSpanFull(),
]),
// BLOCK 3: Nội dung mẫu in - FULL WIDTH, TO RỘNG
// SECTION 3: Full width, RichEditor to
Section::make('Nội dung mẫu in')
->columnSpanFull()
->schema([
RichEditor::make('html_template')
->label('')
->required()
->placeholder('Soạn thảo nội dung biểu mẫu...')
->helperText('Chèn trường dữ liệu bằng cú pháp {{ma_truong}}. Ví dụ: Tên khách hàng: {{ten_khach_hang}}')
->columnSpanFull(),
->columnSpanFull()
->extraInputAttributes(['style' => 'min-height: 500px;']),
]),
]);
}