demo transaksi
This commit is contained in:
@@ -17,14 +17,55 @@
|
||||
<?php endif; ?>
|
||||
<?= form_open_multipart('appnotification/send'); ?>
|
||||
<div class="form-group">
|
||||
<label for="newscategory">Kirim Ke</label>
|
||||
<select class="js-example-basic-single" style="width:100%" name='topic'>
|
||||
<label>Tipe kirim</label>
|
||||
<div class="d-flex flex-wrap align-items-center" style="gap:1rem;">
|
||||
<label class="mb-0 font-weight-normal">
|
||||
<input type="radio" name="send_target" value="topic" checked onchange="toggleAppnotifTarget()"> Topik (broadcast)
|
||||
</label>
|
||||
<label class="mb-0 font-weight-normal">
|
||||
<input type="radio" name="send_target" value="users" onchange="toggleAppnotifTarget()"> Pengguna terpilih (by ID)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="wrap-topic">
|
||||
<label for="topic">Kirim ke topik</label>
|
||||
<select id="topic" class="js-example-basic-single" style="width:100%" name="topic">
|
||||
<option value="pelanggan">User</option>
|
||||
<option value="driver">Driver</option>
|
||||
<option value="mitra">Merchant Partner</option>
|
||||
<option value="ouride">Semua</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="wrap-users" style="display:none;">
|
||||
<label for="user_ids">Pilih pengguna <span class="text-muted">(nama dan ID)</span></label>
|
||||
<select id="user_ids" class="js-example-basic-multiple" name="user_ids[]" multiple="multiple" style="width:100%" data-placeholder="Cari nama atau ID…">
|
||||
<?php if (!empty($pelanggan_list)) : ?>
|
||||
<?php foreach ($pelanggan_list as $u) : ?>
|
||||
<?php
|
||||
$label = $u->fullnama;
|
||||
if ($label === null || trim((string) $label) === '') {
|
||||
$label = $u->no_telepon ?: $u->email ?: ('User #' . (int) $u->id);
|
||||
}
|
||||
$option_text = $label . ' (ID: ' . (int) $u->id . ')';
|
||||
?>
|
||||
<option value="<?= (int) $u->id ?>"><?= htmlspecialchars($option_text, ENT_QUOTES, 'UTF-8') ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
<small class="form-text text-muted">Hanya pengguna yang pernah login dari aplikasi dengan token FCM valid yang menerima push.</small>
|
||||
</div>
|
||||
<script>
|
||||
function toggleAppnotifTarget() {
|
||||
var r = document.querySelector('input[name="send_target"]:checked');
|
||||
var topic = document.getElementById('wrap-topic');
|
||||
var users = document.getElementById('wrap-users');
|
||||
if (!r || !topic || !users) return;
|
||||
var isTopic = r.value === 'topic';
|
||||
topic.style.display = isTopic ? 'block' : 'none';
|
||||
users.style.display = isTopic ? 'none' : 'block';
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', toggleAppnotifTarget);
|
||||
</script>
|
||||
<div class="form-group">
|
||||
<label for="title">Judul</label>
|
||||
<input type="text" class="form-control" placeholder="notification" name="title" required>
|
||||
|
||||
Reference in New Issue
Block a user