Added courier inward importer and exporter
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

This commit is contained in:
dhanabalan
2026-11-03 12:53:11 +05:30
parent 93f88e840d
commit 607e252aac
2 changed files with 121 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Filament\Imports;
use App\Models\CourierInward;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
class CourierInwardImporter extends Importer
{
protected static ?string $model = CourierInward::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->relationship()
->rules(['required']),
ImportColumn::make('date')
->rules(['date']),
ImportColumn::make('from_address_name'),
ImportColumn::make('cover_material'),
ImportColumn::make('pod_number'),
ImportColumn::make('courier_name'),
ImportColumn::make('place'),
ImportColumn::make('to_address_name'),
ImportColumn::make('return_to_other_unit'),
ImportColumn::make('created_by'),
ImportColumn::make('updated_by'),
];
}
public function resolveRecord(): ?CourierInward
{
// return CourierInward::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
return new CourierInward();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your courier inward import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}