ok

Mini Shell

Direktori : /home2/selectio/public_html/mm-tailor-billing/themes/default/views/customers/
Upload File :
Current File : /home2/selectio/public_html/mm-tailor-billing/themes/default/views/customers/index.php

<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); ?>

<script type="text/javascript">
    $(document).ready(function() {

/*if(isset($_GET['cus'])){
    $v .= "&customer=".$_GET['cus'];
}*/
        var table = $('#CuData').DataTable({

            'ajax' : { url: '<?=site_url('customers/get_customers');?>', type: 'POST', "data": function ( d ) {
                d.<?=$this->security->get_csrf_token_name();?> = "<?=$this->security->get_csrf_hash()?>";
            }},
            "buttons": [
            { extend: 'copyHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'excelHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'csvHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': false,
            exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'colvis', text: 'Columns'},
            ],
            
            "pageLength": 25,
            
            "columns": [
            { "data": "id", "visible": false },
            { "data": "name" },
            { "data": "phone", "className": "text-center"},
            { "data": "cf2", "className": "text-center"},
            { "data": "customer_balance", "searchable": false, "render": balance},
            { "data": "DC", "searchable": false },
            { "data": "Clone", "searchable": false },
            { "data": "DC Count", "searchable": false },
            { "data": "Actions", "searchable": false, "orderable": false }
            ]

        });

        $('#search_table').on( 'keyup change', function (e) {
            var code = (e.keyCode ? e.keyCode : e.which);
           if (((code == 13 && table.search() !== this.value) || (table.search() !== '' && this.value === ''))) {
                table.search( this.value ).draw();
           }
        });
        
        
        <?php if(isset($_GET['cus'])){ ?>
        var search_key=$('#search_table').val();
            table.search(search_key).draw();
        <?php } ?>
        
        

    });
    
    /*function balance(c) {
            var no_amount = 'NULL';
            if(c == "0.00"){
                return "<div class='text-center'><span class='tip btn btn-info btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-inr'></i> Balance: "+c+"</span></div>";
            }else{
                 return "<div class='text-center'><span class='tip btn btn-danger btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-inr'></i> Balance: "+c+"</span></div>";
            }
        }*/
        
    function balance(c) {
            var no_amount = 'NULL';
            if(c == "0.00"){
                return "<div class='text-center'><span class='tip btn btn-info btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'>"+c+"</span></div>";
            }else{
                 return "<div class='text-center'><span class='tip btn btn-danger btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'>"+c+"</span></div>";
            }
    }
</script>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <a href="customers/add" class="btn btn-success btn-sm pull-right"><i class="fa fa-user" aria-hidden="true"></i>  Add Customers</a>
                    <h3 class="box-title"><?= lang('list_results'); ?></h3>
                </div>
                <div class="box-body">
                    <div class="table-responsive">
                        <table id="CuData" class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr>
                                    <td colspan="8" class="p0"><input type="text" class="form-control b0" name="search_table" value="<?php if(isset($_GET['cus'])){ echo $_GET['cus'];}?>" id="search_table" placeholder="<?= lang('type_hit_enter'); ?>" style="width:100%;"></td>
                                </tr>
                                <tr>
                                    <th style="max-width:30px;"><?= lang("id"); ?></th>
                                    <th><?= lang("name"); ?></th>
                                    <th><?= lang("phone"); ?></th>
                                    <th><?= lang("additional_phone_no"); ?></th>
                                    <th>Customer&nbsp;Balance&nbsp;Amount</th>
                                    <th>Last&nbsp;DC&nbsp;Number</th>
                                    <th>DC&nbsp;History</th>
                                    <th>Total&nbsp;DC&nbsp;Count</th>
                                    <th style="width: 100px;"><?= lang("actions"); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="8" class="dataTables_empty"><?= lang('loading_data_from_server') ?></td>
                                </tr>
                            </tbody>
                            <tfoot>
                                
                            </tfoot>
                        </table>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- Clone Details Starts Here -->
<div class="modal" data-easein="flipYIn" id="customerCloneSales" tabindex="-1" role="dialog" aria-labelledby="cModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="opacity: 1;display: block;width: 60%;">
        <div class="modal-content">
            <div class="modal-header modal-primary">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
                <h4 class="modal-title" id="cModalLabel">
                    Customer Sales History List
                </h4>
            </div>
            <div class="modal-body">
                <div id="c-alert" class="alert alert-danger" style="display:none;"></div>
                <div class="row">
                    <div class="col-xs-12">
                        <div id="clone_details"></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6"></div>
                    <div class="col-xs-6"></div>
                </div>

            </div>
            <div class="modal-footer" style="margin-top:0;">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal"> <?=lang('close')?> </button>
            </div>
        </div>
    </div>
</div>
<!-- Clone Details Ends Here -->

<script type="text/javascript">
    $(function () {
        $("#clone").click(function () {
            
            var customer_cus_id=$('#spos_customer').val();
            console.log('customer id:'+customer_cus_id);
            
            console.log('customerDetails inside Function Working:');
            var customer_id=$('#spos_customer').val();
            console.log('Customer Id:'+customer_id);
            $.ajax({
			type: "get",
			url: base_url + "pos/saleHistoryByCustomers",
			data : {customer_id:customer_id},
			dataType: "json",
			success: function(t) {
			    console.log('response:'+t['customer_name']);
			    console.log('response:'+t['customer_phone_no']);
			}
		    });
		    $.ajax({
			type: "get",
			url: '<?=site_url('pos/get_all_sale_items');?>',
			data : {customer_id:customer_id},
			dataType: "text",
			success: function(t) {
			    console.log('response:'+t['customer_name']);
			    $("#customerCloneSales").modal("show");
			    $('#clone_details').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#clone_details').empty();
        });
    });
</script>
<script type="text/javascript">
    $(document).ready(function() {
        $(document).on('click', '.clone', function() {
            console.log('CustomerDetails Inside Function Working:');
            /*alert(this.id); 
            alert($(this).attr('id'));*/
            var customer_id = $(this).attr('id');
            console.log(customer_id);

		    $.ajax({
			type: "get",
			url: '<?=site_url('customers/get_all_sale_items');?>',
			data : {customer_id:customer_id},
			dataType: "text",
			success: function(t) {
			    $("#customerCloneSales").modal("show");
			    $('#clone_details').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#clone_details').empty();
        });
    });
</script>
<style>
    tbody{
        font-size: 18px;
        font-weight: 900;
    }
</style>

Zerion Mini Shell 1.0