ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/modicare-pickup-entry-add.php |
<?php require_once('header.php'); ?> <!-- 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(); <?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(); }); </script> <!--Script for onchange function on selection of pincode to get available shipping mode --> <script> </script> <script> </script> <!-- <section class="content-header"> <div class="content-header-left"> <h1>Add 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>    <a href="pickup-entry-bulk-upload.php" class="btn btn-primary btn-sm">Bulk Upload</a> </div> </section>--> <section class="content"> <div class="row"> <div class="col-md-12" style="text-align: center;"> <a href="modicare-pickup-entry.php" class="btn btn-primary btn-sm">View All</a>    <a href="pickup-entry-bulk-upload.php" class="btn btn-primary btn-sm">Bulk Upload</a><h4><i class="fa fa-info-circle"></i> Create 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="awb_number_print.php?list_id=<?php echo $awb_no; ?>"> <button class="btn btn-md btn-primary">Print AWB Number</button> </a> <a href="lable_print.php?list_id=<?php echo $awb_no; ?>"> <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">Select 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> <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> </select> </div> <div class="col-sm-4"> <span id="customer_id_txt"></span> </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="pincodes"> </div> <div class="col-sm-4"> <span id="pincode_txt"></span> </div> </div> <input type="hidden" autocomplete="off" class="form-control" name="shipping_mode" id="shipping_mode" value="Air"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Address <span>*</span></label> <div class="col-sm-6"> <textarea name="address" class="form-control" id="address" style="height:100px;" rows="4" cols="100"></textarea> <!--<textarea class="form-control" name="address" id="address" style="height:100px;"></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"> </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"> </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"> </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"> </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 echo date("Y-m-d") ?>"> </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="off" id="awb_no" class="form-control" name="awb_no" value="<?php if(isset($_POST['awb_no'])){echo $_POST['awb_no'];} ?>"> <input type="hidden" autocomplete="off" id="awb_value" class="form-control" name="awb_value" value="no"> </div> <div class="col-sm-2"> <input type="checkbox" checked id="awb_type" 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> <input type="hidden" autocomplete="off" class="form-control" name="content_desc" id="content_desc" value="1"> <input type="hidden" autocomplete="off" class="form-control" name="payment_mode" id="payment_mode" value="credit"> <input type="hidden" autocomplete="off" class="form-control" name="other_charges" id="other_charges" value="0"> <input type="hidden" autocomplete="off" class="form-control" name="total_charges" id="total_charges" value="0"> <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" id="a_weight" required> </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" id="pics" required> </div> </div> <input type="hidden" autocomplete="off" id="gst" class="form-control" name="gst_no" value="<?php if(isset($_POST['gst_no'])){echo $_POST['gst_no'];} ?>"> <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/validatePickupAdd.js"></script> <script> 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(){ console.log('checked'); 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() { /*********** 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(''); } } }); } }); $('textarea#address').on('keyup', function(e) { address_limit(); }); $('#form_submit').on('click', function(e) { e.preventDefault(); $("#form_submit").prop('disabled', true); var validate = 1;var validate1 = 1; validate = formValidate(); validate1 = formValidate_updated(); // alert(validate); if(validate && validate1) { $('#form_submit').removeClass('btn-danger'); $('#form_submit').addClass('btn-success'); $('#submit_txt').text('Wait'); $.ajax({ type: 'POST', url: 'pickup_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(); }); }); 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); } }); } } function formValidate_updated() { 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; } </script> <?php require_once('footer.php'); ?>