Flag saluran bermasalah + pautan Call/WhatsApp
- Halaman baharu "Saluran Bermasalah": senarai semua saluran dalam DUN (dengan KTM & telefonnya), tanda/buang tanda bermasalah berserta catatan; admin DUN terhad ke DUN sendiri, superadmin semua DUN - Dashboard: baris saluran bermasalah diserlahkan kuning berserta lencana BERMASALAH dan catatan - No. telefon KTM kini ada butang "📞 Call" (tel:) dan "WhatsApp" (wa.me, dinormalkan ke format 60xxxxxxxxx) di dashboard dan halaman saluran bermasalah Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,36 @@ class PetugasPermohonan extends Model
|
||||
return $this->belongsTo(Dun::class, 'dun_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* No. telefon dalam digit sahaja (untuk pautan tel:).
|
||||
*/
|
||||
public function telefonDigits(): ?string
|
||||
{
|
||||
$digit = preg_replace('/\D/', '', (string) $this->no_telefon);
|
||||
|
||||
return $digit !== '' ? $digit : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pautan WhatsApp (wa.me) — normalkan ke format antarabangsa Malaysia.
|
||||
*/
|
||||
public function whatsappUrl(): ?string
|
||||
{
|
||||
$digit = $this->telefonDigits();
|
||||
|
||||
if ($digit === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (str_starts_with($digit, '0')) {
|
||||
$digit = '6'.$digit;
|
||||
} elseif (! str_starts_with($digit, '60')) {
|
||||
$digit = '60'.$digit;
|
||||
}
|
||||
|
||||
return 'https://wa.me/'.$digit;
|
||||
}
|
||||
|
||||
public function assignments(): HasMany
|
||||
{
|
||||
return $this->hasMany(PetugasAssignment::class, 'permohonan_id');
|
||||
|
||||
Reference in New Issue
Block a user