<?php
header('Content-Type: application/json');
require '../../config/db.php';
$res = [];
$res['last_statuses'] = $pdo->query("SELECT last_status, count(*) as c FROM tbl_bookings GROUP BY last_status")->fetchAll(PDO::FETCH_ASSOC);
$res['branches'] = $pdo->query("SELECT status, count(*) as c FROM tbl_branch GROUP BY status")->fetchAll(PDO::FETCH_ASSOC);
$res['companies'] = $pdo->query("SELECT status, count(*) as c FROM tbl_company GROUP BY status")->fetchAll(PDO::FETCH_ASSOC);
$res['employees'] = $pdo->query("SELECT status, count(*) as c FROM tbl_employees GROUP BY status")->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($res);
?>