feat: Add payment information fields and media handling for proposal template and banner in CooperationResource
This commit is contained in:
parent
7e1c688c78
commit
b97b8a3708
@ -16,6 +16,7 @@
|
||||
use App\Models\Cooperation;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Infolists\Components\ImageEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
@ -25,6 +26,7 @@
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Joaopaulolndev\FilamentPdfViewer\Infolists\Components\PdfViewerEntry;
|
||||
use UnitEnum;
|
||||
|
||||
class CooperationResource extends Resource
|
||||
@ -94,7 +96,7 @@ public static function infolist(Schema $schema): Schema
|
||||
TextEntry::make('title')
|
||||
->label('Judul'),
|
||||
|
||||
Grid::make(4)
|
||||
Grid::make(3)
|
||||
->schema([
|
||||
TextEntry::make('initial_submission_date')
|
||||
->label('Tanggal Pengajuan Awal')
|
||||
@ -113,24 +115,31 @@ public static function infolist(Schema $schema): Schema
|
||||
->label('Deadline Verifikasi')
|
||||
->date('l, d F Y')
|
||||
->placeholder('Belum ditentukan'),
|
||||
|
||||
TextEntry::make('payment_amount')
|
||||
->label('Jumlah Pembayaran')
|
||||
->money('IDR')
|
||||
->placeholder('Belum ditentukan'),
|
||||
|
||||
TextEntry::make('payment_date')
|
||||
->label('Tanggal Pembayaran')
|
||||
->date('l, d F Y')
|
||||
->placeholder('Belum dibayar'),
|
||||
]),
|
||||
|
||||
Section::make('Informasi Pembayaran')
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
TextEntry::make('payment_amount')
|
||||
->label('Jumlah Pembayaran')
|
||||
->money('IDR')
|
||||
->placeholder('Belum ditentukan'),
|
||||
PdfViewerEntry::make('proposal_template')
|
||||
->label('Template Proposal')
|
||||
->getStateUsing(fn ($record) => optional($record->getMedia('cooperations')->where('custom_properties.doc_type', 'proposal-template')->sortByDesc('created_at')->first())->getPathRelativeToRoot())
|
||||
->disk(config('filesystems.default')),
|
||||
|
||||
TextEntry::make('payment_date')
|
||||
->label('Tanggal Pembayaran')
|
||||
->date('l, d F Y')
|
||||
->placeholder('Belum dibayar'),
|
||||
]),
|
||||
])
|
||||
->visible(fn ($record) => $record->payment_amount || $record->payment_date),
|
||||
ImageEntry::make('banner')
|
||||
->label('Banner')
|
||||
->getStateUsing(fn ($record) => optional($record->getMedia('banners')->sortByDesc('created_at')->first())->getPathRelativeToRoot())
|
||||
->disk(config('filesystems.default'))
|
||||
->visible(fn ($record) => $record->getMedia('banners')->isNotEmpty()),
|
||||
]),
|
||||
|
||||
TextEntry::make('description')
|
||||
->label('Deskripsi')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user