EVOLUTION-NINJA
Edit File: new_reception_form.php
<?php echo view('includes/header');?> <link href="<?php echo base_url('public/assets/admin_dashboard/css/jquery-ui.css');?>" rel="stylesheet"> <script src="<?php echo base_url('public/assets/js/jquery-ui.js');?>"></script> <section class="content-header"> <h1> Reception form </h1> </section> <!--- section 1 ----> <section class="content"> <div class="col-sm-12 col-md-11"> <form id="land_owner" class="form-inline new_reception_form"> <input type="hidden" class="form-control col-sm-8 booking_id" name="booking_id" required="required"> <input type="hidden" class="form-control col-sm-8 detail_id" name="detail_id" required="required"> <div class="row" style="padding-bottom:20px; padding-top:10px;"> <!-- <label class="col-sm-4">Payment mode</label>--> <label class="col-sm-2" style="margin-left: 17px;">Project Status</label> <div class="col-sm-12 col-md-5"> <label class="radio-inline"><input type="radio" value="Ongoing" id="ongoing_type" name="project_type" checked>Ongoing</label> <label class="radio-inline"><input type="radio" value="Completed" id="completed_type" name="project_type">Completed</label> </div> <div class="col-sm-0 col-md-5"> <!-- <input class="btn btn-default payment_btn1" type="button" style="width:22% !important;" value="Print"> --> </div> </div> <!-- row 8----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Project</label> <select class="form-control col-sm-8 project_list" name="project_id" id="sel1"> <option value="0">Select</option> <?php foreach($projects as $val) { ?> <option value="<?php echo $val->project_id;?>"><?php echo $val->project_name;?></option> <?php } ?> </select> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Site No</label> <input type="text" class="form-control col-sm-3 site_number" name="site_number" style="width:17%!important; " required="required"> <label class="col-sm-3">Dimension</label> <input type="text" class="form-control col-sm-3" readonly name="site_dimension" style="width:17% !important;" required="required"> </div> </div> <!-- row 1----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Client Name</label> <input type="text" class="form-control col-sm-8" name="customer_name" required="required"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Contact</label> <input type="text" class="form-control col-sm-4 contact1" name="contact1" style="width:29%!important; margin-right:10px;" required="required"> <input type="text" class="form-control col-sm-3 contact2" name="contact2" style="width:29% !important;" > </div> </div> <!-- row 2----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Dispatched</label> <select class="form-control col-sm-8 dispatched" name="dispatched" id="dispatched"> <option value="">Select</option> <option value="by_hand">By Hand</option> <option value="courier">By Courier</option> <option value="reg_post">By Reg Post</option> </select> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Dispatched Date</label> <input type="datepicker" name="dispatched_date" class="form-control col-md-4 date_picker" style=""> </div> </div> <!-- row 3----> <div class="row land_owner_a"> <div class="form-group col-sm-6 col-md-6"> <label class="col-sm-4">Document Details</label> <textarea type="text" class="form-control col-sm-8 doc_details" name="doc_details" cols="" rows="3"></textarea> </div> <div class="form-group col-sm-6 col-md-6"> <label class="col-sm-4">Acknowledgement and Document Number</label> <textarea type="text" class="form-control col-sm-8 ack_doc" name="ack_doc" cols="" rows="3"></textarea> </div> </div> <!-- row 4----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Remarks</label> <textarea type="text" class="form-control col-sm-8 remarks" name="remarks" cols="43" rows="4"></textarea> </div> </div> <!-- row 4----> <div class="row land_owner_a"> <div class="col-sm-12 col-md-6"></div> <div class="col-sm-4 col-md-3"> <button type="submit" class="btn btn-primary center-block submit" style="">Submit</button> </div> <div class="col-sm-4 col-md-3"></div> </div> <!-- row 12----> </form> </div> <!--- col-sm-8 ----> </section> <!--- section 2 ----> <style type="text/css"> .content-wrapper, .right-side { //min-height: 1100px !important; } </style> <script type="text/javascript"> $(document).ready(function(){ var $radios = $('input:radio[name=project_type]'); if($radios.is(':checked') === false) { $radios.filter('[value=Ongoing]').prop('checked', true); } var value = $('input[name=project_type]:checked').val(); $.ajax({ type : 'post', url : '<?php echo base_url("Gss/check_project_type_status")?>', data : {value:value}, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { var options = ''; options += '<option value="">Select</option>'; $.each(response.message , function (index, value){ options += '<option value="' + value.project_id + '">' + value.project_name + '</option>'; $('.project_list').html(options); }); } } }); $('.new_reception_form')[0].reset(); var datatable; var tbody = $('#table_body'); datatable = $('.cancellation_table').DataTable({ "scrollY": 350, "scrollX": true }); toastr.options.timeOut = 1000; $('.date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", dateFormat: 'dd-mm-yy' }); $(".site_number").focusout(function (e) { var project_id = $('.project_list :selected').val(); var site_number = $(this).val(); $(".submit").attr('disabled', 'disabled'); $.ajax({ type : 'post', url : '<?php echo site_url("gss/check_cancelled_refunded_site_details")?>', data : {project_id:project_id,site_number:site_number}, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { // $(".submit").removeAttr('disabled'); var registration_due_date= changeDateFormat(response.booking_details.registration_due_date); var booking_date1= changeDateFormat(response.booking_details.booking_date1); $("input[name=booking_id]").val(response.booking_details.booking_id); $("input[name=detail_id]").val(response.booking_details.detail_id); $("input[name=customer_name]").val(response.booking_details.customer_name); $("select option[value='"+response.booking_details.project_id+"']").attr("selected","selected"); $("input[name=site_number]").val(response.booking_details.site_number); $("input[name=site_dimension]").val(response.booking_details.dimension); $("input[name=contact1]").val(response.booking_details.mobile1); $("input[name=contact2]").val(response.booking_details.mobile2); } else if(response.result==2) { toastr["error"](response.message); $(".submit").removeAttr('disabled'); //$('.cancellation_form')[0].reset(); } else if(response.result == 3) { toastr["error"](response.message); $(".submit").removeAttr('disabled'); // $('.cancellation_form')[0].reset(); } else if(response.result==0) { toastr["error"](response.message); $(".submit").removeAttr('disabled'); //$('.cancellation_form')[0].reset(); } } }); }); $('.new_reception_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("add-new-reception-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { toastr["success"](response.message); location.reload(); } else if(response.result==2) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else if(response.result==3) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); }); function changeDateFormat(inputDate){ // expects Y-m-d var splitDate = inputDate.split('-'); if(splitDate.count == 0){ return null; } var year = splitDate[0]; var month = splitDate[1]; var day = splitDate[2]; return day + '-' + month + '-' + year; } $("input[name='project_type']").change(function(){ var value = $('input[name=project_type]:checked').val(); $.ajax({ type : 'post', url : '<?php echo base_url("Gss/check_project_type_status")?>', data : {value:value}, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { var options = ''; options += '<option value="">Select</option>'; $.each(response.message , function (index, value){ options += '<option value="' + value.project_id + '">' + value.project_name + '</option>'; }); $(".project_list").html(options); } else { toastr["error"](response.message); } } }); }); </script> <style> .land_owner_a textarea { width: 60% !important; } </style> <?php echo view('includes/footer');?>