ok

Mini Shell

Direktori : /home2/selectio/www/subamangala/admin/modal/
Upload File :
Current File : /home2/selectio/www/subamangala/admin/modal/points-details-update.php

<?php
include "../config/config.php";
$ids = $_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_points e where e.id=".$ids);
    $statement->execute();
    $datas = $statement->fetchAll(PDO::FETCH_ASSOC);
    $totalData = $statement->rowCount();

if($totalData==1){
    
?> 
<style>
.modal-open .modal {
    overflow-x: hidden;
    overflow-y: hidden;
}
</style>
<div class="modal-dialog modal-lg" role="document" id="add_modal" style="overflow-x: hidden; overflow-y: hidden;">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title mt-0" id="myLargeModalLabel"><b>Update Points Details</b></h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-top: -25px;"><i class="fa fa-times"></i></button>
            </div>
            
            <form id="add_form" method="post">
            <div id="content-div">
            
             <input type="hidden" name="ids" value="<?=$ids?>">
            
            <div class="modal-body" style="padding: 20px 40px 20px 40px;">
                
                
                <div class="form-group">
                        <label>Choose Trip Details</label>
                        <select name="trip_id" class="form-control tip select2" id="trip_id">
                            <option value="">All Trip Details</option>
                            <?php $statement = $pdo->prepare("SELECT tbl_trips.*, pc.name as pickup_city_name, dc.name as drop_city_name, tbl_bus_details.bus_name, tbl_bus_details.bus_code, tbl_bus_details.bus_number FROM `tbl_trips` LEFT JOIN tbl_cities pc ON tbl_trips.pickup_city=pc.id LEFT JOIN tbl_cities dc ON tbl_trips.drop_city=dc.id LEFT JOIN tbl_bus_details ON tbl_bus_details.id=tbl_trips.bus_id ORDER BY tbl_trips.pickup_time");
                                $statement->execute();
                                $results = $statement->fetchAll(PDO::FETCH_ASSOC); 
                                foreach ($results as $result) { ?>
                                  <option value="<?=$result['id']?>" <?php if($datas[0]['trip_id']==$result['id']){echo "selected";}?>><?=$result['pickup_city_name']?> - <?=$result['drop_city_name']?> (<?=date('h:i A', strtotime($result['pickup_time']))?> - <?=date('h:i A', strtotime($result['drop_time']))?>) - <?=$result['bus_code']?></option>
                            <?php } ?>
                        </select>
                </div>
                    
                    <div class="form-group">
                        <label>Point Address</label>
                        <input type="text" name="name" id="name" class="form-control" value="<?=$datas[0]['name']?>" required>
                    </div>
                    
                    <div class="form-group">
                        <label>Choose City</label>
                        <select name="city" class="form-control select2" style="width:100%;" id="city" required>
                            <option value="">Select City Name</option>
                        <?php 
                            $statement = $pdo->prepare("SELECT * FROM `tbl_cities` WHERE status=1");
                            $statement->execute();
                            $result = $statement->fetchAll(PDO::FETCH_ASSOC);
                            foreach ($result as $data) {    ?>
                            <option value="<?=$data['id']?>" <?php if($datas[0]['city']==$data['id']){echo "selected";}?>><?=$data['name']?></option>
                        <?php } ?>
                        </select>
                    </div>
                    
                    
                    
                    
                    
                    
                    <div class="form-group">
                        <label>Quick Adddress</label>
                        <input type="text" name="quick_address" id="quick_address" class="form-control" value="<?=$datas[0]['quick_address']?>" required>
                    </div>
                    
                    <div class="form-group">
                        <label>Point Time</label>
                        <input type="time" name="time" id="time" class="form-control" value="<?=$datas[0]['time']?>" required>
                    </div>

            </div>
            
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">Update</button>
            </div>
            
            
            </div>
            </form>
            
            
            
            <div id="loading-div" style="display: none; padding-bottom: 80px;">
                    <center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center>
            </div>
            
            
            
        </div>
    </div>
<?php } ?>
<script>
    $('#add_form').on('submit', function(e){
        console.log("Click And Form Working");
                e.preventDefault();
                $('#loading-div').show();
                $('#content-div').hide();
                var formData = new FormData(this);
                formData.append('type', 'update_points');
                            $.ajax({
                            url: 'apis/tn-trans-connect.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            enctype: 'multipart/form-data',
                            success: function (response) {
                                if(response['status']==200){
                                     alert(response['message']);
                                     $("#add_modal .close").click();
                                     $('#add_form').trigger("reset");
                                     emp_datas();
                                     $('#loading-div').hide();
                                     $('#content-div').show();
                                }else{
                                    alert(response['message']);
                                    $('#loading-div').hide();
                                    $('#content-div').show();
                                }
                                
                               
                            }
                        });
                
    });
</script>

Zerion Mini Shell 1.0