fcm token api updated

This commit is contained in:
mohanmd 2026-06-15 14:03:23 +05:30
parent 3ecd12ed10
commit 47d0d64550
4 changed files with 140 additions and 10 deletions

View File

@ -28,7 +28,7 @@ public function index()
// Preferred job types: full-time / part-time / live-in / live-out // Preferred job types: full-time / part-time / live-in / live-out
$jobTypes = ['full-time', 'part-time', 'live-in', 'live-out']; $jobTypes = ['full-time', 'part-time', 'live-in', 'live-out'];
$preferredJobType = $jobTypes[$worker->id % 4]; $preferredJobType = $worker->preferred_job_type ?? $jobTypes[$worker->id % 4];
return [ return [
'id' => $worker->id, 'id' => $worker->id,
@ -36,12 +36,17 @@ public function index()
'email' => $worker->email, 'email' => $worker->email,
'phone' => $worker->phone, 'phone' => $worker->phone,
'gender' => $worker->gender ?? 'Female', 'gender' => $worker->gender ?? 'Female',
'age' => $worker->age,
'religion' => $worker->religion,
'visa_status' => $worker->visa_status,
'in_country' => (bool)$worker->in_country,
'language' => $worker->language ?? 'English', 'language' => $worker->language ?? 'English',
'languages' => $langs, 'languages' => $langs,
'nationality' => $worker->nationality, 'nationality' => $worker->nationality,
'country' => $worker->country, 'country' => $worker->country,
'city' => $worker->city, 'city' => $worker->city,
'area' => $worker->area, 'area' => $worker->area,
'preferred_location' => $worker->preferred_location,
'live_in_out' => $worker->live_in_out ?? 'Live-in', 'live_in_out' => $worker->live_in_out ?? 'Live-in',
'experience' => $worker->experience, 'experience' => $worker->experience,
'salary' => (int)$worker->salary, 'salary' => (int)$worker->salary,
@ -124,16 +129,21 @@ public function updateProfile(Request $request, $id)
'country' => 'nullable|string', 'country' => 'nullable|string',
'city' => 'nullable|string', 'city' => 'nullable|string',
'area' => 'nullable|string', 'area' => 'nullable|string',
'preferred_location' => 'nullable|string',
'live_in_out' => 'nullable|string', 'live_in_out' => 'nullable|string',
'experience' => 'required|string', 'experience' => 'required|string',
'salary' => 'nullable|numeric', 'salary' => 'nullable|numeric',
'bio' => 'nullable|string' 'bio' => 'nullable|string',
'nationality' => 'nullable|string',
'visa_status' => 'nullable|string',
'religion' => 'nullable|string',
'age' => 'nullable|integer',
'in_country' => 'nullable|boolean',
'preferred_job_type' => 'nullable|string',
]); ]);
$worker = \App\Models\Worker::findOrFail($id); $worker = \App\Models\Worker::findOrFail($id);
$worker->name = $validated['name']; $worker->name = $validated['name'];
$worker->phone = $validated['phone']; $worker->phone = $validated['phone'];
$worker->gender = $validated['gender'] ?? $worker->gender; $worker->gender = $validated['gender'] ?? $worker->gender;
@ -141,10 +151,19 @@ public function updateProfile(Request $request, $id)
$worker->country = $validated['country'] ?? $worker->country; $worker->country = $validated['country'] ?? $worker->country;
$worker->city = $validated['city'] ?? $worker->city; $worker->city = $validated['city'] ?? $worker->city;
$worker->area = $validated['area'] ?? $worker->area; $worker->area = $validated['area'] ?? $worker->area;
$worker->preferred_location = $validated['preferred_location'] ?? $worker->preferred_location;
$worker->live_in_out = $validated['live_in_out'] ?? $worker->live_in_out; $worker->live_in_out = $validated['live_in_out'] ?? $worker->live_in_out;
$worker->experience = $validated['experience']; $worker->experience = $validated['experience'];
$worker->salary = $validated['salary'] ?? $worker->salary; $worker->salary = $validated['salary'] ?? $worker->salary;
$worker->bio = $validated['bio'] ?? $worker->bio; $worker->bio = $validated['bio'] ?? $worker->bio;
$worker->nationality = $validated['nationality'] ?? $worker->nationality;
$worker->visa_status = $validated['visa_status'] ?? $worker->visa_status;
$worker->religion = $validated['religion'] ?? $worker->religion;
$worker->age = $validated['age'] ?? $worker->age;
if (isset($validated['in_country'])) {
$worker->in_country = (bool)$validated['in_country'];
}
$worker->preferred_job_type = $validated['preferred_job_type'] ?? $worker->preferred_job_type;
$worker->save(); $worker->save();
return back()->with('success', "Worker #{$id} profile details moderated and updated successfully."); return back()->with('success', "Worker #{$id} profile details moderated and updated successfully.");

View File

@ -30,11 +30,6 @@ public function run(): void
// Call Seeders // Call Seeders
$this->call([ $this->call([
SkillSeeder::class, SkillSeeder::class,
WorkerSeeder::class,
EmployerProfileSeeder::class,
JobPostSeeder::class,
ConversationSeeder::class,
SupportTicketSeeder::class,
]); ]);
} }
} }

View File

@ -106,6 +106,11 @@
"format": "date", "format": "date",
"example": "2028-06-12", "example": "2028-06-12",
"description": "Expiry date of the license (YYYY-MM-DD). (REQUIRED)" "description": "Expiry date of the license (YYYY-MM-DD). (REQUIRED)"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -169,6 +174,11 @@
"password": { "password": {
"type": "string", "type": "string",
"example": "Password@123" "example": "Password@123"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -508,6 +518,11 @@
"type": "string", "type": "string",
"example": "Dubai Marina", "example": "Dubai Marina",
"description": "Preferred work location/area." "description": "Preferred work location/area."
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -613,6 +628,11 @@
"format": "password", "format": "password",
"example": "securepassword123", "example": "securepassword123",
"description": "Secret account password." "description": "Secret account password."
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -1563,6 +1583,11 @@
"type": "string", "type": "string",
"example": "Dubai Marina", "example": "Dubai Marina",
"description": "Preferred work location/area." "description": "Preferred work location/area."
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -2380,6 +2405,11 @@
"type": "string", "type": "string",
"example": "+971509990001", "example": "+971509990001",
"description": "Sponsor's mobile phone number" "description": "Sponsor's mobile phone number"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -2420,6 +2450,11 @@
"type": "string", "type": "string",
"example": "111111", "example": "111111",
"description": "6-digit OTP code" "description": "6-digit OTP code"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -2590,6 +2625,11 @@
"type": "string", "type": "string",
"format": "password", "format": "password",
"example": "Password@123" "example": "Password@123"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -2649,6 +2689,11 @@
"password": { "password": {
"type": "string", "type": "string",
"example": "Password@123" "example": "Password@123"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -3266,6 +3311,11 @@
"new_password_confirmation": { "new_password_confirmation": {
"type": "string", "type": "string",
"example": "NewSecurePassword@123" "example": "NewSecurePassword@123"
},
"fcm_token": {
"type": "string",
"example": "fcm_token_example",
"description": "Firebase Cloud Messaging token for push notifications."
} }
} }
} }
@ -4544,6 +4594,7 @@
"status": {"type": "string", "example": "active"}, "status": {"type": "string", "example": "active"},
"license_file": {"type": "string", "example": "uploads/licenses/1234567890_license_trade.pdf"}, "license_file": {"type": "string", "example": "uploads/licenses/1234567890_license_trade.pdf"},
"emirates_id_file": {"type": "string", "example": "uploads/licenses/1234567890_emirates_id.pdf"}, "emirates_id_file": {"type": "string", "example": "uploads/licenses/1234567890_emirates_id.pdf"},
"fcm_token": {"type": "string", "example": "fcm_token_example"},
"created_at": {"type": "string", "format": "date-time"} "created_at": {"type": "string", "format": "date-time"}
} }
}, },

View File

@ -82,6 +82,12 @@ export default function WorkerManagement({ workers }) {
area: '', area: '',
preferred_location: '', preferred_location: '',
live_in_out: '', live_in_out: '',
nationality: '',
visa_status: '',
religion: '',
age: '',
in_country: true,
preferred_job_type: '',
}); });
const [adminNotes, setAdminNotes] = useState(''); const [adminNotes, setAdminNotes] = useState('');
@ -134,7 +140,13 @@ export default function WorkerManagement({ workers }) {
city: editForm.city, city: editForm.city,
area: editForm.area, area: editForm.area,
preferred_location: editForm.preferred_location, preferred_location: editForm.preferred_location,
live_in_out: editForm.live_in_out live_in_out: editForm.live_in_out,
nationality: editForm.nationality,
visa_status: editForm.visa_status,
religion: editForm.religion,
age: editForm.age,
in_country: editForm.in_country,
preferred_job_type: editForm.preferred_job_type
}); });
} }
}); });
@ -176,6 +188,12 @@ export default function WorkerManagement({ workers }) {
area: fullWorker.area || '', area: fullWorker.area || '',
preferred_location: fullWorker.preferred_location || '', preferred_location: fullWorker.preferred_location || '',
live_in_out: fullWorker.live_in_out || '', live_in_out: fullWorker.live_in_out || '',
nationality: fullWorker.nationality || '',
visa_status: fullWorker.visa_status || '',
religion: fullWorker.religion || '',
age: fullWorker.age || '',
in_country: fullWorker.in_country ?? true,
preferred_job_type: fullWorker.preferred_job_type || '',
}); });
setAdminNotes(fullWorker.admin_notes); setAdminNotes(fullWorker.admin_notes);
setIsEditMode(false); setIsEditMode(false);
@ -463,6 +481,33 @@ export default function WorkerManagement({ workers }) {
className="w-full bg-white border border-slate-200 rounded-xl p-2.5 text-xs font-bold text-slate-700 outline-none focus:ring-2 focus:ring-[#0F6E56]/20" className="w-full bg-white border border-slate-200 rounded-xl p-2.5 text-xs font-bold text-slate-700 outline-none focus:ring-2 focus:ring-[#0F6E56]/20"
/> />
</div> </div>
<div>
<label className="text-[10px] font-bold text-slate-500">Age</label>
<input
type="number"
value={editForm.age}
onChange={e => setEditForm({ ...editForm, age: e.target.value })}
className="w-full bg-white border border-slate-200 rounded-xl p-2.5 text-xs font-bold text-slate-700 outline-none focus:ring-2 focus:ring-[#0F6E56]/20"
/>
</div>
<div>
<label className="text-[10px] font-bold text-slate-500">Nationality</label>
<input
type="text"
value={editForm.nationality}
onChange={e => setEditForm({ ...editForm, nationality: e.target.value })}
className="w-full bg-white border border-slate-200 rounded-xl p-2.5 text-xs font-bold text-slate-700 outline-none focus:ring-2 focus:ring-[#0F6E56]/20"
/>
</div>
<div>
<label className="text-[10px] font-bold text-slate-500">Religion</label>
<input
type="text"
value={editForm.religion}
onChange={e => setEditForm({ ...editForm, religion: e.target.value })}
className="w-full bg-white border border-slate-200 rounded-xl p-2.5 text-xs font-bold text-slate-700 outline-none focus:ring-2 focus:ring-[#0F6E56]/20"
/>
</div>
</div> </div>
</div> </div>
@ -636,6 +681,26 @@ export default function WorkerManagement({ workers }) {
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Language</label> <label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Language</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.language || 'English'}</span> <span className="text-slate-800 font-extrabold">{selectedWorker?.language || 'English'}</span>
</div> </div>
<div>
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Nationality</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.nationality || 'N/A'}</span>
</div>
<div>
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Visa Status</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.visa_status || 'N/A'}</span>
</div>
<div>
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Religion</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.religion || 'N/A'}</span>
</div>
<div>
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">Age</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.age || 'N/A'}</span>
</div>
<div>
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-0.5">In Country / Location</label>
<span className="text-slate-800 font-extrabold">{selectedWorker?.in_country ? 'In Country (UAE)' : 'Out of Country'}</span>
</div>
<div className="col-span-2 mt-2"> <div className="col-span-2 mt-2">
<label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-1">Skills</label> <label className="text-[9px] font-black text-slate-400 uppercase tracking-widest block mb-1">Skills</label>
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">