ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/modicare-pickup-entry-edit.php |
<?php require_once('header.php'); $print_id=0; ?> <!--Script for onchange function on selection of pincode to get available shipping mode --> <!-- Script --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src='js/select2.full.min.js' type='text/javascript'></script> <!-- CSS --> <link href='css/select2.full.min.css' rel='stylesheet' type='text/css'> <script> $(document).ready(function(){ // Initialize select2 $("#pincode").select2(); }); $(document).ready(function(){ // Initialize select2 $("#customer_name").select2(); }); $(document).ready(function(){ // Initialize select2 $("#customer_id").select2(); }); </script> <section class="content-header"> <div class="content-header-left"> <h1>Edit Speed Link Pickup Entry</h1> </div> <div class="content-header-right"> <a href="modicare-pickup-entry.php" class="btn btn-primary btn-sm">View All</a> </div> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> <a href="awb_number_print.php?list_id=<?php echo $print_id; ?>" ><button class="btn btn-md btn-primary">Print AWB Number</button></a> <a href="lable_print.php?list_id=<?php echo $print_id; ?>" ><button class="btn btn-md btn-primary">Print Lable</button></a> </div> <?php endif; ?> <?php $state_1 = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE id=? "); $state_1->execute(array($_REQUEST['id'])); $result_1 = $state_1->fetchAll(PDO::FETCH_ASSOC); foreach ($result_1 as $row_1) { $clientid=$row_1['client_id']; $created=$row_1['created_at']; //$date_added=date_format($created,'Y-m-d'); $date_added=date("Y-m-d", strtotime($created)); ?> <form class="form-horizontal" action="" method="post" enctype="multipart/form-data"> <div class="box box-info"> <div class="box-body"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Select Client Name <span>*</span></label> <div class="col-sm-6"> <select class="form-control" name="client_id" id="client_id"> <option value="none">Select Client Name </option> <?php if($clientType=="Admin") { $statement = $pdo->prepare("SELECT * FROM tbl_user WHERE role='Modicare' ORDER BY id ASC"); } else { $statement = $pdo->prepare("SELECT * FROM tbl_user WHERE role='Modicare' and id=$clientId ORDER BY id ASC"); } $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { ?> <option value="<?php echo $row['id']; ?>" <?php if($row_1['client_id']==$row['id']){ echo 'selected';}?>><?php echo $row['full_name']; ?></option> <?php } ?> </select> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Select DB Number <span>*</span></label> <div class="col-sm-6"> <select class="form-control" name="customer_id" id="customer_id"> <!--<option value="none">Select Client First !</option>--> <?php $statement = $pdo->prepare("SELECT * FROM tbl_customer where client_id=".$row_1['client_id']); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { ?> <option value="<?php echo $row['cust_id']; ?>" <?php if($row_1['customer_id']==$row['cust_id']){ echo 'selected';}?>><?php echo $row['cust_name']; ?></option> <?php } ?> </select> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Pincode <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="pincode" id="search_pincode" value="<?php if(isset($row_1['pincode'])){echo $row_1['pincode'];} ?>"> <ul id="searchResult"></ul> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Address <span>*</span></label> <div class="col-sm-6"> <textarea class="form-control" name="address" id="address" style="height:100px;"><?php if(isset($row_1['address'])){echo $row_1['address'];} ?></textarea> </div> <div class="col-sm-4"> <span id="remain">110</span><span id="remain_txt"> characters remaining</span> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">City <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" id="city" class="form-control" name="city" value="<?php if(isset($row_1['city'])){echo $row_1['city'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">State </label> <div class="col-sm-6"> <input type="text" autocomplete="off" id="state" class="form-control" name="state" value="<?php if(isset($row_1['state'])){echo $row_1['state'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Destination <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" id="destination" class="form-control" name="destination" value="<?php if(isset($row_1['destination'])){echo $row_1['destination'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Phone Number <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="phone" id="phone" value="<?php if(isset($row_1['phone'])){echo $row_1['phone'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Pickup Entry Date <span>*</span></label> <div class="col-sm-6"> <input type="date" autocomplete="off" class="form-control" name="created" id="created" value="<?php if(isset($row_1['created_at'])){echo $row_1['created_at'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">AWB No <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" id="awb_no" class="form-control" name="awb_no" value="<?php if(isset($row_1['ref_no'])){echo $row_1['ref_no'];} ?>" ><span style="color:red" id="awb_status"></span> <input type="hidden" autocomplete="off" id="old_awb_value" name="old_awb_value" value="<?php if(isset($row_1['ref_no'])){echo $row_1['ref_no'];} ?>" > <input type="hidden" autocomplete="off" id="print_id" name="print_id" value="<?php if(isset($row_1['awb_no'])){echo $row_1['awb_no'];} ?>" > <input type="hidden" autocomplete="off" id="id" name="id" value="<?php if(isset($row_1['id'])){echo $row_1['id'];} ?>" > <input type="hidden" autocomplete="off" id="awb_value" class="form-control" name="awb_value" value="yes"> </div> <div class="col-sm-4"> <span id="awb_txt"> </span> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Actual Weight <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="a_weight" value="<?php if(isset($row_1['a_weight'])){echo $row_1['a_weight'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Number of Pieces <span>*</span></label> <div class="col-sm-6"> <input type="number" autocomplete="off" class="form-control" name="pics" value="<?php if(isset($row_1['pics'])){echo $row_1['pics'];} ?>"> </div> </div> <input type="hidden" autocomplete="off" id="gst" class="form-control" name="gst_no" value="<?php if(isset($row_1['gst_no'])){echo $row_1['gst_no'];} ?>"> <?php } ?> <div class="alert alert-success alert-dismissible fade in" id="status_success" style="display:none;"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong>Success!</strong> Pick Entry Updated !     <a href="#" id='btn_awb' class="btn btn-md btn-primary">Print AWB Number</a> <a href="#" id='btn_label' class="btn btn-md btn-primary">Print Label</a> </div> <div class="alert alert-danger alert-dismissible fade in" id="status_failure" style="display:none;"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong>Failed!</strong> Please Check the Form ! </div> <div class="form-group"> <label for="" class="col-sm-2 control-label"></label> <div class="col-sm-6"> <button type="submit" id='form_submit' class="btn btn-success pull-left" name="form1"><span id='submit_txt'>Update</span><i id='submit_spin'></i></button> <button type="reset" id='form_reset' class="btn btn-primary pull-right">Reset <i class="fa fa-spin fa-recycle" style="color:white" aria-hidden="true"></i></button> </div> </div> </div> </div> </form> </div> </div> </section> <script src="js/validatePickupEdit.js"></script> <script> function address_limit() { var maxchars = 110; var tlength = $('#address').val().length; $('#address').val($('#address').val().substring(0, maxchars)); var tlength = $('#address').val().length; remain = maxchars - parseInt(tlength); if(remain < 10) { $('#remain').css('color', 'red'); $('#remain_txt').css('color', 'red'); } else { $('#remain').css('color', 'green'); $('#remain_txt').css('color', 'green'); } $('#remain').text(remain); } $(document).ready(function() { address_limit(); /*********** For checking Unique REF Number ***********/ $("#awb_no").keyup(function() { var awb1 = $(this).val(); var awb_old = $('#old_awb_value').val(); if(awb1 == '' || awb1 == awb_old ) { $("#awb_txt").text(''); $("#awb_value").val('yes'); } else { $.ajax({ type: 'POST', url: 'get_unique_awb.php', data: { awb: awb1, type: 'awb_no' }, dataType: 'json', success: function(response) { console.log(response); if(response[0]['error'] == '0') { $("#awb_value").val('yes'); $("#awb_txt").css('color', 'green'); $("#awb_txt").text(response[0]['txt']); } else if(response[0]['error'] == '1') { $("#awb_value").val('no'); $("#awb_txt").css('color', 'red'); $("#awb_txt").text(response[0]['txt']); } else { $("#awb_value").val('no'); $("#awb_txt").css('color', 'red'); $("#awb_txt").text(''); } } }); } }); $('textarea#address').on('keyup', function(e) { address_limit(); }); $('#form_submit').on('click', function(e) { e.preventDefault(); $("#form_submit").prop('disabled', true); var validate = 1; validate = formValidate(); // alert(validate); if(validate) { $('#form_submit').removeClass('btn-danger'); $('#form_submit').addClass('btn-success'); $('#submit_txt').text('Wait'); $.ajax({ type: 'POST', url: 'pickup_edit_ajax.php', data: $("form").serialize(), beforeSend: function() { // setting a timeout $('#submit_spin').addClass('fa fa-spinner fa-spin'); }, dataType: 'json', success: function(response) { console.log(response); var res_text = response[0]['txt']; if(response[0]['error'] == '1') { var awb_num = response[0]['awb_number']; $('#status_success').show(); $('#status_failure').hide(); $("#btn_awb").attr('href', 'awb_number_print.php?list_id=' + awb_num); $("#btn_label").attr('href', 'lable_print.php?list_id=' + awb_num); $('#form_submit').removeClass('btn-danger'); $('#form_submit').addClass('btn-success'); $('#submit_txt').text(res_text); $("#submit_spin").removeClass("fa fa-spinner fa-spin"); } else { $('#status_success').hide(); $('#status_failure').show(); $("#form_submit").prop('disabled', false); $('#form_submit').removeClass('btn-success'); $('#form_submit').addClass('btn-danger'); $('#submit_txt').text(res_text); $("#submit_spin").removeClass("fa fa-spinner fa-spin"); } } }); } else { $('#status_success').hide(); $('#status_failure').show(); $("#form_submit").prop('disabled', false); window.scrollTo(0, 0); $('#form_submit').removeClass('btn-success'); $('#form_submit').addClass('btn-danger'); $('#submit_txt').text('Failed'); } }); $('#form_reset').on('click', function(e) { $("#form_submit").prop('disabled', false); $('#status_success').hide(); $('#status_failure').hide(); }); }); </script> <script> function setText(element) { var value = $(element).text(); var userid = $(element).val(); $("#search_pincode").val(value); get_pincode_list(userid); $("#searchResult").empty(); } function get_pincode_list(search_pincode) { var search_pincode = $('#search_pincode').val(); if(search_pincode != "") { $("#destination").val(''); $.ajax({ type: 'POST', url: 'custom-api/pincode-list.php', data: { search_pincode: search_pincode, type:'get-datalist-pincode' }, dataType: 'json', success: function(response) { console.log('Rssponse:'+response['status']); if(response['status'] == 2) { console.log('data :'+response['data']); var len = response['data'].length; $("#searchResult").empty(); for(var i = 0; i < len; i++) { var id = response['data'][i]['id']; var pin_code = response['data'][i]['pin_code']; $("#searchResult").append("<li value='" + pin_code + "'>" + pin_code + "</li>"); } $("#searchResult li").bind("click", function() { setText(this); }); } if(response['status'] == 1) { $("#searchResult").empty(); $("#destination").val(response['data'][0]['area_code']); } } }); } } $(document).ready(function() { $('#search_pincode').bind('input',function() { var s=''; get_pincode_list(s); }); }); </script> <?php require_once('footer.php'); ?>