- AI 2단계 분석: 고객 인터뷰 → 요구사항 추출 → 견적 산출 - 모델 확장: AiQuotation(모드/견적번호), AiQuotationItem(규격/단가/금액) - AiQuotePriceTable 모델 신규 생성 - Create 페이지: 모듈/제조 모드 탭, 제품 카테고리, 고객 정보 입력 - Show 페이지: 제조 모드 분기 렌더링 (품목/금액/고객정보) - Edit 페이지: 품목 인라인 편집, 할인/부가세/조건 입력 - Document: 한국 표준 제조업 견적서 양식 템플릿 - Controller/Route: update 엔드포인트, edit 라우트 추가
75 lines
1.7 KiB
PHP
75 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Rd;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AiQuotationItem extends Model
|
|
{
|
|
protected $table = 'ai_quotation_items';
|
|
|
|
protected $fillable = [
|
|
'ai_quotation_id',
|
|
'module_id',
|
|
'module_code',
|
|
'module_name',
|
|
'specification',
|
|
'unit',
|
|
'quantity',
|
|
'unit_price',
|
|
'total_price',
|
|
'item_category',
|
|
'floor_code',
|
|
'is_required',
|
|
'reason',
|
|
'dev_cost',
|
|
'monthly_fee',
|
|
'sort_order',
|
|
'options',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_required' => 'boolean',
|
|
'options' => 'array',
|
|
'dev_cost' => 'decimal:0',
|
|
'monthly_fee' => 'decimal:0',
|
|
'quantity' => 'decimal:2',
|
|
'unit_price' => 'decimal:2',
|
|
'total_price' => 'decimal:2',
|
|
];
|
|
|
|
public function quotation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiQuotation::class, 'ai_quotation_id');
|
|
}
|
|
|
|
public function module(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiQuotationModule::class, 'module_id');
|
|
}
|
|
|
|
public function getFormattedDevCostAttribute(): string
|
|
{
|
|
return number_format((int) $this->dev_cost).'원';
|
|
}
|
|
|
|
public function getFormattedMonthlyFeeAttribute(): string
|
|
{
|
|
return number_format((int) $this->monthly_fee).'원';
|
|
}
|
|
|
|
public function getOption(string $key, $default = null)
|
|
{
|
|
return data_get($this->options, $key, $default);
|
|
}
|
|
|
|
public function setOption(string $key, $value): void
|
|
{
|
|
$options = $this->options ?? [];
|
|
data_set($options, $key, $value);
|
|
$this->options = $options;
|
|
$this->save();
|
|
}
|
|
}
|