Various little things
This commit is contained in:
parent
913a4477a7
commit
4a3f777ff5
@ -4,10 +4,12 @@
|
||||
|
||||
use App\Filament\Resources\CustomerResource\Pages;
|
||||
use App\Filament\Resources\CustomerResource\RelationManagers\ContactsRelationManager;
|
||||
use App\Filament\Resources\CustomerResource\RelationManagers\ShippingEntriesRelationManager;
|
||||
use App\Models\Customer;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationGroup;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@ -21,7 +23,7 @@ class CustomerResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Management';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
@ -60,7 +62,10 @@ public static function table(Table $table): Table
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationGroup::make('Relations', [
|
||||
ContactsRelationManager::class,
|
||||
ShippingEntriesRelationManager::class,
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,7 @@ public function table(Table $table): Table
|
||||
return $table
|
||||
->recordTitleAttribute('id')
|
||||
->columns([
|
||||
TextColumn::make('first_name'),
|
||||
TextColumn::make('last_name'),
|
||||
TextColumn::make('full_name'),
|
||||
TextColumn::make('email'),
|
||||
TextColumn::make('phone'),
|
||||
TextColumn::make('notes'),
|
||||
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomerResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ShippingEntriesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'ShippingEntries';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('id')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('courier'),
|
||||
Tables\Columns\TextColumn::make('account_title'),
|
||||
Tables\Columns\TextColumn::make('account_username')
|
||||
->label('Username'),
|
||||
Tables\Columns\TextColumn::make('account_password')
|
||||
->label('Password'),
|
||||
Tables\Columns\TextColumn::make('info_needed'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
@ -206,7 +206,10 @@ public static function table(Table $table): Table
|
||||
->weight('bold')
|
||||
->color('code')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->extraHeaderAttributes([
|
||||
'class' => 'w-8',
|
||||
]),
|
||||
TextColumn::make('order_date')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
@ -24,6 +24,8 @@ class PackingSlipResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Management';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
@ -54,21 +54,29 @@ public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('order.customer.company_name'),
|
||||
Tables\Columns\TextColumn::make('order.customer_po'),
|
||||
Tables\Columns\TextColumn::make('order.customer.company_name')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('order.customer_po')
|
||||
->searchable()
|
||||
->weight('bold')
|
||||
->color('code'),
|
||||
Tables\Columns\TextColumn::make('body')
|
||||
->searchable()
|
||||
->limit(100),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->date('Y-m-d')
|
||||
->sortable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->groups([
|
||||
'order.customer.company_name',
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
64
app/Filament/Resources/ShippingEntryResource.php
Normal file
64
app/Filament/Resources/ShippingEntryResource.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ShippingEntryResource\Pages;
|
||||
use App\Models\ShippingEntry;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ShippingEntryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ShippingEntry::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'lucide-truck';
|
||||
|
||||
protected static ?string $navigationGroup = 'Management';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
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\ListShippingEntries::route('/'),
|
||||
'create' => Pages\CreateShippingEntry::route('/create'),
|
||||
'edit' => Pages\EditShippingEntry::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ShippingEntryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ShippingEntryResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateShippingEntry extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ShippingEntryResource::class;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ShippingEntryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ShippingEntryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditShippingEntry extends EditRecord
|
||||
{
|
||||
protected static string $resource = ShippingEntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ShippingEntryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ShippingEntryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListShippingEntries extends ListRecords
|
||||
{
|
||||
protected static string $resource = ShippingEntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
@ -37,10 +37,7 @@ public function panel(Panel $panel): Panel
|
||||
Pages\Dashboard::class,
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
// Widgets\AccountWidget::class,
|
||||
// Widgets\FilamentInfoWidget::class,
|
||||
])
|
||||
->widgets([])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
@ -55,6 +52,6 @@ public function panel(Panel $panel): Panel
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])
|
||||
->sidebarWidth('12rem');
|
||||
->sidebarWidth('13rem');
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,6 @@ public function run(): void
|
||||
Customer::factory(['company_name' => 'Genumark'])->create();
|
||||
|
||||
// ->has(ShippingEntry::factory([
|
||||
// 'account_title' => 'Genumark',
|
||||
// 'courier' => 'UPS CampusShip',
|
||||
// 'contact' => 'https://www.ups.com/lasso/login',
|
||||
// 'account_username' => 'GenumarkTopNotch',
|
||||
// 'account_password' => 'TopNotch@13579',
|
||||
// 'info_needed' => 'Put PO on box',
|
||||
// 'notify' => 'Various reps, CC Kathlyn Wood',
|
||||
// 'notes' => 'For Save On Foods orders, see Genumark SOF',
|
||||
// ]))
|
||||
// ->has(ShippingEntry::factory([
|
||||
// 'account_title' => 'Genumark Save-On-Foods',
|
||||
|
@ -15,7 +15,9 @@ public function run(): void
|
||||
{
|
||||
foreach (Order::all() as $order) {
|
||||
if (rand(0, 3) >= 1) {
|
||||
Quote::factory()->for($order)->create();
|
||||
Quote::factory([
|
||||
'created_at' => $order->order_date,
|
||||
])->for($order)->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,31 @@ class ShippingEntrySeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
foreach (Customer::all() as $customer) {
|
||||
ShippingEntry::factory(5, ['customer_id' => $customer->id])->create();
|
||||
if ($customer->company_name === 'Genumark') {
|
||||
ShippingEntry::factory([
|
||||
'account_title' => 'Genumark',
|
||||
'courier' => 'UPS CampusShip',
|
||||
'contact' => 'https://www.ups.com/lasso/login',
|
||||
'account_username' => 'GenumarkTopNotch',
|
||||
'account_password' => 'TopNotch@13579',
|
||||
'info_needed' => 'Put PO on box',
|
||||
'notify' => 'Various reps, CC Kathlyn Wood',
|
||||
'notes' => 'For Save On Foods orders, see Genumark SOF',
|
||||
])->for($customer)->create();
|
||||
|
||||
ShippingEntry::factory([
|
||||
'account_title' => 'Genumark Save-On-Foods',
|
||||
'courier' => 'UPS CampusShip',
|
||||
'contact' => 'https://www.ups.com/lasso/login',
|
||||
'account_username' => 'GenumarkTopNotch',
|
||||
'account_password' => 'TopNotch@13579',
|
||||
'info_needed' => 'Put PO on box',
|
||||
'notify' => 'Jane Wellman',
|
||||
'notes' => 'Don\'t CC Kathlyn for SOF orders',
|
||||
])->for($customer)->create();
|
||||
} else {
|
||||
ShippingEntry::factory(rand(0, 2), ['customer_id' => $customer->id])->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user