Modal tidak muncul saat button di klik

mohon bantuannya agan-agan saya membuat button yang mengarah ke modal untuk menampilkan & mengedit database, namun saat button di klik, modal tidak muncul.

anehnya apabila dikoneksikan dengan database yang lain, modalnya bekerja. mohon arahannya. terimakasih

<table>
            <tr style="background-color: #DCDCDC;">
                <th>NO</th>
                <th>QUOTATION ID</th>
                <th>CUSTOMER</th>
                <th>QUOTATION DATE</th>
                <th>SALES</th>
                <th>STATUS</th>
                <th>ACTION</th>
            </tr>

            <?php
                include "koneksi.php";
                if (isset($_POST['tgl_awal'])&& isset($_POST['tgl_akhir'])) {
                    $tgl_awal=date('Y-m-d', strtotime($_POST["tgl_awal"]));
                    $tgl_akhir=date('Y-m-d', strtotime($_POST["tgl_akhir"]));
                    $sql="select * from quotation where date between '".$tgl_awal."' and '".$tgl_akhir."' order by kode desc";
                }elseif (isset($_POST['kata_kunci'])) {
                    $kata_kunci=trim($_POST['kata_kunci']);
                    $sql="select * from quotation where kode like '%".$kata_kunci."%' or pelanggan like '%".$kata_kunci."%' or attn like '%".$kata_kunci."%' or item like '%".$kata_kunci."%' order by kode desc";
                }else {
                    $sql="select * from quotation order by kode desc";
                }
                $hasil=mysqli_query($koneksi,$sql);
                $no=1;
                while ($d = mysqli_fetch_array($hasil)) {
            ?>


            <tr>
                <td><?php echo $no++; ?></td>
                    <td><?php echo $d['kode']; ?></td>
                    <td><?php echo $d['pelanggan']; ?></td>
                    <td><?php echo date('d-M-y', strtotime($d["date"])); ?></td>
                    <td><?php echo $d['sales']; ?>
                <?php
                $status = $d['status'];
                $status = (int)$status;
                if($status == 1){
                  echo '<td style="color: green;">'. 'APPROVED'.'</td>';
                }elseif($status == 2){
                    echo '<td  style="color: red;">' .'REJECTED'. '</td>';
                }else{
                  echo '<td  style="color: orange;">' .'PENDING'. '</td>';
                }
                ?>
                <td>
                    <div class="btn-group" role="group" aria-label="Basic outlined example">
                            <?php
                                include "koneksi.php";
                                    $status = $d['status'];
                                    $status = (int)$status;
                                if($_SESSION['jabatan'] == 'direksi'){
                                    if($status== 0){
                                        echo "<button type='button' style='font-size: 12px;' class='btn btn-outline-primary btn-sm' data-bs-toggle='modal' data-bs-target='#updateQuo$d[kode]'>action</button>";
                                    }elseif($status== 1){
                                        echo "<button type='button' style='font-size: 12px;' class='btn btn-outline-primary btn-sm' data-bs-toggle='modal' data-bs-target='#updateQuo$d[kode]'>action</button>";
                                        echo "<a href='quo_print.php?kode=$d[kode]' target='_blank' style='font-size: 12px;' class='btn btn-outline-primary btn-sm'><span class='fa fa-download'></span> Download</a>";
                                    }else{
                                    echo "<button type='button' style='font-size: 12px;' class='btn btn-outline-primary btn-sm' data-bs-toggle='modal' data-bs-target='#updateQuo$d[kode]'>action</button>";
                                }
                                }elseif($_SESSION['jabatan'] !== 'direksi'){
                                    if($status== 1){
                                        echo "<a href='quo_print.php?kode=$d[kode]' target='_blank' style='font-size: 12px;' class='btn btn-outline-primary btn-sm'><span class='fa fa-download'></span> Download</a>";
                                    }else{
                                    echo "";
                                    }
                                }else{
                                    echo "";
                                }
                            ?>
                    </div>
                </td>
            </tr>
                 <!-- Modal Sampel Update -->
            <div class="modal fade" id="updateQuo<?php echo $d['kode']; ?>" tabindex="-1" aria-labelledby="updateQuo" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="updateQuo">Update Status</h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <form method="post" action="quo_update_aksi.php" class="row g-3">
                                <div class="col-md-6">
                                    <label>Quotation Date</label>
                                    <input type="hidden" name="kode" value="<?php echo $d['kode']; ?>">
                                    <input type="date" name="date" class="form-control" required="required" value="<?php echo $d['date']; ?>"/>
                                </div>
                                <div class="col-md-6">
                                    <label>Sales</label>
                                    <input type="text" name="sales" class="form-control" required="required" value="<?php echo $d['sales']; ?>" readonly/>
                                </div>
                                <div class="col-md-6">
                                    <label>Customer Name</label>
                                    <input type="text" name="customer" class="form-control" required="required" value="<?php echo $d['customer']; ?>" readonly/>
                                </div>
                                <div class="col-md-12">
                                    <label>STATUS</label>
                                    <select  name="status" class="form-select" required  aria-label=".form-select-lg example">
                                    <option disabled selected><?php echo $d['status']; ?></option>
                                    <?php
                                        include "koneksi.php";
                                        if($_SESSION['jabatan'] == 'direksi'){
                                            if($d['status']==0){
                                                echo "<option value='1' style='color: blue;'>APPROVED</option>";
                                                echo "<option value='0' style='color: red;'>REJECTED</option>";
                                            }else{
                                                echo "<option value='' ></option>";
                                            }
                                        }else{
                                            echo "<option value='' ></option>";
                                        }
                                    ?>

                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>Remarks</label>
                                    <input type="text" name="remarks" class="form-control"  value="<?php echo $d['remarks']; ?>"/>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                                    <button type="submit" name="submit"  class="btn btn-primary">Save changes</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <?php
            }
            ?>
        </table>
avatar enthrall
@enthrall

9 Kontribusi 2 Poin

Diperbarui 3 tahun yang lalu

Tanggapan

coba cek di inspect element terus console lognya, ada error apa

1 Jawaban:

<div>Dari pengalaman saya soal modal tidak muncul bisa terjadi karena berikut :<br>1. Load file pendukung css dan js tidak di load atau bisa juga salah ketik urlnya.<br>2. Atribut data-target di tombol tidak singkron dengan id di modal target.<br>3. Belum diinisialisasi modalnya.<br>4. Salah menginisialisasi selektor untuk modal.<br>5. Terkadang browser masih meload file js versi lama kita, harus hapus cookie browser dulu min untuk 1 jam yang lalu.</div>

avatar logika
@logika

19 Kontribusi 8 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban