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\Pages;
|
||||||
use App\Filament\Resources\CustomerResource\RelationManagers\ContactsRelationManager;
|
use App\Filament\Resources\CustomerResource\RelationManagers\ContactsRelationManager;
|
||||||
|
use App\Filament\Resources\CustomerResource\RelationManagers\ShippingEntriesRelationManager;
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\RelationManagers\RelationGroup;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
@ -21,7 +23,7 @@ class CustomerResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationGroup = 'Management';
|
protected static ?string $navigationGroup = 'Management';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 4;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
@ -60,7 +62,10 @@ public static function table(Table $table): Table
|
|||||||
public static function getRelations(): array
|
public static function getRelations(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
RelationGroup::make('Relations', [
|
||||||
ContactsRelationManager::class,
|
ContactsRelationManager::class,
|
||||||
|
ShippingEntriesRelationManager::class,
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ public function table(Table $table): Table
|
|||||||
return $table
|
return $table
|
||||||
->recordTitleAttribute('id')
|
->recordTitleAttribute('id')
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('first_name'),
|
TextColumn::make('full_name'),
|
||||||
TextColumn::make('last_name'),
|
|
||||||
TextColumn::make('email'),
|
TextColumn::make('email'),
|
||||||
TextColumn::make('phone'),
|
TextColumn::make('phone'),
|
||||||
TextColumn::make('notes'),
|
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')
|
->weight('bold')
|
||||||
->color('code')
|
->color('code')
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->extraHeaderAttributes([
|
||||||
|
'class' => 'w-8',
|
||||||
|
]),
|
||||||
TextColumn::make('order_date')
|
TextColumn::make('order_date')
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
@ -24,6 +24,8 @@ class PackingSlipResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationGroup = 'Management';
|
protected static ?string $navigationGroup = 'Management';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
@ -54,21 +54,29 @@ public static function table(Table $table): Table
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('order.customer.company_name'),
|
Tables\Columns\TextColumn::make('order.customer.company_name')
|
||||||
Tables\Columns\TextColumn::make('order.customer_po'),
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('order.customer_po')
|
||||||
|
->searchable()
|
||||||
|
->weight('bold')
|
||||||
|
->color('code'),
|
||||||
Tables\Columns\TextColumn::make('body')
|
Tables\Columns\TextColumn::make('body')
|
||||||
|
->searchable()
|
||||||
->limit(100),
|
->limit(100),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->date('Y-m-d')
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->defaultSort('created_at', 'desc')
|
||||||
|
->groups([
|
||||||
|
'order.customer.company_name',
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
|
||||||
])
|
])
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->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,
|
Pages\Dashboard::class,
|
||||||
])
|
])
|
||||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||||
->widgets([
|
->widgets([])
|
||||||
// Widgets\AccountWidget::class,
|
|
||||||
// Widgets\FilamentInfoWidget::class,
|
|
||||||
])
|
|
||||||
->middleware([
|
->middleware([
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
@ -55,6 +52,6 @@ public function panel(Panel $panel): Panel
|
|||||||
->authMiddleware([
|
->authMiddleware([
|
||||||
Authenticate::class,
|
Authenticate::class,
|
||||||
])
|
])
|
||||||
->sidebarWidth('12rem');
|
->sidebarWidth('13rem');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,6 @@ public function run(): void
|
|||||||
Customer::factory(['company_name' => 'Genumark'])->create();
|
Customer::factory(['company_name' => 'Genumark'])->create();
|
||||||
|
|
||||||
// ->has(ShippingEntry::factory([
|
// ->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([
|
// ->has(ShippingEntry::factory([
|
||||||
// 'account_title' => 'Genumark Save-On-Foods',
|
// 'account_title' => 'Genumark Save-On-Foods',
|
||||||
|
@ -15,7 +15,9 @@ public function run(): void
|
|||||||
{
|
{
|
||||||
foreach (Order::all() as $order) {
|
foreach (Order::all() as $order) {
|
||||||
if (rand(0, 3) >= 1) {
|
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
|
public function run(): void
|
||||||
{
|
{
|
||||||
foreach (Customer::all() as $customer) {
|
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