Added material invoice exporter and updated serial invoice exporter
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
This commit is contained in:
@@ -36,15 +36,6 @@ class InvoiceValidationExporter extends Exporter
|
|||||||
->label('ITEM DESCRIPTION'),
|
->label('ITEM DESCRIPTION'),
|
||||||
ExportColumn::make('stickerMaster.item.uom')
|
ExportColumn::make('stickerMaster.item.uom')
|
||||||
->label('UNIT OF MEASURE'),
|
->label('UNIT OF MEASURE'),
|
||||||
ExportColumn::make('stickerMaster.material_type')
|
|
||||||
->label('MATERIAL TYPE')
|
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
|
||||||
1 => 'Individual',
|
|
||||||
2 => 'Bundle',
|
|
||||||
3 => 'Quantity',
|
|
||||||
4 => 'Bundle Individual',
|
|
||||||
default => '-',
|
|
||||||
}),
|
|
||||||
ExportColumn::make('motor_scanned_status')
|
ExportColumn::make('motor_scanned_status')
|
||||||
->label('MOTOR SCANNED STATUS'),
|
->label('MOTOR SCANNED STATUS'),
|
||||||
ExportColumn::make('pump_scanned_status')
|
ExportColumn::make('pump_scanned_status')
|
||||||
@@ -65,10 +56,6 @@ class InvoiceValidationExporter extends Exporter
|
|||||||
->label('LOAD RATE'),
|
->label('LOAD RATE'),
|
||||||
ExportColumn::make('upload_status')
|
ExportColumn::make('upload_status')
|
||||||
->label('UPLOAD STATUS'),
|
->label('UPLOAD STATUS'),
|
||||||
ExportColumn::make('batch_number')
|
|
||||||
->label('BATCH NUMBER'),
|
|
||||||
ExportColumn::make('quantity')
|
|
||||||
->label('QUANTITY'),
|
|
||||||
ExportColumn::make('operator_id')
|
ExportColumn::make('operator_id')
|
||||||
->label('OPERATOR ID'),
|
->label('OPERATOR ID'),
|
||||||
ExportColumn::make('created_at')
|
ExportColumn::make('created_at')
|
||||||
@@ -90,7 +77,7 @@ class InvoiceValidationExporter extends Exporter
|
|||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
{
|
{
|
||||||
$body = 'Your invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
$body = 'Your serial invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||||
|
|||||||
85
app/Filament/Exports/MaterialInvoiceValidationExporter.php
Normal file
85
app/Filament/Exports/MaterialInvoiceValidationExporter.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\InvoiceValidation;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class MaterialInvoiceValidationExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = InvoiceValidation::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// ExportColumn::make('id')
|
||||||
|
// ->label('ID'),
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('plant.code')
|
||||||
|
->label('PLANT CODE'),
|
||||||
|
ExportColumn::make('invoice_number')
|
||||||
|
->label('INVOICE NUMBER'),
|
||||||
|
ExportColumn::make('serial_number')
|
||||||
|
->label('SERIAL NUMBER'),
|
||||||
|
ExportColumn::make('stickerMaster.item.code')
|
||||||
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('stickerMaster.item.description')
|
||||||
|
->label('ITEM DESCRIPTION'),
|
||||||
|
ExportColumn::make('stickerMaster.item.uom')
|
||||||
|
->label('UNIT OF MEASURE'),
|
||||||
|
ExportColumn::make('stickerMaster.material_type')
|
||||||
|
->label('MATERIAL TYPE')
|
||||||
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
|
1 => 'Individual',
|
||||||
|
2 => 'Bundle',
|
||||||
|
3 => 'Quantity',
|
||||||
|
4 => 'Bundle Individual',
|
||||||
|
default => '-',
|
||||||
|
}),
|
||||||
|
ExportColumn::make('load_rate')
|
||||||
|
->label('LOAD RATE'),
|
||||||
|
ExportColumn::make('upload_status')
|
||||||
|
->label('UPLOAD STATUS'),
|
||||||
|
ExportColumn::make('batch_number')
|
||||||
|
->label('BATCH NUMBER'),
|
||||||
|
ExportColumn::make('quantity')
|
||||||
|
->label('QUANTITY'),
|
||||||
|
ExportColumn::make('operator_id')
|
||||||
|
->label('OPERATOR ID'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('UPDATED BY'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->enabledByDefault(false)
|
||||||
|
->label('DELETED AT'),
|
||||||
|
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your material invoice validation 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ namespace App\Filament\Resources;
|
|||||||
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
|
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
|
||||||
use App\Filament\Exports\AxnExporter;
|
use App\Filament\Exports\AxnExporter;
|
||||||
use App\Filament\Exports\InvoiceValidationExporter;
|
use App\Filament\Exports\InvoiceValidationExporter;
|
||||||
|
use App\Filament\Exports\MaterialInvoiceValidationExporter;
|
||||||
use App\Filament\Imports\InvoiceValidationImporter;
|
use App\Filament\Imports\InvoiceValidationImporter;
|
||||||
use App\Filament\Imports\SapInvoiceValidationImporter;
|
use App\Filament\Imports\SapInvoiceValidationImporter;
|
||||||
use App\Filament\Resources\InvoiceValidationResource\Pages;
|
use App\Filament\Resources\InvoiceValidationResource\Pages;
|
||||||
@@ -1164,12 +1165,19 @@ class InvoiceValidationResource extends Resource
|
|||||||
->visible(function () {
|
->visible(function () {
|
||||||
return Filament::auth()->user()->can('view import sap invoice');
|
return Filament::auth()->user()->can('view import sap invoice');
|
||||||
}),
|
}),
|
||||||
ExportAction::make('invoice_export')
|
ExportAction::make('serial_invoice_export')
|
||||||
->label('Export Invoices')
|
->label('Export Serial Invoices')
|
||||||
->color('warning')
|
->color('warning')
|
||||||
->exporter(InvoiceValidationExporter::class)
|
->exporter(InvoiceValidationExporter::class)
|
||||||
->visible(function () {
|
->visible(function () {
|
||||||
return Filament::auth()->user()->can('view export invoice');
|
return Filament::auth()->user()->can('view export serial invoice');
|
||||||
|
}),
|
||||||
|
ExportAction::make('material_invoice_export')
|
||||||
|
->label('Export Material Invoices')
|
||||||
|
->color('warning')
|
||||||
|
->exporter(MaterialInvoiceValidationExporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view export material invoice');
|
||||||
}),
|
}),
|
||||||
ExportAction::make('axn_export')
|
ExportAction::make('axn_export')
|
||||||
->label('Export Asn')
|
->label('Export Asn')
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import serial invoice']);
|
Permission::updateOrCreate(['name' => 'view import serial invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view import invoice']);
|
Permission::updateOrCreate(['name' => 'view import invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view export invoice']);
|
Permission::updateOrCreate(['name' => 'view import sap invoice']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export serial invoice']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export material invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view export asn invoice']);
|
Permission::updateOrCreate(['name' => 'view export asn invoice']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
||||||
@@ -228,7 +230,14 @@ class PermissionSeeder extends Seeder
|
|||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import asrs item validation']);
|
Permission::updateOrCreate(['name' => 'view import asrs item validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export asrs item validation']);
|
Permission::updateOrCreate(['name' => 'view export asrs item validation']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import employee master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export employee master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view import visitor entries']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export visitor entries']);
|
||||||
Permission::updateOrCreate(['name' => 'view gate entry page']);
|
Permission::updateOrCreate(['name' => 'view gate entry page']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import locator validation']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export locator validation']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user