let base_url = "https://nibrasfincp.azkapersada.com/api/v2/";

let ar={

'relation':{1:'Komisaris',2:'Direksi',3:'Staff',6:'Debitur',7:'Kreditur',8:'Customer',

9:'Supplier',10:'Other'},

'brand':{1:'Samsung',2:'Panasonic',3:'Sharp'}

};





function checkConnection(url) {}



function timeOut(num = 30000) {

  setTimeout(() => {

    app.preloader.hide();

    app.dialog.alert('Operation timed out...', 'Time Out');

  }, num)

}



function promiseTimeout(ms, promise) {

  // Create a promise that rejects in <ms> milliseconds

  let timeout = new Promise((resolve, reject) => {

    let id = setTimeout(() => {

      clearTimeout(id);

      reject('Operation timed out in ' + (ms / 1000) + 's')

    }, ms)

  })

  // Returns a race between our timeout and the passed in promise

  return Promise.race([

    promise,

    timeout

  ])

}



String.prototype.replaceAt = function(index, char) {

  return this.substr(0, index - 1) + char + this.substr(index + char.length);

}



function copyToClipboard(element) {

  var $temp = $("<input>");

  $("body").append($temp);

  $temp.val($(element).text()).select();

  document.execCommand("copy");

  $temp.remove();

}



function init_swiper(Id){      

var swiper1 = app.swiper.create(Id, {  

  pagination: {

    el: '.swiper-pagination',

    type: 'bullets',

  },

    speed: 400,

    spaceBetween: 10,

    slidesPerView: 1,

    autoplay: { delay: 4000, disableOnInteraction:false }

  });

}