WIP Work on Payments
This commit is contained in:
parent
f937302159
commit
8ba8501e53
@ -5,7 +5,7 @@
|
||||
enum IconEnum: string
|
||||
{
|
||||
case DEFAULT = 'heroicon-o-rectangle-stack';
|
||||
case INVOICE = 'lucide-receipt-text';
|
||||
case INVOICE = 'lucide-file-text';
|
||||
case ORDER = 'lucide-shopping-cart';
|
||||
case QUOTE = 'lucide-quote';
|
||||
case CUSTOMER = 'lucide-building';
|
||||
@ -15,8 +15,8 @@ enum IconEnum: string
|
||||
case TAX_RATE = 'lucide-circle-dollar-sign';
|
||||
|
||||
// case PRODUCT_SERVICE = 'heroicon-o-rectangle-stack';
|
||||
// case CUSTOMER_SALES = 'heroicon-o-rectangle-stack';
|
||||
// case INVOICE_REPORT = 'heroicon-o-rectangle-stack';
|
||||
case CUSTOMER_SALES = 'lucide-file-user';
|
||||
case INVOICE_REPORT = 'lucide-files';
|
||||
|
||||
case TAB_ALL = 'lucide-layout-grid';
|
||||
case TAB_OVERDUE = 'lucide-calendar-clock';
|
||||
|
@ -18,13 +18,13 @@ class CustomerReportResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Customer::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Reports';
|
||||
protected static ?string $navigationIcon = IconEnum::CUSTOMER_SALES->value;
|
||||
|
||||
protected static ?string $navigationIcon = IconEnum::DEFAULT->value;
|
||||
protected static ?string $navigationGroup = 'Financial';
|
||||
|
||||
protected static ?string $navigationLabel = 'Customer Sales';
|
||||
protected static ?string $navigationLabel = 'Customer Reports';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
class InvoiceReportResource extends Resource
|
||||
{
|
||||
protected static ?string $navigationIcon = IconEnum::DEFAULT->value;
|
||||
protected static ?string $navigationIcon = IconEnum::INVOICE_REPORT->value;
|
||||
|
||||
protected static ?string $navigationGroup = 'Reports';
|
||||
protected static ?string $navigationGroup = 'Financial';
|
||||
|
||||
protected static ?string $navigationLabel = 'Invoice Reports';
|
||||
|
||||
|
@ -31,9 +31,9 @@ class InvoiceResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = IconEnum::INVOICE->value;
|
||||
|
||||
protected static ?string $navigationGroup = 'Production';
|
||||
protected static ?string $navigationGroup = 'Financial';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ class PackingSlipResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = IconEnum::PACKING_SLIP->value;
|
||||
|
||||
protected static ?string $navigationGroup = 'Management';
|
||||
protected static ?string $navigationGroup = 'Production';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
|
@ -18,10 +18,12 @@ class ServiceTypeResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = IconEnum::DEFAULT->value;
|
||||
|
||||
protected static ?string $navigationGroup = 'Reports';
|
||||
protected static ?string $navigationGroup = 'Financial';
|
||||
|
||||
protected static ?string $label = 'Product Services';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function getWidgets(): array
|
||||
{
|
||||
return [
|
||||
|
@ -120,4 +120,9 @@ public function invoiceReports(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(InvoiceReport::class);
|
||||
}
|
||||
|
||||
public function payments(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Payment)
|
||||
}
|
||||
}
|
||||
|
31
app/Models/Payment.php
Normal file
31
app/Models/Payment.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Payment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'customer_id',
|
||||
'amount',
|
||||
'unapplied_amount',
|
||||
];
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function invoices(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Invoice::class)
|
||||
->withPivot('applied_amount')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Navigation\NavigationGroup;
|
||||
use Filament\Pages;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
@ -53,6 +54,13 @@ public function panel(Panel $panel): Panel
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])
|
||||
->sidebarWidth('13rem');
|
||||
->sidebarWidth('13rem')
|
||||
->navigationGroups([
|
||||
NavigationGroup::make('Production'),
|
||||
NavigationGroup::make('Management'),
|
||||
NavigationGroup::make('Financial'),
|
||||
NavigationGroup::make('Reports'),
|
||||
NavigationGroup::make('Settings'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
32
database/migrations/018_create_payments_table.php
Normal file
32
database/migrations/018_create_payments_table.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('customer_id')->constrained();
|
||||
$table->decimal('amount', 8, 2);
|
||||
$table->decimal('unapplied_amount', 8, 2)->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payments');
|
||||
}
|
||||
};
|
31
database/migrations/019_create_invoice_payment_table.php
Normal file
31
database/migrations/019_create_invoice_payment_table.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('invoice_payment', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('invoice_id')->constrained();
|
||||
$table->foreignId('payment_id')->constrained();
|
||||
$table->decimal('applied_amount', 8, 2);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_payment');
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user