Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 43s
Laravel Pint / pint (pull_request) Successful in 2m21s
Laravel Larastan / larastan (pull_request) Failing after 2m44s
60 lines
2.2 KiB
PHP
60 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Exports;
|
|
|
|
use App\Models\InvoiceInTransit;
|
|
use Filament\Actions\Exports\ExportColumn;
|
|
use Filament\Actions\Exports\Exporter;
|
|
use Filament\Actions\Exports\Models\Export;
|
|
|
|
class InvoiceInTransitExporter extends Exporter
|
|
{
|
|
protected static ?string $model = InvoiceInTransit::class;
|
|
|
|
public static function getColumns(): array
|
|
{
|
|
return [
|
|
ExportColumn::make('id')
|
|
->label('ID'),
|
|
ExportColumn::make('plant.name'),
|
|
ExportColumn::make('receiving_plant'),
|
|
ExportColumn::make('receiving_plant_name'),
|
|
ExportColumn::make('invoice_number'),
|
|
ExportColumn::make('invoice_date'),
|
|
ExportColumn::make('item_code'),
|
|
ExportColumn::make('description'),
|
|
ExportColumn::make('quantity'),
|
|
ExportColumn::make('transport_name'),
|
|
ExportColumn::make('lr_bl_aw_number'),
|
|
ExportColumn::make('lr_bl_aw_date'),
|
|
ExportColumn::make('pending_days'),
|
|
ExportColumn::make('obd_number'),
|
|
ExportColumn::make('obd_date'),
|
|
ExportColumn::make('shipment_weight'),
|
|
ExportColumn::make('unit_price'),
|
|
ExportColumn::make('net_value'),
|
|
ExportColumn::make('total_item_amount'),
|
|
ExportColumn::make('tax_amount'),
|
|
ExportColumn::make('transport_mode'),
|
|
ExportColumn::make('vehicle_number'),
|
|
ExportColumn::make('e_waybill_number'),
|
|
ExportColumn::make('created_at'),
|
|
ExportColumn::make('updated_at'),
|
|
ExportColumn::make('created_by'),
|
|
ExportColumn::make('updated_by'),
|
|
ExportColumn::make('deleted_at'),
|
|
];
|
|
}
|
|
|
|
public static function getCompletedNotificationBody(Export $export): string
|
|
{
|
|
$body = 'Your invoice in transit export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
|
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
}
|
|
|
|
return $body;
|
|
}
|
|
}
|