diff --git a/api/app/Filament/Resources/OrderResource.php b/api/app/Filament/Resources/OrderResource.php index 97df806..12d0fb4 100644 --- a/api/app/Filament/Resources/OrderResource.php +++ b/api/app/Filament/Resources/OrderResource.php @@ -82,6 +82,8 @@ public static function form(Form $form): Form ->label('Zu bezahlen') ->required() ->numeric(), + Forms\Components\DatePicker::make('shipping_date') + ->label('Versanddatum'), ]); } @@ -113,6 +115,10 @@ public static function table(Table $table): Table ->numeric() ->sortable() ->formatStateUsing(fn ($state) => 'CHF ' . $state), + Tables\Columns\TextColumn::make('shipping_date') + ->label('Versanddatum') + ->date('d.m.Y') + ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() diff --git a/api/app/Models/Order.php b/api/app/Models/Order.php index ed1c1ff..c0bc6f4 100644 --- a/api/app/Models/Order.php +++ b/api/app/Models/Order.php @@ -23,5 +23,6 @@ class Order extends Model 'delivery_town', 'amount', 'quantity', + 'shipping_date', ]; } diff --git a/api/database/migrations/2024_11_05_115824_add_shipping_date_to_orders_table.php b/api/database/migrations/2024_11_05_115824_add_shipping_date_to_orders_table.php new file mode 100644 index 0000000..72cbce9 --- /dev/null +++ b/api/database/migrations/2024_11_05_115824_add_shipping_date_to_orders_table.php @@ -0,0 +1,28 @@ +date('shipping_date')->nullable()->after('amount'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('orders', function (Blueprint $table) { + $table->dropColumn('shipping_date'); + }); + } +};