From c994dcd37b498bf332e18ba1e2e84b593847d817 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 28 Jan 2026 13:21:16 +0530 Subject: [PATCH] Added exporter file --- .../Exports/RequestCharacteristicExporter.php | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 app/Filament/Exports/RequestCharacteristicExporter.php diff --git a/app/Filament/Exports/RequestCharacteristicExporter.php b/app/Filament/Exports/RequestCharacteristicExporter.php new file mode 100644 index 0000000..39faa36 --- /dev/null +++ b/app/Filament/Exports/RequestCharacteristicExporter.php @@ -0,0 +1,99 @@ +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('machine.work_center') + ->label('WORK CENTER'), + ExportColumn::make('work_flow_id') + ->label('WORK FLOW ID'), + ExportColumn::make('item.code') + ->label('ITEM CODE'), + ExportColumn::make('aufnr') + ->label('AUFNR'), + ExportColumn::make('characteristicApproverMaster.machine_name') + ->label('MACHINE NAME'), + ExportColumn::make('characteristicApproverMaster.characteristic_field') + ->label('MASTER CHARACTERISTIC FIELD'), + ExportColumn::make('characteristic_name') + ->label('CHARACTERISTIC NAME'), + ExportColumn::make('current_value') + ->label('CURRENT VALUE'), + ExportColumn::make('update_value') + ->label('UPDATE VALUE'), + ExportColumn::make('characteristicApproverMaster.name1') + ->label('APPROVER NAME 1'), + ExportColumn::make('approver_status1') + ->label('APPROVER STATUS 1'), + ExportColumn::make('approver_remark1') + ->label('APPROVER REMARK 1'), + ExportColumn::make('approved1_at') + ->label('APPROVED AT 1'), + ExportColumn::make('characteristicApproverMaster.name2') + ->label('APPROVER NAME 2'), + ExportColumn::make('approver_status2') + ->label('APPROVER STATUS 2'), + ExportColumn::make('approver_remark2') + ->label('APPROVER REMARK 2'), + ExportColumn::make('approved2_at') + ->label('APPROVED AT 2'), + ExportColumn::make('characteristicApproverMaster.name3') + ->label('APPROVER NAME 3'), + ExportColumn::make('approver_status3') + ->label('APPROVER STATUS 3'), + ExportColumn::make('approver_remark3') + ->label('APPROVER REMARK 3'), + ExportColumn::make('approved3_at') + ->label('APPROVED AT 1'), + ExportColumn::make('mail_status') + ->label('MAIL STATUS'), + ExportColumn::make('trigger_at') + ->label('TRIGGERED AT'), + ExportColumn::make('created_at') + ->label('CREATED AT'), + ExportColumn::make('created_by') + ->label('CREATED BY'), + ExportColumn::make('updated_at') + ->label('UPDATED AT'), + ExportColumn::make('updated_by') + ->label('UPDATED BY'), + ExportColumn::make('deleted_at') + ->enabledByDefault(false) + ->label('DELETED AT'), + ]; + } + + public static function getCompletedNotificationBody(Export $export): string + { + $body = 'Your request characteristic 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; + } +}