<?php 
    include 'config.php';     
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

body{
  font-family:'Segoe UI', Roboto, Oxygen, Ubuntu,   Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
}

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

input[type=number], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

label {
  padding: 12px 12px 12px 0;
  display: inline-block;
}

input[type=submit] {
  background-color: #04AA6D;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  float: right;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.containerpartner {
  border-radius: 5px;
  background-color: #ececac;
  padding: 20px;
}

.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 20px;
}

.col-25 {
  float: left;
  width: 25%;
  margin-top: 6px;
}

.col-75 {
  float: left;
  width: 75%;
  margin-top: 6px;
}

/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .col-25, .col-75, input[type=submit] {
    width: 100%;
    margin-top: 0;
  }
}

/* Label Warning*/
.alert {
  padding: 20px;
  background-color: #f44336;
  color: white;
  opacity: 1;
  transition: opacity 0.6s;
  margin-bottom: 15px;
}

.alert.success {background-color: #04AA6D;}
.alert.info {background-color: #2196F3;}
.alert.warning {background-color: #ff9800;}

.closebtn {
  margin-left: 15px;
  color: white;
  font-weight: bold;
  float: right;
  font-size: 22px;
  line-height: 20px;
  cursor: pointer;
  transition: 0.3s;
}

.closebtn:hover {
  color: black;
}

.btn {
  background-color: DodgerBlue;
  border: none;
  color: white;
  padding: 12px 16px;
  font-size: 16px;
  cursor: pointer;
}

/* Darker background on mouse-over */
.btn:hover {
  background-color: RoyalBlue;
}


/* FILE INPUT STYLE */
input[type=file]::file-selector-button {
  margin-right: 20px;
  border: none;
  background: #084cdf;
  padding: 10px 20px;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: background .2s ease-in-out;
}

input[type=file]::file-selector-button:hover {
  background: #0d45a5;
}
</style>
</head>

<?php
    if(isset($_POST["tujuan"])){
        $nama = $_POST["nama"];
        $alamat = $_POST["alamat"];
        $nohp = $_POST["nohp"];

        $nohp = $_POST["nohp"];

        $nama = $_POST["nama"];
        $alamat = $_POST["alamat"];
        $nohp = $_POST["nohp"];
        


        // ambil data file
        $namaFile = $lastname.'.'.$_FILES['berkas']['name'];
        $namaSementara = $_FILES['berkas']['tmp_name'];

        // tentukan lokasi file akan dipindahkan
        $dirUpload = "passport/";

        // pindahkan file
        $terupload = move_uploaded_file($namaSementara, $dirUpload.$namaFile);

        // pengecekan field kosong
        if ($name =='' || $nowa=='' || $usia=='' || $passport=='' || $lastname=='' || $namaSementara==''){
        ?>
            <div class="alert">
                <span class="closebtn">&times;</span>  
                <strong>Gagal!</strong> Data diri Anda belum lengkap.
            </div> 
        <?php } else {
            if ($orang == '2') {
              header("Location: register2.php?name=$name&lastname=$lastname&passport=$passport&email=$email&statuscg=$statuscg&gender=$gender&nowa=$nowa&usia=$usia&gms=$gms&gmslain=$gmslain&nij=$nij&cg=$cg&pelayanan=$pelayanan&hari=$hari&paket=$paket&kamar=$kamar&flightberangkat=$flightberangkat&flightberangkatlain=$flightberangkatlain&flightpulang=$flightpulang&flightpulanglain=$flightpulanglain&catatan=$catatan&namaFile=$namaFile&namaSementara=$namaSementara");
            } else {
              header("Location: konfirmasi.php?orang=single&name=$name&lastname=$lastname&passport=$passport&email=$email&statuscg=$statuscg&gender=$gender&nowa=$nowa&usia=$usia&gms=$gms&gmslain=$gmslain&nij=$nij&cg=$cg&pelayanan=$pelayanan&hari=$hari&paket=$paket&kamar=$kamar&flightberangkat=$flightberangkat&flightberangkatlain=$flightberangkatlain&flightpulang=$flightpulang&flightpulanglain=$flightpulanglain&catatan=$catatan&namaFile=$namaFile&namaSementara=$namaSementara");
            }
             
             
             
            
        }
    }

?>
<body>
<h2>Isikan Detail Pemesan</h2>

<form id="regForm" method="POST" action="order2.php" enctype="multipart/form-data">
  <div class="container">
    <div class="row">
      <div class="col-25">
        <label for="nama">Tanggal dan Jam *</label>
      </div>
      <div class="col-75">
        <input type="datetime-local" id="tanggal" name="tanggal">
      </div>
    </div>
    <div class="row">
      <div class="col-25">
        <label for="alamat">Paste Format Pesanan disini *</label>
      </div>
      <div class="col-75">
        <textarea id="copas" name="copas" placeholder="Paste disini.." style="height:100px"></textarea>
      </div>
    </div>

    

  <div class="row">
        <input name="tujuan" type="hidden" value="USER_COPAS">
        <input type="submit" value="Submit">
  </div>


</form>


</body>
</html>


<script>
        var close = document.getElementsByClassName("closebtn");
        var i;

        for (i = 0; i < close.length; i++) {
            close[i].onclick = function(){
                var div = this.parentElement;
                div.style.opacity = "0";
                setTimeout(function(){ div.style.display = "none"; }, 600);
            }
        }



        function changeTextBox() {
          comp = document.getElementById('gift');
          //alert('masuksini');
          if(comp.value=='Ya') {
            //alert('masuksini');
            document.getElementById('namapenerima').disabled=false;
            document.getElementById('alamatpenerima').disabled=false;
            document.getElementById('nowapenerima').disabled=false;
            document.getElementById('Pesan').disabled=false;
          } else {
            document.getElementById('namapenerima').disabled=true;
            document.getElementById('alamatpenerima').disabled=true;
            document.getElementById('nowapenerima').disabled=true;
            document.getElementById('Pesan').disabled=true;
          }
        }

        function changeTextBoxBerangkat() {
          comp = document.getElementById('lflightberangkat');
          //alert('masuksini');
          if(comp.value=='0') {
            //alert('masuksini');
            document.getElementById('lflightberangkatlain').disabled=false;
          } else {
            document.getElementById('lflightberangkatlain').disabled=true;
          }
        }

        function changeTextBoxPulang() {
          comp = document.getElementById('lflightpulang');
          //alert('masuksini');
          if(comp.value=='0') {
            //alert('masuksini');
            document.getElementById('lflightpulanglain').disabled=false;
          } else {
            document.getElementById('lflightpulanglain').disabled=true;
          }
        }

        function changeTextkamar() {
          comp = document.getElementById('paket');
         // alert('masuksini');
          if(comp.value=='Bintang 4 Single') {
            //alert('masuksinibawah');
            document.getElementById('kamar').disabled=true;
          } else if(comp.value=='Bintang 3 Single') {
            document.getElementById('kamar').disabled=true;
          } else {
            document.getElementById('kamar').disabled=false;
          }
        }

</script>

