HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/posscale/public_html/printmanager/app/Filament/Resources/SupplierTonerPriceResource.php
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\SupplierTonerPriceResource\Pages;
use App\Filament\Resources\SupplierTonerPriceResource\RelationManagers;
use App\Models\Supplier;
use App\Models\SupplierTonerPrice;
use App\Models\TonerInk;
use Filament\Forms;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class SupplierTonerPriceResource extends Resource
{
    protected static ?string $model = SupplierTonerPrice::class;

    protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

        protected static ?string $navigationGroup = "Printer Parts";
    protected static ?int $navigationSort = 8;

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('toner_inks_id')
                    ->label('Toner Ink ID')
                    ->options(TonerInk::all()->pluck('part_no', 'id'))
                    ->searchable()->required(true),
                Select::make('supplier_id')
                    ->label('Supplier ID')
                    ->options(Supplier::all()->pluck('name', 'id'))
                    ->searchable()->required(true),
                TextInput::make('supplier_part_no')->label('Supplier Part No')->required(true),  
                TextInput::make('price')->numeric()->rules(['decimal:0,2']) ->label('Price')->required(true),
                TextInput::make('last_freight_cost')->numeric()->rules(['decimal:0,2']) ->label('Last Freight Cost')->required(true),
                    
            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('tonerlink.part_no'),
                TextColumn::make('suppelier.name'),
                TextColumn::make('supplier_part_no'),
                TextColumn::make('price'),
                TextColumn::make('last_freight_cost'),
            ])
            ->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\ListSupplierTonerPrices::route('/'),
            'create' => Pages\CreateSupplierTonerPrice::route('/create'),
            'edit' => Pages\EditSupplierTonerPrice::route('/{record}/edit'),
        ];
    }
}