WIP Work on Payments

This commit is contained in:
Nisse Lommerde 2025-01-24 21:37:05 -05:00
parent f937302159
commit 80a3e244ba
22 changed files with 1980 additions and 1279 deletions

View File

@ -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-book-user';
case INVOICE_REPORT = 'lucide-files';
case TAB_ALL = 'lucide-layout-grid';
case TAB_OVERDUE = 'lucide-calendar-clock';

View File

@ -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
{

View File

@ -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';

View File

@ -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
{

View File

@ -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;

View File

@ -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 [

View File

@ -120,4 +120,9 @@ public function invoiceReports(): BelongsToMany
{
return $this->belongsToMany(InvoiceReport::class);
}
public function payments(): BelongsToMany
{
return $this->belongsToMany(Payment::class);
}
}

31
app/Models/Payment.php Normal file
View 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();
}
}

View File

@ -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'),
]);
}
}

1491
composer.lock generated

File diff suppressed because it is too large Load Diff

View 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');
}
};

View 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');
}
};

1473
package-lock.json generated

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long