198 lines
14 KiB
PHP
198 lines
14 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/includes/app.php';
|
|
|
|
ensure_applications_table();
|
|
$categories = kei_categories();
|
|
$errors = [];
|
|
$form = [
|
|
'full_name' => trim((string) ($_POST['full_name'] ?? '')),
|
|
'email' => trim((string) ($_POST['email'] ?? '')),
|
|
'whatsapp' => trim((string) ($_POST['whatsapp'] ?? '')),
|
|
'category' => trim((string) ($_POST['category'] ?? 'Penyanyi')),
|
|
'consent_accuracy' => isset($_POST['consent_accuracy']),
|
|
'consent_audition' => isset($_POST['consent_audition']),
|
|
'consent_contract' => isset($_POST['consent_contract']),
|
|
'consent_data' => isset($_POST['consent_data']),
|
|
];
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$form['whatsapp'] = normalize_whatsapp($form['whatsapp']);
|
|
|
|
if ($form['full_name'] === '' || mb_strlen($form['full_name']) < 3) {
|
|
$errors[] = 'Nama lengkap minimal 3 karakter.';
|
|
}
|
|
if (!filter_var($form['email'], FILTER_VALIDATE_EMAIL)) {
|
|
$errors[] = 'Format email belum valid.';
|
|
}
|
|
if ($form['whatsapp'] === '' || mb_strlen($form['whatsapp']) < 8) {
|
|
$errors[] = 'Nomor WhatsApp belum valid.';
|
|
}
|
|
if (!array_key_exists($form['category'], $categories)) {
|
|
$errors[] = 'Kategori pendaftaran tidak tersedia.';
|
|
}
|
|
if (!$form['consent_accuracy'] || !$form['consent_audition'] || !$form['consent_contract'] || !$form['consent_data']) {
|
|
$errors[] = 'Semua persetujuan wajib dicentang.';
|
|
}
|
|
|
|
if (!$errors) {
|
|
try {
|
|
$photoUrl = handle_optional_upload('photo', [
|
|
'image/jpeg' => 'jpg',
|
|
'image/png' => 'png',
|
|
'image/webp' => 'webp',
|
|
], 4 * 1024 * 1024, 'photos');
|
|
|
|
$videoUrl = handle_optional_upload('video', [
|
|
'video/mp4' => 'mp4',
|
|
'video/quicktime' => 'mov',
|
|
'video/webm' => 'webm',
|
|
], 8 * 1024 * 1024, 'videos');
|
|
|
|
$stmt = db()->prepare('INSERT INTO talent_applications (full_name, email, whatsapp, category, photo_url, video_url, consent_accuracy, consent_audition, consent_contract, consent_data, status) VALUES (:full_name, :email, :whatsapp, :category, :photo_url, :video_url, :consent_accuracy, :consent_audition, :consent_contract, :consent_data, :status)');
|
|
$stmt->execute([
|
|
':full_name' => $form['full_name'],
|
|
':email' => $form['email'],
|
|
':whatsapp' => $form['whatsapp'],
|
|
':category' => $form['category'],
|
|
':photo_url' => $photoUrl,
|
|
':video_url' => $videoUrl,
|
|
':consent_accuracy' => $form['consent_accuracy'] ? 1 : 0,
|
|
':consent_audition' => $form['consent_audition'] ? 1 : 0,
|
|
':consent_contract' => $form['consent_contract'] ? 1 : 0,
|
|
':consent_data' => $form['consent_data'] ? 1 : 0,
|
|
':status' => 'review',
|
|
]);
|
|
|
|
flash_set('register_success', [
|
|
'id' => (int) db()->lastInsertId(),
|
|
'full_name' => $form['full_name'],
|
|
'email' => $form['email'],
|
|
'category' => $form['category'],
|
|
'submitted_at' => gmdate('d M Y H:i') . ' UTC',
|
|
]);
|
|
header('Location: register.php?success=1');
|
|
exit;
|
|
} catch (Throwable $exception) {
|
|
$errors[] = 'Pendaftaran belum dapat dikirim. Silakan coba lagi.';
|
|
}
|
|
}
|
|
}
|
|
|
|
$success = isset($_GET['success']) ? flash_get('register_success') : null;
|
|
render_head('Daftar', 'Talent registration page for KOBA Entertainment Indonesia.');
|
|
render_header('register');
|
|
?>
|
|
<main>
|
|
<section class="page-hero section-space-sm">
|
|
<div class="container-fluid kei-container narrow-copy">
|
|
<span class="eyebrow"<?= copy_attrs(['id' => 'Daftar', 'jp' => '応募']) ?>>Daftar</span>
|
|
<h1 class="page-title"<?= copy_attrs(['id' => 'Bergabunglah bersama KOBA Entertainment.', 'jp' => 'KOBA Entertainmentに参加しませんか。']) ?>>Bergabunglah bersama KOBA Entertainment.</h1>
|
|
<p class="page-copy"<?= copy_attrs(['id' => 'Kirim profil Anda untuk singer, talent, atau kreator. Tim KEI akan meninjau data dan media pendukung sebagai tahap awal audisi atau kolaborasi.', 'jp' => 'シンガー、タレント、クリエイターとしてプロフィールを送信してください。KEIチームが応募データと補足メディアを確認し、オーディションまたは協業の初期選考を行います。']) ?>>Kirim profil Anda untuk singer, talent, atau kreator. Tim KEI akan meninjau data dan media pendukung sebagai tahap awal audisi atau kolaborasi.</p>
|
|
</div>
|
|
</section>
|
|
<section class="section-space-sm border-top-soft">
|
|
<div class="container-fluid kei-container">
|
|
<?php if ($success): ?>
|
|
<div class="alert alert-success border-0 soft-alert mb-4" role="alert">
|
|
<strong<?= copy_attrs(['id' => 'Terima kasih telah mendaftar.', 'jp' => 'ご応募ありがとうございます。']) ?>>Terima kasih telah mendaftar.</strong>
|
|
<div class="mt-2">
|
|
<span><?= h($success['full_name']) ?></span>
|
|
<span class="mx-2">•</span>
|
|
<span>#<?= h((string) $success['id']) ?></span>
|
|
<span class="mx-2">•</span>
|
|
<span><?= h($success['submitted_at']) ?></span>
|
|
</div>
|
|
<p class="mb-0 mt-2"<?= copy_attrs(['id' => 'Data Anda masuk ke tahap review awal. Tim KEI akan menghubungi kandidat yang sesuai.', 'jp' => '応募データは初期審査に入りました。条件に合う候補者へKEIチームから連絡します。']) ?>>Data Anda masuk ke tahap review awal. Tim KEI akan menghubungi kandidat yang sesuai.</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($errors): ?>
|
|
<div class="alert alert-danger border-0 soft-alert mb-4" role="alert">
|
|
<strong>Periksa kembali isian form.</strong>
|
|
<ul class="mb-0 mt-2 ps-3">
|
|
<?php foreach ($errors as $error): ?>
|
|
<li><?= h($error) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="row g-4 align-items-start">
|
|
<div class="col-lg-7">
|
|
<form class="app-card form-stack" method="post" enctype="multipart/form-data" data-submit-state>
|
|
<div class="row g-3">
|
|
<div class="col-12">
|
|
<label for="full_name" class="form-label"<?= copy_attrs(['id' => 'Nama Lengkap', 'jp' => '氏名']) ?>>Nama Lengkap</label>
|
|
<input type="text" class="form-control" id="full_name" name="full_name" value="<?= h($form['full_name']) ?>" required<?= placeholder_attrs(['id' => 'Masukkan nama lengkap', 'jp' => '氏名を入力']) ?>>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="email" class="form-label"<?= copy_attrs(['id' => 'Email', 'jp' => 'メール']) ?>>Email</label>
|
|
<input type="email" class="form-control" id="email" name="email" value="<?= h($form['email']) ?>" required<?= placeholder_attrs(['id' => 'nama@email.com', 'jp' => 'name@email.com']) ?>>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="whatsapp" class="form-label"<?= copy_attrs(['id' => 'WhatsApp', 'jp' => 'WhatsApp']) ?>>WhatsApp</label>
|
|
<input type="text" class="form-control" id="whatsapp" name="whatsapp" value="<?= h($form['whatsapp']) ?>" required<?= placeholder_attrs(['id' => '08xxxxxxxxxx', 'jp' => '連絡先番号']) ?>>
|
|
</div>
|
|
<div class="col-12">
|
|
<label for="category" class="form-label"<?= copy_attrs(['id' => 'Kategori', 'jp' => 'カテゴリー']) ?>>Kategori</label>
|
|
<select class="form-select" id="category" name="category" required>
|
|
<?php foreach ($categories as $value => $label): ?>
|
|
<option value="<?= h($value) ?>"<?= $form['category'] === $value ? ' selected' : '' ?><?= copy_attrs($label) ?>><?= h(copy_text($label)) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="photo" class="form-label"<?= copy_attrs(['id' => 'Foto (opsional)', 'jp' => '写真(任意)']) ?>>Foto (opsional)</label>
|
|
<input class="form-control" type="file" id="photo" name="photo" accept=".jpg,.jpeg,.png,.webp" data-file-target="photo-file-name">
|
|
<small class="form-hint" id="photo-file-name">JPG, PNG, WEBP · max 4MB</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="video" class="form-label"<?= copy_attrs(['id' => 'Video (opsional)', 'jp' => '動画(任意)']) ?>>Video (opsional)</label>
|
|
<input class="form-control" type="file" id="video" name="video" accept=".mp4,.mov,.webm" data-file-target="video-file-name">
|
|
<small class="form-hint" id="video-file-name">MP4, MOV, WEBM · max 8MB</small>
|
|
</div>
|
|
</div>
|
|
<div class="consent-list mt-4">
|
|
<label class="form-check consent-item">
|
|
<input class="form-check-input" type="checkbox" name="consent_accuracy"<?= $form['consent_accuracy'] ? ' checked' : '' ?>>
|
|
<span class="form-check-label"<?= copy_attrs(['id' => 'Data yang saya kirim benar.', 'jp' => '送信する情報は正確です。']) ?>>Data yang saya kirim benar.</span>
|
|
</label>
|
|
<label class="form-check consent-item">
|
|
<input class="form-check-input" type="checkbox" name="consent_audition"<?= $form['consent_audition'] ? ' checked' : '' ?>>
|
|
<span class="form-check-label"<?= copy_attrs(['id' => 'Saya bersedia mengikuti audisi.', 'jp' => 'オーディション参加に同意します。']) ?>>Saya bersedia mengikuti audisi.</span>
|
|
</label>
|
|
<label class="form-check consent-item">
|
|
<input class="form-check-input" type="checkbox" name="consent_contract"<?= $form['consent_contract'] ? ' checked' : '' ?>>
|
|
<span class="form-check-label"<?= copy_attrs(['id' => 'Saya bersedia mengikuti proses kontrak bila lolos.', 'jp' => '通過した場合、契約プロセスに同意します。']) ?>>Saya bersedia mengikuti proses kontrak bila lolos.</span>
|
|
</label>
|
|
<label class="form-check consent-item">
|
|
<input class="form-check-input" type="checkbox" name="consent_data"<?= $form['consent_data'] ? ' checked' : '' ?>>
|
|
<span class="form-check-label"<?= copy_attrs(['id' => 'Saya memberi izin penggunaan data untuk keperluan review.', 'jp' => '審査目的でのデータ利用に同意します。']) ?>>Saya memberi izin penggunaan data untuk keperluan review.</span>
|
|
</label>
|
|
</div>
|
|
<button type="submit" class="btn btn-brand btn-lg mt-4" data-submit-label="Kirim Pendaftaran"<?= copy_attrs(['id' => 'Kirim Pendaftaran', 'jp' => '応募を送信']) ?>>Kirim Pendaftaran</button>
|
|
</form>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<aside class="app-card info-stack">
|
|
<span class="eyebrow"<?= copy_attrs(['id' => 'Workflow', 'jp' => 'ワークフロー']) ?>>Workflow</span>
|
|
<h2<?= copy_attrs(['id' => 'Alur pendaftaran yang sederhana, rapi, dan siap direview.', 'jp' => 'シンプルで整理された、レビューしやすい応募フロー。']) ?>>Alur pendaftaran yang sederhana, rapi, dan siap direview.</h2>
|
|
<ol class="ordered-list">
|
|
<li<?= copy_attrs(['id' => 'Isi data talent dan pilih kategori.', 'jp' => 'プロフィール情報とカテゴリを入力。']) ?>>Isi data talent dan pilih kategori.</li>
|
|
<li<?= copy_attrs(['id' => 'Upload foto/video pendukung bila tersedia.', 'jp' => '必要に応じて写真・動画を追加。']) ?>>Upload foto/video pendukung bila tersedia.</li>
|
|
<li<?= copy_attrs(['id' => 'Dapatkan konfirmasi lalu data masuk ke dashboard admin.', 'jp' => '送信後、管理ダッシュボードで確認されます。']) ?>>Dapatkan konfirmasi lalu data masuk ke dashboard admin.</li>
|
|
</ol>
|
|
<div class="detail-panel mt-4">
|
|
<span class="eyebrow"<?= copy_attrs(['id' => 'Admin Review', 'jp' => '管理レビュー']) ?>>Admin Review</span>
|
|
<p class="mb-2"<?= copy_attrs(['id' => 'Tim admin dapat login untuk mencari data, memfilter status, membuka detail kandidat, dan ekspor CSV.', 'jp' => '管理チームはログイン後、検索・ステータス絞り込み・候補者詳細確認・CSV書き出しが可能です。']) ?>>Tim admin dapat login untuk mencari data, memfilter status, membuka detail kandidat, dan ekspor CSV.</p>
|
|
<a href="admin/login.php" class="text-link"<?= copy_attrs(['id' => 'Buka Admin Dashboard', 'jp' => '管理画面を開く']) ?>>Buka Admin Dashboard</a>
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
<?php render_footer(); ?>
|