feat(tender): tambahkan informasi pengguna pada email penawaran

- Mengambil informasi pengguna yang sedang login.
- Menyimpan informasi pengguna dalam job pengiriman email.
- Mengupdate tampilan email untuk menampilkan informasi pengguna.
This commit is contained in:
Daeng Deni Mardaeni
2025-02-03 13:28:07 +07:00
parent 9e6ae1f5ad
commit a7cd063be9
3 changed files with 12 additions and 6 deletions

View File

@@ -724,6 +724,7 @@ class TenderController extends Controller
$districts = District::where('code', $district_permohonan)->get();
$cities = City::where('code', $city_permohonan)->get();
$provinces = Province::where('code', $province_permohonan)->get();
$user = auth::user();
$subject = 'Send Penawaran Email';
@@ -734,7 +735,8 @@ class TenderController extends Controller
'villages' => $villages,
'districts' => $districts,
'cities' => $cities,
'provinces' => $provinces
'provinces' => $provinces,
'user' => $user,
])->render();
// Dispatch job untuk mengirim email
@@ -745,7 +747,8 @@ class TenderController extends Controller
$villages,
$districts,
$cities,
$provinces
$provinces,
$user
);
try {

View File

@@ -21,11 +21,12 @@ class SendPenawaranTenderJob implements ShouldQueue
protected $districts;
protected $cities;
protected $provinces;
protected $user; // Tidak perlu array [0] lagi
/**
* Create a new job instance.
*/
public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces)
public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces,$user)
{
$this->kjpps = $kjpps;
$this->penawaran = $penawaran;
@@ -34,6 +35,7 @@ class SendPenawaranTenderJob implements ShouldQueue
$this->districts = $districts;
$this->cities = $cities;
$this->provinces = $provinces;
$this->user = $user; // Simpan user yang dikirim email ke properti
}
/**
@@ -49,6 +51,7 @@ class SendPenawaranTenderJob implements ShouldQueue
'districts' => $this->districts,
'cities' => $this->cities,
'provinces' => $this->provinces,
'user' => $this->user // Kirim user ke email ke properti sebagai additional data
]);
Mail::to($this->kjpps)->send($email);

View File

@@ -165,10 +165,10 @@
<div class="signature">
Best Regards,<br/>
<img src="{{ asset('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}"
alt="{{ $permohonan->user->name }}" width="200">
<img src="{{ asset('storage/signatures/' . $user->id . '/' . $user->sign) }}"
alt="{{ $user->name }}" width="200">
<p>
{{ $permohonan->user->name }}
{{ $user->name }}
</p>
</div>