function dropDownDateDeparture($name = '', $optionsOnly = false, $htmlOptions = []) { // dd($name); if (!empty($_GET['paket'])) { $paketIds = getPaketIdsByPaketName($_GET['paket']); $dates = getDepartureDates('', $paketIds); } else { $dates = getDepartureDates(); } if (!$optionsOnly) { $html = '<select required name="tgl_keberangkatan" id="tgl-berangkat">'; } $html .= '<option value=""> — Pilih Tanggal —</option>'; foreach ($dates as $date) { $date = DateTime::createFromFormat('Ymd', $date['date'])->format('d M Y'); $html .= '<option value="' . $date . '"'; $html .= ' >' . $date . '</option>'; } if (!$optionsOnly) { $html .= '</select>'; } return $html; }
foreach ($paketPlus as $k => $v) { $selectedPackageIds[] = $k; } } else { foreach ($paketNonPlus as $k => $v) { // dump($v === $_GET['paket'], $k, $v); if ($v->post_name === $_GET['paket']) { $selectedPackageIds = $v->ID; } } } $allPacketIds = $selectedPackageIds; } // dd($allPacketIds, $selectedPackageIds, $paketNonPlus); //grouped by month $groupedDepartureDates = array_group_by(getDepartureDates($_GET['bulan'], $selectedPackageIds), 'bulan'); // loop bulan foreach ($groupedDepartureDates as $monthIndex => $data) { // dd($data); ?> <div class="calendar__row"> <h3 class="calendar__row__title"><?php echo $indonesianMonths[$monthIndex] . ' ' . Date('Y'); ?> </h3> <?php // loop hari foreach ($data as $key => $value) {