ok

Mini Shell

Direktori : /home2/selectio/www/mm-tailor-billing/themes/default/views/expenses/
Upload File :
Current File : /home2/selectio/www/mm-tailor-billing/themes/default/views/expenses/edit_expense.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-md-6">
                        <?= form_open_multipart("expenses/edit_expense/".$expense->id); ?>

                        <?php if ($Admin) { ?>
                            <div class="form-group">
                                <?= lang("date", "date"); ?>
                                <input type="date" name="date" class="form-control" value="<?=$expense->date?>">
                            </div>
                            <?php } ?>

                            <div class="form-group" hidden>
                                <?= lang("reference", "reference"); ?>
                                <?= form_input('reference', (isset($_POST['reference']) ? $_POST['reference'] : $expense->reference), 'class="form-control tip" id="reference"'); ?>
                            </div>

                            <div class="form-group">
                                <?= lang("amount", "amount"); ?>
                                <?= form_input('amount', (isset($_POST['amount']) ? $_POST['amount'] : $expense->amount), 'class="form-control tip" id="amount"'); ?>
                            </div>
                            
                            <div class="form-group">
                                <label>Accounts</label>
                                <select name="category" id="category" onkey="getsubCategory();" onkeyup="getsubCategory();" onchange="getsubCategory();" class="form-control select2">
                                    <option value="">Select a Category</option>
                                    <?php $f=1; foreach($expense_category as $category){ ?>
                                    <option value="<?=$category->id?>" <?php if($expense->category==$category->id){echo "selected";}?>><?=$category->name?></option>
                                    <?php $f++; } ?>
                                </select>
                            </div>
                            
                            <div class="form-group">
                                <input type="hidden" value="<?=$expense->sub_category?>" id="get_sub_category"/>
                                <?//= lang("sub_category", "sub_category"); ?>
                                <label>Category</label>
                                <select name="sub_category" id="sub_category" class="form-control">
                                </select>
                            </div>
                            
                            <div class="form-group" hidden>
                                <?= lang("attachment", "attachment") ?>
                                <input type="file" name="userfile" class="form-control file">
                            </div>

                            <div class="form-group">
                                <?= lang("note", "note"); ?>
                                <?php echo form_textarea('note', (isset($_POST['note']) ? $_POST['note'] : $expense->note), 'class="form-control redactor" id="note"'); ?>
                            </div>

                            <div class="form-group">
                                <?php echo form_submit('edit_expense', lang('edit_expense'), 'class="btn btn-primary"'); ?>
                            </div>
                        </div>
                        <?php echo form_close(); ?>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
</section>

<script src="<?= $assets ?>plugins/bootstrap-datetimepicker/js/moment.min.js" type="text/javascript"></script>
<script src="<?= $assets ?>plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('.datetimepicker').datetimepicker({
            format: 'YYYY-MM-DD HH:mm'
        });
    });
</script>
<script>

</script>
<script>
/*$(".content").mouseover(function(){
  $("p").css("background-color", "yellow");
});*/
/*$(window).load(function() {
});*/
    function getsubCategory(){
        console.log('Get Sub Category Inside Function Working:');
          var category=$('#category').val();
          console.log('Category Id:'+category);
          $.ajax({
			type: "get",
			url: '<?=site_url('purchases/get_sub_category');?>',
			data : {category:category},
			dataType: "text",
			success: function(t) {
			    console.log('Sub Category Name:'+t['sub_name']);
			    $('#sub_category').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#sub_category').empty();
    }
    $(window).load(function() {
        console.log('Get Sub Category Inside Function Working:');
          var category=$('#category').val();
          var sub_category=$('#get_sub_category').val();
          console.log('Category Id:'+sub_category);
          $.ajax({
			type: "get",
			url: '<?=site_url('purchases/get_select_sub_category');?>',
			data : {sub_category:sub_category},
			dataType: "text",
			success: function(t) {
			    console.log('Sub Category Name:'+t['sub_name']);
			    $('#sub_category').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#sub_category').empty();
});
</script>

Zerion Mini Shell 1.0