<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0"/>
        <meta name="description" content="eOrder Djoedes memudahkan anda memesan makanan di kedai Mie Djoedes">
		<meta name="keywords" content="Eorder Mie Djoedes">

		<title>eOrder Djoedes</title>

		<!-- Fonts -->
		<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,300i" rel="stylesheet">

		<!-- Styles -->
		<link href="https://eorder.solariaresto.co.id/assets/css/core.min.css" rel="stylesheet">
		<link href="https://eorder.solariaresto.co.id/assets/css/app.min.css" rel="stylesheet">
		<link href="https://eorder.solariaresto.co.id/assets/css/style.min.css" rel="stylesheet">

		<!-- Favicons -->
		<link rel="apple-touch-icon" href="https://eorder.solariaresto.co.id/assets/img/apple-touch-icon.png">
		<link rel="icon" type="image/png" href="<?php echo base_url('assets/') ?>/img/logojud.png"/>
		<style type="text/css">
			.hide{
				display: none;
			}
		</style>
		<script type="text/javascript" src="https://eorder.solariaresto.co.id/assets/js/jquery.min.js"></script>
	</head>
	
	<body>
		<div class="row min-h-fullscreen center-vh p-0 m-0">
		
			<div class="col-12 p-0">
  <div class="card card-shadowed px-30 py-50 w-400px mx-auto" style="max-width: 100%">
    <div class="text-center"><img src="http://enambelasapp.my.id/rest/assets/img/logojud.png" style="width: 96px;"></div>
    <h6 class="text-center mt-3 mb-0">Selamat Datang Di Mie Djoedes</h6>
            
          <h4 class="text-center mt-0"><b style="font-weight: bold"><?php echo $toko ?></b></h4>
      <h6 class="text-center mt-1">Pilih Jenis Pesanan</h6>
      <br>
      <form class="form-type-material" method="POST" action="<?php echo base_url().'mobile/member/auth'?>"  id="form-login" data-provide="validation">

        <div class="form-group text-center">
            <div class="btn-group">
              <a id="dinein" class="btn btn-purple text-white"><i class="ti-home"></i> Dine In</a>
              <a id="take"   class="btn btn-light"><i class="ti-bag"></i> Take Away</a>
			  <a id="do" class="btn btn-light"><i class="ti-bag"></i> DO</a>
            </div>
        </div>
        
        <div class="form-group">
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1">&nbsp;<i class="ti-user"></i>&nbsp;</span>
              <div class="input-group-input">
                <input type="text" class="form-control" aria-describedby="basic-addon1" name="username">
                <label>Nama</label>
              </div>
            </div>
        </div>
        <div class="form-group">
          <div class="input-group">
              <span class="input-group-addon" id="basic-addon1">+62</span>
              <div class="input-group-input">
                <input type="text" class="form-control" aria-describedby="basic-addon1" name="userphone" onkeydown="validateNumber(event);">
                <label>No Handphone/Wa</label>
              </div>
            </div>
        </div>
        <div class="form-group mb-1 hide" id="alamat">
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1">&nbsp;<i class="ti-user"></i>&nbsp;</span>
              <div class="input-group-input">
                <input type="text" class="form-control" aria-describedby="basic-addon1" name="alamat">
                <label>Alamat</label>
              </div>
            </div>
        </div>
        <div class="form-group mb-1 hide" id="alamat">
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1">&nbsp;<i class="ti-user"></i>&nbsp;</span>
              <div class="input-group-input">
                <input type="text" class="form-control" aria-describedby="basic-addon1" name="alamat">
                <label>Peta</label>
              </div>
            </div>
        </div>
        <div class="form-group text-center">
          <input type="checkbox" class="checkbox mr-1">Bersedia terima informasi promo Mie Djoedes
          <button type="submit" class="btn btn-bold btn-block btn-purple mt-2">Submit</button>
          <input type="hidden" name="toko" value="<?php echo $kdtoko ?>">
          <input type="hidden" name="order_type" >
        </div>
      </form>
    <!---  
    <div class="divider">Or Sign In With</div>
    <div class="text-center">
      <a class="btn btn-block btn-facebook" href="#"><i class="fa fa-facebook"></i> Facebook</a>
      <a class="btn btn-block btn-google" href="#"><i class="fa fa-google"></i> Google</a>
    </div> -->
  </div>
</div>
<script type="text/javascript">
  function validateNumber(evt) {
    var theEvent = evt || window.event;

    // Handle paste
    if (theEvent.type === 'paste') {
      key = event.clipboardData.getData('text/plain');
    } else {
    // Handle key press
      var key = theEvent.keyCode || theEvent.which;
      key = String.fromCharCode(key);
    }
    var regex = /[0-9]|\./;
    if(!((theEvent.keyCode == 65 || theEvent.keyCode == 86 || theEvent.keyCode == 67) && (theEvent.ctrlKey === true || theEvent.metaKey === true))
      && theEvent.keyCode !== 8 
      && theEvent.keyCode !== 46 
      && (!regex.test(key) || (theEvent.target.value.length == 0 && theEvent.which == 48))) {
      theEvent.returnValue = false;
      if(theEvent.preventDefault) theEvent.preventDefault();
    }
  }

  $(document).ready(function(){
    /*$('[name=userphone]').focus();*/
    $('#dinein').click(function(){
      $('[name=username]').focus();
      $('[name=userphone]').blur();
      $('[name=username]').attr('required', 'required');
      $('[name=userphone]').attr('required', 'required');
      $('#dinein').addClass('btn-purple');
      $('#dinein').addClass('text-white');
      $('#take').removeClass('btn-purple');
      $('#take').removeClass('text-white');
      $('#do').removeClass('btn-purple');
      $('#do').removeClass('text-white');
      $('[name=order_type]').val('1');
    });
    $('#take').click(function(){
      $('[name=username]').focus();
      $('[name=userphone]').blur();
      $('[name=username]').attr('required', 'required');
      $('[name=userphone]').attr('required', 'required');
      $('#dinein').removeClass('btn-purple');
      $('#dinein').removeClass('text-white');
      $('#take').addClass('btn-purple');
      $('#take').addClass('text-white');
      $('#do').removeClass('btn-purple');
      $('#do').removeClass('text-white');
      $('[name=order_type]').val('2');
    });    
     $('#do').click(function(){
      $('[name=username]').focus();
      $('[name=userphone]').blur();
      $('[name=alamat]').blur();
      $('[name=userphone]').attr('required', 'required');
      $('[name=username]').attr('required', 'required');
      $('[name=alamat]').attr('required', 'required');
      $('#dinein').removeClass('btn-purple');
      $('#dinein').removeClass('text-white');
      $('#take').removeClass('btn-purple');
      $('#take').removeClass('text-white');
      $('#do').addClass('btn-purple');
      $('#do').addClass('text-white');
      $('[name=order_type]').val('3');
    });  

    $('#form-login').submit(function(e){
      // if ($('#form-login [name="userphone"]').val() == '' && localStorage.getItem('solaria_anonim_user') != null){
      //   $('#form-login').append('<input type="hidden" name="userphone_anonim" value="'+localStorage.getItem('solaria_anonim_user')+'">');
      // }
      if (
        $('[name=order_type]').val() == '1' 
        && $('#form-login [name="username"]').val() != '' 
        && $('#form-login [name="userphone"]').val() != '' 
        && localStorage.getItem('solaria_anonim_user') != null
      ){
        $('#form-login [name="username"]').closest('.form-group').remove();
        $('#form-login').append('<input type="hidden" name="userphone" value="'+localStorage.getItem('solaria_anonim_user')+'">');
      }else if (
        $('[name=order_type]').val() == '2' 
        && $('#form-login [name="username"]').val() != '' 
        && $('#form-login [name="userphone"]').val() != '' 
        && localStorage.getItem('solaria_anonim_user') != null
      ){
        $('#form-login [name="userphone"]').closest('.form-group').remove();
        $('#form-login').append('<input type="hidden" name="userphone" value="'+localStorage.getItem('solaria_anonim_user')+'">');
      }
    }else if (
        $('[name=order_type]').val() == '3' 
        && $('#form-login [name="username"]').val() != '' 
        && $('#form-login [name="userphone"]').val() != '' 
        && $('#form-login [name="alamat"]').val() != '' 
        && $('#form-login [name="lokasi"]').val() != '' 
        && localStorage.getItem('solaria_anonim_user') != null
      ){
        $('#form-login [name="userphone"]').closest('.form-group').remove();
        $('#form-login').append('<input type="hidden" name="userphone" value="'+localStorage.getItem('solaria_anonim_user')+'">');
      }
      return true;
    });
  });
</script>		
			<footer class="col-12 align-self-end text-center fs-13">
        <p class="mb-0"><small>Copyright © 2020 <a href="#">Mandiri</a>. All rights reserved.</small></p>
      </footer>
    </div>
    <!-- Scripts -->
    <script src="https://eorder.solariaresto.co.id/assets/js/core.min.js"></script>
    <script src="https://eorder.solariaresto.co.id/assets/js/app.min.js"></script>
    <script src="https://eorder.solariaresto.co.id/assets/js/script.min.js"></script>
    <script type="text/javascript">
      $("#take").click(function(){
          $("#username").removeClass('hide');
          $("#alamat").addClass('hide');
      });
      $("#dinein").click(function(){
          $("#username").removeClass('hide');
          $("#alamat").addClass('hide');
          
      });
      $("#do").click(function(){
          $("#alamat").removeClass('hide');
      });
    </script>
  </body>
</html>