feat: updates
This commit is contained in:
28
app/Actions/Account/StoreAccount.php
Normal file
28
app/Actions/Account/StoreAccount.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Account;
|
||||
|
||||
use App\Actions\BaseAction;
|
||||
use App\Commands\Account\CreateAccountCommand;
|
||||
use App\DataObjects\CreateAccountDTO;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use LogicException;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class StoreAccount extends BaseAction
|
||||
{
|
||||
public function __construct(private readonly CreateAccountCommand $createAccountCommand) {}
|
||||
|
||||
public function __invoke(CreateAccountDTO|Data $payload, Closure $next)
|
||||
{
|
||||
try {
|
||||
$payload->account = $this->createAccountCommand->execute($payload->data);
|
||||
|
||||
return $next($payload);
|
||||
|
||||
} catch (Exception $exception) {
|
||||
throw new LogicException('Error Storing Account: '.$exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
30
app/Actions/Account/StoreAccountBalance.php
Normal file
30
app/Actions/Account/StoreAccountBalance.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Account;
|
||||
|
||||
use App\Actions\BaseAction;
|
||||
use App\Commands\Account\CreateBalanceCommand;
|
||||
use App\DataObjects\CreateAccountDTO;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use LogicException;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class StoreAccountBalance extends BaseAction
|
||||
{
|
||||
public function __construct(private readonly CreateBalanceCommand $createBalanceCommand) {}
|
||||
|
||||
public function __invoke(CreateAccountDTO|Data $payload, Closure $next)
|
||||
{
|
||||
try {
|
||||
|
||||
$payload->data['account_id'] = $payload->account->id;
|
||||
$payload->balance = $this->createBalanceCommand->execute($payload->data);
|
||||
|
||||
return $next($payload->account);
|
||||
|
||||
} catch (Exception $exception) {
|
||||
throw new LogicException('Error Storing Account Balance: '.$exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,27 +5,28 @@ namespace App\Actions\Branch;
|
||||
use App\Actions\BaseAction;
|
||||
use App\Commands\Branches\CreateBranchCommand;
|
||||
use App\DataObjects\CreateBranchDTO;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use LogicException;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class StoreBranch extends BaseAction
|
||||
{
|
||||
|
||||
public function __construct(private CreateBranchCommand $createBranchCommand) {}
|
||||
public function __construct(private readonly CreateBranchCommand $createBranchCommand) {}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __invoke(CreateBranchDTO | Data $payload, \Closure $next)
|
||||
public function __invoke(CreateBranchDTO|Data $payload, Closure $next)
|
||||
{
|
||||
try {
|
||||
|
||||
$payload->branch = $this->createBranchCommand->execute($payload->data);
|
||||
|
||||
return $next($payload);
|
||||
|
||||
} catch (Exception $exception)
|
||||
{
|
||||
throw new \LogicException('Error Storing Branch: ' . $exception->getMessage());
|
||||
} catch (Exception $exception) {
|
||||
throw new LogicException('Error Storing Branch: '.$exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Commands/Account/CreateAccountCommand.php
Normal file
22
app/Commands/Account/CreateAccountCommand.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands\Account;
|
||||
|
||||
use App\Commands\Command;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateAccountCommand implements Command
|
||||
{
|
||||
public function execute(array $data): mixed
|
||||
{
|
||||
return DB::transaction(
|
||||
callback: fn () => Account::query()->updateOrCreate([
|
||||
'id' => $data['id'] ?? null,
|
||||
'client_id' => $data['client_id'],
|
||||
], Arr::except($data, ['starting_balance', 'branch_id'])),
|
||||
attempts: 2
|
||||
);
|
||||
}
|
||||
}
|
||||
28
app/Commands/Account/CreateBalanceCommand.php
Normal file
28
app/Commands/Account/CreateBalanceCommand.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands\Account;
|
||||
|
||||
use App\Commands\Command;
|
||||
use App\Models\Balance;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateBalanceCommand implements Command
|
||||
{
|
||||
public function execute(array $data): mixed
|
||||
{
|
||||
return DB::transaction(
|
||||
callback: fn () => Balance::query()->updateOrCreate(
|
||||
[
|
||||
'id' => $data['id'] ?? null,
|
||||
'account_id' => $data['account_id'],
|
||||
'is_starting' => isset($data['starting_balance']),
|
||||
'branch_id' => $data['branch_id'] ?? null,
|
||||
],
|
||||
[
|
||||
'balance' => $data['starting_balance'],
|
||||
]
|
||||
),
|
||||
attempts: 2
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,17 @@ namespace App\Commands\Branches;
|
||||
|
||||
use App\Commands\Command;
|
||||
use App\Models\Branch;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateBranchCommand implements Command
|
||||
{
|
||||
public function execute(array $data): \Illuminate\Database\Eloquent\Model
|
||||
public function execute(array $data): Model
|
||||
{
|
||||
return DB::transaction(
|
||||
callback: fn() => Branch::query()->updateOrCreate(['id' => $data['id'] ?? null], Arr::except($data, ['series'])),
|
||||
callback: fn () => Branch::query()->updateOrCreate(['id' => $data['id'] ?? null, 'client_id' => $data['client_id']], Arr::except($data, ['series'])),
|
||||
attempts: 2
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
15
app/DataObjects/CreateAccountDTO.php
Normal file
15
app/DataObjects/CreateAccountDTO.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataObjects;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class CreateAccountDTO extends Data
|
||||
{
|
||||
public function __construct(
|
||||
public array $data,
|
||||
public ?Model $account = null,
|
||||
public ?Model $balance = null,
|
||||
) {}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithDefaultStyles;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
@@ -19,25 +18,21 @@ use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Style;
|
||||
|
||||
class TransmittalsExport implements FromCollection, WithMapping, ShouldAutoSize, ShouldQueue, WithDefaultStyles, WithHeadings
|
||||
class TransmittalsExport implements FromCollection, ShouldAutoSize, ShouldQueue, WithDefaultStyles, WithHeadings, WithMapping
|
||||
{
|
||||
|
||||
use Exportable, Queueable, SerializesModels;
|
||||
|
||||
|
||||
public function __construct(
|
||||
private readonly array $id
|
||||
)
|
||||
{}
|
||||
|
||||
) {}
|
||||
|
||||
public function view(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$transmittals = Transmittal::query()->with(['client','branch', 'files.notes', 'files.remarks'])->whereIn('id', Arr::flatten($this->id))->get();
|
||||
$transmittals = Transmittal::query()->with(['client', 'branch', 'files.notes', 'files.remarks'])->whereIn('id', Arr::flatten($this->id))->get();
|
||||
|
||||
return View::make('transmittal.export.transmittal-export-table')->with(['transmittals' => $transmittals]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -58,37 +53,57 @@ class TransmittalsExport implements FromCollection, WithMapping, ShouldAutoSize,
|
||||
'series',
|
||||
'files',
|
||||
'notes',
|
||||
'remarks'
|
||||
'remarks',
|
||||
];
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$transmittals = Transmittal::query()->with(['client','branch', 'files.notes', 'files.remarks'])
|
||||
->withCount(['files','notes','remarks'])->with(['files' => function($files) {
|
||||
$files->withCount(['notes','remarks']);
|
||||
$transmittals = Transmittal::query()->with(['client', 'branch', 'files.notes', 'files.remarks'])
|
||||
->withCount(['files', 'notes', 'remarks'])->with(['files' => function ($files) {
|
||||
$files->withCount(['notes', 'remarks']);
|
||||
}])
|
||||
->whereIn('id', Arr::flatten($this->id))->get();
|
||||
|
||||
|
||||
|
||||
return $transmittals;
|
||||
}
|
||||
|
||||
public function map($transmittal): array
|
||||
{
|
||||
|
||||
|
||||
|
||||
$data = [];
|
||||
|
||||
|
||||
|
||||
$firstFile = $transmittal->files->first();
|
||||
|
||||
$data[] = [
|
||||
$transmittal->series,
|
||||
$firstFile?->description,
|
||||
$firstFile->notes->first()?->comment,
|
||||
$firstFile->remarks->first()?->remark,
|
||||
];
|
||||
|
||||
$data[] = [$transmittal->series, $firstFile?->description, $firstFile->notes->first()?->comment, $firstFile->remarks->first()?->remark];
|
||||
//iterate comments and remarks for first file
|
||||
$notes = $firstFile->notes->pluck('comment');
|
||||
$remarks = $firstFile->remarks->pluck('remark');
|
||||
|
||||
$fileNoteCount = count($notes);
|
||||
$fileRemarkCount = count($remarks);
|
||||
|
||||
$fileRowCount = $fileNoteCount;
|
||||
if ($fileRemarkCount > $fileNoteCount) {
|
||||
$fileRowCount = $fileRemarkCount;
|
||||
}
|
||||
|
||||
for ($i = 1; $i < $fileRowCount; $i++) {
|
||||
$data[] = [
|
||||
'',
|
||||
'',
|
||||
$notes[$i] ?? '',
|
||||
$remarks[$i] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
//file iteration except for first file
|
||||
$fileRowCounter = 0;
|
||||
foreach ($transmittal->files as $file) {
|
||||
$notes = $file->notes->pluck('comment');
|
||||
@@ -98,20 +113,20 @@ class TransmittalsExport implements FromCollection, WithMapping, ShouldAutoSize,
|
||||
$fileRemarkCount = count($remarks);
|
||||
|
||||
$fileRowCount = $fileNoteCount;
|
||||
if($fileRemarkCount > $fileNoteCount) {
|
||||
if ($fileRemarkCount > $fileNoteCount) {
|
||||
$fileRowCount = $fileRemarkCount;
|
||||
}
|
||||
|
||||
|
||||
if($fileRowCounter != 0) {
|
||||
if ($fileRowCounter != 0) {
|
||||
$data[] = [
|
||||
'',
|
||||
$file->description ,
|
||||
$notes[$fileRowCounter - 1] ?? '',
|
||||
$remarks[$fileRowCounter - 1] ?? '',
|
||||
$file->description,
|
||||
$file->notes->first()?->comment ?? '',
|
||||
$file->remarks->first()?->remark ?? '',
|
||||
];
|
||||
|
||||
for ($i = 0; $i < $fileRowCount; $i++) {
|
||||
//iterate for remaining notes and remarks
|
||||
for ($i = 1; $i < $fileRowCount; $i++) {
|
||||
$data[] = [
|
||||
'',
|
||||
'',
|
||||
@@ -124,10 +139,6 @@ class TransmittalsExport implements FromCollection, WithMapping, ShouldAutoSize,
|
||||
$fileRowCounter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,16 @@
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\BranchResource\Pages;
|
||||
use App\Filament\Resources\BranchResource\RelationManagers;
|
||||
use App\Filament\Resources\BranchResource\RelationManagers\BalancesRelationManager;
|
||||
use App\Models\Branch;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rules\Unique;
|
||||
|
||||
class BranchResource extends Resource
|
||||
{
|
||||
@@ -19,14 +20,34 @@ class BranchResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
Select::make('client_id')->relationship('client', 'id')
|
||||
->getOptionLabelFromRecordUsing(fn ($record) => $record->company)
|
||||
->disabled()
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('code')->required()
|
||||
->unique(
|
||||
'branches',
|
||||
'code',
|
||||
ignoreRecord: true,
|
||||
modifyRuleUsing: fn (Unique $rule) => $rule->where('client_id', app(static::getModel())->id)
|
||||
),
|
||||
|
||||
TextInput::make('series')->label('Current Series')
|
||||
->required()
|
||||
->numeric()
|
||||
->integer()
|
||||
->maxLength(6)
|
||||
->minLength(1)
|
||||
->mask(RawJs::make(<<<'JS'
|
||||
'999999'
|
||||
JS)),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -52,7 +73,8 @@ class BranchResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
// AccountsRelationManager::make(),
|
||||
BalancesRelationManager::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,30 @@
|
||||
namespace App\Filament\Resources\BranchResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BranchResource;
|
||||
use App\Filament\Resources\ClientResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EditBranch extends EditRecord
|
||||
{
|
||||
protected static string $resource = BranchResource::class;
|
||||
|
||||
public function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$data['series'] = $this->getRecord()->current_series;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function handleRecordUpdate(Model $record, array $data): Model
|
||||
{
|
||||
$data['client_id'] = $record->client_id;
|
||||
$data['id'] = $record->id;
|
||||
|
||||
return ClientResource::saveBranch($data);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BranchResource\RelationManagers;
|
||||
|
||||
use App\Models\Account;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
|
||||
class AccountsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'accounts';
|
||||
|
||||
public function getTableQuery(): Builder|Relation|null
|
||||
{
|
||||
return Account::query()->whereHas('balances', function (Builder $query) {
|
||||
$query->where('branch_id', $this->getOwnerRecord()->id);
|
||||
});
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('branch_id')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('branch_id')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('account'),
|
||||
Tables\Columns\TextColumn::make('branch_id'),
|
||||
Tables\Columns\TextColumn::make('normal_balance'),
|
||||
Tables\Columns\TextColumn::make('starting_balance'),
|
||||
Tables\Columns\TextColumn::make('current_balance'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BranchResource\RelationManagers;
|
||||
|
||||
use App\DataObjects\CreateAccountDTO;
|
||||
use App\Models\Account;
|
||||
use App\Models\AccountType;
|
||||
use App\Processes\Account\CreateAccountProcess;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
|
||||
class BalancesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'balances';
|
||||
|
||||
protected static ?string $title = 'Account Balances';
|
||||
|
||||
public function getTableQuery(): Builder|Relation|null
|
||||
{
|
||||
return Account::query()->whereHas('balances', function (Builder $query) {
|
||||
$query->where('branch_id', $this->getOwnerRecord()->id);
|
||||
});
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('branch_id')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('account')->sortable(),
|
||||
Tables\Columns\TextColumn::make('accountType.normal_balance')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'Debit' => 'success',
|
||||
'Credit' => 'danger',
|
||||
})
|
||||
->sortable()
|
||||
->formatStateUsing(fn ($state): string => ucfirst($state)),
|
||||
Tables\Columns\TextColumn::make('starting_balance')->label('Starting Balance'),
|
||||
Tables\Columns\TextColumn::make('current_balance')->label('Current Balance'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make()
|
||||
->using(fn (array $data) => $this->saveAccount($data)),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function saveAccount(array $data): Account
|
||||
{
|
||||
$data['branch_id'] = $this->getOwnerRecord()->id;
|
||||
$data['normal_balance'] = $data['normal_balance'] ?? AccountType::find($data['account_type_id'])?->normal_balance;
|
||||
$data['client_id'] = $this->getOwnerRecord()->client_id;
|
||||
$payload = new CreateAccountDTO(data: $data);
|
||||
|
||||
return app(CreateAccountProcess::class)->run($payload);
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema($this->getAccountForm())
|
||||
->columns(1);
|
||||
}
|
||||
|
||||
public function getAccountForm(): array
|
||||
{
|
||||
return [
|
||||
Forms\Components\Grid::make()
|
||||
->schema([
|
||||
Forms\Components\Select::make('account_type_id')
|
||||
->label('Account Type')
|
||||
->relationship('accountType', 'type'),
|
||||
Forms\Components\TextInput::make('account'),
|
||||
Forms\Components\Textarea::make('description'),
|
||||
Forms\Components\TextInput::make('starting_balance')
|
||||
->integer(),
|
||||
])->columns(1),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
|
||||
use App\DataObjects\CreateBranchDTO;
|
||||
use App\Filament\Resources\ClientResource\Pages\EditClient;
|
||||
use App\Filament\Resources\ClientResource\Pages\ListClients;
|
||||
use App\Filament\Resources\ClientResource\Pages\ViewClient;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\AccountsRelationManager;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\BranchesRelationManager;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\TransmittalsRelationManager;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Client;
|
||||
use App\Processes\Branch\CreateBranchProcess;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Infolists\Components\Grid;
|
||||
use Filament\Infolists\Components\Section;
|
||||
use Filament\Infolists\Components\Split;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Infolists\Infolist;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -28,7 +28,7 @@ class ClientResource extends Resource
|
||||
|
||||
public static function authorizeView(Model $record): void
|
||||
{
|
||||
parent::authorizeView($record); // TODO: Change the autogenerated stub
|
||||
parent::authorizeView($record);
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
@@ -43,7 +43,7 @@ class ClientResource extends Resource
|
||||
Forms\Components\Select::make('type_id')
|
||||
->relationship('type', 'type')
|
||||
->label('Type')->required(),
|
||||
])->columns(2)
|
||||
])->columns(2),
|
||||
])->columns(3);
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ class ClientResource extends Resource
|
||||
Tables\Filters\Filter::make('Vatable')
|
||||
->query(fn (Builder $query) => $query->orWhereHas('type', function (Builder $query) {
|
||||
$query->where('type', 'Vatable');
|
||||
}) ),
|
||||
})),
|
||||
Tables\Filters\Filter::make('Non-Vatable')
|
||||
->query(fn (Builder $query) => $query->orWhereHas('type', function (Builder $query) {
|
||||
$query->where('type', 'Non Vatable');
|
||||
}) )
|
||||
})),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()->requiresConfirmation()
|
||||
Tables\Actions\DeleteAction::make()->requiresConfirmation(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
@@ -79,23 +79,29 @@ class ClientResource extends Resource
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
AccountsRelationManager::class,
|
||||
BranchesRelationManager::class,
|
||||
TransmittalsRelationManager::class
|
||||
TransmittalsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'view' => \App\Filament\Resources\ClientResource\Pages\ViewClient:: route('/{record}'),
|
||||
'edit' => \App\Filament\Resources\ClientResource\Pages\EditClient::route('/{record}/edit'),
|
||||
'index' => \App\Filament\Resources\ClientResource\Pages\ListClients::route('/'),
|
||||
'view' => ViewClient::route('/{record}'),
|
||||
'edit' => EditClient::route('/{record}/edit'),
|
||||
'index' => ListClients::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function saveBranch($data): Branch
|
||||
{
|
||||
$createBranchProcess = new CreateBranchProcess;
|
||||
$payload = new CreateBranchDTO(data: $data);
|
||||
|
||||
return $createBranchProcess->run($payload)->branch;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,7 @@ namespace App\Filament\Resources\ClientResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ClientResource;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\AccountsRelationManager;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\BranchesRelationManager;
|
||||
use App\Filament\Resources\ClientResource\RelationManagers\TransmittalsRelationManager;
|
||||
use App\Models\Account;
|
||||
use App\Models\Transmittal;
|
||||
use Filament\Actions;
|
||||
use Filament\Infolists\Components\Grid;
|
||||
use Filament\Infolists\Components\RepeatableEntry;
|
||||
use Filament\Infolists\Components\Section;
|
||||
@@ -41,8 +37,8 @@ class ViewClient extends ViewRecord
|
||||
TextEntry::make('current_series')->label('Branch Current Series'),
|
||||
])
|
||||
->hiddenLabel()
|
||||
->grid(2)
|
||||
])->collapsible()
|
||||
->grid(2),
|
||||
])->collapsible(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ class AccountsRelationManager extends RelationManager
|
||||
Forms\Components\TextInput::make('account')->required(),
|
||||
Forms\Components\Textarea::make('description')->nullable(),
|
||||
Forms\Components\Select::make('account_type_id')
|
||||
->relationship('accountType','type')
|
||||
->relationship('accountType', 'type')
|
||||
->required(),
|
||||
Forms\Components\Select::make('normal_balance')->options(
|
||||
['debit' => 'Debit','credit' => 'Credit']
|
||||
)->required()
|
||||
['debit' => 'Debit', 'credit' => 'Credit']
|
||||
)->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class AccountsRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('client_id')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('account')->description(fn (Account $record): string => $record->description),
|
||||
Tables\Columns\TextColumn::make('account')->description(fn (Account $record): string => $record->description ?? ''),
|
||||
Tables\Columns\TextColumn::make('accountType.type'),
|
||||
Tables\Columns\TextColumn::make('normal_balance'),
|
||||
])
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\ClientResource\RelationManagers;
|
||||
|
||||
use App\DataObjects\CreateBranchDTO;
|
||||
use App\Filament\Resources\BranchResource\Pages\EditBranch;
|
||||
use App\Filament\Resources\ClientResource;
|
||||
use App\Models\Branch;
|
||||
use App\Processes\Branch\CreateBranchProcess;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
@@ -10,6 +12,7 @@ use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Validation\Rules\Unique;
|
||||
|
||||
class BranchesRelationManager extends RelationManager
|
||||
{
|
||||
@@ -18,15 +21,24 @@ class BranchesRelationManager extends RelationManager
|
||||
protected static bool $shouldCheckPolicyExistence = true;
|
||||
|
||||
protected CreateBranchProcess $createBranchProcess;
|
||||
public function __construct() {
|
||||
$this->createBranchProcess = new CreateBranchProcess();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->createBranchProcess = new CreateBranchProcess;
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('code')->required()->unique('branches','code'),
|
||||
Forms\Components\Hidden::make('id'),
|
||||
Forms\Components\TextInput::make('code')->required()
|
||||
->unique(
|
||||
'branches',
|
||||
'code',
|
||||
ignoreRecord: true,
|
||||
modifyRuleUsing: fn (Unique $rule) => $rule->where('client_id', $this->getOwnerRecord()->id)
|
||||
),
|
||||
Forms\Components\TextInput::make('series')->label('Current Series')
|
||||
->required()
|
||||
->numeric()
|
||||
@@ -35,7 +47,7 @@ class BranchesRelationManager extends RelationManager
|
||||
->minLength(1)
|
||||
->mask(RawJs::make(<<<'JS'
|
||||
'999999'
|
||||
JS))
|
||||
JS)),
|
||||
])->columns(1);
|
||||
}
|
||||
|
||||
@@ -52,17 +64,16 @@ class BranchesRelationManager extends RelationManager
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make()
|
||||
->mutateFormDataUsing(function (array $data): array {
|
||||
$data['client_id'] = $this->ownerRecord->id;
|
||||
return $data;
|
||||
})
|
||||
->using(function($data) {
|
||||
$payload = new CreateBranchDTO(data: $data);
|
||||
return $this->createBranchProcess->run($payload)->branch;
|
||||
}),
|
||||
->mutateFormDataUsing(fn ($data) => $this->appendCientId($data))
|
||||
->using(fn ($data) => $this->saveBranch($data)),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
// Tables\Actions\ViewAction::make()->url(fn ($record) => EditBranch::getUrl(['record' => $record->id])),
|
||||
Tables\Actions\EditAction::make()
|
||||
->fillForm(fn ($record) => ['id' => $record->id, 'code' => $record->code, 'series' => $record->current_series])
|
||||
->mutateFormDataUsing(fn ($data) => $this->appendCientId($data))
|
||||
->using(fn ($data) => $this->saveBranch($data))
|
||||
->url(fn ($record) => EditBranch::getUrl(['record' => $record->id])),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
@@ -72,5 +83,15 @@ class BranchesRelationManager extends RelationManager
|
||||
]);
|
||||
}
|
||||
|
||||
public function appendCientId($data): array
|
||||
{
|
||||
$data['client_id'] = $this->ownerRecord->id;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function saveBranch($data): Branch
|
||||
{
|
||||
return ClientResource::saveBranch($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\ClientResource\RelationManagers;
|
||||
|
||||
use App\Commands\Transmittal\GenerateTransmittalSeries;
|
||||
use App\Commands\Transmittal\StoreTransmittalCommand;
|
||||
use App\DataObjects\CreateTransmittalDTO;
|
||||
use App\Filament\Resources\TransmittalResource;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Client;
|
||||
use App\Models\Transmittal;
|
||||
use App\Processes\Transmittal\CreateTransmittalProcess;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
@@ -33,30 +18,23 @@ class TransmittalsRelationManager extends RelationManager
|
||||
return auth()->user()->can('update_transmittal');
|
||||
}
|
||||
|
||||
protected CreateTransmittalProcess $transmittalProcess;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->transmittalProcess = new CreateTransmittalProcess();
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return TransmittalResource::form($form)
|
||||
->fill(
|
||||
['client_id' => $this->getOwnerRecord()->id]
|
||||
);
|
||||
['client_id' => $this->getOwnerRecord()->id]
|
||||
);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return TransmittalResource::table($table)->headerActions([
|
||||
Tables\Actions\Action::make('New Transmittal')->action('openCreateForm')
|
||||
Tables\Actions\Action::make('New Transmittal')->action('openCreateForm'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function openCreateForm() {
|
||||
public function openCreateForm()
|
||||
{
|
||||
return redirect()->route('filament.admin.resources.transmittals.create');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
app/Filament/Resources/ExpenseResource.php
Normal file
60
app/Filament/Resources/ExpenseResource.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ExpenseResource\Pages;
|
||||
use App\Models\Expense;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ExpenseResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Expense::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListExpenses::route('/'),
|
||||
'create' => Pages\CreateExpense::route('/create'),
|
||||
'edit' => Pages\EditExpense::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExpenseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExpenseResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateExpense extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ExpenseResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/ExpenseResource/Pages/EditExpense.php
Normal file
19
app/Filament/Resources/ExpenseResource/Pages/EditExpense.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExpenseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExpenseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditExpense extends EditRecord
|
||||
{
|
||||
protected static string $resource = ExpenseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExpenseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExpenseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListExpenses extends ListRecords
|
||||
{
|
||||
protected static string $resource = ExpenseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
60
app/Filament/Resources/SaleResource.php
Normal file
60
app/Filament/Resources/SaleResource.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\SaleResource\Pages;
|
||||
use App\Models\Sale;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SaleResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Sale::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSales::route('/'),
|
||||
'create' => Pages\CreateSale::route('/create'),
|
||||
'edit' => Pages\EditSale::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/SaleResource/Pages/CreateSale.php
Normal file
11
app/Filament/Resources/SaleResource/Pages/CreateSale.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSale extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SaleResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/SaleResource/Pages/EditSale.php
Normal file
19
app/Filament/Resources/SaleResource/Pages/EditSale.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSale extends EditRecord
|
||||
{
|
||||
protected static string $resource = SaleResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/SaleResource/Pages/ListSales.php
Normal file
19
app/Filament/Resources/SaleResource/Pages/ListSales.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSales extends ListRecords
|
||||
{
|
||||
protected static string $resource = SaleResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use App\Commands\Transmittal\GenerateTransmittalSeries;
|
||||
use App\Commands\Transmittal\StoreTransmittalCommand;
|
||||
use App\Exports\TransmittalsExport;
|
||||
use App\Filament\Resources\TransmittalResource\Pages;
|
||||
use App\Filament\Resources\TransmittalResource\RelationManagers;
|
||||
use App\Jobs\ExportCompleteJob;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Client;
|
||||
@@ -23,31 +22,23 @@ use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Arr;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Malzariey\FilamentDaterangepickerFilter\Filters\DateRangeFilter;
|
||||
|
||||
use YOS\FilamentExcel\Actions\Import;
|
||||
|
||||
class TransmittalResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Transmittal::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return $form
|
||||
->schema(static::getFormSchema());
|
||||
return parent::getEloquentQuery()->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
@@ -93,19 +84,74 @@ class TransmittalResource extends Resource
|
||||
Tables\Actions\BulkAction::make('Bulk Export')->action(function ($records) {
|
||||
|
||||
static::exportTransmittal(Arr::flatten($records->pluck('id')));
|
||||
})
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
public static function getTableActions(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
Tables\Actions\Action::make('Export')->action(fn ($record) => static::exportTransmittal([$record->id])),
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\Action::make('Update Status')
|
||||
->fillForm(function ($record) {
|
||||
return [
|
||||
'user_id' => $record->user_id,
|
||||
'date_dispatch' => $record->date_dispatch,
|
||||
'date_received' => $record->date_received,
|
||||
'received_by' => $record->received_by,
|
||||
];
|
||||
})
|
||||
->form([
|
||||
Select::make('user_id')->label('Dispatch By')
|
||||
->relationship('user', 'name')
|
||||
->searchable()
|
||||
->preload(),
|
||||
Datepicker::make('date_dispatch')->label('Dispatch Date')
|
||||
->native(false)->default(now()),
|
||||
TextInput::make('received_by')->label('Received By'),
|
||||
Datepicker::make('date_received')->label('Date Received')->native(false),
|
||||
])
|
||||
->action(function ($data, $record) {
|
||||
$data['id'] = $record->id;
|
||||
(new StoreTransmittalCommand)->execute($data);
|
||||
})
|
||||
->icon('heroicon-o-pencil-square')
|
||||
->slideOver()
|
||||
->hidden(! auth()->user()->can('update_transmittal')),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getFormSchema() : array
|
||||
public static function exportTransmittal(array $id): void
|
||||
{
|
||||
$recipient = auth()->user();
|
||||
|
||||
static::generateExportNotification();
|
||||
|
||||
(new TransmittalsExport([$id]))->store('public/transmittal-export.xlsx')->chain([
|
||||
app(ExportCompleteJob::class, ['user' => $recipient]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function generateExportNotification(): Notification
|
||||
{
|
||||
|
||||
return Notification::make()
|
||||
->title('Your export will be ready. check your notification for file download link.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema(static::getFormSchema());
|
||||
}
|
||||
|
||||
public static function getFormSchema(): array
|
||||
{
|
||||
return [
|
||||
Forms\Components\Select::make('client_id')
|
||||
@@ -143,65 +189,17 @@ class TransmittalResource extends Resource
|
||||
]),
|
||||
])
|
||||
->columns(3)
|
||||
->columnSpan(3)
|
||||
->columnSpan(3),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getTableActions () : array
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
Tables\Actions\Action::make('Export')->action(fn ($record) => static::exportTransmittal([$record->id])),
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\Action::make('Update Status')
|
||||
->fillForm(function($record) {
|
||||
return [
|
||||
'user_id' => $record->user_id,
|
||||
'date_dispatch' => $record->date_dispatch,
|
||||
'date_received' => $record->date_received,
|
||||
'received_by' => $record->received_by,
|
||||
];
|
||||
})
|
||||
->form([
|
||||
Select::make('user_id')->label('Dispatch By')
|
||||
->relationship('user', 'name')
|
||||
->searchable()
|
||||
->preload(),
|
||||
Datepicker::make('date_dispatch')->label('Dispatch Date')
|
||||
->native(false)->default(now()),
|
||||
TextInput::make('received_by')->label('Received By'),
|
||||
Datepicker::make('date_received')->label('Date Received')->native(false),
|
||||
])
|
||||
->action(function ($data, $record) {
|
||||
$data['id'] = $record->id;
|
||||
(new StoreTransmittalCommand())->execute($data);
|
||||
})
|
||||
->icon('heroicon-o-pencil-square')
|
||||
->slideOver()
|
||||
->hidden(!auth()->user()->can('update_transmittal')),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function generateExportNotification() : Notification {
|
||||
|
||||
|
||||
return Notification::make()
|
||||
->title('Your export will be ready. check your notification for file download link.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
public static function exportTransmittal(array $id) : void {
|
||||
$recipient = auth()->user();
|
||||
|
||||
static::generateExportNotification();
|
||||
|
||||
(new TransmittalsExport([$id]))->store('public/transmittal-export.xlsx')->chain([
|
||||
app(ExportCompleteJob::class, [ 'user' => $recipient])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -2,92 +2,54 @@
|
||||
|
||||
namespace App\Filament\Resources\TransmittalResource\Pages;
|
||||
|
||||
use App\Exports\TransmittalsExport;
|
||||
use App\Filament\Resources\TransmittalResource;
|
||||
use App\Jobs\ExportCompleteJob;
|
||||
use Filament\Actions;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Filament\Support\Exceptions\Halt;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Throwable;
|
||||
use Filament\Notifications\Actions\Action as NotificationAction;
|
||||
|
||||
class CreateTransmittal extends CreateRecord
|
||||
{
|
||||
protected static string $resource = TransmittalResource::class;
|
||||
|
||||
public bool $willExport = false;
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function createAndExport(): void
|
||||
{
|
||||
$this->willExport = true;
|
||||
$this->create();
|
||||
}
|
||||
|
||||
public function afterCreate()
|
||||
{
|
||||
if ($this->willExport) {
|
||||
TransmittalResource::exportTransmittal([$this->record->id]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCreatedNotificationMessage(): ?string
|
||||
{
|
||||
if ($this->willExport) {
|
||||
return 'Transmittal Was Created Successfully!, Check your notification for file download link';
|
||||
}
|
||||
|
||||
return 'Transmittal Was Created Successfully!';
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction(),
|
||||
$this->getCreateAnotherFormAction(),
|
||||
Action::make('Create and Export')->action('saveAndExport')->color('success'),
|
||||
$this->getCancelFormAction()
|
||||
Action::make('Create and Export')->action('createAndExport')->color('success'),
|
||||
$this->getCancelFormAction(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function saveAndExport(): void
|
||||
{
|
||||
$this->authorizeAccess();
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$this->callHook('beforeValidate');
|
||||
|
||||
$data = $this->form->getState();
|
||||
|
||||
$this->callHook('afterValidate');
|
||||
|
||||
$data = $this->mutateFormDataBeforeCreate($data);
|
||||
|
||||
$this->callHook('beforeCreate');
|
||||
|
||||
$this->record = $this->handleRecordCreation($data);
|
||||
|
||||
$this->form->model($this->getRecord())->saveRelationships();
|
||||
|
||||
$this->callHook('afterCreate');
|
||||
|
||||
DB::commit();
|
||||
} catch (Halt $exception) {
|
||||
$exception->shouldRollbackDatabaseTransaction() ?
|
||||
DB::rollBack() :
|
||||
DB::commit();
|
||||
|
||||
return;
|
||||
} catch (Throwable $exception) {
|
||||
DB::rollBack();
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->rememberData();
|
||||
|
||||
TransmittalResource::exportTransmittal([$this->record->id]);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Transmittal Was Created Successfully!, Check your notification for file download link')
|
||||
->send();
|
||||
|
||||
}
|
||||
|
||||
public function getCreatedNotificationMessage(): ?string
|
||||
{
|
||||
return 'Transmittal Was Created Successfully!'; // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->previousUrl ?? $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
app/Forms/Components/BranchAccounts.php
Normal file
10
app/Forms/Components/BranchAccounts.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Components;
|
||||
|
||||
use Filament\Forms\Components\Field;
|
||||
|
||||
class BranchAccounts extends Field
|
||||
{
|
||||
protected string $view = 'forms.components.branch-accounts';
|
||||
}
|
||||
13
app/Livewire/BranchAccountsForm.php
Normal file
13
app/Livewire/BranchAccountsForm.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class BranchAccountsForm extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.branch-accounts-form');
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,53 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Observers\AccountObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[ObservedBy([AccountObserver::class])]
|
||||
class Account extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded= [];
|
||||
protected $guarded = [];
|
||||
|
||||
public function accountType() : BelongsTo
|
||||
public function accountType(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AccountType::class);
|
||||
}
|
||||
|
||||
public function client() : BelongsTo
|
||||
public function client(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function getStartingBalanceAttribute()
|
||||
{
|
||||
if ($this->balances()->exists()) {
|
||||
return $this->balances()
|
||||
->where('is_starting', true)
|
||||
->orderBy('id', 'desc')->first()->balance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function balances(): HasMany
|
||||
{
|
||||
return $this->hasMany(Balance::class);
|
||||
}
|
||||
|
||||
public function getCurrentBalanceAttribute()
|
||||
{
|
||||
if ($this->balances()->exists()) {
|
||||
return $this->balances()
|
||||
->orderBy('id', 'desc')->first()->balance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,50 +2,49 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use App\Observers\BranchObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
#[ObservedBy(BranchObserver::class)]
|
||||
class Branch extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Get the client that owns the Branch
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function client(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function getCurrentSeriesAttribute()
|
||||
{
|
||||
if ($this->series()->count() > 0) {
|
||||
return $this->series()->orderBy('id', 'desc')->first()->series;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the series for the Branch
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function series(): HasMany
|
||||
{
|
||||
return $this->hasMany(Series::class);
|
||||
}
|
||||
|
||||
public function getCurrentSeriesAttribute()
|
||||
{
|
||||
if ($this->series()->count() > 0) {
|
||||
return $this->series()->orderBy('id', 'desc')->first()->series;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the sales for the Branch
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function sales(): HasMany
|
||||
{
|
||||
@@ -54,11 +53,19 @@ class Branch extends Model
|
||||
|
||||
/**
|
||||
* Get all of the expenses for the Branch
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function expenses(): HasMany
|
||||
{
|
||||
return $this->hasMany(Expense::class);
|
||||
}
|
||||
|
||||
public function balances(): HasMany
|
||||
{
|
||||
return $this->hasMany(Balance::class);
|
||||
}
|
||||
|
||||
public function accounts(): \Znck\Eloquent\Relations\BelongsToThrough
|
||||
{
|
||||
return $this->belongsToThrough(Account::class, Balance::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use App\Observers\ClientObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[ObservedBy([ClientObserver::class])]
|
||||
class Client extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
@@ -19,7 +21,7 @@ class Client extends Model
|
||||
|
||||
public function getFullNameAttribute()
|
||||
{
|
||||
return $this->lname . ', ' . $this->fname . ' ' . $this->mname;
|
||||
return $this->lname.', '.$this->fname.' '.$this->mname;
|
||||
}
|
||||
|
||||
public function getVatableAttribute()
|
||||
@@ -29,8 +31,6 @@ class Client extends Model
|
||||
|
||||
/**
|
||||
* Get all of the branches for the Client
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function branches(): HasMany
|
||||
{
|
||||
@@ -39,8 +39,6 @@ class Client extends Model
|
||||
|
||||
/**
|
||||
* Get the type associated with the Client
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function type(): BelongsTo
|
||||
{
|
||||
@@ -54,17 +52,14 @@ class Client extends Model
|
||||
|
||||
/**
|
||||
* The users that belong to the Client
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
public function transmittals() : HasMany
|
||||
public function transmittals(): HasMany
|
||||
{
|
||||
return $this->hasMany(Transmittal::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use BezhanSalleh\FilamentShield\Traits\HasPanelShield;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@@ -13,7 +11,7 @@ use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable, HasRoles, HasPermissions;
|
||||
use HasFactory, HasPermissions, HasRoles, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
||||
56
app/Observers/AccountObserver.php
Normal file
56
app/Observers/AccountObserver.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Account;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AccountObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Account "created" event.
|
||||
*/
|
||||
public function created(Account $account): void
|
||||
{
|
||||
DB::transaction(function () use ($account) {
|
||||
if (! $account->balances()->exists()) {
|
||||
$account->balances()->create([
|
||||
'balance' => 0,
|
||||
'is_starting' => true,
|
||||
]);
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Account "updated" event.
|
||||
*/
|
||||
public function updated(Account $account): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Account "deleted" event.
|
||||
*/
|
||||
public function deleted(Account $account): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Account "restored" event.
|
||||
*/
|
||||
public function restored(Account $account): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Account "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Account $account): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
62
app/Observers/BranchObserver.php
Normal file
62
app/Observers/BranchObserver.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Branch;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BranchObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Branch "created" event.
|
||||
*/
|
||||
public function created(Branch $branch): void
|
||||
{
|
||||
$accounts = $branch->client->accounts;
|
||||
DB::transaction(function () use ($branch, $accounts) {
|
||||
foreach ($accounts as $account) {
|
||||
$branch->balances()->updateOrCreate(
|
||||
attributes: [
|
||||
'account_id' => $account->id,
|
||||
'is_starting' => true,
|
||||
],
|
||||
values: [
|
||||
'balance' => $account->starting_balance,
|
||||
]);
|
||||
}
|
||||
}, 2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Branch "updated" event.
|
||||
*/
|
||||
public function updated(Branch $branch): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Branch "deleted" event.
|
||||
*/
|
||||
public function deleted(Branch $branch): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Branch "restored" event.
|
||||
*/
|
||||
public function restored(Branch $branch): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Branch "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Branch $branch): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
87
app/Observers/ClientObserver.php
Normal file
87
app/Observers/ClientObserver.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ClientObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Client "created" event.
|
||||
*/
|
||||
public function created(Client $client): void
|
||||
{
|
||||
DB::transaction(function () use ($client) {
|
||||
$client->accounts()->createMany([
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Cash',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Input Tax',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Creditable Withholding Tax',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 2,
|
||||
'account' => 'Output Tax',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 2,
|
||||
'account' => 'Payable Withholding Tax',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 5,
|
||||
'account' => 'Vat Exempt Revenue',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 4,
|
||||
'account' => 'Sales Discount',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "updated" event.
|
||||
*/
|
||||
public function updated(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "deleted" event.
|
||||
*/
|
||||
public function deleted(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "restored" event.
|
||||
*/
|
||||
public function restored(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
15
app/Processes/Account/CreateAccountProcess.php
Normal file
15
app/Processes/Account/CreateAccountProcess.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Processes\Account;
|
||||
|
||||
use App\Actions\Account\StoreAccount;
|
||||
use App\Actions\Account\StoreAccountBalance;
|
||||
use App\Processes\BaseProcess;
|
||||
|
||||
class CreateAccountProcess extends BaseProcess
|
||||
{
|
||||
protected array $tasks = [
|
||||
StoreAccount::class,
|
||||
StoreAccountBalance::class,
|
||||
];
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
@@ -27,6 +28,9 @@ class AdminPanelProvider extends PanelProvider
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->login()
|
||||
->brandLogo(asset('images/logo-light.png'))
|
||||
->darkModeBrandLogo(asset('images/logo-dark.png'))
|
||||
->brandLogoHeight('2.5rem')
|
||||
->colors([
|
||||
'primary' => Color::Amber,
|
||||
])
|
||||
@@ -55,11 +59,11 @@ class AdminPanelProvider extends PanelProvider
|
||||
Authenticate::class,
|
||||
])
|
||||
->plugins([
|
||||
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make()
|
||||
FilamentShieldPlugin::make()
|
||||
->gridColumns([
|
||||
'default' => 1,
|
||||
'sm' => 2,
|
||||
'lg' => 3
|
||||
'lg' => 3,
|
||||
])
|
||||
->sectionColumnSpan(1)
|
||||
->checkboxListColumns([
|
||||
@@ -72,7 +76,6 @@ class AdminPanelProvider extends PanelProvider
|
||||
'sm' => 2,
|
||||
]),
|
||||
])
|
||||
->viteTheme('resources/css/filament/admin/theme.css')
|
||||
;
|
||||
->viteTheme('resources/css/filament/admin/theme.css');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"malzariey/filament-daterangepicker-filter": "^2.8",
|
||||
"pxlrbt/filament-excel": "^2.3",
|
||||
"spatie/laravel-data": "^4.7",
|
||||
"staudenmeir/belongs-to-through": "^2.16",
|
||||
"yemenopensource/filament-excel": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
67
composer.lock
generated
67
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f908c6791028758e39e2ab5689fc67fd",
|
||||
"content-hash": "366e87ad704c235f10c87aa17c669966",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
@@ -6967,6 +6967,71 @@
|
||||
],
|
||||
"time": "2024-03-13T16:08:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "staudenmeir/belongs-to-through",
|
||||
"version": "v2.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/staudenmeir/belongs-to-through.git",
|
||||
"reference": "79667db6660fa0065b24415bab29a5f85a0128c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/staudenmeir/belongs-to-through/zipball/79667db6660fa0065b24415bab29a5f85a0128c7",
|
||||
"reference": "79667db6660fa0065b24415bab29a5f85a0128c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/database": "^11.0",
|
||||
"php": "^8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-ide-helper": "^3.0",
|
||||
"orchestra/testbench": "^9.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Staudenmeir\\BelongsToThrough\\IdeHelperServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Znck\\Eloquent\\": "src/",
|
||||
"Staudenmeir\\BelongsToThrough\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rahul Kadyan",
|
||||
"email": "hi@znck.me"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Staudenmeir",
|
||||
"email": "mail@jonas-staudenmeir.de"
|
||||
}
|
||||
],
|
||||
"description": "Laravel Eloquent BelongsToThrough relationships",
|
||||
"support": {
|
||||
"issues": "https://github.com/staudenmeir/belongs-to-through/issues",
|
||||
"source": "https://github.com/staudenmeir/belongs-to-through/tree/v2.16"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://paypal.me/JonasStaudenmeir",
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-09T09:53:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.1.1",
|
||||
|
||||
@@ -55,7 +55,7 @@ return [
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'strict' => false,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
|
||||
BIN
public/images/logo-dark.png
Normal file
BIN
public/images/logo-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
public/images/logo-light.png
Normal file
BIN
public/images/logo-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,8 @@
|
||||
<x-dynamic-component
|
||||
:component="$getFieldWrapperView()"
|
||||
:field="$field"
|
||||
>
|
||||
<div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
|
||||
<!-- Interact with the `state` property in Alpine.js -->
|
||||
</div>
|
||||
</x-dynamic-component>
|
||||
3
resources/views/livewire/branch-accounts-form.blade.php
Normal file
3
resources/views/livewire/branch-accounts-form.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
The Master doesn't talk, he acts.
|
||||
</div>
|
||||
Reference in New Issue
Block a user