ok
Direktori : /home2/selectio/www/mm-tailor-billing/themes/default/views/material_usage/ |
Current File : /home2/selectio/www/mm-tailor-billing/themes/default/views/material_usage/edit.php |
<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); ?> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box box-primary"> <div class="box-header"> <h3 class="box-title"><?= lang('update_info'); ?></h3> </div> <div class="box-body"> <div class="col-lg-12"> <?php echo form_open_multipart("material_usage/edit/".$material_usage->id);?> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Date</label> <input type="date" name="date" class="form-control" id="name" value="<?=$material_usage->date?>" required="required"> </div> <div class="form-group"> <label>Material</label> <select name="material" class="form-control" id="material" onchange="getUnits()"> <?php $f=1; foreach($product_material as $product){ if($product->id==$material_usage->material){?> <option value="<?=$product->id?>" <?php if($material_usage->material==$product->id){echo "selected";}?>><?=$product->name?></option> <?php } ?> <?php $f++; } ?> </select> </div> <input type="hidden" name="already_updated_qty" value="<?=$material_usage->qty?>"> <input type="hidden" name="id" value="<?=$material_usage->id?>"> <div class="form-group"> <label>Units</label> <select name="units" class="form-control" id="units"> <option value="">Select Units</option> </select> </div> <div class="form-group"> <label>Quantity</label> <input type="text" name="quantity" class="form-control" id="quantity" value="<?=$material_usage->qty?>" required="required"> </div> <div class="form-group"> <label>Remarks</label> <input type="text" name="remarks" class="form-control" id="remarks" value="<?=$material_usage->remarks?>"> </div> </div> </div> <div class="form-group"> <?= form_submit('edit_material_usage', lang('edit_material_usage'), 'class="btn btn-primary"'); ?> </div> <?php echo form_close();?> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <script> $(document).ready(function(){ getUnits(); }); function getUnits(){ console.log('Get Units Inside Function Working:'); var material=$('#material').val(); console.log('Units Id:'+material); $.ajax({ type: "get", url: '<?=site_url('material_usage/select_unit');?>', data : {material:material}, dataType: "text", success: function(t) { $('#units').append(t); }, error:function(err){ alert(err); } }); $('#units').empty(); } </script>