<?php
require_once "../magic/session_config.php";
bdr_start_session();
ob_start();
$father = $_SESSION["user_id"];
$branch = $_SESSION["branch"];
if(!isset($_SESSION["user_id"])){ header("location:logout.php");}
$cust_dd = 9231 ;// $_REQUEST['A'];
$idSA    = 1035949666 ;//$_REQUEST['SA'];
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>صورة هوية و رخصة</title>
    <link href="../dist/css/dropzone.css" rel="stylesheet"/>
    <style>
        .container{
          position: relative;
          width: 800px;
          margin: 50px auto;
          /* height: 700px; */
        }
        .dropzone{
          border: 3px dashed lightcoral;
          font-weight: 700;
        }
    </style>
</head>
<body>

    <div class="container">
      <form action="upload.php" class="dropzone" id="dropzoneFrom">
        <div class="fallback">
          <input type="file" name="file"  multiple/>
        </div>
        <input type="hidden" id="cust_dd" name="cust_dd" value="<?php echo $cust_dd;?>" />
        <input type="hidden" id="photo_idSA" name="photo_idSA" value="<?php echo $idSA ; ?>" />
      </form>
    </div>
   <div align="center">
    <button type="button" class="btn btn-info" id="submit-all">Upload</button>
   </div>
   <div id="preview"></div>
   <br />
   <br />
  </div>
    <script src="../dist/js/jquery.min.js"></script>
    <script src="../dist/js/dropzone.js"></script>
</body>
</html>
<script>
  $(document).ready(function(){
    // Dropzone.options.dropzoneFrom = false;
    // Dropzone.autoDiscover = false;
      Dropzone.options.dropzoneFrom = {
          autoProcessQueue: false,
          acceptedFiles:".png,.jpg,.jpeg",
          maxFilesize:1,
          maxFiles:1,

  init: function(){
          var submitButton = document.querySelector('#submit-all');
          myDropzone = this;
          submitButton.addEventListener("click", function(){
            myDropzone.processQueue();
          });
   this.on("complete", function(){
    if(this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0)
    {
     var _this = this;
     _this.removeAllFiles();
    }
    // list_image();
   });
  },
 };

});
</script>
