feat:문서양식관리 기능 추가 및 권한 토글 개선
- 문서양식관리 CRUD 기능 구현 (생산관리 > 문서양식관리) - 결재라인, 섹션, 컬럼 동적 관리 (Vanilla JS) - 섹션별 이미지 업로드 기능 - SortableJS 드래그앤드롭 순서 변경 - 문서 미리보기 모달 - document_type 글로벌 코드 추가 (품질, 생산, 영업, 구매, 일반, 기타) - 역할/부서 권한 토글 시 페이지 새로고침 방지 (hx-swap="none") Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
69
app/Models/DocumentTemplate.php
Normal file
69
app/Models/DocumentTemplate.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DocumentTemplate extends Model
|
||||
{
|
||||
use HasFactory, BelongsToTenant, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'name',
|
||||
'category',
|
||||
'title',
|
||||
'company_name',
|
||||
'company_address',
|
||||
'company_contact',
|
||||
'footer_remark_label',
|
||||
'footer_judgement_label',
|
||||
'footer_judgement_options',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'footer_judgement_options' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* 결재라인
|
||||
*/
|
||||
public function approvalLines(): HasMany
|
||||
{
|
||||
return $this->hasMany(DocumentTemplateApprovalLine::class, 'template_id')
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본 필드
|
||||
*/
|
||||
public function basicFields(): HasMany
|
||||
{
|
||||
return $this->hasMany(DocumentTemplateBasicField::class, 'template_id')
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 검사 기준서 섹션
|
||||
*/
|
||||
public function sections(): HasMany
|
||||
{
|
||||
return $this->hasMany(DocumentTemplateSection::class, 'template_id')
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 컬럼
|
||||
*/
|
||||
public function columns(): HasMany
|
||||
{
|
||||
return $this->hasMany(DocumentTemplateColumn::class, 'template_id')
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user