<?php include 'includes/header.php';?>

<?php 
if(!$_SESSION['user']){ 
    header("location:index.php");
}

?>
<title><?php echo $dil['055'];?></title>
<meta name="description" content="Müşteri Paneli">
<meta name="keywords" content="müşteri paneli,">
<meta name="author" content="ParsTech">
<body class="mobile_panel black_theme">




    <?php

    if(isset($_POST['adresekle'])){
        $baslik =$_POST['baslik'];
        $sehir =$_POST['sehir'];
        $ilce =$_POST['ilce'];
        $mah =$_POST['mah'];
        $adres =$_POST['adres'];


        $satir = [
            'uye' => $_SESSION['user']->id,
            'sehir' => $sehir,
            'ilce' => $ilce,
            'mah' => $mah,
            'baslik' => $baslik,
            'adress' => $adres,
        ];

        $ksorgu     =   $dbh->prepare("SELECT * FROM users_adress WHERE uye=? && baslik=? && mah=? && adress=?");
        $ksorgu     ->  execute(array($_SESSION['user']->id,$baslik,$mah,$adres));
        $kbilgi     =   $ksorgu     ->fetch(PDO::FETCH_OBJ);
        if(!$kbilgi){
            $sql = "INSERT INTO users_adress SET uye=:uye ,baslik=:baslik, sehir=:sehir, ilce=:ilce , mah=:mah ,adress=:adress;";
            $durum = $dbh->prepare($sql)->execute($satir);
            echo "<script>
            const Toast = Swal.mixin({
              toast: true,
              position: 'top-end',
              showConfirmButton: false,
              timer: 6000,
              timerProgressBar: true,
              didOpen: (toast) => {
                toast.addEventListener('mouseenter', Swal.stopTimer)
                toast.addEventListener('mouseleave', Swal.resumeTimer)
            }
            })

            Toast.fire({
                icon: 'success',
                title: 'Başarı ile kayıt edildi.'
                })
                </script>";

            }else{
             echo "<script>
             const Toast = Swal.mixin({
              toast: true,
              position: 'top-end',
              showConfirmButton: false,
              timer: 6000,
              timerProgressBar: true,
              didOpen: (toast) => {
                toast.addEventListener('mouseenter', Swal.stopTimer)
                toast.addEventListener('mouseleave', Swal.resumeTimer)
            }
            })

            Toast.fire({
                icon: 'error',
                title: 'Adres Bulunmakta.'
                })
                </script>";

            }
        }

        if($_SESSION['okey']==1){
          echo "<script>
          const Toast = Swal.mixin({
              toast: true,
              position: 'top-end',
              showConfirmButton: false,
              timer: 6000,
              timerProgressBar: true,
              didOpen: (toast) => {
                toast.addEventListener('mouseenter', Swal.stopTimer)
                toast.addEventListener('mouseleave', Swal.resumeTimer)
            }
            })

            Toast.fire({
                icon: 'success',
                title: 'İşlem Başarılı.'
                })
                </script>";
            }

            unset($_SESSION['okey']);


            $adresler      =   $dbh->prepare("SELECT * FROM users_adress WHERE uye=?  order by id desc");
            $adresler      ->  execute(array($_SESSION['user']->id));
            $adresler      =   $adresler      ->fetchAll(PDO::FETCH_OBJ);
            foreach ($adresler as $adres) {


            }
            ?>
            <!-- Sepet_Urunler_Wrapper -->
            <div class="cart_product_wrapper">
                <div class="container">
                    <div class="cart_product_list flex justify-start items-start text-center flex-col pt-8"> 
                        <div class="text-left w-full standart_label about_text">

                           <div class="row">
                            <div class="col-lg-12">

                                <div class="card">
                                    <div class="card-header">
                                        <h4 class="card-title"><?php echo $dil['055'];?></h4>
                                        <p class="text-muted mb-0"><?php echo $dil['056'];?> <?=$_SESSION['user']->name;?></p>
                                    </div><!--end card-header-->
                                    <div class="card-body">
                                        <div class="col-lg-12 urun_tabs">
                                            <!-- Nav tabs -->
                                            <ul class="nav nav-pills nav-justified" role="tablist">
                                                <li class="nav-item waves-effect waves-light">
                                                    <a class="nav-link active" data-toggle="tab" href="#home-1" role="tab" aria-selected="true"><?php echo $dil['057'];?></a>
                                                </li>
                                                <li class="nav-item waves-effect waves-light">
                                                    <a class="nav-link" data-toggle="tab" href="#profile-1" role="tab" aria-selected="false"><?php echo $dil['058'];?></a>
                                                </li>
                                                <li class="nav-item waves-effect waves-light">
                                                    <a class="nav-link" data-toggle="tab" href="#adres" role="tab" aria-selected="false"><?php echo $dil['127'];?></a>
                                                </li>
                                                <li class="nav-item waves-effect waves-light">
                                                    <a class="nav-link" data-toggle="tab" href="#settings-1" role="tab" aria-selected="false"><?php echo $dil['059'];?></a>
                                                </li>
                                            </ul>
                                            <!-- Tab panes -->
                                            <div class="tab-content">
                                                <div class="tab-pane p-3 active" id="home-1" role="tabpanel">
                                                    <form class="cmxform" id="ContactForm" method="post" action="post/user.php"  data-xhr="true">

                                                        <div class="cart_product_list flex justify-start items-start text-center flex-col pt-8">

                                                            <div class="product_detail_title "><?php echo $dil['057'];?></div>
                                                            <div class="form-group flex flex-col justify-start w-full mb-4">
                                                                <label class="text-left mb-1 font-semibold standart_label" for="adisoyadi"><?php echo $dil['026'];?> *</label>
                                                                <input type="text" name="adisoyadi" placeholder="<?php echo $dil['026'];?>" id="adisoyadi" value="<?=$_SESSION['user']->name;?>" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                                            </div>
                                                            <div class="form-group flex flex-col justify-start w-full">
                                                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['031'];?> *</label>
                                                                <input type="email" name="mail" placeholder="<?php echo $dil['031'];?>" id="email" value="<?=$_SESSION['user']->mail;?>" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                                            </div>
                                                            <div class="form-group flex flex-col justify-start w-full">
                                                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['040'];?> *</label>
                                                                <input type="number" name="telefon" placeholder="<?php echo $dil['040'];?>" id="phone" value="<?=$_SESSION['user']->phone;?>" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                                            </div>

                                                            <div class="form-group flex flex-col justify-start w-full">
                                                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['032'];?> </label>
                                                                <input type="password" name="password" placeholder="<?php echo $dil['032'];?>" id="password" value="" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" >
                                                            </div>

                                                            <div class="form-group flex flex-col justify-start w-full">
                                                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['051'];?> </label>
                                                                <input type="password" name="password2" placeholder="<?php echo $dil['051'];?>" id="password" value="" class="form_input required w-full text-sm py-2  pl-2 rounded-lg">
                                                            </div>



                                                            <input type="hidden" name="update">
                                                            <div class="flex flex-row justify-between items-center w-full mb-0">
                                                                <button  type="submit"  class=" btn btn-lg btn-default default-shadow btn-block">

                                                                    <div class="spinner-border" style="    width: 1rem;
                                                                    height: 1rem;display: none" id="yukleniyor" role="status">
                                                                    <span class="sr-only"><?php echo $dil['033'];?>...</span>
                                                                </div>
                                                                <?php echo $dil['060'];?> <span class="ml-2 icon arrow_right"></span></button>
                                                            </div>
                                                            <label class="text-center standart_label  mb-1 font-normal w-100 mt-4 mb-4" ><?php echo $dil['061'];?></label>

                                                        </div>
                                                    </form>

                                                </div>
                                                <div class="tab-pane p-3" id="profile-1" role="tabpanel">
                                                    <div class="table-rep-plugin">
                                                        <div class="table-responsive mb-0" data-pattern="priority-columns">
                                                            <table id="tech-companies-1" class="table table-striped mb-0">
                                                                <thead>
                                                                    <tr>
                                                                        <th><?php echo $dil['178'];?></th>
                                                                        <th data-priority="1"><?php echo $dil['179'];?></th>
                                                                        <th data-priority="6"><?php echo $dil['065'];?></th>
                                                                        <th data-priority="6"><?php echo $dil['066'];?></th>
                                                                        <th data-priority="6"><?php echo $dil['180'];?></th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                    <?php

                                                                    $sipler      =   $dbh->prepare("SELECT * FROM product_orders WHERE uye=?  order by siparis_id desc");
                                                                    $sipler      ->  execute(array($_SESSION['user']->id));
                                                                    $sipler      =   $sipler      ->fetchAll(PDO::FETCH_OBJ);
                                                                    foreach ($sipler as $sip) { 

                                                                        $id=$sip->siparis_id;
                                                                        ?>
                                                                        <tr>
                                                                            <th> <span class="co-name">#<?=$sip->siparis_id?></span></th>
                                                                            <td><?=$sip->adi_soyadi?></td>

                                                                            <td><?=$sip->amount?> TL</td>
                                                                            <td>
                                                                                <?php $durum=$sip->durum;
                                                                                if ($durum == 0) {
                                                                                    echo $dil["128"];  
                                                                                }else if($durum == 1){
                                                                                 echo $dil["129"];  
                                                                             }else if($durum == 2){
                                                                              echo $dil["130"];  
                                                                          }else if($durum == 3){
                                                                             echo $dil["131"];  
                                                                         }

                                                                         ?>


                                                                     </td>
                                                                     <td>
                                                                        <button class=""   data-toggle="modal" data-target="#sipdetay<?=$id;?>" ><?php echo $dil['181'];?></button>
                                                                    </td>
                                                                </tr>




                                                            <?php }
                                                            if(count($sipler)==0){echo "<tr><td colspan='7' ><center>Sipariş Bulunmamakta</center></td></tr>";}
                                                            ?>

                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>






                                        <div class="tab-pane p-3" id="adres" role="tabpanel">
                                            <a class="nav-link" data-toggle="tab" href="#adres-ekle" role="tab" aria-selected="false"><center><?php echo $dil['132'];?></center></a>

                                            <div class="table-rep-plugin">
                                                <div class="table-responsive mb-0" data-pattern="priority-columns">
                                                    <table id="tech-companies-1" class="table table-striped mb-0">
                                                        <thead>
                                                            <tr>
                                                                <th data-priority="3"><?php echo $dil['174'];?></th>
                                                                <th data-priority="3"><?php echo $dil['169'];?></th>
                                                                <th data-priority="3"><?php echo $dil['171'];?></th>
                                                                <th data-priority="3"><?php echo $dil['133'];?></th>
                                                                <th data-priority="1"><?php echo $dil['134'];?></th>
                                                                <th data-priority="6"><?php echo $dil['135'];?></th>
                                                                <th data-priority="6"><?php echo $dil['136'];?></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php

                                                            $adresler      =   $dbh->prepare("SELECT * FROM users_adress WHERE uye=?  order by id desc");
                                                            $adresler      ->  execute(array($_SESSION['user']->id));
                                                            $adresler      =   $adresler      ->fetchAll(PDO::FETCH_OBJ);
                                                            foreach ($adresler as $adres) {
                                                                $id=$adres->id;
                                                                $mah      =   $dbh->prepare("SELECT * FROM mahalle WHERE mahalle_key=? ");
                                                                $mah      ->  execute(array($adres->mah));
                                                                $mah      =   $mah      ->fetch(PDO::FETCH_OBJ);

                                                                $sehir      =   $dbh->prepare("SELECT * FROM sehir WHERE sehir_key=? ");
                                                                $sehir      ->  execute(array($adres->sehir));
                                                                $sehir      =   $sehir      ->fetch(PDO::FETCH_OBJ);

                                                                $ilce      =   $dbh->prepare("SELECT * FROM ilce WHERE ilce_key=? ");
                                                                $ilce      ->  execute(array($adres->ilce));
                                                                $ilce      =   $ilce      ->fetch(PDO::FETCH_OBJ);




                                                                ?>
                                                                <tr>
                                                                    <td><?=$adres->baslik?></td>
                                                                    <td><?=$sehir->sehir_title?></td>
                                                                    <td><?=$ilce->ilce_title?></td>
                                                                    <td><?=$mah->mahalle_title?></td>
                                                                    <td><?=$adres->adress?></td>
                                                                    <td><?=$adres->tarih?></td>
                                                                    <td>
                                                                        <button class=""  data-toggle="modal" data-target="#sil<?=$id;?>" ><?php echo $dil['137'];?></button>
                                                                        <button class=""   data-toggle="modal" data-target="#duzenle<?=$id;?>" ><?php echo $dil['138'];?></button>
                                                                    </td>

                                                                </tr>


                                                            <?php }
                                                            if(count($adresler)==0){echo "<tr><td colspan='7' ><center>Adres Bulunmamakta</center></td></tr>";}
                                                            ?>

                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>






                                        <div class="tab-pane p-3" id="adres-ekle" role="tabpanel">
                                         <form class="cmxform" id="ContactForm" method="post" action="" >


                                            <div class="cart_product_list flex justify-start items-start text-center flex-col pt-8">

                                                <div class="product_detail_title "><?php echo $dil['132'];?></div>


                                                <div class="form-group flex flex-col justify-start w-full">
                                                    <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['175'];?> </label>
                                                    <input type="text" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" name="baslik">
                                                </div>

                                                <div class="form-group flex flex-col justify-start w-full">
                                                    <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['169'];?>*</label>

                                                    <select name="sehir"  id="slct" onchange="ilcegetir(this)" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                                      <option value=""><?php echo $dil['170'];?></option>

                                                      <?php 

                                                      $sehirler = $dbh -> prepare("SELECT * FROM sehir where aktif=1 order by sehir_title");
                                                      $sehirler-> execute(array());
                                                      $sehirler = $sehirler->fetchAll(PDO::FETCH_OBJ);
                                                      foreach ($sehirler as $sehir) { ?>
                                                        <option value="<?=$sehir->sehir_key?>"><?=$sehir->sehir_title?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>

                                            <div class="form-group flex flex-col justify-start w-full">
                                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['171'];?>*</label>

                                                <select name="ilce"  id="slctilce"  onchange="mahallegetir(this)"  class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                                  <option value=""><?php echo $dil['172'];?></option>
                                              </select>
                                          </div>

                                          <div class="form-group flex flex-col justify-start w-full">
                                            <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['096'];?>*</label>

                                            <select name="mah"  id="slctmahalle" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
                                              <option value=""><?php echo $dil['173'];?></option>

                                          </select>
                                      </div>



                                      <div class="form-group flex flex-col justify-start w-full">
                                        <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['134'];?> </label>
                                        <textarea class="form_input required w-full text-sm py-2  pl-2 rounded-lg" name="adres" required=""></textarea>
                                    </div>




                                    <div class="flex flex-row justify-between items-center w-full mb-0">
                                        <button  type="submit" name="adresekle" class=" btn btn-lg btn-default default-shadow btn-block">

                                         <?php echo $dil["151"];?> <span class="ml-2 icon arrow_right"></span></button>
                                     </div>
                                     <label class="text-center standart_label  mb-1 font-normal w-100 mt-4 mb-4" ><?php echo $dil['061'];?></label>

                                 </div>
                             </form>
                         </div>



                         <div class="tab-pane p-3" id="settings-1" role="tabpanel">
                            <p class="text-muted mb-0">
                                <a href="cikis.php"><?php echo $dil['068'];?></a>
                            </p>
                        </div>
                    </div>
                </div><!-- tabs end -->
            </div><!--end card-body-->
        </div><!--end card-->
    </div><!--end col-->
</div><!--end row-->
</div>
<a href="bize-ulasin" class="bg-white border text-black w-full btn btn-secondary text-center">
    <span><?php echo $dil['015'];?></span>
</a>

</div>

</div>
</div>

<?php include 'includes/modal.php';?>

<?php include 'includes/footer.php';?>



<?php 



foreach ($sipler as $sip) { 

    $id=$sip->siparis_id;
    ?>



    <div class="modal fade" id="sipdetay<?=$id;?>" tabindex="-1" role="dialog" aria-labelledby="sipdetay<?=$id;?>" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-danger">
                    <h6 class="modal-title m-0 text-white" id="exampleModalDanger<?=$id;?>"><?=$adress;?></h6>
                    <button type="button" class="close " data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true"><i class="la la-times text-white"></i></span>
                    </button>
                </div><!--end modal-header-->
                <div class="modal-body">


                    <b><?php echo $dil['040'];?>:</b> <?=$sip->telefon?><br><br>

                    <b><?php echo $dil['031'];?>:</b> <?=$sip->mail?><br><br>

                    <b><?php echo $dil['063'];?>: </b><?=$sip->adres?><br><br>

                    <?php echo $dil['064'];?>:

                    


                    <?php
                    $_SESSION['sepete'] =json_decode($sip->sip);
                    $toplam2 =0;
                    foreach ($_SESSION['sepete']  as $siparis => $siparisdetay) {
                        $array=$siparisdetay;
                        $urun_getir = $dbh -> prepare("SELECT * FROM product WHERE id = ?");
                        $urun_getir-> execute(array($siparisdetay->urunid));
                        $urun = $urun_getir->fetch(PDO::FETCH_ASSOC);
                        $fiyat = $urun["product_price"];

                        $ekstraistek=0;
                        $porsyon="";
                        $pfiyat=0;
                        if($siparisdetay->menu_porsiyon>0){
                            $porsyon = $dbh -> prepare("SELECT * FROM product_portion WHERE id = ?");
                            $porsyon-> execute(array($siparisdetay->menu_porsiyon));
                            $porsyon = $porsyon->fetch(PDO::FETCH_ASSOC);
                            $key= array_search($siparisdetay->menu_porsiyon,json_decode($urun['product_portion']) );
                            $porsiyonfler=json_decode($urun['product_portion_price']) ;
                            $pfiyat= $porsiyonfler[$key];
                        }
                        if($siparisdetay->ekstra){
                            $ekstralara=" ";
                            $eksftop=0;
                            foreach ($siparisdetay->ekstra as $eks) {
                                $ekstrad = $dbh -> prepare("SELECT * FROM selectable WHERE id = ?");
                                $ekstrad-> execute(array($eks));
                                $ekstrad = $ekstrad->fetch(PDO::FETCH_ASSOC);
                                $key= array_search($eks,json_decode($urun['product_optionek']) );
                                $ekstrafiyat=json_decode($urun['product_optionek_price']) ;
                                $ekfiyat= $ekstrafiyat[$key];
                                $eksftop+=$ekfiyat;

                                if($ekfiyat>0){
                                    $ekstralara.= $ekstrad['option']." ".$ekfiyat." TL + ";
                                }else{
                                    $ekstralara.= $ekstrad['option']." + ";
                                }
                            }
                            $ekstralara=rtrim($ekstralara," + " );
                        }

                        $toplam = ($fiyat + $pfiyat +  $eksftop)*$array->qty;
                        $urun = cevir("menu",$urun,$_SESSION["dil"]);
                        $toplam2 += $toplam;

                        $porsyon = cevir("porsiyon_secenekleri",$porsyon,$_SESSION["dil"]);
                        ?>

                        <div class="alert alert-outline-primary" role="alert">
                            <strong><b><?=$urun['product_name']?> (<?=$fiyat?> TL)</strong> ;</b><br><br>
                            <li><?=$array->qty?> Adet</li>
                            <li><b>Porsiyon Seçimi:</b> <?php echo   $porsyon['portion'] ." + " .$pfiyat . "TL";?></li>
                            <li><b>Ekstra Seçim:</b> <?php echo " +".$ekstralara."  " ;?> </li> 
                            <li><b>Müşteri Açıklaması:</b> <?php echo $array->icerik;?> </li>   
                            <li><b>Toplam Tutar:<?=$toplam." TL";?></b></li>                     
                        </div>

                    <?php } ?>
                    <ul class="list-group list-group-flush">
                        <li class="list-group-item"><i class="la la-angle-double-right  mr-2"></i><b>Toplam Tutar:</b> <?=$toplam2 ?> TL</li>


                        <li class="list-group-item"><i class="la la-angle-double-right text-info mr-2"></i><b>İndirim Kuponu:</b>   <?php 

                        $kodkontrol = $dbh -> prepare("SELECT * FROM coupon WHERE coupon_code = ?");
                        $kodkontrol-> execute(array($sip->coupon));
                        $kodkontrol = $kodkontrol->fetch(PDO::FETCH_OBJ);

                        if($sip->coupon){
                            echo "".$kodkontrol->discount_amount."TL"; 
                        } ?> 
                    </li>


                    <li class="list-group-item"><i class="la la-angle-double-right text-info mr-2"></i><b>Genel Toplam:</b> <?=$toplam2 -$kodkontrol->discount_amount?> TL</li>


                </ul>

            </div><!--end modal-body-->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal"><?php echo $dil['140'];?></button>
            </div><!--end modal-footer-->
        </div><!--end modal-content-->
    </div><!--end modal-dialog-->
</div><!--end modal-->
<?php } ?>










<?php
$adresler      =   $dbh->prepare("SELECT * FROM users_adress WHERE uye=?  order by id desc");
$adresler      ->  execute(array($_SESSION['user']->id));
$adresler      =   $adresler      ->fetchAll(PDO::FETCH_OBJ);
foreach ($adresler as $adres) {
    $id=$adres->id;
    $mah      =   $dbh->prepare("SELECT * FROM adresler WHERE id=? ");
    $mah      ->  execute(array($adres->mah));
    $mah      =   $mah      ->fetch(PDO::FETCH_OBJ);

    ?>

    <div class="modal fade" id="duzenle<?=$id;?>" tabindex="-1" role="dialog" aria-labelledby="duzenle<?=$id;?>" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form action="post/adres.php" method="post">
                    <div class="modal-header bg-danger">
                        <h6 class="modal-title m-0 text-white" id="exampleModalDanger<?=$id;?>"><?=$adress;?></h6>
                        <button type="button" class="close " data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="la la-times text-white"></i></span>
                        </button>
                    </div><!--end modal-header-->
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12">
                             <div class="form-group flex flex-col justify-start w-full">
                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['175'];?> </label>
                                <input class="form_input required w-full text-sm py-2  pl-2 rounded-lg" name="adres_baslik" required="" value="<?=$adres->baslik?>">
                            </div>



                            <div class="form-group flex flex-col justify-start w-full">
                                <label class=" text-left mb-1 font-semibold standart_label" for="telefon"><?php echo $dil['134'];?> </label>
                                <textarea class="form_input required w-full text-sm py-2  pl-2 rounded-lg" name="adres" required=""><?=$adres->adress?></textarea>
                                <input type="hidden" name="id" value="<?=$id?>">
                            </div>
                        </div><!--end col-->
                    </div><!--end row-->
                </div><!--end modal-body-->
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal"><?php echo $dil['140'];?></button>
                    <button type="submit" name="duzenle" class="btn btn-danger btn-sm"><?php echo $dil['138'];?></button>
                </div><!--end modal-footer-->
            </form>
        </div><!--end modal-content-->
    </div><!--end modal-dialog-->
</div><!--end modal-->


<!-- silme başlangıçı -->

<div class="modal fade" id="sil<?=$id;?>" tabindex="-1" role="dialog" aria-labelledby="sil<?=$id;?>" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header bg-danger">
                <h6 class="modal-title m-0 text-white" id="exampleModalDanger<?=$id;?>"><?=$adress;?></h6>
                <button type="button" class="close " data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true"><i class="la la-times text-white"></i></span>
                </button>
            </div><!--end modal-header-->
            <div class="modal-body">
                <div class="row">
                    <div class="col-lg-12">
                        <h5><?php echo $dil['141'];?></h5>
                        <ul class="mt-3 mb-0">
                            <li><?php echo $dil['142'];?></li>
                        </ul>
                    </div><!--end col-->
                </div><!--end row-->
            </div><!--end modal-body-->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal"><?php echo $dil['140'];?></button>
                <a href="post/adres.php?id=<?=$id; ?>&islem=adres-sil"><button type="button" class="btn btn-danger btn-sm"><?php echo $dil['143'];?></button></a>
            </div><!--end modal-footer-->
        </div><!--end modal-content-->
    </div><!--end modal-dialog-->
</div><!--end modal-->



<?php
}
?>
<script type="text/javascript">




    function ilcegetir(selectObject) {
      var value = selectObject.value;

      $.ajax({
        url:"post/adresislem.php",
        data    :'tur=ilcegetir&id='+value,
        type    : 'POST',
        success : function(sonuc){
            $('#slctilce').html(sonuc); 

        }
    });

  }

  function mahallegetir(selectObject) {
      var value = selectObject.value;

      $.ajax({
        url:"post/adresislem.php",
        data    :'tur=mahallegetir&id='+value,
        type    : 'POST',
        success : function(sonuc){
            $('#slctmahalle').html(sonuc); 

        }
    });

  }
</script>