added sender ID export, edit payment bug fix, profile page bug fix

This commit is contained in:
Kwesi Banson
2026-10-29 12:23:00 +00:00
parent 8428d94abd
commit 965892ac62
15 changed files with 792 additions and 139 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Exports;
use App\Models\SenderId;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class SenderIdsExport implements FromQuery, WithHeadings, WithMapping
{
use Exportable;
protected $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function query()
{
$query = SenderId::query();
// Apply the same filters used on the index page
if ($this->request->filled('search')) {
$search = $this->request->input('search');
$query->where('senderid', 'like', "%{$search}%")
->orWhere('mno_name', 'like', "%{$search}%")
->orWhere('supplier_name', 'like', "%{$search}%");
}
if ($this->request->filled('direct_mno')) {
$query->where('direct_mno', $this->request->input('direct_mno'));
}
if ($this->request->filled('status')) {
$query->where('status', $this->request->input('status'));
}
return $query->orderBy('created_at', 'desc');
}
public function headings(): array
{
return [
'Sender ID', 'Direct MNO', 'MNO Name', 'Supplier Name',
'Type', 'Bind Name', 'Status', 'Remarks', 'Created At'
];
}
public function map($sender): array
{
return [
$sender->senderid,
$sender->direct_mno,
$sender->mno_name ?? 'N/A',
$sender->supplier_name ?? 'N/A',
$sender->type,
$sender->bind_name,
strtoupper($sender->status),
$sender->remarks,
$sender->created_at ? $sender->created_at->format('Y-m-d H:i') : '',
];
}
}