ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/bharath/uploads/staff_documents/naac/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/bharath/uploads/staff_documents/naac/create_job.php

 <?php include'header.php' ;
 $office_id=$_SESSION['office']['id'];
$date = date('d/m/Y h:i:s a', time());
 ?>

<?php
if(isset($_POST['create_job'])) {
    
    
if($_POST['cutting_unit_id']=='')
{
    echo"<script>alert('Please Select Cuttiing Unit');window.location = 'create_job.php';</script>";
}
    
    //   Uploading Picture 1
           $path = $_FILES['picture1']['name'];
        if($path!=''){
            $uniquesavename=time().uniqid(rand());
		    $path_tmp = $_FILES['picture1']['tmp_name'];  
            $ext = pathinfo( $path, PATHINFO_EXTENSION );
		    $file_name = basename( $path, '.' . $ext );
		    $final_name = 'photo-'.$uniquesavename.'.'.$ext;
		    move_uploaded_file( $path_tmp, 'images/create_job/'.$final_name );
             }else
           {
               $final_name='';
           }
           
           //   Uploading Picture 2
           $path = $_FILES['picture2']['name'];
        if($path!=''){
            $uniquesavename=time().uniqid(rand());
		    $path_tmp = $_FILES['picture2']['tmp_name'];  
            $ext = pathinfo( $path, PATHINFO_EXTENSION );
		    $file_name = basename( $path, '.' . $ext );
		    $final_name1 = 'photo-'.$uniquesavename.'.'.$ext;
		    move_uploaded_file( $path_tmp, 'images/create_job/'.$final_name1 );
             }else
           {
               $final_name1='';
           }
           
            //   Uploading Picture 3
           $path = $_FILES['picture3']['name'];
        if($path!=''){
            $uniquesavename=time().uniqid(rand());
		    $path_tmp = $_FILES['picture3']['tmp_name'];  
            $ext = pathinfo( $path, PATHINFO_EXTENSION );
		    $file_name = basename( $path, '.' . $ext );
		    $final_name2 = 'photo-'.$uniquesavename.'.'.$ext;
		    move_uploaded_file( $path_tmp, 'images/create_job/'.$final_name2 );
             }else
           {
               $final_name2 ='';
           }

		$statement = $pdo->prepare("INSERT INTO booking(
										cutting_unit_id,
										tracking_status,
										of_cloth_type,
										of_model,
										of_size,
										of_total_meters,
										of_nop,
										of_trans_mode,
										of_delivery_to,
										of_notes,
										of_photo1,
										of_photo2,
										of_photo3,
										working_type,
										office_id,
										created_at
									) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		$result=$statement->execute(array(
										$_POST['cutting_unit_id'],
										'job_in_process',
										$_POST['cloth_type'],
										$_POST['model_type'],
										$_POST['size'],
										$_POST['of_total_meters'],
										$_POST['pieces'],
										$_POST['transport_mode'],
										$_POST['delivery_to'],
										$_POST['notes'],
										$final_name,
										$final_name1,
										$final_name2,
										'office',
										$office_id,
										$date	
									));
            if($result)
            {
               // select inserted id value in booking
              $statement1 = $pdo->prepare("SELECT id FROM booking WHERE of_photo1='$final_name' AND office_id='$office_id'");
              $statement1->execute();
              $result1 = $statement1->fetchAll(PDO::FETCH_ASSOC);
              foreach($result1 as $row1)
              {
                  $book_id=$row1['id'];
              }
              $total_count = $statement1->rowCount();
             
                
             	$statement = $pdo->prepare("INSERT INTO tracking_office_job(of_booking_id,of_user_id) VALUES (?,?)");
		$final=$statement->execute(array(
										$book_id,
										$office_id
									));
                
            }
            if($final)
            {
                echo"<script>alert('Job has been created successfully');</script>";
            }
            else
            {
                echo"<script>alert('Failed To created');</script>";
            }
    }
    ?>

    
    <?php include'sidebar.php' ?>
    
    <?php include'footer.php' ?>
    
<script>
$(document).ready(function(){
    $('#cloth_type').on('change', function(){
        var cloth_ID = $(this).val();
        if(cloth_ID){
            $.ajax({
                type:'POST',
                url:'get_models_type.php',
                data:'cloth_id='+cloth_ID,
                success:function(html){
                    $('#model_type').html(html);
                }
            }); 
        }else{
            $('#model_type').html('<option value="">Select Branch first</option>');
        }
    });
});
</script>
<!--<script>-->
<!--$(document).ready(function(){-->
<!--    $('#cutting').on('change', function(){-->
<!--        var cut_ID = $(this).val();-->
<!--            $.ajax({-->
<!--                type:'POST',-->
<!--                url:'get_last_job.php',-->
<!--                data:'cut_ID='+cut_ID,-->
<!--                success:function(response){-->
                    // alert(response);
<!--                     $('#last_assigned').val(response);-->
<!--                }-->
<!--            }); -->
        
<!--    });-->
<!--});-->
<!--</script>-->
 <script>
        $(document).ready(function(){

    $("#txt_search").keyup(function(){
        var search = $(this).val();

        if(search != ""){

            $.ajax({
                url: 'getsearch_cutting_unit.php',
                type: 'post',
                data: {search:search, type:1},
                dataType: 'json',
                success:function(response){
                
                    var len = response.length;
                    $("#searchResult").empty();
                    for( var i = 0; i<len; i++){
                        var id = response[i]['id'];
                        var fname = response[i]['name'];
                        var date = response[i]['date'];

                        $("#searchResult").append("<li value='"+id+"'>"+fname+"("+date+")</li>");

                    }
                    
                    // binding click event to li
                    $("#searchResult li").bind("click",function(){
                        setText(this);
                    });

                }
            });
        }

    });

});
function setText(element){

    var value = $(element).text();
    var userid = $(element).val();

    $("#txt_search").val(value);
    $("#job_ids").val(userid);
     $("#searchResult").empty();
    
}
</script>

   <form action="" method="POST" enctype="multipart/form-data">
         <div style="margin-top: 20%;">
         <h2 style="text-align:center;color:red">CREATE JOB ID</h2>
   
        <div class="card card-style" style="margin-left:14px;">
            <div class="content" style="margin-left: 50px;">
                <div class="d-flex bd-highlight mb-n2" >
                   <div class=" w-100 bd-highlight" ><br>
<!-- --------------------------------------------------------->
                   <h5 style="margin-top: -10%;">Search Cutting Unit</h5>
                       <input type="hidden" class="form-control" style="padding: 6px;height: 35px;" id="job_ids" name="cutting_unit_id" required>
                            <input type="text" class="form-control" style="padding: 6px;height: 35px;"  id="txt_search" placeholder="Search Cutting Unit Name" required>
                            <ul id="searchResult"></ul>  <br><br>
                            <!--<h5 style="margin-top: -10%;"  >Last Job Assigned</h5>-->
                            <!-- <input type="text" name="last_assigned" id="last_assigned" readonly class="form-control" style="padding: 6px;height: 35px;"><br><br>-->
                             
                              <h5 style="margin-top: -10%;">Cloth Type</h5>
                        <select name="cloth_type" class="form-control" required style="padding: 6px;height: 35px;" id="cloth_type">
                            <option >Select Cloth Type</option>
                            	<?php
									$statement = $pdo->prepare("SELECT * FROM tbl_cloth_type ORDER BY id ASC");
									$statement->execute();
									$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
									foreach ($result as $row) {	?>
											<option value="<?php echo $row['id']; ?>"><?php echo $row['short_desc']; ?></option>
										<?php }	?>
                         
                            </select><br><br>
                            
                            <h5 style="margin-top: -10%;">Model Type</h5>
                        <select name="model_type" class="form-control" required style="padding: 6px;height: 35px;" id="model_type">
                         <option >Select Cloth Type First !</option>
                            </select><br><br>
                            
                             <h5 style="margin-top: -10%;"  >Size</h5>
                             <input type="text" name="size" required class="form-control" required style="padding: 6px;height: 35px;"><br><br>
                            
                             <h5 style="margin-top: -10%;"  >Total Meters</h5>
                             <input type="text" name="of_total_meters" required class="form-control" required style="padding: 6px;height: 35px;"><br><br>
                             
                             <h5 style="margin-top: -10%;"  >Width</h5>
                             <input type="text" name="of_width" required class="form-control" required style="padding: 6px;height: 35px;"><br><br>
                             
                             <h5 style="margin-top: -10%;"  for="favcolor">No.Of.Pieces</h5>
                             <input type="number" name="pieces" class="form-control" required required style="padding: 6px;height: 35px;"><br><br>
                            
                            <h5 style="margin-top: -10%;"  for="favcolor">Transport Mode</h5>
                             <input type="text" name="transport_mode" class="form-control" required style="padding: 6px;height: 35px;"><br><br>
                             
                               <h5 style="margin-top: -10%;"  >Delivery To</h5>
                             <input type="text" name="delivery_to" required class="form-control" required style="padding: 6px;height: 35px;"><br><br>
                            
                             <h5 style="margin-top: -10%;"  for="favcolor">Notes</h5>
                             <input type="text" name="notes" class="form-control" required required style="padding: 6px;height: 35px;"><br><br>
                        </div>
                    </div>
               </div>
           </div>
        </div>
        
      <div class="card card-style" style="margin-top: -7%;">
            <h3 style="text-align:center;color:red">Upload Image</h3>
            <div class="content">
                <div class="d-flex bd-highlight mb-n2">
                    
                    <div class="p-2 w-100 bd-highlight" style="margin-top: 20%;">
                        <h5 style="margin-top: -10%;color:red"  for="favcolor">Picture 1</h5>
                             <input type='file' name="picture1" class="form-control" style="padding: 6px;height: 35px;" required onchange="readURL(this);">
                    </div>
                    
                    <div class="p-2 flex-shrink-1"> 
                    <img id="blah" src="#" alt="your image" width="90" class="preload-img " style="width: 60%;">
                    </div>
                </div>
                <div class="d-flex bd-highlight mb-n2">
                    <div class="p-2 w-100 bd-highlight" style="margin-top: 20%;">
                        <h5 style="margin-top: -10%;color:red"  for="favcolor">Picture 2</h5>
                         <input type='file' class="form-control" name="picture2" style="padding: 6px;height: 35px;" onchange="readURL1(this);">
                    </div>
                    <div class="p-2 flex-shrink-1"> 
                    <img id="blah1" src="#" alt="your image" width="90" class="preload-img " style="width: 60%;">
                    </div>
                </div>
                 <div class="d-flex bd-highlight mb-n2">
                    <div class="p-2 w-100 bd-highlight" style="margin-top: 20%;">
                        <h5 style="margin-top: -10%;color:red"  for="favcolor">Picture 3</h5>
                         <input type='file' class="form-control" name="picture3" style="padding: 6px;height: 35px;" onchange="readURL2(this);">
                    </div>
                    <div class="p-2 flex-shrink-1"> 
                    <img id="blah2" src="#" alt="your image" width="90" class="preload-img " style="width: 60%;">
                    </div>
                </div>
            </div>
            </div>
        
        <div style="margin-left: 11%;margin-top: -7%;">
               <center><p>
               <!--<a href="#" class="btn btn-3d btn-m  mb-3 rounded-xs text-uppercase font-900 shadow-s  border-green1-dark bg-green1-light">Submit</a>-->
               <button type="submit" name="create_job" class="btn btn-3d btn-m  mb-3 rounded-xs text-uppercase font-900 shadow-s  border-green1-dark bg-green1-light">Submit</button>&ensp;
               <span>
                <a href="index-pages.php" class="btn btn-3d btn-m  mb-3 rounded-xs text-uppercase font-900 shadow-s border-red2-dark bg-red2-light">Cancel</a></span></p></center> 
               
                </div>
                </form> 
                <br><br>
        </body>
        <script>
        function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah')
                    .attr('src', e.target.result)
                    .width(150)
                    .height(200);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }
        
         function readURL1(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah1')
                    .attr('src', e.target.result)
                    .width(150)
                    .height(200);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }
    
     function readURL2(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah2')
                    .attr('src', e.target.result)
                    .width(150)
                    .height(200);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }
    
        </script>
        
        </html>

        
        
                
        

Zerion Mini Shell 1.0