This commit is contained in:
lizandrogd
2026-01-21 02:22:29 -05:00
parent 3fffb0d023
commit b1961f0116
35 changed files with 1006 additions and 122 deletions
+17 -12
View File
@@ -24,18 +24,23 @@ header('Access-Control-Allow-Headers: Content-Type');
try {
$db = Database::getInstance();
$templates = $db->fetchAll(
"SELECT
id,
name,
template_name,
language_code,
category,
status,
created_at
FROM message_templates
ORDER BY name ASC"
);
$approvedOnly = isset($_GET['approved_only']) && $_GET['approved_only'] == '1';
$limit = isset($_GET['limit']) ? intval($_GET['limit']) : null;
$sql = "SELECT id, name, template_name, language_code, category, status, body_text, created_at FROM message_templates";
$params = [];
if ($approvedOnly) {
$sql .= " WHERE status = 'approved'";
}
$sql .= " ORDER BY name ASC";
if ($limit && $limit > 0) {
$sql .= " LIMIT " . $limit;
}
$templates = $db->fetchAll($sql, $params);
echo json_encode([
'success' => true,