295 lines
7.5 KiB
TypeScript
295 lines
7.5 KiB
TypeScript
import { ref, computed } from 'vue';
|
|
|
|
// Define interface for the asnaf profile (keep for type reference)
|
|
interface AsnafProfile {
|
|
id: string;
|
|
nama: string;
|
|
idNumber: string;
|
|
kategori: string;
|
|
status: string;
|
|
tarikhDaftar: string;
|
|
alamat: string;
|
|
telefon: string;
|
|
email: string;
|
|
gender: string;
|
|
maritalStatus: string;
|
|
birthDate: string;
|
|
occupation: string;
|
|
monthlyIncome: string;
|
|
otherIncome: string;
|
|
totalIncome: string;
|
|
spouse: {
|
|
name: string;
|
|
idNumber: string;
|
|
} | null;
|
|
dependents: Array<{
|
|
name: string;
|
|
age: number;
|
|
relationship: string;
|
|
}>;
|
|
documents: Array<{
|
|
name: string;
|
|
size: string;
|
|
url: string;
|
|
}>;
|
|
analysis: {
|
|
hadKifayahPercentage: string;
|
|
suggestedCategory: string;
|
|
status: string;
|
|
familyCategory: string;
|
|
asnafCategory: string;
|
|
};
|
|
}
|
|
|
|
// Mock data for Asnaf profiles (LIST page)
|
|
const asnafProfiles = ref<AsnafProfile[]>([
|
|
{
|
|
id: '1',
|
|
nama: 'Ahmad Bin Abdullah',
|
|
idNumber: 'MYKAD001',
|
|
kategori: 'Fakir',
|
|
status: 'Aktif',
|
|
tarikhDaftar: '2023-01-15',
|
|
alamat: '123 Jalan Merdeka',
|
|
telefon: '012-3456789',
|
|
email: 'ahmad@example.com',
|
|
gender: 'Lelaki',
|
|
maritalStatus: 'Berkahwin',
|
|
birthDate: '1988-01-01',
|
|
occupation: 'Buruh',
|
|
monthlyIncome: '1200.00',
|
|
otherIncome: '300.00',
|
|
totalIncome: '1500.00',
|
|
spouse: { name: 'Aminah binti Yusof', idNumber: '900202-14-5678' },
|
|
dependents: [
|
|
{ name: 'Muhammad bin Ahmad', age: 10, relationship: 'Anak' },
|
|
{ name: 'Fatimah binti Ahmad', age: 8, relationship: 'Anak' }
|
|
],
|
|
documents: [
|
|
{ name: 'Salinan Kad Pengenalan', size: '1.2 MB', url: '#' },
|
|
{ name: 'Slip Gaji', size: '850 KB', url: '#' },
|
|
{ name: 'Surat Pengesahan Pendapatan', size: '1.5 MB', url: '#' }
|
|
],
|
|
analysis: {
|
|
hadKifayahPercentage: '65.25%',
|
|
suggestedCategory: 'Miskin',
|
|
status: 'Layak (Miskin)',
|
|
familyCategory: 'Miskin (50-100% Had Kifayah)',
|
|
asnafCategory: 'Miskin'
|
|
}
|
|
},
|
|
{
|
|
id: '2',
|
|
nama: 'Siti Binti Ali',
|
|
idNumber: 'MYKAD002',
|
|
kategori: 'Miskin',
|
|
status: 'Aktif',
|
|
tarikhDaftar: '2023-02-20',
|
|
alamat: '456 Jalan Harmoni',
|
|
telefon: '019-8765432',
|
|
email: 'siti@example.com',
|
|
gender: 'Perempuan',
|
|
maritalStatus: 'Bujang',
|
|
birthDate: '1990-05-12',
|
|
occupation: 'Kerani',
|
|
monthlyIncome: '1500.00',
|
|
otherIncome: '0.00',
|
|
totalIncome: '1500.00',
|
|
spouse: null,
|
|
dependents: [],
|
|
documents: [
|
|
{ name: 'Salinan Kad Pengenalan', size: '1.1 MB', url: '#' }
|
|
],
|
|
analysis: {
|
|
hadKifayahPercentage: '80.00%',
|
|
suggestedCategory: 'Miskin',
|
|
status: 'Layak (Miskin)',
|
|
familyCategory: 'Miskin (50-100% Had Kifayah)',
|
|
asnafCategory: 'Miskin'
|
|
}
|
|
},
|
|
{
|
|
id: '3',
|
|
nama: 'Lim Ah Beng',
|
|
idNumber: 'MYKAD003',
|
|
kategori: 'Mualaf',
|
|
status: 'Dalam Semakan',
|
|
tarikhDaftar: '2023-03-10',
|
|
alamat: '789 Jalan Sejahtera',
|
|
telefon: '011-1234567',
|
|
email: 'lim@example.com',
|
|
gender: 'Lelaki',
|
|
maritalStatus: 'Bujang',
|
|
birthDate: '1985-09-09',
|
|
occupation: 'Peniaga',
|
|
monthlyIncome: '2000.00',
|
|
otherIncome: '200.00',
|
|
totalIncome: '2200.00',
|
|
spouse: null,
|
|
dependents: [],
|
|
documents: [],
|
|
analysis: {
|
|
hadKifayahPercentage: '55.00%',
|
|
suggestedCategory: 'Miskin',
|
|
status: 'Dalam Semakan',
|
|
familyCategory: 'Miskin (50-100% Had Kifayah)',
|
|
asnafCategory: 'Mualaf'
|
|
}
|
|
},
|
|
{
|
|
id: '4',
|
|
nama: 'Raju A/L Muthu',
|
|
idNumber: 'MYKAD004',
|
|
kategori: 'Fi-sabilillah',
|
|
status: 'Tidak Aktif',
|
|
tarikhDaftar: '2022-12-05',
|
|
alamat: '101 Jalan Damai',
|
|
telefon: '013-9876543',
|
|
email: 'raju@example.com',
|
|
gender: 'Lelaki',
|
|
maritalStatus: 'Berkahwin',
|
|
birthDate: '1975-11-23',
|
|
occupation: 'Guru',
|
|
monthlyIncome: '2500.00',
|
|
otherIncome: '0.00',
|
|
totalIncome: '2500.00',
|
|
spouse: { name: 'Saraswathy a/p Maniam', idNumber: '750101-10-1234' },
|
|
dependents: [],
|
|
documents: [],
|
|
analysis: {
|
|
hadKifayahPercentage: '110.00%',
|
|
suggestedCategory: 'Tidak Layak',
|
|
status: 'Tidak Layak',
|
|
familyCategory: 'Non-FM (>100% Had Kifayah)',
|
|
asnafCategory: 'Fi-sabilillah'
|
|
}
|
|
},
|
|
{
|
|
id: '5',
|
|
nama: 'Aminah Binti Kassim',
|
|
idNumber: 'MYKAD005',
|
|
kategori: 'Gharimin',
|
|
status: 'Aktif',
|
|
tarikhDaftar: '2023-04-01',
|
|
alamat: '202 Jalan Ceria',
|
|
telefon: '014-2345678',
|
|
email: 'aminah@example.com',
|
|
gender: 'Perempuan',
|
|
maritalStatus: 'Janda',
|
|
birthDate: '1982-03-15',
|
|
occupation: 'Peniaga',
|
|
monthlyIncome: '1800.00',
|
|
otherIncome: '100.00',
|
|
totalIncome: '1900.00',
|
|
spouse: null,
|
|
dependents: [
|
|
{ name: 'Ali bin Kassim', age: 12, relationship: 'Anak' }
|
|
],
|
|
documents: [],
|
|
analysis: {
|
|
hadKifayahPercentage: '70.00%',
|
|
suggestedCategory: 'Miskin',
|
|
status: 'Layak (Miskin)',
|
|
familyCategory: 'Miskin (50-100% Had Kifayah)',
|
|
asnafCategory: 'Gharimin'
|
|
}
|
|
},
|
|
{
|
|
id: '6',
|
|
nama: 'John Doe Anak Luta',
|
|
idNumber: 'MYKAD006',
|
|
kategori: 'Ibnu Sabil',
|
|
status: 'Dalam Semakan',
|
|
tarikhDaftar: '2023-05-12',
|
|
alamat: '303 Jalan Gembira',
|
|
telefon: '016-3456789',
|
|
email: 'john@example.com',
|
|
gender: 'Lelaki',
|
|
maritalStatus: 'Bujang',
|
|
birthDate: '1995-07-07',
|
|
occupation: 'Penganggur',
|
|
monthlyIncome: '0.00',
|
|
otherIncome: '0.00',
|
|
totalIncome: '0.00',
|
|
spouse: null,
|
|
dependents: [],
|
|
documents: [],
|
|
analysis: {
|
|
hadKifayahPercentage: '30.00%',
|
|
suggestedCategory: 'Fakir',
|
|
status: 'Dalam Semakan',
|
|
familyCategory: 'Fakir (0-49% Had Kifayah)',
|
|
asnafCategory: 'Ibnu Sabil'
|
|
}
|
|
}
|
|
]);
|
|
|
|
// Mock detail data for a profile (DETAIL page)
|
|
const mockProfileDetail: AsnafProfile = asnafProfiles.value[0];
|
|
|
|
// Get profile by ID for detail page
|
|
function getProfileById(id: string): AsnafProfile | undefined {
|
|
return asnafProfiles.value.find((p) => p.id === id);
|
|
}
|
|
|
|
export const useAsnafMockData = () => {
|
|
// Computed statistics
|
|
const statistics = computed(() => {
|
|
const total = asnafProfiles.value.length;
|
|
const active = asnafProfiles.value.filter(p => p.status === 'Aktif').length;
|
|
const inactive = asnafProfiles.value.filter(p => p.status === 'Tidak Aktif').length;
|
|
const review = asnafProfiles.value.filter(p => p.status === 'Dalam Semakan').length;
|
|
|
|
return {
|
|
total,
|
|
active,
|
|
inactive,
|
|
review
|
|
};
|
|
});
|
|
|
|
// Filter profiles by search and filters
|
|
const filterProfiles = (search = '', statusFilter = 'All', categoryFilter = 'All'): AsnafProfile[] => {
|
|
return asnafProfiles.value.filter(profile => {
|
|
// Search by name or ID
|
|
const matchesSearch = search === '' ||
|
|
profile.nama.toLowerCase().includes(search.toLowerCase()) ||
|
|
profile.id.toLowerCase().includes(search.toLowerCase()) ||
|
|
profile.idNumber.includes(search);
|
|
|
|
// Filter by status
|
|
const matchesStatus = statusFilter === 'All' || profile.status === statusFilter;
|
|
|
|
// Filter by category
|
|
const matchesCategory = categoryFilter === 'All' || profile.kategori === categoryFilter;
|
|
|
|
return matchesSearch && matchesStatus && matchesCategory;
|
|
});
|
|
};
|
|
|
|
// Categories
|
|
const categories = [
|
|
'Fakir',
|
|
'Miskin',
|
|
'Mualaf',
|
|
'Fi-sabilillah',
|
|
'Gharimin',
|
|
'Ibnu Sabil'
|
|
];
|
|
|
|
// Statuses
|
|
const statuses = [
|
|
'Aktif',
|
|
'Tidak Aktif',
|
|
'Dalam Semakan'
|
|
];
|
|
|
|
return {
|
|
asnafProfiles,
|
|
statistics,
|
|
getProfileById,
|
|
filterProfiles,
|
|
categories,
|
|
statuses
|
|
};
|
|
};
|