<?php
include "asset/session_check.php";
$nama_pegawai = $_SESSION['nama_pegawai'];
$akses = $_SESSION['akses'];
?>
<!doctype html>
<html lang="en">

<head>
    <?php
    include "asset/head.php";
    ?>
</head>

<body>
    <!-- NAVIGASI -->
    <?php
    include "asset/navigasi.php";
    ?>
    <div class="container">
        <div class="row">
            <div class="d-flex bd-highlight mb-3">
                <div class="me-auto p-2 bd-highlight">
                    <h1>Tambah Data Telp Customers Bisman</h1>
                </div>
            </div>
        </div>
        <form action="function/function-telpbisman.php" method="post">
            <div class="row">
                <?php
                include "koneksi.php";

                $tgl = date("Y-m-d");
                $idtelp_custbisman = $_GET["idtelp_custbisman"];

                $cariidtelp = mysqli_query($konek, "SELECT t.idtelp_custbisman,t.keperluan,t.sumber,t.ket_sumber,c.idcustomer,c.bu,c.nama_customer,c.alamat,c.kota,c.email,c.telp,t.note_telp FROM telp_custbisman t INNER JOIN customeb c ON t.idcustomer=c.idcustomer WHERE t.idtelp_custbisman = '$idtelp_custbisman'");
                $data = mysqli_fetch_array($cariidtelp);
                $idcustomer = $data['idcustomer'] ?? '';
                $bu = $data['bu'] ?? '';
                $nama_customer = $data['nama_customer'] ?? '';
                $alamat = $data['alamat'] ?? '';
                $kota = $data['kota'] ?? '';
                $email = $data['email'] ?? '';
                $telp = $data['telp'] ?? '';
                $sumber = $data['sumber'] ?? '';
                $ketarangansumber = $data['ket_sumber'] ?? '';
                $keperluan = $data['keperluan'] ?? '';
                $note = $data['note'] ?? '';
                $note_telp = $data['note_telp'] ?? '';
                ?>
                <input type="text" class="form-control" name="idtelp_custbisman" value="<?= $idtelp_custbisman ?>" hidden>
                <div class="mb-3">
                    <label class="form-label" hidden>Tanggal Telp Customers</label>
                    <input type="date" class="form-control" name="tgl_customer" value="<?= $tgl ?>" hidden>
                </div>
                <div class="col">
                    <div class="mb-3">
                        <label class="form-label">Customers</label>
                        <div class="input-group">
                            <select class="form-select" name="bu" id="bu" style="max-width: 95px;">
                                <option value="PT " <?= (strtoupper(trim($bu)) == 'PT ') ? 'selected' : '' ?>>PT</option>
                                <option value="CV " <?= (strtoupper(trim($bu)) == 'CV ') ? 'selected' : '' ?>>CV</option>
                                <option value="UD " <?= (strtoupper(trim($bu)) == 'UD ') ? 'selected' : '' ?>>UD</option>
                                <option value="TOKO " <?= (strtoupper(trim($bu)) == 'Toko ') ? 'selected' : '' ?>>TOKO
                                </option>
                                <option value="Bapak" <?= (strtoupper(trim($bu)) == 'BAPAK') ? 'selected' : '' ?>>Bapak
                                </option>
                                <option value="Ibu " <?= (strtoupper(trim($bu)) == 'Ibu ') ? 'selected' : '' ?>>Ibu
                                </option>
                            </select>
                            <input type="text" class="form-control" autocomplete="off" name="nama_customer" id="nama_customer" value="<?= $nama_customer ?>" placeholder="Masukkan Nama Customer">
                        </div>
                        <div id="customerList"
                            class="list-group w-100"
                            style="z-index:1000; display:none;"></div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Alamat</label>
                        <input type="text" id="alamat" name="alamat" class="form-control" value="<?= $alamat ?>" placeholder="Masukkan Alamat">
                        <div id="suggestion" class="list-group"></div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">KOTA</label>
                        <input type="text" id="kota" name="kota" class="form-control kota" value="<?= $kota ?>" placeholder="Ketik kota / kabupaten">
                        <div id="suggestion" class="list-group suggestion"></div>
                    </div>
                    <!-- <div class="mb-3">
                        <label class="form-label">PIC</label>
                        <div class="input-group">
                            <select class="form-select" name="tt" id="tt" style="max-width: 95px;">
                                <option value="Bapak">Bapak</option>
                                <option value="Ibu">Ibu</option>
                            </select>
                            <input type="text" class="form-control" autocomplete="off" name="pic" id="pice" placeholder="Masukkan Nama PIC">
                        </div>
                    </div> -->
                    <div class="mb-3">
                        <label class="form-label">Telp Perusahaan</label>
                        <input type="text" class="form-control" name="telp" id="telp" value="<?= $telp ?>" placeholder="Masukkan Nama Telp" maxlength="50">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Note Customer</label>
                        <textarea type="text" class="form-control" name="note_telp" id="note_telp"><?= $note_telp ?></textarea>
                    </div>
                </div>
                <div class="col">
                    <div class="mb-3">
                        <label class="form-label">Email</label>
                        <input type="text" class="form-control" name="email" id="email" value="<?= $email ?>" placeholder="Masukkan Email">
                    </div>
                    <label class="form-label">Sumber</label>
                    <div class="mb-3" id="selectSum">
                        <select class="form-select" id="sumber" name="sumber">
                            <option value="WA" <?= ($sumber == 'WA') ? 'selected' : '' ?>>WA</option>
                            <option value="Email" <?= ($sumber == 'Email') ? 'selected' : '' ?>>Email</option>
                            <option value="Brosur" <?= ($sumber == 'Brosur') ? 'selected' : '' ?>>Brosur</option>
                            <option value="Walk In" <?= ($sumber == 'Walk In') ? 'selected' : '' ?>>Walk In</option>
                            <option value="Telp" <?= ($sumber == 'Telp') ? 'selected' : '' ?>>Telp</option>
                            <option value="Iklan" <?= ($sumber == 'Iklan') ? 'selected' : '' ?>>Iklan</option>
                            <option value="Website" <?= ($sumber == 'Website') ? 'selected' : '' ?>>Website</option>
                            <option value="Tidak Tau" <?= ($sumber == 'Tidak tahu') ? 'selected' : '' ?>>Tidak tahu</option>
                        </select>
                        <select class="form-select" id="formWebsite" style="display:none;" name="keteranganSumberWeb">
                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523
                            </option>

                            <option value="alatangkat.com / sales@alatangkat.com / 082338331857"
                                <?= ($ketarangansumber == 'alatangkat.com / sales@alatangkat.com / 082338331857') ? 'selected' : '' ?>>
                                alatangkat.com / sales@alatangkat.com / 082338331857
                            </option>

                            <option value="dunialifting.com / dunialifting@gmail.com / 081334095835"
                                <?= ($ketarangansumber == 'dunialifting.com / dunialifting@gmail.com / 081334095835') ? 'selected' : '' ?>>
                                dunialifting.com / dunialifting@gmail.com / 081334095835
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081230200491"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081230200491') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081230200491
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 082122225308"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 082122225308') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 082122225308
                            </option>

                            <option value="handlift.id / - / 081336092292"
                                <?= ($ketarangansumber == 'handlift.id / - / 081336092292') ? 'selected' : '' ?>>
                                handlift.id / - / 081336092292
                            </option>

                            <option value="saranalifting.com / - / 081336402013"
                                <?= ($ketarangansumber == 'saranalifting.com / - / 081336402013') ? 'selected' : '' ?>>
                                saranalifting.com / - / 081336402013
                            </option>

                            <option value="sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813"
                                <?= ($ketarangansumber == 'sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813') ? 'selected' : '' ?>>
                                sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813
                            </option>

                            <option value="indoputrateknik.com / indputrateknik@gmail.com / 085704664297"
                                <?= ($ketarangansumber == 'indoputrateknik.com / indputrateknik@gmail.com / 085704664297') ? 'selected' : '' ?>>
                                indoputrateknik.com / indputrateknik@gmail.com / 085704664297
                            </option>

                            <option value="primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244"
                                <?= ($ketarangansumber == 'primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244') ? 'selected' : '' ?>>
                                primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244
                            </option>

                            <option value="suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070"
                                <?= ($ketarangansumber == 'suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070') ? 'selected' : '' ?>>
                                suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224844"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224844') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224844
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224880"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224880') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224880
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081334108072"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081334108072') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081334108072
                            </option>

                            <option value="linamitrateknik.com / linamitrateknik@gmail.com / 082338331874"
                                <?= ($ketarangansumber == 'linamitrateknik.com / linamitrateknik@gmail.com / 082338331874') ? 'selected' : '' ?>>
                                linamitrateknik.com / linamitrateknik@gmail.com / 082338331874
                            </option>
                        </select>
                        <select class="form-select" id="formEmail" style="display:none;" name="keteranganSumberEmail">
                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523
                            </option>

                            <option value="alatangkat.com / sales@alatangkat.com / 082338331857"
                                <?= ($ketarangansumber == 'alatangkat.com / sales@alatangkat.com / 082338331857') ? 'selected' : '' ?>>
                                alatangkat.com / sales@alatangkat.com / 082338331857
                            </option>

                            <option value="dunialifting.com / dunialifting@gmail.com / 081334095835"
                                <?= ($ketarangansumber == 'dunialifting.com / dunialifting@gmail.com / 081334095835') ? 'selected' : '' ?>>
                                dunialifting.com / dunialifting@gmail.com / 081334095835
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081230200491"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081230200491') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081230200491
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 082122225308"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 082122225308') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 082122225308
                            </option>

                            <option value="handlift.id / - / 081336092292"
                                <?= ($ketarangansumber == 'handlift.id / - / 081336092292') ? 'selected' : '' ?>>
                                handlift.id / - / 081336092292
                            </option>

                            <option value="saranalifting.com / - / 081336402013"
                                <?= ($ketarangansumber == 'saranalifting.com / - / 081336402013') ? 'selected' : '' ?>>
                                saranalifting.com / - / 081336402013
                            </option>

                            <option value="sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813"
                                <?= ($ketarangansumber == 'sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813') ? 'selected' : '' ?>>
                                sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813
                            </option>

                            <option value="indoputrateknik.com / indputrateknik@gmail.com / 085704664297"
                                <?= ($ketarangansumber == 'indoputrateknik.com / indputrateknik@gmail.com / 085704664297') ? 'selected' : '' ?>>
                                indoputrateknik.com / indputrateknik@gmail.com / 085704664297
                            </option>

                            <option value="primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244"
                                <?= ($ketarangansumber == 'primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244') ? 'selected' : '' ?>>
                                primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244
                            </option>

                            <option value="suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070"
                                <?= ($ketarangansumber == 'suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070') ? 'selected' : '' ?>>
                                suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224844"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224844') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224844
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224880"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224880') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224880
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081334108072"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081334108072') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081334108072
                            </option>

                            <option value="linamitrateknik.com / linamitrateknik@gmail.com / 082338331874"
                                <?= ($ketarangansumber == 'linamitrateknik.com / linamitrateknik@gmail.com / 082338331874') ? 'selected' : '' ?>>
                                linamitrateknik.com / linamitrateknik@gmail.com / 082338331874
                            </option>
                        </select>
                        <select class="form-select" id="formTelp" style="display:none;" name="keteranganSumberTelp">
                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523
                            </option>

                            <option value="alatangkat.com / sales@alatangkat.com / 082338331857"
                                <?= ($ketarangansumber == 'alatangkat.com / sales@alatangkat.com / 082338331857') ? 'selected' : '' ?>>
                                alatangkat.com / sales@alatangkat.com / 082338331857
                            </option>

                            <option value="dunialifting.com / dunialifting@gmail.com / 081334095835"
                                <?= ($ketarangansumber == 'dunialifting.com / dunialifting@gmail.com / 081334095835') ? 'selected' : '' ?>>
                                dunialifting.com / dunialifting@gmail.com / 081334095835
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081230200491"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081230200491') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081230200491
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 082122225308"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 082122225308') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 082122225308
                            </option>

                            <option value="handlift.id / - / 081336092292"
                                <?= ($ketarangansumber == 'handlift.id / - / 081336092292') ? 'selected' : '' ?>>
                                handlift.id / - / 081336092292
                            </option>

                            <option value="saranalifting.com / - / 081336402013"
                                <?= ($ketarangansumber == 'saranalifting.com / - / 081336402013') ? 'selected' : '' ?>>
                                saranalifting.com / - / 081336402013
                            </option>

                            <option value="sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813"
                                <?= ($ketarangansumber == 'sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813') ? 'selected' : '' ?>>
                                sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813
                            </option>

                            <option value="indoputrateknik.com / indputrateknik@gmail.com / 085704664297"
                                <?= ($ketarangansumber == 'indoputrateknik.com / indputrateknik@gmail.com / 085704664297') ? 'selected' : '' ?>>
                                indoputrateknik.com / indputrateknik@gmail.com / 085704664297
                            </option>

                            <option value="primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244"
                                <?= ($ketarangansumber == 'primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244') ? 'selected' : '' ?>>
                                primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244
                            </option>

                            <option value="suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070"
                                <?= ($ketarangansumber == 'suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070') ? 'selected' : '' ?>>
                                suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224844"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224844') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224844
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224880"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224880') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224880
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081334108072"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081334108072') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081334108072
                            </option>

                            <option value="linamitrateknik.com / linamitrateknik@gmail.com / 082338331874"
                                <?= ($ketarangansumber == 'linamitrateknik.com / linamitrateknik@gmail.com / 082338331874') ? 'selected' : '' ?>>
                                linamitrateknik.com / linamitrateknik@gmail.com / 082338331874
                            </option>
                        </select>
                        <select class="form-select" id="formWA" style="display:none;" name="keteranganSumberWA">
                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081249883080
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 081231201845
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 03130000249
                            </option>

                            <option value="bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / sales@bismanbintangbuana.com / 0217237287
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081384457297
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081283579026
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081252981592
                            </option>

                            <option value="bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523"
                                <?= ($ketarangansumber == 'bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523') ? 'selected' : '' ?>>
                                bismanbintangbuana.com / service@bismanbintangbuana.com / 081314000523
                            </option>

                            <option value="alatangkat.com / sales@alatangkat.com / 082338331857"
                                <?= ($ketarangansumber == 'alatangkat.com / sales@alatangkat.com / 082338331857') ? 'selected' : '' ?>>
                                alatangkat.com / sales@alatangkat.com / 082338331857
                            </option>

                            <option value="dunialifting.com / dunialifting@gmail.com / 081334095835"
                                <?= ($ketarangansumber == 'dunialifting.com / dunialifting@gmail.com / 081334095835') ? 'selected' : '' ?>>
                                dunialifting.com / dunialifting@gmail.com / 081334095835
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081230200491"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081230200491') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081230200491
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 082122225308"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 082122225308') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 082122225308
                            </option>

                            <option value="handlift.id / - / 081336092292"
                                <?= ($ketarangansumber == 'handlift.id / - / 081336092292') ? 'selected' : '' ?>>
                                handlift.id / - / 081336092292
                            </option>

                            <option value="saranalifting.com / - / 081336402013"
                                <?= ($ketarangansumber == 'saranalifting.com / - / 081336402013') ? 'selected' : '' ?>>
                                saranalifting.com / - / 081336402013
                            </option>

                            <option value="sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813"
                                <?= ($ketarangansumber == 'sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813') ? 'selected' : '' ?>>
                                sumberterangdunia.com / sumberterangdunia@gmail.com / 081259832813
                            </option>

                            <option value="indoputrateknik.com / indputrateknik@gmail.com / 085704664297"
                                <?= ($ketarangansumber == 'indoputrateknik.com / indputrateknik@gmail.com / 085704664297') ? 'selected' : '' ?>>
                                indoputrateknik.com / indputrateknik@gmail.com / 085704664297
                            </option>

                            <option value="primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244"
                                <?= ($ketarangansumber == 'primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244') ? 'selected' : '' ?>>
                                primajayasukses.com / forkliftprimajaya@gmail.com / 087822631244
                            </option>

                            <option value="suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070"
                                <?= ($ketarangansumber == 'suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070') ? 'selected' : '' ?>>
                                suryasinarabadi.com / suryasinarabadi@gmail.com / 085904497070
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224844"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224844') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224844
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081370224880"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081370224880') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081370224880
                            </option>

                            <option value="forkliftnusantara.com / info@forkliftnusantara.com / 081334108072"
                                <?= ($ketarangansumber == 'forkliftnusantara.com / info@forkliftnusantara.com / 081334108072') ? 'selected' : '' ?>>
                                forkliftnusantara.com / info@forkliftnusantara.com / 081334108072
                            </option>

                            <option value="linamitrateknik.com / linamitrateknik@gmail.com / 082338331874"
                                <?= ($ketarangansumber == 'linamitrateknik.com / linamitrateknik@gmail.com / 082338331874') ? 'selected' : '' ?>>
                                linamitrateknik.com / linamitrateknik@gmail.com / 082338331874
                            </option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">kebutuhan</label>
                        <input type="text" id="keperluan" class="form-control" name="keperluane" value="<?= $keperluan ?>" placeholder="Masukkan Keperluan">
                        <div id="keperluanItem" class="list-group"></div>
                    </div>
                    <label class="form-label">Keperluan</label>
                    <div class="mb-3">
                        <select name="kebutuhan" class="form-select">
                            <option value="Penawaran">Penawaran</option>
                            <option value="Tanya Saja">Tanya Saja</option>
                            <option value="Dll">Dll</option>
                        </select>
                    </div>
                    <label class="form-label">Status</label>
                    <div class="mb-3" id="selectStatus">
                        <select name="statuse" id="status" class="form-select">
                            <option value="Penawaran">Penawaran</option>
                            <option value="Hold">Hold</option>
                            <option value="Cancel">Cancel</option>
                            <option value="Closing">Closing (Deal Beli/PO)</option>
                        </select>
                        <input type="date" class="form-control" name="tglhold" id="formTglHold">
                    </div>
                </div>
            </div>
            <button type="submit" class="btn btnfunc" name="tambah">Tambah PIC</button>
            <hr>
        </form>
        <div class="row">
            <table class="table table-hover">
                <thead>
                    <tr style="text-align: center;">
                        <th>No</th>
                        <th>PIC</th>
                        <th>Telp PIC</th>
                        <th>Note PIC</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $no = 1;
                    $query = mysqli_query($konek, "SELECT t.idtelp_custbisman,td.iddtelp_custbisman,c.idcustomer,c.nama_customer,c.bu,c.telp,c.kota,p.nama_pic,p.telp_pic,p.note,t.keperluan,t.sumber,t.ket_sumber FROM telp_custbisman_detail td INNER JOIN picb p ON td.idpic = p.idpic INNER JOIN telp_custbisman t ON td.idtelp_custbisman = t.idtelp_custbisman INNER JOIN customeb c ON t.idcustomer = c.idcustomer WHERE td.idtelp_custbisman = '$idtelp_custbisman'");
                    while ($row = mysqli_fetch_array($query)) {
                    ?>
                        <tr style="text-align: center;">
                            <td><?php echo $no ?></td>
                            <td><?php echo $row['nama_pic'] ?></td>
                            <td><?php echo $row['telp_pic'] ?></td>
                            <td style="text-align: left;"><?= nl2br(htmlspecialchars($row['note'])); ?></td>
                            <td>
                                <a href="function/function-telpbisman.php?hps&idtelp_custbisman=<?php echo $row['idtelp_custbisman'] ?>&iddtelp_custbisman=<?php echo $row['iddtelp_custbisman'] ?>" class="btn btn-sm btn-danger"><i class="bi bi-trash3"></i></a>
                            </td>
                        </tr>
                    <?php
                        $no++;
                    }
                    ?>
                </tbody>
            </table>
        </div>
        <div class="row">
            <a href="telp_custbisman.php" class="btn btn-secondary">Selesai</a>
        </div>
    </div>
    <?php
    $modal = $_GET['modal'] ?? '';
    ?>
    <div class="modal fade" id="ModalTmbTelp" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Tambah Data PIC</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <form action="function/function-telpbisman.php?idtelp_custbisman=<?php echo $idtelp_custbisman ?>" method="post">
                    <div class="modal-body">
                        <label class="form-label">Nama PIC</label>
                        <div class="input-group">
                            <select class="form-select" name="tt" id="tt" style="max-width: 95px;">
                                <option value="Bapak">Bapak</option>
                                <option value="Ibu">Ibu</option>
                            </select>
                            <input type="text" class="form-control idcustomer" autocomplete="off" name="pic" id="idcustomer" value="<?php echo $idcustomer ?>" hidden>
                            <input type="text" class="form-control pic" autocomplete="off" name="pic" id="pice" placeholder="Masukkan Nama PIC">
                        </div>
                        <div id="picList"
                            class="list-group picList w-100"
                            style=" display:none;"></div>
                        <br>
                        <div class="mb-3">
                            <label class="form-label">Telp PIC</label>
                            <input type="text" class="form-control telep" id="telep" autocomplete="off" name="telppic" maxlength="50" placeholder="Masukkan Telp PIC">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Note</label>
                            <textarea class="form-control note" name="note" id="note" style="height: 100px"><?= $note ?></textarea>
                            <!-- <input type="text" class="form-control" name="note" value="<?= $note ?>" placeholder="Masukkan Note"> -->
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn" name="tmbpic" style="background-color: #1E93AB;color: white;">Simpan</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- customer -->
    <script src="asset/js/auto_custb.js"></script>
    <!-- pic -->
    <script src="asset/js/auto_picb.js"></script>
    <!-- wilayah -->
    <script src="asset/js/auto_wilayah.js"></script>
    <!-- keperluan -->
    <script src="asset/js/auto_keperluan.js"></script>

    <?php if ($modal === 'ModalTmbTelp'): ?>
        <script>
            document.addEventListener('DOMContentLoaded', function() {
                const modal = new bootstrap.Modal(
                    document.getElementById('ModalTmbTelp')
                );
                modal.show();
            });
        </script>
    <?php endif; ?>
    <script>
        function toggleChecker() {
            let nilai = document.getElementById('sumber').value;

            let formWebsite = document.getElementById('formWebsite');
            let formEmail = document.getElementById('formEmail');
            let formTelp = document.getElementById('formTelp');
            let formWA = document.getElementById('formWA');
            let selectSum = document.getElementById('selectSum');

            // sembunyikan semua dulu
            formWebsite.style.display = 'none';
            formEmail.style.display = 'none';
            formTelp.style.display = 'none';
            formWA.style.display = 'none';

            // tampilkan sesuai pilihan
            if (nilai == 'Website') {
                formWebsite.style.display = 'block';
                selectSum.style.display = 'flex';
            } else if (nilai == 'Email') {
                formEmail.style.display = 'block';
                selectSum.style.display = 'flex';
            } else if (nilai == 'Telp') {
                formTelp.style.display = 'block';
                selectSum.style.display = 'flex';
            } else if (nilai == 'WA') {
                formWA.style.display = 'block';
                selectSum.style.display = 'flex';
            }
        }

        document.getElementById('sumber').addEventListener('change', toggleChecker);
        document.addEventListener('DOMContentLoaded', toggleChecker);
    </script>
    <script>
        function toggleChecker() {
            let status = document.getElementById('status').value;

            let formtglhold = document.getElementById('formTglHold');
            let selectStatus = document.getElementById('selectStatus');

            // sembunyikan semua dulu
            formtglhold.style.display = 'none';

            // tampilkan sesuai pilihan
            if (status == 'Hold') {
                formtglhold.style.display = 'block';
                selectStatus.style.display = 'flex';
            }
        }

        document.getElementById('status').addEventListener('change', toggleChecker);
        document.addEventListener('DOMContentLoaded', toggleChecker);
    </script>
    <!-- INI FOOTER -->
    <?php
    include "asset/footer.php";
    ?>
</body>

</html>