Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //HTML
- <div class="form-group">
- <label class="col-md-4 col-sm-4 col-xs-12 control-label">No. Order Masuk</label>
- <div class="col-md-8 col-sm-8 col-xs-12">
- <select id="id_order_masuk" name="id_order_masuk" data-live-search="true" class="form-control selectpicker" title="-- Pilih No. Order Masuk | Customer --" required="required">
- </select>
- </div>
- </div>
- //AJAX
- function autolistkasir(){
- var time = setTimeout("autolistkasir()", 8000)
- $.ajax({
- url: '<?php echo base_url('Penjualan/realtime_list')?>',
- type: 'AJAX',
- dataType: 'JSON',
- async : false,
- crossOrigin : false,
- cache : false,
- success : function(data){
- console.log(data);
- var html = '';
- var i;
- for (i = 0; i < data.length; i++) {
- html+= '<option value="'+data[i].id_order_masuk+'">'+data[i].id_order_masuk +'|'+ data[i].nama_customer+'</option>';
- }
- $('#id_order_masuk').append(html);
- }
- });
- }
- $(document).ready(function(){
- localStorage.setItem("req_time_kasir", "<?= date('YmdHis'); ?>");
- get_notif_for_kasir();
- //autolistkasir();
- //setInterval(() => {autolistkasir()},3000);
- setInterval(autolistkasir(), 5000)
- })
- //CONTROllER
- $data = $this->penjualan_model->realtime_list();
- echo json_encode($data);
- //MODEL
- $this->db->select('*');
- $this->db->from('tabel_order_masuk');
- $this->db->join('tabel_customer', 'tabel_order_masuk.id_customer = tabel_customer.id_customer', 'left');
- $this->db->join('tabel_perusahaan', 'tabel_customer.id_perusahaan = tabel_perusahaan.id_perusahaan', 'left');
- $this->db->where('tabel_order_masuk.status_order_masuk', 0);
- $this->db->order_by('tanggal_order_masuk', 'desc');
- $this->db->order_by('jam_order_masuk', 'desc');
- $data = $this->db->get();
- return $data->result();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement