diff --git a/app/Filament/Pages/GeneralLedger.php b/app/Filament/Pages/GeneralLedger.php new file mode 100644 index 0000000..60b9393 --- /dev/null +++ b/app/Filament/Pages/GeneralLedger.php @@ -0,0 +1,12 @@ +columns(3), ]), - Section::make('Branches')->schema([ - RepeatableEntry::make('branches') - ->schema([ - TextEntry::make('code')->label('Branch Code'), - TextEntry::make('current_series')->label('Branch Current Series'), - ]) - ->hiddenLabel() - ->grid(2), - ])->collapsible(), + // Section::make('Branches')->schema([ + // RepeatableEntry::make('branches') + // ->schema([ + // TextEntry::make('code')->label('Branch Code'), + // TextEntry::make('current_series')->label('Branch Current Series'), + // ]) + // ->hiddenLabel() + // ->grid(2), + // ])->collapsible(), ]); } - public function getRelationManagers(): array - { - return [ - AccountsRelationManager::class, - TransmittalsRelationManager::class, - ]; - } + // public function getRelationManagers(): array + // { + // return [ + // AccountsRelationManager::class, + // TransmittalsRelationManager::class, + // ]; + // } } diff --git a/app/Filament/Resources/ExpenseResource.php b/app/Filament/Resources/ExpenseResource.php index 474ddf9..ebbdd92 100644 --- a/app/Filament/Resources/ExpenseResource.php +++ b/app/Filament/Resources/ExpenseResource.php @@ -45,18 +45,22 @@ class ExpenseResource extends Resource $set('branch_id', ''); $set('voucher_number', static::getVoucherNumber($get)); }) + ->required() ->live(), Select::make('branch_id') ->relationship('branch', 'code') ->options(fn ($get) => Branch::query()->where('client_id', $get('client'))->get()->pluck('code', 'id')) ->afterStateUpdated(fn ($set, $get) => $set('voucher_number', static::getVoucherNumber($get))) + ->required() ->live(), - TextInput::make('supplier')->label('Supplier Name'), + TextInput::make('supplier')->label('Supplier Name')->required(), TextInput::make('reference_number')->label('Reference Number'), TextInput::make('voucher_number')->label('Voucher Number') ->default(fn ($get) => static::getVoucherNumber($get)) ->readOnly(), - DatePicker::make('happened_on')->label('Date')->native(false), + DatePicker::make('happened_on')->label('Date') + ->required() + ->native(false), TableRepeater::make('transactions') ->headers(fn (Get $get): array => static::getTransactionTableHeader($get)) @@ -81,15 +85,15 @@ class ExpenseResource extends Resource public static function getTransactionTableHeader(Get $get): array { - if (! static::getIsVatable($get)) { - return [ - Header::make('Charge Account'), - Header::make('Description'), - Header::make('Gross Amount'), - Header::make('Withholding Tax'), - Header::make('Net Amount'), - ]; - } + // if (! static::getIsVatable($get)) { + // return [ + // Header::make('Charge Account'), + // Header::make('Description'), + // Header::make('Gross Amount'), + // Header::make('Withholding Tax'), + // Header::make('Net Amount'), + // ]; + // } return [ Header::make('Charge Account'), @@ -104,38 +108,24 @@ class ExpenseResource extends Resource ]; } - public static function getIsVatable(Get $get): bool - { - $client = Client::find($get('client')); - - return $client && $client->vatable; - - } - - public static function isVatable(bool $value): void - { - static::$isVatable = $value; - dump('sett'); - } - public static function getTransactionTableFormSchema(Get $get): array { - if (! static::getIsVatable($get)) { - return [ - Select::make('account_id')->options(fn ($get) => static::getAccountOptions($get)), - TextInput::make('description')->label('Description'), - TextInput::make('gross_amount')->numeric() - ->live() - ->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) { - static::setDefaultFormValues($get, $set, $old, $state); - })->default(0), - TextInput::make('payable_withholding_tax')->numeric()->live() - ->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) { - static::setDefaultFormValues($get, $set, $old, $state); - })->default(0), - TextInput::make('net_amount')->numeric()->default(0), - ]; - } + // if (! static::getIsVatable($get)) { + // return [ + // Select::make('account_id')->options(fn ($get) => static::getAccountOptions($get)), + // TextInput::make('description')->label('Description'), + // TextInput::make('gross_amount')->numeric() + // ->live() + // ->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) { + // static::setDefaultFormValues($get, $set, $old, $state); + // })->default(0), + // TextInput::make('payable_withholding_tax')->numeric()->live() + // ->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) { + // static::setDefaultFormValues($get, $set, $old, $state); + // })->default(0), + // TextInput::make('net_amount')->numeric()->default(0), + // ]; + // } return [ Select::make('account_id')->options(fn ($get) => static::getAccountOptions($get)), @@ -227,6 +217,20 @@ class ExpenseResource extends Resource $set('net_amount', number_format($netAmount, 2)); } + public static function getIsVatable(Get $get): bool + { + $client = Client::find($get('client')); + + return $client && $client->vatable; + + } + + public static function isVatable(bool $value): void + { + static::$isVatable = $value; + dump('sett'); + } + public static function table(Table $table): Table { return $table diff --git a/resources/views/filament/pages/general-ledger.blade.php b/resources/views/filament/pages/general-ledger.blade.php new file mode 100644 index 0000000..b448ffd --- /dev/null +++ b/resources/views/filament/pages/general-ledger.blade.php @@ -0,0 +1,69 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Product name + + Color + + Category + + Price +
+ Apple MacBook Pro 17" + + Silver + + Laptop + + $2999 +
+ Microsoft Surface Pro + + White + + Laptop PC + + $1999 +
+ Magic Mouse 2 + + Black + + Accessories + + $99 +
+
+ +
diff --git a/resources/views/filament/pages/trial-balance.blade.php b/resources/views/filament/pages/trial-balance.blade.php new file mode 100644 index 0000000..708bc1f --- /dev/null +++ b/resources/views/filament/pages/trial-balance.blade.php @@ -0,0 +1,45 @@ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ Account + + Debit Amount + + Credit Amount +
+ Apple MacBook Pro 17" + + $2999 + + $2999 +
+ Total + + $1999 + + $1999 +
+
+ +