ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/otc-modicare-pickup-entry-add.php |
<?php require_once('header.php'); ?> <!--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 for onchange function on selection of pincode to get available shipping mode --> <script> $(document).ready(function() { // Initialize select2 $("#pincode").select2(); <?php if($_SESSION['user']['role_type']==2) { ?> system_user_fun(); <?php } ?> auto_awb_check(); }); $(document).ready(function() { // Initialize select2 //$("#customer_name").select2(); }); $(document).ready(function() { // Initialize select2 //$("#customer_id").select2(); }); function system_user_fun(){ var client_id=$('#client_id').val(); if(client_id){ $.ajax({ type:'POST', url:'get_client_data.php', data:{id:client_id}, dataType: 'json', success:function(response){ var len = response.length; $('#gst').val(response[0]['gst']); } }); } /*********** For fetching Customer ***********/ var client_id=$('#client_id').val(); // alert(client_id); if(client_id){ $.ajax({ type:'POST', url:'get_client_selection.php', data:{id:client_id}, success:function(html){ $('#customer_id').html(html); } }); } } </script> <script> function populateSecondTextBox() { document.getElementById('charged_weight').value = document.getElementById('actual_weight').value; } </script> <section class="content"> <div class="row"> <div class="col-md-12" style="text-align: center;"> <h4><i class="fa fa-info-circle"></i> Create One Time Pickup Entry Details</h4> </div> </div> <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="pk_awb_number_print.php?list_id=<?php echo $awb_no; ?>" target="_blank"> <button class="btn btn-md btn-primary">Print AWB Number</button> </a> <a href="pk_lable_print.php?list_id=<?php echo $awb_no; ?>" target="_blank"> <button class="btn btn-md btn-primary">Print Lable</button> </a> </div> <?php endif; ?> <form class="form-horizontal" action="" method="post" enctype="multipart/form-data"> <div > <div class="box-body"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Client Name <span>*</span></label> <div class="col-sm-6"> <select class="form-control select2" name="client_id" id="client_id" onchange="auto_awb_check()"> <?php if($clientType=='Admin'){ echo "<option value='none'>Select Client Name</option>"; $where_cus="";?> <?php }elseif($_SESSION['user']['role_type']==3) { $where_cus=" and id=".$clientId; }else{ $where_cus=" and id=".$_SESSION['user']['branch_id'];} ?> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_user` where role='Modicare' $where_cus"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { ?> <option value="<?php echo $row['id']; ?>"> <?php echo $row['full_name']; ?> </option> <?php } ?> </select> </div> <div class="col-sm-4"> <span id="client_id_txt"></span> </div> </div> <input type="hidden" name="shipping_mode" value="Road"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Refrence Code<span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="db_code" class="form-control" name="db_code" value="<?php if(isset($_POST['db_code'])){echo $_POST['db_code'];} ?>"> <input type="hidden" autocomplete="none" id="db_value" class="form-control" name="db_value" value="no"> </div> <div class="col-sm-4"> <span id="db_code_txt"></span> </div> </div> <div id="office_customer"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Sender Name<span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="sender_name" class="form-control" name="sender_name" value="<?php if(isset($_POST['sender_name'])){echo $_POST['sender_name'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Sender Address <span>*</span></label> <div class="col-sm-6"> <textarea class="form-control" name="sender_address" id="sender_address" style="height:100px;"> <?php if(isset($_POST['sender_address'])){echo $_POST['sender_address'];} ?> </textarea> </div> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">AWB No <span>*</span></label> <div class="col-sm-4"> <input type="text" autocomplete="none" id="awb_no" class="form-control" name="awb_no" value="<?php if(isset($_POST['awb_no'])){echo $_POST['awb_no'];} ?>"> <input type="hidden" autocomplete="none" id="awb_value" class="form-control" name="awb_value" value="no"> </div> <div class="col-sm-2"> <input type="checkbox" id="awb_type" checked onchange="auto_awb_check()" class="checkbox"> <span style='color:green;size:10px;'>(Click Here If Auto Awb Fetch)</span></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">Customer Name<span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="customer_name" class="form-control" name="customer_name" value="<?php if(isset($_POST['customer_name'])){echo $_POST['customer_name'];} ?>"> </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" id="search_pincode" class="form-control" name="pincode" autocomplete="none" required> <ul id="searchResult"></ul> </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="none" id="city" class="form-control" name="pincode" value="<?php if(isset($_POST['pincode'])){ $_POST['pincode'];} ?>"> </div>--> <!-- <select class="form-control select2" name="pincode" id="pincode" >--> <?php /* $statement = $pdo->prepare("SELECT * FROM `pincode`"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { ?> <option value="<?php echo $row['pin_code']; ?>"> <?php echo $row['pin_code']; ?> </option> <?php }*/ ?><!-- </select> </div> </div> --> <div class="form-group"> <label for="" class="col-sm-2 control-label">Address <span>*</span></label> <div class="col-sm-6"> <textarea name="address" autocomplete="none" class="form-control" id="address" style="height:100px;" rows="4" cols="100"></textarea> <!--<textarea class="form-control" name="address" id="address" style="height:100px;" rows="4" cols="50"> </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="none" id="city" autocomplete="none" class="form-control" name="city" value="<?php if(isset($_POST['city'])){echo $_POST['city'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">State <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="state" class="form-control" name="state" value="<?php if(isset($_POST['state'])){echo $_POST['state'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Destination City <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="destination_city" class="form-control" name="destination_city" value="<?php if(isset($_POST['destination_city'])){echo $_POST['destination_city'];} ?>"> </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="none" class="form-control" name="phone" id="phone" value="<?php if(isset($_POST['phone'])){echo $_POST['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="none" class="form-control" name="created" value="<?php echo date("Y-m-d") ?>" id="created"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Content Description <span>*</span></label> <div class="col-sm-6"> <select class="form-control" name="content_desc"> <!--<option >Select Description</option>--> <?php $statement = $pdo->prepare("SELECT * FROM material_desc 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> </div> </div> <input type="hidden" name="payment_mode" value="credit"> <input type="hidden" name="other_charges" value="credit"> <input type="hidden" name="total_charges" value="credit"> <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="none" class="form-control" name="a_weight" id="actual_weight" onkeyup="populateSecondTextBox();" value="<?php if(isset($_POST['a_weight'])){echo $_POST['a_weight'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Charged Weight <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" class="form-control" name="c_weight" id="charged_weight" value="<?php if(isset($_POST['c_weight'])){echo $_POST['c_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="none" id='pics' class="form-control" name="pics" value="<?php if(isset($_POST['pics'])){echo $_POST['pics'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">GST Number </label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="gst" class="form-control" name="gst_no" value="<?php if(isset($_POST['gst_no'])){echo $_POST['gst_no'];} ?>"> </div> </div> <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 Added !     <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> <a href="#" id='btn_label_address' class="btn btn-md btn-warning">Print Label With Address</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'>Submit</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/validateOnetimePickupAdd.js"></script> <script> function formNOBValidate() { var valid = 1; if ($('#client_id').val() == 'none') { $('#client_id_txt').text('Please select the Client'); $('#client_id_txt').css('color', 'red'); valid=0; } else { $('#client_id_txt').text(''); } if ($('#customer_id').val() == 'none') { $('#customer_id_txt').text('Please select the Customer'); $('#customer_id_txt').css('color', 'red'); valid=0; } else { $('#customer_id_txt').text(''); } if ($('#awb_value').val() == 'no') { $('#awb_txt').text('Please Enter Valid AWB Number'); $('#awb_txt').css('color', 'red'); valid=0; } else { $('#awb_txt').text(''); } if ($('#pics').val() == '' || $('#pics').val()==0) { $('#awb_txt').text('Please Enter Number Of Box'); $('#awb_txt').css('color', 'red'); valid=0; } else { $('#awb_txt').text(''); } return valid; } function auto_fetch_awb_no() { var client_id=$('#client_id').val(); if(client_id){ $.ajax({ type:'POST', url:'get-available-awb-number.php', data:{id:client_id}, dataType: 'json', success:function(response){ console.log('awb_code no :'+response[0]['awb_code']); $('#awb_no').val(response[0]['awb_code']); var awb1 = $(awb_no).val(); $.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(''); } } }); } }); } } function auto_awb_check(){ var fd= $('#awb_type').is(':checked'); if(fd){ auto_fetch_awb_no(); }else{ $('#awb_no').val(''); $("#awb_value").val('no'); $("#awb_txt").css('color', 'red'); $("#awb_txt").text('Enter Awb Number'); } } 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() { $('#office_customer').hide(); $('textarea#address').on('keyup', function(e) { address_limit(); }); /* $("#pincode").change(function() { console.log('pincode'); var pincode = $('#pincode').val(); $.ajax({ type: 'POST', url: 'get-pincode-name-by-pincode.php', data: {pincode: pincode}, dataType: 'text', success: function(response) { console.log(response); $('#destination_city').val(response); } }); }); $("#pincode").keyup(function() { console.log('pincode'); var pincode = $('#pincode').val(); $.ajax({ type: 'POST', url: 'get-pincode-name-by-pincode.php', data: {pincode: pincode}, dataType: 'text', success: function(response) { console.log(response); } }); });*/ /*********** For checking Unique REF Number ***********/ $("#awb_no").keyup(function() { var awb1 = $(this).val(); if(awb1 == '') { $("#awb_txt").text(''); } 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(''); } } }); } }); /*********** For checking Unique db code Number ***********/ $("#db_code").keyup(function() { var awb = $(this).val(); // alert(awb); if(awb == '') { $("#db_code_txt").text(''); } else { $.ajax({ type: 'POST', url: 'get_unique_awb.php', data: { awb: awb, type: 'dpcode' }, dataType: 'json', success: function(response) { console.log(response); if(response[0]['error'] == '0') { $("#db_value").val('yes'); $("#db_code_txt").css('color', 'green'); $("#db_code_txt").text(response[0]['txt']); } else if(response[0]['error'] == '1') { $("#db_value").val('no'); $("#db_code_txt").css('color', 'red'); $("#db_code_txt").text(response[0]['txt']); } else { $("#db_value").val('no'); $("#db_code_txt").text(''); } } }); } }); $('#form_submit').on('click', function(e) { e.preventDefault(); $("#form_submit").prop('disabled', true); var validate = 1; var validate1 = 1; validate = formValidate(); validate1 = formNOBValidate(); // alert(validate); if(validate && validate1) { $('#form_submit').removeClass('btn-danger'); $('#form_submit').addClass('btn-success'); $('#submit_txt').text('Wait'); $.ajax({ type: 'POST', url: 'pickup_onetime_add_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']; var p_id = response[0]['p_id']; $('#status_success').show(); $('#status_failure').hide(); $("#btn_awb").attr('href', 'awb_number_print.php?list_id=' + p_id); $("#btn_label").attr('href', 'lable_print.php?list_id=' + p_id); $("#btn_label_address").attr('href', 'lable-print-with-address.php?list_id=' + p_id); $('#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_city").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_city").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'); ?>