Initial commit BIJ CI4
This commit is contained in:
32
public/ios/app/debug/base_url_example.php
Normal file
32
public/ios/app/debug/base_url_example.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Base URL Example</h2>";
|
||||
|
||||
echo "<h3>Constants:</h3>";
|
||||
echo "<p><strong>BASE_URL:</strong> " . BASE_URL . "</p>";
|
||||
echo "<p><strong>API_BASE:</strong> " . API_BASE . "</p>";
|
||||
|
||||
echo "<h3>Helper Functions:</h3>";
|
||||
echo "<p><strong>url('dashboard.php'):</strong> " . url('dashboard.php') . "</p>";
|
||||
echo "<p><strong>url('login.php'):</strong> " . url('login.php') . "</p>";
|
||||
echo "<p><strong>url('detail-info.php?id=123'):</strong> " . url('detail-info.php?id=123') . "</p>";
|
||||
|
||||
echo "<p><strong>asset('css/style.css'):</strong> " . asset('css/style.css') . "</p>";
|
||||
echo "<p><strong>asset('logo_bij3.png'):</strong> " . asset('logo_bij3.png') . "</p>";
|
||||
echo "<p><strong>asset('favicon.ico'):</strong> " . asset('favicon.ico') . "</p>";
|
||||
|
||||
echo "<h3>Usage Examples:</h3>";
|
||||
echo "<p>Link to dashboard: <a href='" . url('dashboard.php') . "'>Dashboard</a></p>";
|
||||
echo "<p>CSS file: <link rel='stylesheet' href='" . asset('css/style.css') . "'>";
|
||||
echo "<p>Image: <img src='" . asset('logo_bij3.png') . "' alt='Logo'>";
|
||||
|
||||
echo "<h3>Current URL Detection:</h3>";
|
||||
echo "<p><strong>Current URL:</strong> " . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "</p>";
|
||||
|
||||
echo "<h3>Dynamic Base URL (Alternative):</h3>";
|
||||
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$script_name = dirname($_SERVER['SCRIPT_NAME']);
|
||||
$dynamic_base = $protocol . '://' . $host . $script_name . '/';
|
||||
echo "<p><strong>Dynamic Base URL:</strong> " . $dynamic_base . "</p>";
|
||||
41
public/ios/app/debug/berita_fresh_test.php
Normal file
41
public/ios/app/debug/berita_fresh_test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Fresh Berita Test</h2>";
|
||||
|
||||
// Fresh login
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "✅ Fresh login berhasil<br>";
|
||||
echo "Token: " . substr($token, 0, 20) . "...<br><br>";
|
||||
|
||||
// Test api_get_berita
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<h3>API Get Berita Result:</h3>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "<br>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$berita_data = $berita_result['data'];
|
||||
echo "Data Type: " . gettype($berita_data) . "<br>";
|
||||
echo "Data Count: " . (is_array($berita_data) ? count($berita_data) : 'N/A') . "<br>";
|
||||
|
||||
if (is_array($berita_data) && !empty($berita_data)) {
|
||||
echo "<h3>First Berita Item:</h3>";
|
||||
$first = $berita_data[0];
|
||||
echo "Raw: <pre>" . print_r($first, true) . "</pre>";
|
||||
echo "Judul: " . ($first['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($first['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($first['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
} else {
|
||||
echo "❌ Data kosong atau bukan array<br>";
|
||||
}
|
||||
} else {
|
||||
echo "❌ API call gagal<br>";
|
||||
echo "Error: " . json_encode($berita_result['data']) . "<br>";
|
||||
}
|
||||
} else {
|
||||
echo "❌ Login gagal: " . json_encode($login_result['data']) . "<br>";
|
||||
}
|
||||
57
public/ios/app/debug/berita_test_clean.php
Normal file
57
public/ios/app/debug/berita_test_clean.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// Test berita tanpa extension interference
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "=== BERITA TEST CLEAN ===\n\n";
|
||||
|
||||
// Login fresh
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "✅ Login berhasil\n";
|
||||
echo "Token: " . substr($token, 0, 20) . "...\n\n";
|
||||
|
||||
// Call API directly
|
||||
$ch = curl_init(API_BASE . 'berita');
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => ['token' => $token],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: $httpCode\n";
|
||||
echo "Raw Response Length: " . strlen($response) . " bytes\n\n";
|
||||
|
||||
$data = json_decode($response, true);
|
||||
echo "JSON Decode Success: " . (json_last_error() === JSON_ERROR_NONE ? 'YES' : 'NO') . "\n";
|
||||
echo "JSON Error: " . json_last_error_msg() . "\n\n";
|
||||
|
||||
if ($data && isset($data['data'])) {
|
||||
echo "Data Count: " . count($data['data']) . "\n";
|
||||
if (!empty($data['data'])) {
|
||||
$first = $data['data'][0];
|
||||
echo "\n=== FIRST ITEM ===\n";
|
||||
echo "Judul: " . ($first['judul'] ?? 'N/A') . "\n";
|
||||
echo "Tanggal: " . ($first['tanggal'] ?? 'N/A') . "\n";
|
||||
echo "Isi: " . substr(strip_tags($first['isi'] ?? 'N/A'), 0, 100) . "...\n";
|
||||
|
||||
echo "\n=== ALL FIELDS ===\n";
|
||||
foreach ($first as $key => $value) {
|
||||
echo "$key: " . (is_string($value) ? substr($value, 0, 50) . "..." : $value) . "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "❌ No data found\n";
|
||||
}
|
||||
} else {
|
||||
echo "❌ Login gagal: " . json_encode($login_result['data']) . "\n";
|
||||
}
|
||||
60
public/ios/app/debug/check_berita_json.php
Normal file
60
public/ios/app/debug/check_berita_json.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$token = $_SESSION['token'] ?? null;
|
||||
if (!$token) {
|
||||
echo "No token found";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<h2>Check Berita JSON Response</h2>";
|
||||
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<h3>Full API Response:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($berita_result);
|
||||
echo "</pre>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$data = $berita_result['data'];
|
||||
echo "<h3>Data Structure:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($data);
|
||||
echo "</pre>";
|
||||
|
||||
$items = $data['data'] ?? $data;
|
||||
if (is_array($items) && count($items) > 0) {
|
||||
echo "<h3>First Item Keys:</h3>";
|
||||
$first_item = $items[0];
|
||||
echo "<ul>";
|
||||
foreach (array_keys($first_item) as $key) {
|
||||
echo "<li><strong>$key</strong>: " . gettype($first_item[$key]) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
echo "<h3>First Item Values:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($first_item);
|
||||
echo "</pre>";
|
||||
|
||||
// Check specifically for photo-related fields
|
||||
echo "<h3>Photo Field Check:</h3>";
|
||||
$photo_fields = ['photo', 'foto', 'image', 'gambar', 'img', 'thumbnail', 'preview', 'cover'];
|
||||
foreach ($photo_fields as $field) {
|
||||
if (isset($first_item[$field])) {
|
||||
$value = $first_item[$field];
|
||||
echo "<p><strong>$field:</strong> " . htmlspecialchars($value) . " (" . gettype($value) . ")</p>";
|
||||
|
||||
if (is_string($value) && !empty($value) && ($u = uploads_berita_url($value)) !== '') {
|
||||
echo "<p>Test URL: <a href='" . htmlspecialchars($u) . "' target='_blank'>" . htmlspecialchars($u) . "</a></p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p><strong>$field:</strong> NOT FOUND</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>API Error: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
49
public/ios/app/debug/dashboard_berita_test.php
Normal file
49
public/ios/app/debug/dashboard_berita_test.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Simulate dashboard environment
|
||||
if (!isset($_SESSION['token'])) {
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$_SESSION['token'] = $login_result['data']['token'];
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
}
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'] ?? '';
|
||||
|
||||
// Get berita exactly like dashboard
|
||||
$berita_result = api_get_berita($token);
|
||||
$berita_data = $berita_result['success'] ? $berita_result['data'] : [];
|
||||
|
||||
echo "<h2>Dashboard Berita Test</h2>";
|
||||
|
||||
echo "<h3>API Result:</h3>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "<br>";
|
||||
|
||||
echo "<h3>Data Analysis:</h3>";
|
||||
echo "Data Type: " . gettype($berita_data) . "<br>";
|
||||
echo "Data Count: " . (is_array($berita_data) ? count($berita_data) : 'N/A') . "<br>";
|
||||
echo "Data Empty: " . (empty($berita_data) ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
echo "<h3>Raw Data:</h3>";
|
||||
echo "<pre>" . print_r($berita_data, true) . "</pre>";
|
||||
|
||||
echo "<h3>Dashboard Logic Test:</h3>";
|
||||
if (!empty($berita_data) && is_array($berita_data)) {
|
||||
echo "✅ Condition passed - should show berita<br>";
|
||||
echo "<h4>Sample Berita:</h4>";
|
||||
foreach (array_slice($berita_data, 0, 2) as $index => $berita) {
|
||||
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 5px 0;'>";
|
||||
echo "<strong>Berita " . (intval($index) + 1) . ":</strong><br>";
|
||||
echo "Raw: <pre>" . print_r($berita, true) . "</pre>";
|
||||
echo "Judul: " . ($berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($berita['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "❌ Condition failed - showing 'Tidak ada pengumuman'<br>";
|
||||
}
|
||||
57
public/ios/app/debug/dashboard_debug.php
Normal file
57
public/ios/app/debug/dashboard_debug.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Simulate dashboard environment
|
||||
if (!isset($_SESSION['token'])) {
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$_SESSION['token'] = $login_result['data']['token'];
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
}
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'] ?? '';
|
||||
|
||||
// Get berita exactly like dashboard
|
||||
$berita_result = api_get_berita($token);
|
||||
$berita_data = $berita_result['success'] ? $berita_result['data'] : [];
|
||||
|
||||
echo "<h2>Dashboard Debug - Berita</h2>";
|
||||
|
||||
echo "<h3>API Result:</h3>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "<br>";
|
||||
|
||||
echo "<h3>Data Analysis:</h3>";
|
||||
echo "Data Type: " . gettype($berita_data) . "<br>";
|
||||
echo "Data Count: " . (is_array($berita_data) ? count($berita_data) : 'N/A') . "<br>";
|
||||
echo "Data Empty: " . (empty($berita_data) ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
echo "<h3>Raw Data:</h3>";
|
||||
echo "<pre>" . print_r($berita_data, true) . "</pre>";
|
||||
|
||||
echo "<h3>Dashboard Logic Test:</h3>";
|
||||
if (!empty($berita_data) && is_array($berita_data)) {
|
||||
echo "✅ Condition passed - should show berita<br>";
|
||||
|
||||
// Handle different data structures
|
||||
$berita_items = array_values($berita_data); // Convert to indexed array
|
||||
$berita_items = array_slice($berita_items, 0, 3);
|
||||
|
||||
echo "Berita Items Count: " . count($berita_items) . "<br>";
|
||||
|
||||
foreach ($berita_items as $index => $berita) {
|
||||
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 5px 0;'>";
|
||||
echo "<strong>Berita " . (intval($index) + 1) . ":</strong><br>";
|
||||
echo "Raw: <pre>" . print_r($berita, true) . "</pre>";
|
||||
echo "Judul: " . ($berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($berita['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "❌ Condition failed - showing 'Tidak ada pengumuman'<br>";
|
||||
echo "Empty check: " . (empty($berita_data) ? 'TRUE' : 'FALSE') . "<br>";
|
||||
echo "Array check: " . (is_array($berita_data) ? 'TRUE' : 'FALSE') . "<br>";
|
||||
}
|
||||
136
public/ios/app/debug/dashboard_simple.php
Normal file
136
public/ios/app/debug/dashboard_simple.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
$user_data = $_SESSION['user_data'] ?? [];
|
||||
|
||||
// Get user profile data
|
||||
$profile_result = api_get_profil($token);
|
||||
$profile_data = $profile_result['success'] ? $profile_result['data'] : [];
|
||||
|
||||
// Get today's attendance
|
||||
$presensi_today_result = api_get_presensi_today($token);
|
||||
$presensi_today = $presensi_today_result['success'] ? $presensi_today_result['data'] : [];
|
||||
|
||||
// Extract user info from API response
|
||||
$pegawai = $profile_data['pegawai'] ?? [];
|
||||
$user_name = $pegawai['nama_lengkap'] ?? $user_data['nama'] ?? 'User';
|
||||
$user_jabatan = $pegawai['jabatan']['nama_jabatan'] ?? $user_data['jabatan'] ?? 'Karyawan';
|
||||
$user_id = $pegawai['nip'] ?? $user_data['id'] ?? '';
|
||||
$unit_kerja = $pegawai['unit_kerja']['nama_unit_kerja'] ?? 'Unit Kerja';
|
||||
$kantor = $pegawai['kantor']['nama_kantor'] ?? 'Kantor Pusat';
|
||||
$alamat_kantor = $pegawai['kantor']['alamat_kantor'] ?? '';
|
||||
$kode_kantor = $pegawai['kantor']['kode_kantor'] ?? '';
|
||||
|
||||
// Extract attendance info from presensi_today
|
||||
$presensi_data_today = $presensi_today['data'] ?? [];
|
||||
$masuk_time = $presensi_data_today['jam_masuk'] ?? null;
|
||||
$pulang_time = $presensi_data_today['jam_pulang'] ?? null;
|
||||
|
||||
// Extract work schedule info from profile
|
||||
$jadwal = $pegawai['jadwal'] ?? [];
|
||||
$jam_masuk = $jadwal['masuk'] ?? '08:00';
|
||||
$jam_pulang = $jadwal['pulang'] ?? '17:00';
|
||||
$jam_istirahat = $jadwal['istirahat'] ?? '12:00';
|
||||
$toleransi_masuk = $jadwal['toleransi_masuk'] ?? '15';
|
||||
|
||||
// Helper function untuk format tanggal Indonesia
|
||||
function formatTanggalIndonesia($format = 'l, d F Y')
|
||||
{
|
||||
$hari = ['Sunday' => 'Minggu', 'Monday' => 'Senin', 'Tuesday' => 'Selasa', 'Wednesday' => 'Rabu', 'Thursday' => 'Kamis', 'Friday' => 'Jumat', 'Saturday' => 'Sabtu'];
|
||||
$bulan = ['January' => 'Januari', 'February' => 'Februari', 'March' => 'Maret', 'April' => 'April', 'May' => 'Mei', 'June' => 'Juni', 'July' => 'Juli', 'August' => 'Agustus', 'September' => 'September', 'October' => 'Oktober', 'November' => 'November', 'December' => 'Desember'];
|
||||
$tanggal_inggris = date($format);
|
||||
$tanggal_indonesia = str_replace(array_keys($hari), array_values($hari), str_replace(array_keys($bulan), array_values($bulan), $tanggal_inggris));
|
||||
return $tanggal_indonesia;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard - Sistem Presensi Bank BIJ</title>
|
||||
<link rel="stylesheet" href="<?php echo asset('css/tailwind-essential.css'); ?>">
|
||||
</head>
|
||||
|
||||
<body class="bg-gradient-to-br from-blue-900 via-blue-800 to-blue-700 min-h-screen">
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<!-- Header -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-800">Dashboard Presensi</h1>
|
||||
<p class="text-gray-600">Bank BIJ</p>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<p class="text-lg font-semibold text-gray-800"><?php echo htmlspecialchars($user_name); ?></p>
|
||||
<p class="text-gray-600"><?php echo htmlspecialchars($user_jabatan); ?></p>
|
||||
<p class="text-sm text-gray-500"><?php echo htmlspecialchars($user_id); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Informasi Jadwal Kerja -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-4">Informasi Jadwal Kerja</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Jadwal Kerja:</p>
|
||||
<p class="text-lg font-semibold text-gray-800"><?php echo formatTanggalIndonesia(); ?></p>
|
||||
<p class="text-gray-700"><?php echo $jam_masuk; ?> - <?php echo $jam_pulang; ?></p>
|
||||
<p class="text-sm text-gray-600">Istirahat: <?php echo $jam_istirahat; ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Lokasi Kerja:</p>
|
||||
<p class="text-lg font-semibold text-gray-800"><?php echo htmlspecialchars($unit_kerja); ?></p>
|
||||
<?php if (!empty($alamat_kantor)): ?>
|
||||
<p class="text-sm text-gray-600"><?php echo htmlspecialchars($alamat_kantor); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Status Kehadiran Hari Ini -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-4">Status Kehadiran Hari Ini</h2>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="text-center p-4 border rounded-lg <?php echo $masuk_time ? 'bg-green-50 border-green-200' : 'bg-gray-50 border-gray-200'; ?>">
|
||||
<p class="text-sm text-gray-500">Masuk</p>
|
||||
<p class="text-xl font-bold text-gray-800"><?php echo $masuk_time ?: '00:00'; ?></p>
|
||||
<p class="text-sm text-gray-500"><?php echo $masuk_time ? '(sudah rekam)' : '(belum rekam)'; ?></p>
|
||||
</div>
|
||||
<div class="text-center p-4 border rounded-lg <?php echo $pulang_time ? 'bg-green-50 border-green-200' : 'bg-gray-50 border-gray-200'; ?>">
|
||||
<p class="text-sm text-gray-500">Pulang</p>
|
||||
<p class="text-xl font-bold text-gray-800"><?php echo $pulang_time ?: '00:00'; ?></p>
|
||||
<p class="text-sm text-gray-500"><?php echo $pulang_time ? '(sudah rekam)' : '(belum rekam)'; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-4">Aksi Presensi</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<a href="rekam.php" class="bg-blue-600 text-white px-6 py-3 rounded-lg text-center hover:bg-blue-700 transition">
|
||||
<i class="fas fa-clock mr-2"></i>Rekam Presensi
|
||||
</a>
|
||||
<a href="dashboard.php" class="bg-green-600 text-white px-6 py-3 rounded-lg text-center hover:bg-green-700 transition">
|
||||
<i class="fas fa-chart-bar mr-2"></i>Lihat Dashboard
|
||||
</a>
|
||||
<a href="logout.php" class="bg-red-600 text-white px-6 py-3 rounded-lg text-center hover:bg-red-700 transition">
|
||||
<i class="fas fa-sign-out-alt mr-2"></i>Logout
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
94
public/ios/app/debug/debug_api_response.php
Normal file
94
public/ios/app/debug/debug_api_response.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
// Test data
|
||||
$test_data = [
|
||||
'latitude' => -6.2088,
|
||||
'longitude' => 106.8456,
|
||||
'waktu' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
echo "<h1>Debug API Response - Presensi Submit</h1>";
|
||||
echo "<p><strong>Token:</strong> " . substr($token, 0, 20) . "...</p>";
|
||||
echo "<p><strong>Test Data:</strong></p>";
|
||||
echo "<pre>" . json_encode($test_data, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test Masuk
|
||||
echo "<h2>Test API Save Masuk</h2>";
|
||||
$result_masuk = api_save_masuk($token, $test_data);
|
||||
echo "<p><strong>Success:</strong> " . ($result_masuk['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $result_masuk['http_code'] . "</p>";
|
||||
echo "<p><strong>Raw Response:</strong></p>";
|
||||
echo "<pre>" . json_encode($result_masuk, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test Pulang
|
||||
echo "<h2>Test API Save Pulang</h2>";
|
||||
$result_pulang = api_save_pulang($token, $test_data);
|
||||
echo "<p><strong>Success:</strong> " . ($result_pulang['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $result_pulang['http_code'] . "</p>";
|
||||
echo "<p><strong>Raw Response:</strong></p>";
|
||||
echo "<pre>" . json_encode($result_pulang, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test Istirahat
|
||||
echo "<h2>Test API Save Istirahat</h2>";
|
||||
$result_istirahat = api_save_istirahat($token, $test_data);
|
||||
echo "<p><strong>Success:</strong> " . ($result_istirahat['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $result_istirahat['http_code'] . "</p>";
|
||||
echo "<p><strong>Raw Response:</strong></p>";
|
||||
echo "<pre>" . json_encode($result_istirahat, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test dengan koordinat yang berbeda
|
||||
echo "<h2>Test dengan Koordinat Jauh (500m dari kantor)</h2>";
|
||||
$test_data_jauh = [
|
||||
'latitude' => -6.2138, // ~500m dari kantor
|
||||
'longitude' => 106.8506,
|
||||
'waktu' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
echo "<p><strong>Test Data Jauh:</strong></p>";
|
||||
echo "<pre>" . json_encode($test_data_jauh, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
$result_jauh = api_save_masuk($token, $test_data_jauh);
|
||||
echo "<p><strong>Success:</strong> " . ($result_jauh['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $result_jauh['http_code'] . "</p>";
|
||||
echo "<p><strong>Raw Response:</strong></p>";
|
||||
echo "<pre>" . json_encode($result_jauh, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test dengan koordinat yang sangat jauh
|
||||
echo "<h2>Test dengan Koordinat Sangat Jauh (10km dari kantor)</h2>";
|
||||
$test_data_sangat_jauh = [
|
||||
'latitude' => -6.3088, // ~10km dari kantor
|
||||
'longitude' => 106.9456,
|
||||
'waktu' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
echo "<p><strong>Test Data Sangat Jauh:</strong></p>";
|
||||
echo "<pre>" . json_encode($test_data_sangat_jauh, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
$result_sangat_jauh = api_save_masuk($token, $test_data_sangat_jauh);
|
||||
echo "<p><strong>Success:</strong> " . ($result_sangat_jauh['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $result_sangat_jauh['http_code'] . "</p>";
|
||||
echo "<p><strong>Raw Response:</strong></p>";
|
||||
echo "<pre>" . json_encode($result_sangat_jauh, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='rekam.php'>← Kembali ke Rekam Presensi</a></p>";
|
||||
43
public/ios/app/debug/debug_berita.php
Normal file
43
public/ios/app/debug/debug_berita.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug Berita/Pengumuman</h2>";
|
||||
|
||||
// Login dulu
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
|
||||
// Get berita
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h3>Berita API Response:</h3>";
|
||||
echo "<pre>" . json_encode($berita_result, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$berita_data = $berita_result['data'];
|
||||
echo "<h3>Berita Data Count: " . count($berita_data) . "</h3>";
|
||||
|
||||
if (!empty($berita_data)) {
|
||||
echo "<h3>Sample Berita:</h3>";
|
||||
foreach (array_slice($berita_data, 0, 3) as $index => $berita) {
|
||||
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 10px 0;'>";
|
||||
echo "<strong>Berita #" . (intval($index) + 1) . ":</strong><br>";
|
||||
echo "ID: " . ($berita['id_berita'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Judul: " . ($berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . ($berita['isi'] ?? 'N/A') . "<br>";
|
||||
echo "Photo: " . ($berita['photo'] ?? 'N/A') . "<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>Berita data kosong!</p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>API berita gagal: " . json_encode($berita_result['data']) . "</p>";
|
||||
}
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
49
public/ios/app/debug/debug_berita_direct.php
Normal file
49
public/ios/app/debug/debug_berita_direct.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug Berita Direct</h2>";
|
||||
|
||||
// Login dulu
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
|
||||
// Get berita
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<h3>Raw API Response:</h3>";
|
||||
echo "<pre>" . json_encode($berita_result, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
echo "<h3>Data Extraction:</h3>";
|
||||
$berita_data = $berita_result['success'] ? $berita_result['data'] : [];
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "Data Type: " . gettype($berita_data) . "<br>";
|
||||
echo "Data Count: " . (is_array($berita_data) ? count($berita_data) : 'N/A') . "<br>";
|
||||
echo "Data Empty: " . (empty($berita_data) ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
echo "<h3>Data Content:</h3>";
|
||||
echo "<pre>" . json_encode($berita_data, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
echo "<h3>Test Display Logic:</h3>";
|
||||
if (!empty($berita_data) && is_array($berita_data)) {
|
||||
echo "✅ Condition passed - should show berita<br>";
|
||||
echo "<h4>Raw Array Structure:</h4>";
|
||||
echo "<pre>" . print_r($berita_data, true) . "</pre>";
|
||||
|
||||
foreach (array_slice($berita_data, 0, 3) as $index => $berita) {
|
||||
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 5px 0;'>";
|
||||
echo "<strong>Berita " . (intval($index) + 1) . ":</strong><br>";
|
||||
echo "Raw berita item: <pre>" . print_r($berita, true) . "</pre>";
|
||||
echo "Judul: " . ($berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($berita['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "❌ Condition failed - showing 'Tidak ada pengumuman'<br>";
|
||||
echo "Empty check: " . (empty($berita_data) ? 'TRUE' : 'FALSE') . "<br>";
|
||||
echo "Array check: " . (is_array($berita_data) ? 'TRUE' : 'FALSE') . "<br>";
|
||||
}
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
50
public/ios/app/debug/debug_berita_ids.php
Normal file
50
public/ios/app/debug/debug_berita_ids.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
// Get berita data
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<h2>Debug Berita IDs</h2>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$berita_data = $berita_result['data'];
|
||||
$berita_items = $berita_data['data'] ?? $berita_data;
|
||||
|
||||
if (is_array($berita_items)) {
|
||||
echo "<h3>Available Berita Items:</h3>";
|
||||
echo "<table border='1' cellpadding='5' cellspacing='0'>";
|
||||
echo "<tr><th>Index</th><th>ID</th><th>Judul</th><th>Tanggal</th><th>Link</th></tr>";
|
||||
|
||||
foreach ($berita_items as $index => $item) {
|
||||
$item_id = $item['id'] ?? 'NO_ID';
|
||||
$item_judul = $item['judul'] ?? 'NO_TITLE';
|
||||
$item_tanggal = $item['tanggal'] ?? 'NO_DATE';
|
||||
$link = "detail-info.php?id=" . urlencode($item_id);
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td>$index</td>";
|
||||
echo "<td>$item_id</td>";
|
||||
echo "<td>" . htmlspecialchars($item_judul) . "</td>";
|
||||
echo "<td>" . htmlspecialchars($item_tanggal) . "</td>";
|
||||
echo "<td><a href='$link' target='_blank'>Test Link</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
} else {
|
||||
echo "<p>Berita items is not an array</p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>API call failed: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
|
||||
echo "<p><a href='dashboard.php'>← Kembali ke Dashboard</a></p>";
|
||||
59
public/ios/app/debug/debug_berita_photo.php
Normal file
59
public/ios/app/debug/debug_berita_photo.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
echo "<h2>Debug Berita Photo Structure</h2>";
|
||||
|
||||
// Get berita data
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$berita_data = $berita_result['data'];
|
||||
$berita_items = $berita_data['data'] ?? $berita_data;
|
||||
|
||||
echo "<h3>Raw API Response:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($berita_result);
|
||||
echo "</pre>";
|
||||
|
||||
if (is_array($berita_items)) {
|
||||
echo "<h3>Photo Fields Analysis:</h3>";
|
||||
foreach ($berita_items as $index => $item) {
|
||||
echo "<h4>Item $index:</h4>";
|
||||
echo "<pre>";
|
||||
print_r($item);
|
||||
echo "</pre>";
|
||||
|
||||
// Check all possible photo fields
|
||||
$photo_fields = ['photo', 'foto', 'image', 'gambar', 'img', 'thumbnail', 'preview'];
|
||||
echo "<h5>Photo Fields Check:</h5>";
|
||||
foreach ($photo_fields as $field) {
|
||||
$value = $item[$field] ?? 'NOT_FOUND';
|
||||
echo "<p><strong>$field:</strong> " . htmlspecialchars($value) . "</p>";
|
||||
}
|
||||
|
||||
// Check if there are any fields that might contain image data
|
||||
echo "<h5>All Fields:</h5>";
|
||||
foreach ($item as $key => $value) {
|
||||
if (is_string($value) && (strpos($value, '.jpg') !== false || strpos($value, '.jpeg') !== false || strpos($value, '.png') !== false || strpos($value, '.gif') !== false)) {
|
||||
echo "<p style='color: green;'><strong>$key:</strong> " . htmlspecialchars($value) . " (POSSIBLE IMAGE)</p>";
|
||||
} else {
|
||||
echo "<p><strong>$key:</strong> " . htmlspecialchars(is_string($value) ? $value : gettype($value)) . "</p>";
|
||||
}
|
||||
}
|
||||
echo "<hr>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>API call failed: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
|
||||
echo "<p><a href='dashboard.php'>← Kembali ke Dashboard</a></p>";
|
||||
62
public/ios/app/debug/debug_data.php
Normal file
62
public/ios/app/debug/debug_data.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug Data Dashboard</h2>";
|
||||
|
||||
// Login fresh
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
|
||||
echo "✅ Login berhasil<br><br>";
|
||||
|
||||
// Get profile data
|
||||
$profile_result = api_get_profil($token);
|
||||
$profile_data = $profile_result['success'] ? $profile_result['data'] : [];
|
||||
|
||||
echo "<h3>Profile Data:</h3>";
|
||||
echo "Success: " . ($profile_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "Raw Data: <pre>" . print_r($profile_data, true) . "</pre>";
|
||||
|
||||
if ($profile_result['success']) {
|
||||
$pegawai = $profile_data['pegawai'] ?? [];
|
||||
echo "<h4>Pegawai Data:</h4>";
|
||||
echo "<pre>" . print_r($pegawai, true) . "</pre>";
|
||||
|
||||
echo "<h4>Extracted Values:</h4>";
|
||||
echo "Nama: " . ($pegawai['nama_lengkap'] ?? 'N/A') . "<br>";
|
||||
echo "Jabatan: " . ($pegawai['jabatan']['nama_jabatan'] ?? 'N/A') . "<br>";
|
||||
echo "Kantor: " . ($pegawai['kantor']['nama_kantor'] ?? 'N/A') . "<br>";
|
||||
echo "Unit Kerja: " . ($pegawai['unit_kerja']['nama_unit_kerja'] ?? 'N/A') . "<br>";
|
||||
echo "Alamat Kantor: " . ($pegawai['kantor']['alamat_kantor'] ?? 'N/A') . "<br>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Get berita data
|
||||
$berita_result = api_get_berita($token);
|
||||
$berita_data = $berita_result['success'] ? $berita_result['data'] : [];
|
||||
|
||||
echo "<h3>Berita Data:</h3>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "<br>";
|
||||
echo "Raw Data: <pre>" . print_r($berita_data, true) . "</pre>";
|
||||
|
||||
if ($berita_result['success'] && !empty($berita_data)) {
|
||||
echo "<h4>Berita Items:</h4>";
|
||||
$berita_items = array_values($berita_data);
|
||||
foreach (array_slice($berita_items, 0, 2) as $index => $berita) {
|
||||
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 5px 0;'>";
|
||||
echo "<strong>Berita " . ($index + 1) . ":</strong><br>";
|
||||
echo "Judul: " . ($berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($berita['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "❌ Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
68
public/ios/app/debug/debug_detail_info.php
Normal file
68
public/ios/app/debug/debug_detail_info.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
$berita_id = $_GET['id'] ?? '';
|
||||
|
||||
echo "<h2>Debug Detail Info</h2>";
|
||||
echo "<p><strong>ID yang dicari:</strong> " . htmlspecialchars($berita_id) . "</p>";
|
||||
|
||||
// Get berita data
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h3>API Response:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($berita_result);
|
||||
echo "</pre>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$berita_data = $berita_result['data'];
|
||||
echo "<h3>Berita Data:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($berita_data);
|
||||
echo "</pre>";
|
||||
|
||||
// Check structure
|
||||
$berita_items = $berita_data['data'] ?? $berita_data;
|
||||
echo "<h3>Berita Items (extracted):</h3>";
|
||||
echo "<pre>";
|
||||
print_r($berita_items);
|
||||
echo "</pre>";
|
||||
|
||||
if (is_array($berita_items)) {
|
||||
echo "<h3>Available IDs:</h3>";
|
||||
foreach ($berita_items as $index => $item) {
|
||||
$item_id = $item['id'] ?? 'NO_ID';
|
||||
$item_judul = $item['judul'] ?? 'NO_TITLE';
|
||||
echo "<p>Index $index: ID = '$item_id', Judul = '$item_judul'</p>";
|
||||
}
|
||||
|
||||
// Try to find the specific ID
|
||||
echo "<h3>Searching for ID: '$berita_id'</h3>";
|
||||
$found = false;
|
||||
foreach ($berita_items as $item) {
|
||||
if (($item['id'] ?? '') == $berita_id) {
|
||||
echo "<p style='color: green; font-weight: bold;'>FOUND! Item details:</p>";
|
||||
echo "<pre>";
|
||||
print_r($item);
|
||||
echo "</pre>";
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
echo "<p style='color: red; font-weight: bold;'>ID '$berita_id' NOT FOUND in the data!</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'>API call failed: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
|
||||
echo "<p><a href='detail-info.php?id=$berita_id'>← Kembali ke Detail Info</a></p>";
|
||||
55
public/ios/app/debug/debug_info.php
Normal file
55
public/ios/app/debug/debug_info.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug Information</h2>";
|
||||
echo "<p><strong>API_BASE:</strong> " . htmlspecialchars(API_BASE) . "</p>";
|
||||
|
||||
echo "<h3>PHP Version:</h3>";
|
||||
echo phpversion() . "<br><br>";
|
||||
|
||||
echo "<h3>CURL Support:</h3>";
|
||||
echo (extension_loaded('curl') ? 'YES' : 'NO') . "<br><br>";
|
||||
|
||||
echo "<h3>JSON Support:</h3>";
|
||||
echo (extension_loaded('json') ? 'YES' : 'NO') . "<br><br>";
|
||||
|
||||
echo "<h3>OpenSSL Support:</h3>";
|
||||
echo (extension_loaded('openssl') ? 'YES' : 'NO') . "<br><br>";
|
||||
|
||||
echo "<h3>Error Log Location:</h3>";
|
||||
echo ini_get('error_log') . "<br><br>";
|
||||
|
||||
echo "<h3>Last 20 Error Log Entries:</h3>";
|
||||
$log_file = ini_get('error_log');
|
||||
if (file_exists($log_file)) {
|
||||
$log_entries = file_get_contents($log_file);
|
||||
$lines = explode("\n", $log_entries);
|
||||
$recent_lines = array_slice($lines, -20);
|
||||
foreach ($recent_lines as $line) {
|
||||
if (trim($line) && strpos($line, 'API') !== false) {
|
||||
echo htmlspecialchars($line) . "<br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Error log file not found<br>";
|
||||
}
|
||||
|
||||
echo "<h3>Test Direct API Call:</h3>";
|
||||
$url = API_BASE . 'login';
|
||||
$data = json_encode(['username' => 'admin', 'password' => 'admin']);
|
||||
|
||||
$context = stream_context_create([
|
||||
'http' => [
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/json',
|
||||
'content' => $data,
|
||||
'timeout' => 10
|
||||
]
|
||||
]);
|
||||
|
||||
$result = file_get_contents($url, false, $context);
|
||||
echo "Result: " . htmlspecialchars($result) . "<br>";
|
||||
|
||||
if ($http_response_header) {
|
||||
echo "Headers: " . implode('<br>', $http_response_header) . "<br>";
|
||||
}
|
||||
45
public/ios/app/debug/debug_lembur.php
Normal file
45
public/ios/app/debug/debug_lembur.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
echo "Token not found. Please login first.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
echo "<h1>Debug Lembur Data</h1>";
|
||||
echo "<p>Token: " . substr($token, 0, 20) . "...</p>";
|
||||
|
||||
// Get lembur data
|
||||
$lembur_result = api_get_lembur($token);
|
||||
echo "<h2>API Result:</h2>";
|
||||
echo "<pre>";
|
||||
print_r($lembur_result);
|
||||
echo "</pre>";
|
||||
|
||||
$lembur_data = $lembur_result['success'] ? $lembur_result['data'] : [];
|
||||
|
||||
echo "<h2>Lembur Data:</h2>";
|
||||
echo "<pre>";
|
||||
print_r($lembur_data);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h2>Data Analysis:</h2>";
|
||||
echo "<p>Success: " . ($lembur_result['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p>HTTP Code: " . $lembur_result['http_code'] . "</p>";
|
||||
echo "<p>Data empty: " . (empty($lembur_data) ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p>Data is array: " . (is_array($lembur_data) ? 'YES' : 'NO') . "</p>";
|
||||
|
||||
if (is_array($lembur_data)) {
|
||||
echo "<p>Data count: " . count($lembur_data) . "</p>";
|
||||
|
||||
if (isset($lembur_data['data'])) {
|
||||
echo "<p>Data['data'] is array: " . (is_array($lembur_data['data']) ? 'YES' : 'NO') . "</p>";
|
||||
if (is_array($lembur_data['data'])) {
|
||||
echo "<p>Data['data'] count: " . count($lembur_data['data']) . "</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
85
public/ios/app/debug/debug_login.php
Normal file
85
public/ios/app/debug/debug_login.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Debug login langsung
|
||||
$username = $_POST['username'] ?? 'admin';
|
||||
$password = $_POST['password'] ?? 'admin';
|
||||
|
||||
echo "<h2>Debug Login</h2>";
|
||||
echo "Username: " . htmlspecialchars($username) . "<br>";
|
||||
echo "Password: " . htmlspecialchars($password) . "<br><br>";
|
||||
|
||||
// Test langsung dengan curl
|
||||
$url = API_BASE . 'login';
|
||||
$data = json_encode([
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
]);
|
||||
|
||||
echo "URL: " . $url . "<br>";
|
||||
echo "Data: " . $data . "<br><br>";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
|
||||
],
|
||||
CURLOPT_POSTFIELDS => $data,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_VERBOSE => true
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$error = curl_error($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
|
||||
echo "<h3>Response:</h3>";
|
||||
echo "HTTP Code: " . $httpCode . "<br>";
|
||||
echo "Error: " . ($error ?: 'None') . "<br>";
|
||||
echo "Response: " . htmlspecialchars($response) . "<br><br>";
|
||||
|
||||
echo "<h3>CURL Info:</h3>";
|
||||
echo "<pre>" . print_r($info, true) . "</pre>";
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
// Test dengan method GET juga
|
||||
echo "<h3>Test GET Request:</h3>";
|
||||
$get_url = API_BASE . 'login?username=' . urlencode($username) . '&password=' . urlencode($password);
|
||||
echo "GET URL: " . $get_url . "<br>";
|
||||
|
||||
$ch2 = curl_init();
|
||||
curl_setopt_array($ch2, [
|
||||
CURLOPT_URL => $get_url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_FOLLOWLOCATION => true
|
||||
]);
|
||||
|
||||
$response2 = curl_exec($ch2);
|
||||
$httpCode2 = curl_getinfo($ch2, CURLINFO_HTTP_CODE);
|
||||
$error2 = curl_error($ch2);
|
||||
|
||||
echo "HTTP Code: " . $httpCode2 . "<br>";
|
||||
echo "Error: " . ($error2 ?: 'None') . "<br>";
|
||||
echo "Response: " . htmlspecialchars($response2) . "<br>";
|
||||
|
||||
curl_close($ch2);
|
||||
?>
|
||||
|
||||
<form method="POST">
|
||||
<input type="text" name="username" placeholder="Username" value="<?php echo htmlspecialchars($username); ?>">
|
||||
<input type="password" name="password" placeholder="Password" value="<?php echo htmlspecialchars($password); ?>">
|
||||
<button type="submit">Test Login</button>
|
||||
</form>
|
||||
39
public/ios/app/debug/debug_presensi.php
Normal file
39
public/ios/app/debug/debug_presensi.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug Presensi Data</h2>";
|
||||
|
||||
// Login dulu
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
|
||||
// Get presensi today
|
||||
$presensi_today_result = api_get_presensi_today($token);
|
||||
$presensi_today = $presensi_today_result['success'] ? $presensi_today_result['data'] : [];
|
||||
|
||||
echo "<h3>Raw Presensi Today Response:</h3>";
|
||||
echo "<pre>" . json_encode($presensi_today, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
echo "<h3>Extracted Data:</h3>";
|
||||
$presensi_data_today = $presensi_today['data'] ?? [];
|
||||
$masuk_time = $presensi_data_today['jam_masuk'] ?? null;
|
||||
$istirahat_mulai = $presensi_data_today['mulai_istirahat'] ?? null;
|
||||
$istirahat_selesai = $presensi_data_today['beres_istirahat'] ?? null;
|
||||
$pulang_time = $presensi_data_today['jam_pulang'] ?? null;
|
||||
|
||||
echo "masuk_time: " . var_export($masuk_time, true) . "<br>";
|
||||
echo "istirahat_mulai: " . var_export($istirahat_mulai, true) . "<br>";
|
||||
echo "istirahat_selesai: " . var_export($istirahat_selesai, true) . "<br>";
|
||||
echo "pulang_time: " . var_export($pulang_time, true) . "<br>";
|
||||
|
||||
echo "<h3>Status Check:</h3>";
|
||||
echo "Masuk sudah rekam: " . (($masuk_time && $masuk_time !== '00:00' && $masuk_time !== null) ? 'YES' : 'NO') . "<br>";
|
||||
echo "Istirahat sudah rekam: " . (($istirahat_mulai && $istirahat_mulai !== '00:00' && $istirahat_mulai !== null) ? 'YES' : 'NO') . "<br>";
|
||||
echo "Pulang sudah rekam: " . (($pulang_time && $pulang_time !== '00:00' && $pulang_time !== null) ? 'YES' : 'NO') . "<br>";
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
369
public/ios/app/debug/debug_presensi_submit.php
Normal file
369
public/ios/app/debug/debug_presensi_submit.php
Normal file
@@ -0,0 +1,369 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
$user_data = $_SESSION['user_data'] ?? [];
|
||||
|
||||
// Get user profile data
|
||||
$profile_result = api_get_profil($token);
|
||||
$profile_data = $profile_result['success'] ? $profile_result['data'] : [];
|
||||
|
||||
// Extract user info
|
||||
$pegawai = $profile_data['pegawai'] ?? $profile_data['data']['pegawai'] ?? $profile_data['data'] ?? [];
|
||||
$user_name = $pegawai['nama_lengkap'] ?? $pegawai['nama'] ?? $user_data['nama'] ?? $user_data['nama_lengkap'] ?? 'User';
|
||||
$user_id = $pegawai['nip'] ?? $pegawai['id'] ?? $user_data['id'] ?? $user_data['nip'] ?? '';
|
||||
|
||||
// Extract kantor coordinates
|
||||
$kantor_lat = $pegawai['kantor']['latitude'] ?? $pegawai['kantor']['lat'] ?? $user_data['kantor_lat'] ?? -6.2088;
|
||||
$kantor_lng = $pegawai['kantor']['longitude'] ?? $pegawai['kantor']['lng'] ?? $user_data['kantor_lng'] ?? 106.8456;
|
||||
$toleransi_meter = $pegawai['kantor']['toleransi'] ?? $pegawai['toleransi'] ?? $user_data['toleransi'] ?? 100;
|
||||
|
||||
$debug_results = [];
|
||||
$test_coordinates = [
|
||||
['lat' => -6.2088, 'lng' => 106.8456, 'name' => 'Jakarta (Kantor)'],
|
||||
['lat' => -6.2090, 'lng' => 106.8458, 'name' => 'Jakarta (50m dari kantor)'],
|
||||
['lat' => -6.2100, 'lng' => 106.8470, 'name' => 'Jakarta (200m dari kantor)'],
|
||||
['lat' => -6.3000, 'lng' => 106.9000, 'name' => 'Jakarta (Jauh dari kantor)'],
|
||||
];
|
||||
|
||||
// Test presensi untuk setiap koordinat
|
||||
foreach ($test_coordinates as $coord) {
|
||||
$data = [
|
||||
'latitude' => $coord['lat'],
|
||||
'longitude' => $coord['lng'],
|
||||
'waktu' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
// Test masuk
|
||||
$result_masuk = api_save_masuk($token, $data);
|
||||
|
||||
// Test pulang
|
||||
$result_pulang = api_save_pulang($token, $data);
|
||||
|
||||
// Test istirahat
|
||||
$result_istirahat = api_save_istirahat($token, $data);
|
||||
|
||||
$debug_results[] = [
|
||||
'location' => $coord['name'],
|
||||
'coordinates' => $coord['lat'] . ', ' . $coord['lng'],
|
||||
'masuk' => $result_masuk,
|
||||
'pulang' => $result_pulang,
|
||||
'istirahat' => $result_istirahat
|
||||
];
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Debug Presensi Submit - Sistem Presensi Bank BIJ</title>
|
||||
<link rel="stylesheet" href="<?php echo asset('css/tailwind-essential.css'); ?>">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url('assets/webfonts/Outfit-Light.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('assets/webfonts/Outfit-Regular.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url('assets/webfonts/Outfit-Medium.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url('assets/webfonts/Outfit-SemiBold.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('assets/webfonts/Outfit-Bold.woff2') format('woff2');
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Outfit', sans-serif;
|
||||
}
|
||||
|
||||
.code-block {
|
||||
background: #1e1e1e;
|
||||
color: #d4d4d4;
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 0.875rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: #f59e0b;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="bg-gray-100 min-h-screen">
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<!-- Header -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-800">Debug Presensi Submit</h1>
|
||||
<p class="text-gray-600">Test API response untuk berbagai koordinat</p>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<p class="text-sm text-gray-500">User: <?php echo htmlspecialchars($user_name); ?></p>
|
||||
<p class="text-sm text-gray-500">NIP: <?php echo htmlspecialchars($user_id); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Kantor Info -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-4">Informasi Kantor</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Koordinat Kantor</p>
|
||||
<p class="font-mono text-lg"><?php echo $kantor_lat; ?>, <?php echo $kantor_lng; ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Toleransi</p>
|
||||
<p class="font-mono text-lg"><?php echo $toleransi_meter; ?> meter</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Token</p>
|
||||
<p class="font-mono text-sm"><?php echo substr($token, 0, 20); ?>...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Test Results -->
|
||||
<div class="space-y-6">
|
||||
<?php foreach ($debug_results as $index => $result): ?>
|
||||
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||
<h3 class="text-lg font-bold text-gray-800 mb-4">
|
||||
Test <?php echo $index + 1; ?>: <?php echo htmlspecialchars($result['location']); ?>
|
||||
</h3>
|
||||
<p class="text-sm text-gray-600 mb-4">Koordinat: <?php echo $result['coordinates']; ?></p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<!-- Masuk -->
|
||||
<div class="border rounded-lg p-4">
|
||||
<h4 class="font-semibold text-gray-700 mb-2">
|
||||
<i class="fas fa-sign-in-alt mr-2"></i>Masuk
|
||||
</h4>
|
||||
<div class="space-y-2">
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Status:</span>
|
||||
<span class="<?php echo $result['masuk']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo $result['masuk']['success'] ? 'SUCCESS' : 'ERROR'; ?>
|
||||
</span>
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">HTTP Code:</span>
|
||||
<?php echo $result['masuk']['http_code']; ?>
|
||||
</p>
|
||||
<?php if (isset($result['masuk']['data']['pesan'])): ?>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Pesan:</span>
|
||||
<span class="<?php echo $result['masuk']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo htmlspecialchars($result['masuk']['data']['pesan']); ?>
|
||||
</span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pulang -->
|
||||
<div class="border rounded-lg p-4">
|
||||
<h4 class="font-semibold text-gray-700 mb-2">
|
||||
<i class="fas fa-sign-out-alt mr-2"></i>Pulang
|
||||
</h4>
|
||||
<div class="space-y-2">
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Status:</span>
|
||||
<span class="<?php echo $result['pulang']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo $result['pulang']['success'] ? 'SUCCESS' : 'ERROR'; ?>
|
||||
</span>
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">HTTP Code:</span>
|
||||
<?php echo $result['pulang']['http_code']; ?>
|
||||
</p>
|
||||
<?php if (isset($result['pulang']['data']['pesan'])): ?>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Pesan:</span>
|
||||
<span class="<?php echo $result['pulang']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo htmlspecialchars($result['pulang']['data']['pesan']); ?>
|
||||
</span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Istirahat -->
|
||||
<div class="border rounded-lg p-4">
|
||||
<h4 class="font-semibold text-gray-700 mb-2">
|
||||
<i class="fas fa-coffee mr-2"></i>Istirahat
|
||||
</h4>
|
||||
<div class="space-y-2">
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Status:</span>
|
||||
<span class="<?php echo $result['istirahat']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo $result['istirahat']['success'] ? 'SUCCESS' : 'ERROR'; ?>
|
||||
</span>
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">HTTP Code:</span>
|
||||
<?php echo $result['istirahat']['http_code']; ?>
|
||||
</p>
|
||||
<?php if (isset($result['istirahat']['data']['pesan'])): ?>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Pesan:</span>
|
||||
<span class="<?php echo $result['istirahat']['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo htmlspecialchars($result['istirahat']['data']['pesan']); ?>
|
||||
</span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Raw Response -->
|
||||
<div class="mt-4">
|
||||
<h5 class="font-semibold text-gray-700 mb-2">Raw Response (Masuk):</h5>
|
||||
<div class="code-block">
|
||||
<?php echo htmlspecialchars(json_encode($result['masuk'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<!-- Manual Test Form -->
|
||||
<div class="bg-white rounded-lg shadow-lg p-6 mt-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-4">Manual Test</h2>
|
||||
<form method="POST" class="space-y-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Latitude</label>
|
||||
<input type="number" name="test_lat" step="any" value="-6.2088"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Longitude</label>
|
||||
<input type="number" name="test_lng" step="any" value="106.8456"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Action</label>
|
||||
<select name="test_action" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="masuk">Masuk</option>
|
||||
<option value="pulang">Pulang</option>
|
||||
<option value="istirahat">Istirahat</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" name="manual_test"
|
||||
class="w-full bg-blue-600 text-white py-2 px-4 rounded-lg hover:bg-blue-700 transition-colors">
|
||||
<i class="fas fa-play mr-2"></i>Test Manual
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($_POST['manual_test'])): ?>
|
||||
<div class="mt-6 p-4 bg-gray-50 rounded-lg">
|
||||
<h3 class="font-semibold text-gray-700 mb-2">Manual Test Result:</h3>
|
||||
<?php
|
||||
$manual_data = [
|
||||
'latitude' => $_POST['test_lat'],
|
||||
'longitude' => $_POST['test_lng'],
|
||||
'waktu' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$manual_result = null;
|
||||
switch ($_POST['test_action']) {
|
||||
case 'masuk':
|
||||
$manual_result = api_save_masuk($token, $manual_data);
|
||||
break;
|
||||
case 'pulang':
|
||||
$manual_result = api_save_pulang($token, $manual_data);
|
||||
break;
|
||||
case 'istirahat':
|
||||
$manual_result = api_save_istirahat($token, $manual_data);
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<div class="space-y-2">
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Status:</span>
|
||||
<span class="<?php echo $manual_result['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo $manual_result['success'] ? 'SUCCESS' : 'ERROR'; ?>
|
||||
</span>
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">HTTP Code:</span>
|
||||
<?php echo $manual_result['http_code']; ?>
|
||||
</p>
|
||||
<?php if (isset($manual_result['data']['pesan'])): ?>
|
||||
<p class="text-sm">
|
||||
<span class="font-medium">Pesan:</span>
|
||||
<span class="<?php echo $manual_result['success'] ? 'success' : 'error'; ?>">
|
||||
<?php echo htmlspecialchars($manual_result['data']['pesan']); ?>
|
||||
</span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<h5 class="font-semibold text-gray-700 mb-2">Raw Response:</h5>
|
||||
<div class="code-block">
|
||||
<?php echo htmlspecialchars(json_encode($manual_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Navigation -->
|
||||
<div class="mt-6 text-center">
|
||||
<a href="rekam.php" class="inline-flex items-center text-blue-600 hover:text-blue-800">
|
||||
<i class="fas fa-arrow-left mr-2"></i> Kembali ke Rekam Presensi
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
124
public/ios/app/debug/debug_profil_koordinat.php
Normal file
124
public/ios/app/debug/debug_profil_koordinat.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
// Get user profile data
|
||||
$profile_result = api_get_profil($token);
|
||||
|
||||
echo "<h1>Debug Profil - Cek Koordinat Kantor</h1>";
|
||||
echo "<p><strong>Token:</strong> " . substr($token, 0, 20) . "...</p>";
|
||||
|
||||
echo "<h2>Profile API Response</h2>";
|
||||
echo "<p><strong>Success:</strong> " . ($profile_result['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $profile_result['http_code'] . "</p>";
|
||||
|
||||
echo "<h3>Raw Profile Data:</h3>";
|
||||
echo "<pre style='background: #f5f5f5; padding: 15px; border-radius: 5px; overflow-x: auto;'>";
|
||||
echo htmlspecialchars(json_encode($profile_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
echo "</pre>";
|
||||
|
||||
if ($profile_result['success'] && isset($profile_result['data'])) {
|
||||
$data = $profile_result['data'];
|
||||
|
||||
echo "<h2>Struktur Data Profil</h2>";
|
||||
|
||||
// Cek struktur data
|
||||
echo "<h3>Keys di data utama:</h3>";
|
||||
echo "<ul>";
|
||||
foreach (array_keys($data) as $key) {
|
||||
echo "<li><strong>$key</strong> - " . gettype($data[$key]) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
// Cek pegawai
|
||||
if (isset($data['pegawai'])) {
|
||||
echo "<h3>Data Pegawai:</h3>";
|
||||
echo "<pre style='background: #e8f4fd; padding: 10px; border-radius: 5px;'>";
|
||||
echo htmlspecialchars(json_encode($data['pegawai'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
echo "</pre>";
|
||||
|
||||
// Cek keys di pegawai
|
||||
echo "<h4>Keys di pegawai:</h4>";
|
||||
echo "<ul>";
|
||||
foreach (array_keys($data['pegawai']) as $key) {
|
||||
echo "<li><strong>$key</strong> - " . gettype($data['pegawai'][$key]) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
// Cek kantor
|
||||
if (isset($data['pegawai']['kantor'])) {
|
||||
echo "<h3>Data Kantor:</h3>";
|
||||
echo "<pre style='background: #e8f5e8; padding: 10px; border-radius: 5px;'>";
|
||||
echo htmlspecialchars(json_encode($data['pegawai']['kantor'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
echo "</pre>";
|
||||
|
||||
// Cek keys di kantor
|
||||
echo "<h4>Keys di kantor:</h4>";
|
||||
echo "<ul>";
|
||||
foreach (array_keys($data['pegawai']['kantor']) as $key) {
|
||||
$value = $data['pegawai']['kantor'][$key];
|
||||
echo "<li><strong>$key</strong> - " . gettype($value) . " = " . (is_string($value) ? htmlspecialchars($value) : json_encode($value)) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
// Cek koordinat khusus
|
||||
echo "<h3>Koordinat Kantor:</h3>";
|
||||
$kantor = $data['pegawai']['kantor'];
|
||||
echo "<ul>";
|
||||
echo "<li><strong>latitude:</strong> " . (isset($kantor['latitude']) ? $kantor['latitude'] : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>lat:</strong> " . (isset($kantor['lat']) ? $kantor['lat'] : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>longitude:</strong> " . (isset($kantor['longitude']) ? $kantor['longitude'] : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>lng:</strong> " . (isset($kantor['lng']) ? $kantor['lng'] : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>toleransi:</strong> " . (isset($kantor['toleransi']) ? $kantor['toleransi'] : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>nama_kantor:</strong> " . (isset($kantor['nama_kantor']) ? htmlspecialchars($kantor['nama_kantor']) : 'TIDAK ADA') . "</li>";
|
||||
echo "<li><strong>alamat_kantor:</strong> " . (isset($kantor['alamat_kantor']) ? htmlspecialchars($kantor['alamat_kantor']) : 'TIDAK ADA') . "</li>";
|
||||
echo "</ul>";
|
||||
} else {
|
||||
echo "<p style='color: red;'><strong>KANTOR TIDAK DITEMUKAN di pegawai</strong></p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color: red;'><strong>PEGAWAI TIDAK DITEMUKAN</strong></p>";
|
||||
}
|
||||
|
||||
// Cek struktur alternatif
|
||||
echo "<h2>Pencarian Koordinat di Semua Level</h2>";
|
||||
|
||||
function searchCoordinates($data, $path = '')
|
||||
{
|
||||
$found = [];
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $key => $value) {
|
||||
$currentPath = $path ? "$path.$key" : $key;
|
||||
if (in_array($key, ['latitude', 'lat', 'longitude', 'lng', 'toleransi'])) {
|
||||
$found[$currentPath] = $value;
|
||||
} elseif (is_array($value)) {
|
||||
$found = array_merge($found, searchCoordinates($value, $currentPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
}
|
||||
|
||||
$coordinates = searchCoordinates($data);
|
||||
if (!empty($coordinates)) {
|
||||
echo "<h3>Koordinat yang ditemukan:</h3>";
|
||||
echo "<ul>";
|
||||
foreach ($coordinates as $path => $value) {
|
||||
echo "<li><strong>$path:</strong> $value</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
} else {
|
||||
echo "<p style='color: red;'><strong>TIDAK ADA KOORDINAT DITEMUKAN di seluruh struktur data</strong></p>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='rekam.php'>← Kembali ke Rekam Presensi</a> | <a href='debug_presensi_submit.php'>Debug Presensi Submit</a></p>";
|
||||
28
public/ios/app/debug/debug_profil_simple.php
Normal file
28
public/ios/app/debug/debug_profil_simple.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
$profile_result = api_get_profil($token);
|
||||
|
||||
echo "<h1>Debug Profil - Simple</h1>";
|
||||
echo "<p><strong>Success:</strong> " . ($profile_result['success'] ? 'YES' : 'NO') . "</p>";
|
||||
echo "<p><strong>HTTP Code:</strong> " . $profile_result['http_code'] . "</p>";
|
||||
|
||||
echo "<h2>Full Response:</h2>";
|
||||
echo "<pre style='background: #f0f0f0; padding: 10px; white-space: pre-wrap;'>";
|
||||
print_r($profile_result);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h2>JSON Response:</h2>";
|
||||
echo "<pre style='background: #f0f0f0; padding: 10px; white-space: pre-wrap;'>";
|
||||
echo json_encode($profile_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='rekam.php'>← Kembali ke Rekam Presensi</a></p>";
|
||||
64
public/ios/app/debug/debug_rekam_error.php
Normal file
64
public/ios/app/debug/debug_rekam_error.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['token'];
|
||||
|
||||
// Get user profile data
|
||||
$profile_result = api_get_profil($token);
|
||||
$profile_data = $profile_result['success'] ? $profile_result['data'] : [];
|
||||
|
||||
// Get today's attendance data
|
||||
$presensi_today_result = api_get_presensi_today($token);
|
||||
$presensi_today = $presensi_today_result['success'] ? $presensi_today_result['data'] : [];
|
||||
|
||||
// Extract user info
|
||||
$pegawai = $profile_data['pegawai'] ?? $profile_data['data']['pegawai'] ?? $profile_data['data'] ?? [];
|
||||
$user_name = $pegawai['nama_lengkap'] ?? $pegawai['nama'] ?? 'User';
|
||||
$user_jabatan = $pegawai['jabatan']['nama_jabatan'] ?? $pegawai['jabatan'] ?? 'Karyawan';
|
||||
$user_id = $pegawai['nip'] ?? $pegawai['id'] ?? '';
|
||||
$user_photo = $pegawai['photo'] ?? $pegawai['foto'] ?? '';
|
||||
|
||||
// Extract work schedule info
|
||||
$jam_masuk = $pegawai['jam_masuk'] ?? '08:00';
|
||||
$jam_pulang = $pegawai['jam_pulang'] ?? '17:00';
|
||||
$jam_istirahat = $pegawai['jam_istirahat'] ?? '12:00';
|
||||
$kantor_nama = $pegawai['kantor']['nama_kantor'] ?? 'Kantor Pusat';
|
||||
$alamat_kantor = $pegawai['kantor']['alamat_kantor'] ?? '';
|
||||
|
||||
echo "<h1>Debug Rekam Error</h1>";
|
||||
echo "<p><strong>User Name:</strong> " . htmlspecialchars($user_name) . "</p>";
|
||||
echo "<p><strong>Kantor Nama:</strong> " . htmlspecialchars($kantor_nama) . "</p>";
|
||||
echo "<p><strong>Alamat Kantor:</strong> " . htmlspecialchars($alamat_kantor) . "</p>";
|
||||
|
||||
// Test koordinat extraction
|
||||
$kantor_lat = null;
|
||||
$kantor_lng = null;
|
||||
$toleransi_meter = 100;
|
||||
|
||||
if (isset($pegawai['kantor'])) {
|
||||
$kantor = $pegawai['kantor'];
|
||||
echo "<h2>Kantor Data:</h2>";
|
||||
echo "<pre>" . print_r($kantor, true) . "</pre>";
|
||||
|
||||
$kantor_lat = $kantor['latitude'] ?? $kantor['lat'] ?? $kantor['koordinat_lat'] ?? $kantor['lat_kantor'] ?? null;
|
||||
$kantor_lng = $kantor['longitude'] ?? $kantor['lng'] ?? $kantor['koordinat_lng'] ?? $kantor['lng_kantor'] ?? null;
|
||||
$toleransi_meter = $kantor['jarak_rekam_presensi'] ?? $kantor['toleransi'] ?? $kantor['radius'] ?? $kantor['jarak_toleransi'] ?? 100;
|
||||
|
||||
echo "<p><strong>Kantor Lat:</strong> $kantor_lat</p>";
|
||||
echo "<p><strong>Kantor Lng:</strong> $kantor_lng</p>";
|
||||
echo "<p><strong>Toleransi:</strong> $toleransi_meter</p>";
|
||||
}
|
||||
|
||||
// Test htmlspecialchars
|
||||
echo "<h2>Test htmlspecialchars:</h2>";
|
||||
echo "<p>Kantor Nama (string): " . htmlspecialchars($kantor_nama) . "</p>";
|
||||
echo "<p>Alamat Kantor (string): " . htmlspecialchars($alamat_kantor) . "</p>";
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='rekam.php'>← Kembali ke Rekam Presensi</a></p>";
|
||||
115
public/ios/app/debug/debug_request.php
Normal file
115
public/ios/app/debug/debug_request.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Debug API Request & Response</h2>";
|
||||
|
||||
// Login dulu untuk dapat token
|
||||
echo "<h3>1. Login Process:</h3>";
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
echo "<pre>";
|
||||
echo "Login Success: " . ($login_result['success'] ? 'YES' : 'NO') . "\n";
|
||||
echo "HTTP Code: " . $login_result['http_code'] . "\n";
|
||||
echo "Raw Response: " . $login_result['raw_response'] . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
if (!$login_result['success']) {
|
||||
echo "<p style='color:red'>Login gagal, tidak bisa lanjut test berita</p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $login_result['data']['token'];
|
||||
echo "<p style='color:green'>✅ Token: " . substr($token, 0, 20) . "...</p>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
// Test berita dengan debug detail
|
||||
echo "<h3>2. Berita API Request:</h3>";
|
||||
|
||||
// Simulasi request yang akan dikirim
|
||||
$endpoint = 'berita';
|
||||
$body = ['token' => $token];
|
||||
$url = API_BASE . $endpoint;
|
||||
|
||||
echo "<pre>";
|
||||
echo "URL: $url\n";
|
||||
echo "Method: POST\n";
|
||||
echo "Body: " . json_encode($body) . "\n";
|
||||
echo "Content-Type: application/x-www-form-urlencoded\n";
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>3. Berita API Response:</h3>";
|
||||
|
||||
// Panggil API berita
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<pre>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "\n";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "\n";
|
||||
echo "Raw Response: " . $berita_result['raw_response'] . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>4. Parsed Data:</h3>";
|
||||
echo "<pre>";
|
||||
echo "Data Type: " . gettype($berita_result['data']) . "\n";
|
||||
echo "Data Count: " . (is_array($berita_result['data']) ? count($berita_result['data']) : 'N/A') . "\n";
|
||||
echo "Data Structure:\n";
|
||||
print_r($berita_result['data']);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>5. Berita Items:</h3>";
|
||||
|
||||
if ($berita_result['success'] && !empty($berita_result['data'])) {
|
||||
$data = $berita_result['data'];
|
||||
|
||||
// Cek struktur data
|
||||
if (isset($data['data']) && is_array($data['data'])) {
|
||||
$berita_items = $data['data'];
|
||||
echo "<p style='color:green'>✅ Data ditemukan di response['data']['data']</p>";
|
||||
} elseif (is_array($data) && isset($data[0])) {
|
||||
$berita_items = $data;
|
||||
echo "<p style='color:green'>✅ Data ditemukan di response['data'] langsung</p>";
|
||||
} else {
|
||||
$berita_items = [];
|
||||
echo "<p style='color:red'>❌ Struktur data tidak dikenali</p>";
|
||||
}
|
||||
|
||||
if (!empty($berita_items)) {
|
||||
echo "<p>Jumlah berita: " . count($berita_items) . "</p>";
|
||||
|
||||
foreach (array_slice($berita_items, 0, 3) as $index => $item) {
|
||||
echo "<div style='border:1px solid #ccc;padding:10px;margin:10px 0;background:#f9f9f9;'>";
|
||||
echo "<h4>Berita " . ($index + 1) . ":</h4>";
|
||||
echo "<pre>";
|
||||
print_r($item);
|
||||
echo "</pre>";
|
||||
|
||||
// Tampilkan format yang diinginkan
|
||||
$judul = htmlspecialchars($item['judul'] ?? '-');
|
||||
$tanggal = htmlspecialchars($item['tanggal'] ?? '-');
|
||||
$isi = htmlspecialchars(trim($item['isi'] ?? ''));
|
||||
$photoUrl = uploads_berita_url((string) ($item['photo'] ?? ''));
|
||||
|
||||
echo "<div style='border:1px solid #ddd;padding:10px;margin:5px 0;background:white;'>";
|
||||
echo "<h4 style='margin:0 0 5px 0;'>📅 $tanggal — $judul</h4>";
|
||||
if ($photoUrl !== '') {
|
||||
echo "<img src='" . htmlspecialchars($photoUrl) . "' alt='$judul' style='max-width:250px;border-radius:8px;display:block;margin:8px 0;'>";
|
||||
}
|
||||
echo "<p>" . nl2br($isi) . "</p>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ Tidak ada item berita ditemukan</p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ API berita gagal atau tidak mengembalikan data</p>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
echo "<h3>6. Debug Info:</h3>";
|
||||
echo "<pre>";
|
||||
echo "Session Token: " . ($_SESSION['token'] ?? 'Tidak ada') . "\n";
|
||||
echo "Current Time: " . date('Y-m-d H:i:s') . "\n";
|
||||
echo "PHP Version: " . phpversion() . "\n";
|
||||
echo "</pre>";
|
||||
60
public/ios/app/debug/download_assets.php
Normal file
60
public/ios/app/debug/download_assets.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
// Script untuk download dan host CSS/JS lokal
|
||||
// Jalankan sekali untuk download assets
|
||||
|
||||
echo "<h2>Downloading Assets for Production</h2>";
|
||||
|
||||
// Create assets directory if not exists
|
||||
if (!is_dir('assets/css')) {
|
||||
mkdir('assets/css', 0755, true);
|
||||
}
|
||||
if (!is_dir('assets/js')) {
|
||||
mkdir('assets/js', 0755, true);
|
||||
}
|
||||
|
||||
// Download Tailwind CSS
|
||||
echo "<p>Downloading Tailwind CSS...</p>";
|
||||
$tailwind_url = 'https://cdn.tailwindcss.com/3.4.0/tailwind.min.css';
|
||||
$tailwind_content = file_get_contents($tailwind_url);
|
||||
if ($tailwind_content) {
|
||||
file_put_contents('assets/css/tailwind.min.css', $tailwind_content);
|
||||
echo "<p style='color: green;'>✓ Tailwind CSS downloaded</p>";
|
||||
} else {
|
||||
echo "<p style='color: red;'>✗ Failed to download Tailwind CSS</p>";
|
||||
}
|
||||
|
||||
// Download Font Awesome CSS
|
||||
echo "<p>Downloading Font Awesome CSS...</p>";
|
||||
$fa_url = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css';
|
||||
$fa_content = file_get_contents($fa_url);
|
||||
if ($fa_content) {
|
||||
file_put_contents('assets/css/fontawesome.min.css', $fa_content);
|
||||
echo "<p style='color: green;'>✓ Font Awesome CSS downloaded</p>";
|
||||
} else {
|
||||
echo "<p style='color: red;'>✗ Failed to download Font Awesome CSS</p>";
|
||||
}
|
||||
|
||||
// Download Font Awesome fonts
|
||||
echo "<p>Downloading Font Awesome fonts...</p>";
|
||||
$fa_fonts = [
|
||||
'fa-solid-900.woff2' => 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff2',
|
||||
'fa-regular-400.woff2' => 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-regular-400.woff2',
|
||||
'fa-brands-400.woff2' => 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-brands-400.woff2'
|
||||
];
|
||||
|
||||
if (!is_dir('assets/webfonts')) {
|
||||
mkdir('assets/webfonts', 0755, true);
|
||||
}
|
||||
|
||||
foreach ($fa_fonts as $filename => $url) {
|
||||
$font_content = file_get_contents($url);
|
||||
if ($font_content) {
|
||||
file_put_contents('assets/webfonts/' . $filename, $font_content);
|
||||
echo "<p style='color: green;'>✓ Downloaded $filename</p>";
|
||||
} else {
|
||||
echo "<p style='color: red;'>✗ Failed to download $filename</p>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<h3>Assets Download Complete!</h3>";
|
||||
echo "<p>Now update your HTML files to use local assets instead of CDN.</p>";
|
||||
31
public/ios/app/debug/minimal_test.php
Normal file
31
public/ios/app/debug/minimal_test.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
echo "Test PHP: " . phpversion() . "<br>";
|
||||
echo "Test Time: " . date('Y-m-d H:i:s') . "<br>";
|
||||
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$login = api_login('Widia', 'qwerty5*');
|
||||
echo "Login Success: " . ($login['success'] ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
if ($login['success']) {
|
||||
$token = $login['data']['token'];
|
||||
$berita = api_get_berita($token);
|
||||
echo "Berita Success: " . ($berita['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "Berita Count: " . (is_array($berita['data']) ? count($berita['data']) : 'N/A') . "<br>";
|
||||
|
||||
if ($berita['success'] && !empty($berita['data'])) {
|
||||
echo "Data Structure: <pre>" . print_r($berita['data'], true) . "</pre>";
|
||||
echo "Data Keys: " . implode(', ', array_keys($berita['data'])) . "<br>";
|
||||
|
||||
// Try different access methods
|
||||
if (isset($berita['data'][0])) {
|
||||
$first = $berita['data'][0];
|
||||
echo "First Judul (index 0): " . ($first['judul'] ?? 'N/A') . "<br>";
|
||||
} else {
|
||||
echo "No index 0 found<br>";
|
||||
// Try to get first element
|
||||
$first = reset($berita['data']);
|
||||
echo "First Element (reset): " . ($first['judul'] ?? 'N/A') . "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
30
public/ios/app/debug/plain_test.php
Normal file
30
public/ios/app/debug/plain_test.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// Plain text output, no HTML
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "=== MINIMAL BERITA TEST ===\n\n";
|
||||
|
||||
$login = api_login('Widia', 'qwerty5*');
|
||||
echo "Login: " . ($login['success'] ? 'SUCCESS' : 'FAILED') . "\n";
|
||||
|
||||
if ($login['success']) {
|
||||
$token = $login['data']['token'];
|
||||
$berita = api_get_berita($token);
|
||||
echo "Berita API: " . ($berita['success'] ? 'SUCCESS' : 'FAILED') . "\n";
|
||||
echo "HTTP Code: " . $berita['http_code'] . "\n";
|
||||
|
||||
if ($berita['success']) {
|
||||
$data = $berita['data'];
|
||||
echo "Data Type: " . gettype($data) . "\n";
|
||||
echo "Data Count: " . (is_array($data) ? count($data) : 'N/A') . "\n";
|
||||
|
||||
if (is_array($data) && !empty($data)) {
|
||||
$first = $data[0];
|
||||
echo "First Item Keys: " . implode(', ', array_keys($first)) . "\n";
|
||||
echo "First Judul: " . ($first['judul'] ?? 'N/A') . "\n";
|
||||
echo "First Tanggal: " . ($first['tanggal'] ?? 'N/A') . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
38
public/ios/app/debug/quick_test.php
Normal file
38
public/ios/app/debug/quick_test.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Quick Test</h2>";
|
||||
|
||||
// Cek token
|
||||
$token = $_SESSION['token'] ?? '';
|
||||
echo "Token: " . ($token ? substr($token, 0, 20) . "..." : "TIDAK ADA") . "<br>";
|
||||
|
||||
if (empty($token)) {
|
||||
echo "<p style='color:red'>Token tidak ada, coba login dulu</p>";
|
||||
echo "<a href='login.php'>Login</a>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Test API berita
|
||||
echo "<h3>Test API Berita:</h3>";
|
||||
$result = api_get_berita($token);
|
||||
|
||||
echo "<pre>";
|
||||
echo "Success: " . ($result['success'] ? 'YES' : 'NO') . "\n";
|
||||
echo "HTTP Code: " . $result['http_code'] . "\n";
|
||||
echo "Response: " . substr($result['raw_response'], 0, 300) . "...\n";
|
||||
echo "</pre>";
|
||||
|
||||
if ($result['success'] && !empty($result['data']['data'])) {
|
||||
echo "<p style='color:green'>✅ Berita ditemukan: " . count($result['data']['data']) . " item</p>";
|
||||
|
||||
foreach (array_slice($result['data']['data'], 0, 2) as $item) {
|
||||
echo "<div style='border:1px solid #ccc;padding:10px;margin:5px 0;'>";
|
||||
echo "<h4>📅 " . htmlspecialchars($item['tanggal'] ?? '') . " — " . htmlspecialchars($item['judul'] ?? '') . "</h4>";
|
||||
echo "<p>" . nl2br(htmlspecialchars($item['isi'] ?? '')) . "</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ Berita tidak ditemukan</p>";
|
||||
}
|
||||
38
public/ios/app/debug/simple_berita_debug.php
Normal file
38
public/ios/app/debug/simple_berita_debug.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$token = $_SESSION['token'] ?? null;
|
||||
if (!$token) {
|
||||
echo "No token found";
|
||||
exit;
|
||||
}
|
||||
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h2>Simple Berita Debug</h2>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$data = $berita_result['data'];
|
||||
echo "<h3>Raw Data Structure:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($data);
|
||||
echo "</pre>";
|
||||
|
||||
$items = $data['data'] ?? $data;
|
||||
if (is_array($items)) {
|
||||
echo "<h3>Items Count: " . count($items) . "</h3>";
|
||||
echo "<h3>First Item:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($items[0] ?? 'No first item');
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>All Items with IDs:</h3>";
|
||||
foreach ($items as $i => $item) {
|
||||
$id = $item['id'] ?? $item['berita_id'] ?? "NO_ID_$i";
|
||||
$judul = $item['judul'] ?? 'NO_TITLE';
|
||||
echo "<p>$i: ID='$id', Judul='$judul'</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p>Error: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
44
public/ios/app/debug/simple_berita_test.php
Normal file
44
public/ios/app/debug/simple_berita_test.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Simple Berita Test</h2>";
|
||||
|
||||
// Login fresh
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "✅ Login berhasil<br>";
|
||||
|
||||
// Call API directly
|
||||
$ch = curl_init(API_BASE . 'berita');
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => ['token' => $token],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: $httpCode<br>";
|
||||
echo "Raw Response: <pre>$response</pre>";
|
||||
|
||||
$data = json_decode($response, true);
|
||||
echo "JSON Decode Success: " . (json_last_error() === JSON_ERROR_NONE ? 'YES' : 'NO') . "<br>";
|
||||
echo "JSON Error: " . json_last_error_msg() . "<br>";
|
||||
|
||||
if ($data && isset($data['data'])) {
|
||||
echo "Data Count: " . count($data['data']) . "<br>";
|
||||
if (!empty($data['data'])) {
|
||||
$first = $data['data'][0];
|
||||
echo "First Item Judul: " . ($first['judul'] ?? 'N/A') . "<br>";
|
||||
echo "First Item Tanggal: " . ($first['tanggal'] ?? 'N/A') . "<br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "❌ Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
46
public/ios/app/debug/simple_debug.php
Normal file
46
public/ios/app/debug/simple_debug.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// simple_debug.php
|
||||
session_start();
|
||||
|
||||
// load config helper API
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
// --- ambil data berita dari API ---
|
||||
$response = api_request('berita', $_SESSION['token'] ?? null);
|
||||
|
||||
// --- debug basic ---
|
||||
echo "<h2>Berita Data:</h2>";
|
||||
|
||||
if (!$response) {
|
||||
echo "<p style='color:red'>Gagal ambil data dari API.</p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// tampilkan info umum
|
||||
echo "<pre>";
|
||||
echo "Success: " . ($response['status'] == 1 ? 'YES' : 'NO') . "\n";
|
||||
echo "HTTP Code: 200\n";
|
||||
echo "Data count: " . (is_array($response['data'] ?? null) ? count($response['data']) : 0) . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
// --- tampilkan daftar berita ---
|
||||
if (!empty($response['data']) && is_array($response['data'])) {
|
||||
echo "<h3>Daftar Berita:</h3>";
|
||||
|
||||
foreach ($response['data'] as $item) {
|
||||
$judul = htmlspecialchars($item['judul'] ?? '-');
|
||||
$tanggal = htmlspecialchars($item['tanggal'] ?? '-');
|
||||
$isi = nl2br(htmlspecialchars(trim($item['isi'] ?? '')));
|
||||
$photoUrl = uploads_berita_url((string) ($item['photo'] ?? ''));
|
||||
|
||||
echo "<div style='border:1px solid #ccc;padding:10px;margin-bottom:15px;border-radius:8px'>";
|
||||
echo "<h4 style='margin:0 0 5px 0;'>📅 $tanggal — $judul</h4>";
|
||||
if ($photoUrl !== '') {
|
||||
echo "<img src='" . htmlspecialchars($photoUrl) . "' alt='$judul' style='max-width:250px;border-radius:8px;display:block;margin:8px 0;'>";
|
||||
}
|
||||
echo "<p>$isi</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p>Tidak ada berita ditemukan.</p>";
|
||||
}
|
||||
107
public/ios/app/debug/simple_login_test.php
Normal file
107
public/ios/app/debug/simple_login_test.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$message = '';
|
||||
$success = false;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = $_POST['username'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if (empty($username) || empty($password)) {
|
||||
$message = 'Username dan password harus diisi!';
|
||||
} else {
|
||||
echo "<h3>Testing Login...</h3>";
|
||||
echo "Username: " . htmlspecialchars($username) . "<br>";
|
||||
echo "Password: " . htmlspecialchars($password) . "<br><br>";
|
||||
|
||||
$result = api_login($username, $password);
|
||||
|
||||
echo "<h4>API Response:</h4>";
|
||||
echo "<pre>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
if ($result['success']) {
|
||||
$message = 'Login berhasil!';
|
||||
$success = true;
|
||||
if (isset($result['data']['token'])) {
|
||||
echo "<p>Token: " . substr($result['data']['token'], 0, 20) . "...</p>";
|
||||
}
|
||||
} else {
|
||||
$message = 'Login gagal: ' . ($result['data']['pesan'] ?? 'Unknown error');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Simple Login Test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 40px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"] {
|
||||
padding: 8px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
background: #007cba;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Simple Login Test</h2>
|
||||
|
||||
<?php if ($message): ?>
|
||||
<div class="<?php echo $success ? 'success' : 'error'; ?>">
|
||||
<?php echo htmlspecialchars($message); ?>
|
||||
</div><br>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label>Username:</label><br>
|
||||
<input type="text" name="username" value="<?php echo htmlspecialchars($_POST['username'] ?? 'Widia'); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password:</label><br>
|
||||
<input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'] ?? 'qwerty5*'); ?>" required>
|
||||
</div>
|
||||
|
||||
<button type="submit">Test Login</button>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
<h3>Quick Test Links:</h3>
|
||||
<a href="test_credentials.php">Test Multiple Credentials</a><br>
|
||||
<a href="debug_info.php">Debug Information</a><br>
|
||||
<a href="test_api.php">Test API Connection</a><br>
|
||||
<a href="debug_login.php">Debug Login</a><br>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
52
public/ios/app/debug/simple_photo_debug.php
Normal file
52
public/ios/app/debug/simple_photo_debug.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$token = $_SESSION['token'] ?? null;
|
||||
if (!$token) {
|
||||
echo "No token found";
|
||||
exit;
|
||||
}
|
||||
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h2>Simple Photo Debug</h2>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$data = $berita_result['data'];
|
||||
$items = $data['data'] ?? $data;
|
||||
|
||||
if (is_array($items) && count($items) > 0) {
|
||||
echo "<h3>First Item Structure:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($items[0]);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>Photo Field Analysis:</h3>";
|
||||
$first_item = $items[0];
|
||||
foreach ($first_item as $key => $value) {
|
||||
if (is_string($value)) {
|
||||
echo "<p><strong>$key:</strong> '$value'";
|
||||
if (preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $value)) {
|
||||
echo " <span style='color: green; font-weight: bold;'>(IMAGE FILE)</span>";
|
||||
}
|
||||
echo "</p>";
|
||||
} else {
|
||||
echo "<p><strong>$key:</strong> " . gettype($value) . "</p>";
|
||||
}
|
||||
}
|
||||
|
||||
// Test photo URL
|
||||
$photo = $first_item['photo'] ?? '';
|
||||
if ($photo && ($photo_url = uploads_berita_url((string) $photo)) !== '') {
|
||||
echo "<h3>Photo URL Test:</h3>";
|
||||
echo "<p>Full URL: <a href='" . htmlspecialchars($photo_url) . "' target='_blank'>" . htmlspecialchars($photo_url) . "</a></p>";
|
||||
echo "<p>Image preview:</p>";
|
||||
echo "<img src='" . htmlspecialchars($photo_url) . "' style='max-width: 200px; max-height: 200px; border: 1px solid #ccc;' onerror=\"this.style.display='none'; this.nextElementSibling.style.display='block';\" />";
|
||||
echo "<p style='display: none; color: red;'>Gambar tidak dapat dimuat</p>";
|
||||
} else {
|
||||
echo "<p style='color: red;'>Tidak ada field 'photo' ditemukan</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p>Error: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
60
public/ios/app/debug/test_api.php
Normal file
60
public/ios/app/debug/test_api.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test API Connection</h2>";
|
||||
|
||||
// Test 1: Cek koneksi ke server
|
||||
echo "<h3>1. Test Koneksi Server</h3>";
|
||||
$test_url = API_BASE . "login";
|
||||
echo "URL: " . $test_url . "<br>";
|
||||
|
||||
$ch = curl_init($test_url);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
||||
CURLOPT_TIMEOUT => 10,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
||||
CURLOPT_POSTFIELDS => json_encode(['username' => 'test', 'password' => 'test'])
|
||||
]);
|
||||
|
||||
$res = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$error = curl_error($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: " . $httpCode . "<br>";
|
||||
echo "Error: " . ($error ?: 'None') . "<br>";
|
||||
echo "Response: " . htmlspecialchars($res) . "<br>";
|
||||
echo "CURL Info: " . json_encode($info) . "<br><br>";
|
||||
|
||||
// Test 2: Cek dengan credentials yang mungkin benar
|
||||
echo "<h3>2. Test dengan Credentials</h3>";
|
||||
$result = api_login('admin', 'admin');
|
||||
echo "Result: " . json_encode($result, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
|
||||
// Test 3: Cek dengan credentials kosong
|
||||
echo "<h3>3. Test dengan Credentials Kosong</h3>";
|
||||
$result2 = api_login('', '');
|
||||
echo "Result: " . json_encode($result2, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
|
||||
// Test 4: Cek endpoint lain
|
||||
echo "<h3>4. Test Endpoint Lain</h3>";
|
||||
$result3 = api_request('berita');
|
||||
echo "Berita Result: " . json_encode($result3, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
|
||||
echo "<h3>5. Cek Log Error PHP</h3>";
|
||||
echo "Error log location: " . ini_get('error_log') . "<br>";
|
||||
echo "Log entries (last 10):<br>";
|
||||
$log_entries = file_get_contents(ini_get('error_log'));
|
||||
$lines = explode("\n", $log_entries);
|
||||
$recent_lines = array_slice($lines, -10);
|
||||
foreach ($recent_lines as $line) {
|
||||
if (trim($line)) {
|
||||
echo htmlspecialchars($line) . "<br>";
|
||||
}
|
||||
}
|
||||
41
public/ios/app/debug/test_api_berita.php
Normal file
41
public/ios/app/debug/test_api_berita.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test API Berita Function</h2>";
|
||||
|
||||
// Login dulu
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
|
||||
echo "<h3>Login Success, Token: " . substr($token, 0, 20) . "...</h3>";
|
||||
|
||||
// Test api_get_berita
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<h3>API Get Berita Result:</h3>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "<br>";
|
||||
echo "Raw Response: <pre>" . $berita_result['raw_response'] . "</pre>";
|
||||
|
||||
echo "<h3>Decoded Data:</h3>";
|
||||
echo "<pre>" . print_r($berita_result['data'], true) . "</pre>";
|
||||
|
||||
if ($berita_result['success'] && isset($berita_result['data'])) {
|
||||
$berita_data = $berita_result['data'];
|
||||
echo "<h3>Data Access Test:</h3>";
|
||||
echo "Is Array: " . (is_array($berita_data) ? 'YES' : 'NO') . "<br>";
|
||||
echo "Count: " . (is_array($berita_data) ? count($berita_data) : 'N/A') . "<br>";
|
||||
|
||||
if (is_array($berita_data) && !empty($berita_data)) {
|
||||
$first_berita = $berita_data[0];
|
||||
echo "<h4>First Berita Item:</h4>";
|
||||
echo "Raw: <pre>" . print_r($first_berita, true) . "</pre>";
|
||||
echo "Judul: " . ($first_berita['judul'] ?? 'N/A') . "<br>";
|
||||
echo "Tanggal: " . ($first_berita['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "Isi: " . substr(strip_tags($first_berita['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
37
public/ios/app/debug/test_berita_simple.php
Normal file
37
public/ios/app/debug/test_berita_simple.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Berita Simple</h2>";
|
||||
|
||||
$token = $_SESSION['token'] ?? null;
|
||||
if (!$token) {
|
||||
echo "<p>No token found</p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h3>API Result:</h3>";
|
||||
echo "<pre>";
|
||||
var_dump($berita_result);
|
||||
echo "</pre>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$data = $berita_result['data'];
|
||||
echo "<h3>Data Structure:</h3>";
|
||||
echo "<pre>";
|
||||
var_dump($data);
|
||||
echo "</pre>";
|
||||
|
||||
$items = $data['data'] ?? $data;
|
||||
if (is_array($items)) {
|
||||
echo "<h3>Items (count: " . count($items) . "):</h3>";
|
||||
foreach ($items as $i => $item) {
|
||||
echo "<h4>Item $i:</h4>";
|
||||
echo "<pre>";
|
||||
var_dump($item);
|
||||
echo "</pre>";
|
||||
echo "<hr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
74
public/ios/app/debug/test_credentials.php
Normal file
74
public/ios/app/debug/test_credentials.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Credentials</h2>";
|
||||
|
||||
$test_credentials = [
|
||||
['Widia', 'qwerty5*'], // Credentials yang diberikan user
|
||||
['admin', 'admin'],
|
||||
['admin', 'password'],
|
||||
['admin', '123456'],
|
||||
['user', 'user'],
|
||||
['user', 'password'],
|
||||
['test', 'test'],
|
||||
['demo', 'demo'],
|
||||
['bij', 'bij'],
|
||||
['karyawan', 'karyawan'],
|
||||
['', '']
|
||||
];
|
||||
|
||||
foreach ($test_credentials as $cred) {
|
||||
$username = $cred[0];
|
||||
$password = $cred[1];
|
||||
|
||||
echo "<h3>Testing: $username / $password</h3>";
|
||||
|
||||
$result = api_login($username, $password);
|
||||
|
||||
echo "Success: " . ($result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $result['http_code'] . "<br>";
|
||||
echo "Response: " . json_encode($result['data'], JSON_PRETTY_PRINT) . "<br>";
|
||||
|
||||
if ($result['success']) {
|
||||
echo "<strong style='color: green;'>LOGIN BERHASIL!</strong><br>";
|
||||
if (isset($result['data']['token'])) {
|
||||
echo "Token: " . substr($result['data']['token'], 0, 20) . "...<br>";
|
||||
}
|
||||
break; // Stop testing if successful
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
}
|
||||
|
||||
echo "<h3>Test dengan format data yang berbeda</h3>";
|
||||
|
||||
// Test dengan format data yang mungkin berbeda
|
||||
$test_data_formats = [
|
||||
['username' => 'admin', 'password' => 'admin'],
|
||||
['user' => 'admin', 'pass' => 'admin'],
|
||||
['login' => 'admin', 'pwd' => 'admin'],
|
||||
['uname' => 'admin', 'pword' => 'admin']
|
||||
];
|
||||
|
||||
foreach ($test_data_formats as $format) {
|
||||
echo "<h4>Format: " . json_encode($format) . "</h4>";
|
||||
|
||||
$ch = curl_init(API_BASE . 'login');
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
||||
CURLOPT_TIMEOUT => 10,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_POSTFIELDS => json_encode($format)
|
||||
]);
|
||||
|
||||
$res = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
$data = json_decode($res, true);
|
||||
echo "HTTP Code: $httpCode<br>";
|
||||
echo "Response: " . json_encode($data, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
}
|
||||
52
public/ios/app/debug/test_dashboard_data.php
Normal file
52
public/ios/app/debug/test_dashboard_data.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Dashboard Data</h2>";
|
||||
|
||||
// Login dulu untuk mendapatkan token
|
||||
echo "<h3>1. Login untuk mendapatkan token</h3>";
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
echo "Login Result: " . json_encode($login_result, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
|
||||
if ($login_result['success'] && isset($login_result['data']['token'])) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "<strong style='color: green;'>Login berhasil! Token: " . substr($token, 0, 20) . "...</strong><br><br>";
|
||||
|
||||
// Simpan token di session untuk testing
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
|
||||
// Test semua endpoint yang digunakan di dashboard
|
||||
$endpoints = [
|
||||
'profil' => 'api_get_profil',
|
||||
'presensi_today' => 'api_get_presensi_today',
|
||||
'presensi' => 'api_get_presensi',
|
||||
'berita' => 'api_get_berita',
|
||||
'libur' => 'api_get_libur',
|
||||
'cuti' => 'api_get_cuti',
|
||||
'lembur' => 'api_get_lembur'
|
||||
];
|
||||
|
||||
echo "<h3>2. Test Data untuk Dashboard</h3>";
|
||||
foreach ($endpoints as $name => $function) {
|
||||
echo "<h4>$name</h4>";
|
||||
$result = $function($token);
|
||||
echo "Success: " . ($result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $result['http_code'] . "<br>";
|
||||
|
||||
if ($result['success'] && !empty($result['data'])) {
|
||||
echo "Data Count: " . (is_array($result['data']) ? count($result['data']) : 'N/A') . "<br>";
|
||||
echo "Sample Data: " . json_encode(array_slice($result['data'], 0, 2), JSON_PRETTY_PRINT) . "<br>";
|
||||
} else {
|
||||
echo "Error: " . json_encode($result['data'], JSON_PRETTY_PRINT) . "<br>";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
echo "<h3>3. Test Dashboard URL</h3>";
|
||||
echo "<a href='dashboard.php' target='_blank'>Buka Dashboard</a><br><br>";
|
||||
} else {
|
||||
echo "<strong style='color: red;'>Login gagal!</strong><br>";
|
||||
echo "Error: " . json_encode($login_result, JSON_PRETTY_PRINT) . "<br>";
|
||||
}
|
||||
63
public/ios/app/debug/test_dashboard_vars.php
Normal file
63
public/ios/app/debug/test_dashboard_vars.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Dashboard Variables</h2>";
|
||||
|
||||
// Login dulu
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['user_data'] = $login_result['data'];
|
||||
|
||||
// Get data seperti di dashboard
|
||||
$profile_result = api_get_profil($token);
|
||||
$profile_data = $profile_result['success'] ? $profile_result['data'] : [];
|
||||
|
||||
$presensi_today_result = api_get_presensi_today($token);
|
||||
$presensi_today = $presensi_today_result['success'] ? $presensi_today_result['data'] : [];
|
||||
|
||||
// Extract variables seperti di dashboard
|
||||
$pegawai = $profile_data['pegawai'] ?? [];
|
||||
$user_name = $pegawai['nama_lengkap'] ?? 'User';
|
||||
$user_jabatan = $pegawai['jabatan']['nama_jabatan'] ?? 'Karyawan';
|
||||
$user_id = $pegawai['nip'] ?? '';
|
||||
$user_photo = $pegawai['photo'] ?? '';
|
||||
$unit_kerja = $pegawai['unit_kerja']['nama_unit_kerja'] ?? 'Unit Kerja';
|
||||
$kantor = $pegawai['kantor']['nama_kantor'] ?? 'Kantor Pusat';
|
||||
|
||||
$presensi_data_today = $presensi_today['data'] ?? [];
|
||||
$masuk_time = $presensi_data_today['jam_masuk'] ?? '00:00';
|
||||
$istirahat_mulai = $presensi_data_today['mulai_istirahat'] ?? '00:00';
|
||||
$istirahat_selesai = $presensi_data_today['beres_istirahat'] ?? '00:00';
|
||||
$pulang_time = $presensi_data_today['jam_pulang'] ?? '00:00';
|
||||
|
||||
$jadwal = $pegawai['jadwal'] ?? [];
|
||||
$jam_masuk = $jadwal['masuk'] ?? '08:00';
|
||||
$jam_pulang = $jadwal['pulang'] ?? '17:00';
|
||||
$jam_istirahat = $jadwal['istirahat'] ?? '12:00';
|
||||
$toleransi_masuk = $jadwal['toleransi_masuk'] ?? '15';
|
||||
$toleransi_pulang = $jadwal['toleransi_pulang'] ?? '15';
|
||||
|
||||
echo "<h3>Variables Check:</h3>";
|
||||
echo "user_name: " . ($user_name ?: 'EMPTY') . "<br>";
|
||||
echo "user_jabatan: " . ($user_jabatan ?: 'EMPTY') . "<br>";
|
||||
echo "user_id: " . ($user_id ?: 'EMPTY') . "<br>";
|
||||
echo "unit_kerja: " . ($unit_kerja ?: 'EMPTY') . "<br>";
|
||||
echo "kantor: " . ($kantor ?: 'EMPTY') . "<br>";
|
||||
echo "jam_masuk: " . ($jam_masuk ?: 'EMPTY') . "<br>";
|
||||
echo "jam_pulang: " . ($jam_pulang ?: 'EMPTY') . "<br>";
|
||||
echo "jam_istirahat: " . ($jam_istirahat ?: 'EMPTY') . "<br>";
|
||||
echo "toleransi_masuk: " . ($toleransi_masuk ?: 'EMPTY') . "<br>";
|
||||
echo "masuk_time: " . ($masuk_time ?: 'EMPTY') . "<br>";
|
||||
echo "pulang_time: " . ($pulang_time ?: 'EMPTY') . "<br>";
|
||||
|
||||
echo "<h3>Raw Profile Data:</h3>";
|
||||
echo "<pre>" . json_encode($profile_data, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
echo "<h3>Raw Presensi Today Data:</h3>";
|
||||
echo "<pre>" . json_encode($presensi_today, JSON_PRETTY_PRINT) . "</pre>";
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']);
|
||||
}
|
||||
58
public/ios/app/debug/test_final.php
Normal file
58
public/ios/app/debug/test_final.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Final - Semua Endpoint</h2>";
|
||||
|
||||
// Login dulu
|
||||
echo "<h3>1. Login</h3>";
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
echo "Login: " . ($login_result['success'] ? 'SUCCESS' : 'FAILED') . "<br>";
|
||||
|
||||
if ($login_result['success']) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "Token: " . substr($token, 0, 20) . "...<br><br>";
|
||||
|
||||
// Test semua endpoint
|
||||
$tests = [
|
||||
'Profil' => function () use ($token) {
|
||||
return api_get_profil($token);
|
||||
},
|
||||
'Presensi Today' => function () use ($token) {
|
||||
return api_get_presensi_today($token);
|
||||
},
|
||||
'Presensi' => function () use ($token) {
|
||||
return api_get_presensi($token);
|
||||
},
|
||||
'Berita' => function () use ($token) {
|
||||
return api_get_berita($token);
|
||||
},
|
||||
'Libur' => function () use ($token) {
|
||||
return api_get_libur($token);
|
||||
},
|
||||
'Cuti' => function () use ($token) {
|
||||
return api_get_cuti($token);
|
||||
},
|
||||
'Lembur' => function () use ($token) {
|
||||
return api_get_lembur($token);
|
||||
}
|
||||
];
|
||||
|
||||
echo "<h3>2. Test Endpoints</h3>";
|
||||
foreach ($tests as $name => $test) {
|
||||
$result = $test();
|
||||
$status = $result['success'] ? '✅ SUCCESS' : '❌ FAILED';
|
||||
$data_count = is_array($result['data']) ? count($result['data']) : 'N/A';
|
||||
echo "<strong>$name:</strong> $status (Data: $data_count)<br>";
|
||||
|
||||
if (!$result['success']) {
|
||||
echo " Error: " . json_encode($result['data']) . "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br><h3>3. Dashboard Links</h3>";
|
||||
echo "<a href='login.php' target='_blank'>Login Page</a><br>";
|
||||
echo "<a href='dashboard.php' target='_blank'>Dashboard</a><br>";
|
||||
echo "<a href='rekam.php' target='_blank'>Rekam Presensi</a><br>";
|
||||
} else {
|
||||
echo "Login gagal: " . json_encode($login_result['data']) . "<br>";
|
||||
}
|
||||
28
public/ios/app/debug/test_json_decode.php
Normal file
28
public/ios/app/debug/test_json_decode.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test JSON Decode</h2>";
|
||||
|
||||
// Test dengan data yang kita tahu benar
|
||||
$test_json = '{"status":1,"pesan":"","data":[{"id_berita":"13","tanggal":"2025-06-03","photo":"bc48a-libur-idul-adha-2025.jpg","judul":"Libur Nasional Idul Adha","isi":"<p>Pemberitahuan Libur Idul Adha tanggal 6 Juni 2025 dan Cuti Bersama Tanggal 9 Juni 2025.<\/p><p>Operasional Kembali Pada Tanggal 10 Juni 2025<\/p>"}]}';
|
||||
|
||||
echo "<h3>Raw JSON:</h3>";
|
||||
echo "<pre>" . $test_json . "</pre>";
|
||||
|
||||
$decoded = json_decode($test_json, true);
|
||||
echo "<h3>Decoded Array:</h3>";
|
||||
echo "<pre>" . print_r($decoded, true) . "</pre>";
|
||||
|
||||
echo "<h3>Access Data:</h3>";
|
||||
echo "Status: " . ($decoded['status'] ?? 'N/A') . "<br>";
|
||||
echo "Data Count: " . (isset($decoded['data']) ? count($decoded['data']) : 'N/A') . "<br>";
|
||||
|
||||
if (isset($decoded['data']) && is_array($decoded['data'])) {
|
||||
$first_item = $decoded['data'][0];
|
||||
echo "First Item Judul: " . ($first_item['judul'] ?? 'N/A') . "<br>";
|
||||
echo "First Item Tanggal: " . ($first_item['tanggal'] ?? 'N/A') . "<br>";
|
||||
echo "First Item Isi: " . substr(strip_tags($first_item['isi'] ?? 'N/A'), 0, 100) . "...<br>";
|
||||
}
|
||||
|
||||
echo "<h3>JSON Error:</h3>";
|
||||
echo "JSON Last Error: " . json_last_error_msg() . "<br>";
|
||||
72
public/ios/app/debug/test_token.php
Normal file
72
public/ios/app/debug/test_token.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test Token Dashboard</h2>";
|
||||
|
||||
// Cek session
|
||||
echo "<h3>1. Session Check:</h3>";
|
||||
echo "<pre>";
|
||||
echo "Session Token: " . ($_SESSION['token'] ?? 'TIDAK ADA') . "\n";
|
||||
echo "User Data: " . json_encode($_SESSION['user_data'] ?? []) . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
// Cek token dari session
|
||||
$token = $_SESSION['token'] ?? '';
|
||||
|
||||
if (empty($token)) {
|
||||
echo "<p style='color:red'>❌ Token tidak ada di session, coba login dulu</p>";
|
||||
echo "<a href='login.php'>Login</a>";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<p style='color:green'>✅ Token ditemukan: " . substr($token, 0, 20) . "...</p>";
|
||||
|
||||
// Test API berita dengan token dari session
|
||||
echo "<h3>2. Test API Berita dengan Token Session:</h3>";
|
||||
$berita_result = api_get_berita($token);
|
||||
|
||||
echo "<pre>";
|
||||
echo "Success: " . ($berita_result['success'] ? 'YES' : 'NO') . "\n";
|
||||
echo "HTTP Code: " . $berita_result['http_code'] . "\n";
|
||||
echo "Raw Response: " . $berita_result['raw_response'] . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
echo "<p style='color:green'>✅ API berita berhasil dengan token session</p>";
|
||||
|
||||
if (!empty($berita_result['data']['data'])) {
|
||||
echo "<p>Jumlah berita: " . count($berita_result['data']['data']) . "</p>";
|
||||
|
||||
foreach (array_slice($berita_result['data']['data'], 0, 2) as $index => $item) {
|
||||
echo "<div style='border:1px solid #ccc;padding:10px;margin:10px 0;'>";
|
||||
echo "<h4>📅 " . htmlspecialchars($item['tanggal'] ?? '') . " — " . htmlspecialchars($item['judul'] ?? '') . "</h4>";
|
||||
echo "<p>" . nl2br(htmlspecialchars($item['isi'] ?? '')) . "</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ API berita gagal dengan token session</p>";
|
||||
}
|
||||
|
||||
// Test login fresh untuk bandingkan
|
||||
echo "<h3>3. Test Login Fresh untuk Bandingkan:</h3>";
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
if ($login_result['success']) {
|
||||
$fresh_token = $login_result['data']['token'];
|
||||
echo "<p style='color:green'>✅ Login fresh berhasil</p>";
|
||||
|
||||
$fresh_berita_result = api_get_berita($fresh_token);
|
||||
echo "<pre>";
|
||||
echo "Fresh Token Success: " . ($fresh_berita_result['success'] ? 'YES' : 'NO') . "\n";
|
||||
echo "Fresh Token HTTP Code: " . $fresh_berita_result['http_code'] . "\n";
|
||||
echo "</pre>";
|
||||
|
||||
if ($fresh_berita_result['success']) {
|
||||
echo "<p style='color:green'>✅ API berita berhasil dengan token fresh</p>";
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ API berita gagal dengan token fresh</p>";
|
||||
}
|
||||
} else {
|
||||
echo "<p style='color:red'>❌ Login fresh gagal</p>";
|
||||
}
|
||||
48
public/ios/app/debug/test_with_token.php
Normal file
48
public/ios/app/debug/test_with_token.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
echo "<h2>Test API dengan Token Valid</h2>";
|
||||
|
||||
// Login dulu untuk mendapatkan token
|
||||
echo "<h3>1. Login untuk mendapatkan token</h3>";
|
||||
$login_result = api_login('Widia', 'qwerty5*');
|
||||
echo "Login Result: " . json_encode($login_result, JSON_PRETTY_PRINT) . "<br><br>";
|
||||
|
||||
if ($login_result['success'] && isset($login_result['data']['token'])) {
|
||||
$token = $login_result['data']['token'];
|
||||
echo "<strong style='color: green;'>Login berhasil! Token: " . substr($token, 0, 20) . "...</strong><br><br>";
|
||||
|
||||
// Test semua endpoint dengan token
|
||||
$endpoints = [
|
||||
'profil' => 'api_get_profil',
|
||||
'presensi_today' => 'api_get_presensi_today',
|
||||
'presensi' => 'api_get_presensi',
|
||||
'berita' => 'api_get_berita',
|
||||
'libur' => 'api_get_libur',
|
||||
'cuti' => 'api_get_cuti',
|
||||
'lembur' => 'api_get_lembur'
|
||||
];
|
||||
|
||||
foreach ($endpoints as $name => $function) {
|
||||
echo "<h4>2. Test $name</h4>";
|
||||
$result = $function($token);
|
||||
echo "Success: " . ($result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "HTTP Code: " . $result['http_code'] . "<br>";
|
||||
echo "Response: " . json_encode($result['data'], JSON_PRETTY_PRINT) . "<br><br>";
|
||||
}
|
||||
|
||||
// Test save presensi (tanpa foto)
|
||||
echo "<h4>3. Test Save Presensi Masuk (tanpa foto)</h4>";
|
||||
$presensi_data = [
|
||||
'latitude' => '-6.9022',
|
||||
'longitude' => '107.6181',
|
||||
'waktu' => date('Y-m-d H:i:s'),
|
||||
'jarak' => '0'
|
||||
];
|
||||
$save_result = api_save_masuk($token, $presensi_data);
|
||||
echo "Success: " . ($save_result['success'] ? 'YES' : 'NO') . "<br>";
|
||||
echo "Response: " . json_encode($save_result['data'], JSON_PRETTY_PRINT) . "<br><br>";
|
||||
} else {
|
||||
echo "<strong style='color: red;'>Login gagal!</strong><br>";
|
||||
echo "Error: " . json_encode($login_result, JSON_PRETTY_PRINT) . "<br>";
|
||||
}
|
||||
Reference in New Issue
Block a user