Add employee presence with kiosk sign-in, QR badges, and mobile step-out.
Deploy Ladill Frontdesk / deploy (push) Failing after 26s
Deploy Ladill Frontdesk / deploy (push) Failing after 26s
Enables staff roster, PIN/code kiosk flow, attendance reports, evacuation staff roll call, webhooks, branch mismatch warnings, and a linked-user My presence portal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Services\Integrations;
|
||||
|
||||
use App\Models\Employee;
|
||||
use App\Models\EmployeePresence;
|
||||
use App\Models\Visit;
|
||||
use App\Models\WebhookEndpoint;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
@@ -13,16 +15,6 @@ class WebhookDispatcher
|
||||
{
|
||||
$visit->loadMissing('organization');
|
||||
|
||||
$endpoints = WebhookEndpoint::query()
|
||||
->where('organization_id', $visit->organization_id)
|
||||
->where('is_active', true)
|
||||
->get()
|
||||
->filter(fn (WebhookEndpoint $endpoint) => $endpoint->subscribesTo($event));
|
||||
|
||||
if ($endpoints->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'event' => $event,
|
||||
'visit' => [
|
||||
@@ -41,6 +33,41 @@ class WebhookDispatcher
|
||||
'timestamp' => now()->toIso8601String(),
|
||||
];
|
||||
|
||||
$this->dispatchPayload($visit->organization_id, $event, $payload);
|
||||
}
|
||||
|
||||
public function dispatchEmployee(string $event, Employee $employee, ?EmployeePresence $presence = null): void
|
||||
{
|
||||
$presence ??= $employee->presence;
|
||||
|
||||
$payload = [
|
||||
'event' => $event,
|
||||
'employee' => [
|
||||
'id' => $employee->id,
|
||||
'employee_code' => $employee->employee_code,
|
||||
'full_name' => $employee->full_name,
|
||||
'department' => $employee->department,
|
||||
'branch_id' => $employee->branch_id,
|
||||
'status' => $presence?->status,
|
||||
'destination' => $presence?->destination,
|
||||
'signed_in_at' => $presence?->signed_in_at?->toIso8601String(),
|
||||
'expected_return_at' => $presence?->expected_return_at?->toIso8601String(),
|
||||
],
|
||||
'timestamp' => now()->toIso8601String(),
|
||||
];
|
||||
|
||||
$this->dispatchPayload($employee->organization_id, $event, $payload);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $payload */
|
||||
protected function dispatchPayload(int $organizationId, string $event, array $payload): void
|
||||
{
|
||||
$endpoints = WebhookEndpoint::query()
|
||||
->where('organization_id', $organizationId)
|
||||
->where('is_active', true)
|
||||
->get()
|
||||
->filter(fn (WebhookEndpoint $endpoint) => $endpoint->subscribesTo($event));
|
||||
|
||||
foreach ($endpoints as $endpoint) {
|
||||
$this->send($endpoint, $payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user