657 lines
30 KiB
JavaScript
657 lines
30 KiB
JavaScript
|
var csrf_token = jQuery("input[name=_csrf]").val();
|
||
|
|
||
|
var trLink = true;
|
||
|
|
||
|
$(window).bind('beforeunload', function() {
|
||
|
portalUtil.showMainLoading(true);
|
||
|
});
|
||
|
|
||
|
// Disabled right click
|
||
|
$(document).bind('contextmenu', function (e) { e.preventDefault(); });
|
||
|
|
||
|
//Drawback for daterangepicker
|
||
|
/*
|
||
|
* $(function(){ if (!Modernizr.inputtypes.date) { // If not native HTML5
|
||
|
* support, fallback to jQuery datePicker $('input[type=date]').daterangepicker({ //
|
||
|
* Consistent format with the HTML5 picker dateFormat : 'yy-mm-dd' }, //
|
||
|
* Localization $.daterangepicker.regional['it'] ); } });
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Datatable - Row number generation
|
||
|
*
|
||
|
* @param oSettings
|
||
|
* @returns
|
||
|
*/
|
||
|
function processRowNum(oSettings, col) {
|
||
|
var no=oSettings._iDisplayStart;
|
||
|
if( oSettings.aiDisplay.length > 0 ) {
|
||
|
for ( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ ) {
|
||
|
no=no+1;
|
||
|
if(col) {
|
||
|
$('td:eq(' + col +')', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr ).html( no );
|
||
|
} else {
|
||
|
$('td:eq(0)', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr ).html( no );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Datatable - Hides pagination
|
||
|
*
|
||
|
* @param e
|
||
|
* @param id
|
||
|
* @returns
|
||
|
*/
|
||
|
function hidePagination(e, id) {
|
||
|
if (e.api().data().length == 0) {
|
||
|
if($(id + '_paginate')) $(id + '_paginate').css("display", "none");
|
||
|
if($(id + '_info')) $(id + '_info').css("display", "none");
|
||
|
if($(id + '_length')) $(id + '_length').css("display", "none");
|
||
|
} else {
|
||
|
if($(id + '_paginate')) $(id + '_paginate').removeAttr("style");
|
||
|
if($(id + '_info')) $(id + '_info').removeAttr("style");
|
||
|
if($(id + '_length')) $(id + '_length').removeAttr("style");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function dtRequestHeader (request) {
|
||
|
request.setRequestHeader("X-CSRF-Token", csrf_token);
|
||
|
request.setRequestHeader("Content-Type", "application/json;charset=utf-8");
|
||
|
}
|
||
|
|
||
|
function dtDataSrc ( json ) {
|
||
|
var result = jQuery.parseJSON( json );
|
||
|
return result.data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Datatable - Initialize Table Card
|
||
|
*
|
||
|
* @param id
|
||
|
* @returns
|
||
|
*/
|
||
|
function dataTableCardInit(id) {
|
||
|
$(id).dataTable({
|
||
|
dom : '<"top"i>tr<"bottom"p><"clear">',
|
||
|
scrollY: "400px",
|
||
|
scrollCollapse: true,
|
||
|
oLanguage : {
|
||
|
"sEmptyTable" : "No data available",
|
||
|
"sLoadingRecords" : "Please wait - loading...",
|
||
|
"sProcessing" : "DataTables is currently busy",
|
||
|
"sZeroRecords" : "No records to display"
|
||
|
},
|
||
|
fnDrawCallback : function(oSettings) {
|
||
|
hidePagination(this, id);
|
||
|
$(oSettings.nTHead).hide();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Utility
|
||
|
*/
|
||
|
var portalUtil = (function() {
|
||
|
return {
|
||
|
showMainLoading : function(isShow) {
|
||
|
if ((typeof isShow) === "undefined") {
|
||
|
isShow = true;
|
||
|
}
|
||
|
if (isShow) {
|
||
|
$('#overlay_message')
|
||
|
.attr('style', "display: block !important");
|
||
|
} else {
|
||
|
$('#overlay_message').attr('style', "display: none !important");
|
||
|
}
|
||
|
},
|
||
|
showMessage : function(message, type, callback, title) {
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
title : title,
|
||
|
className : "message-modal " + type,
|
||
|
buttons : {
|
||
|
confirm : {
|
||
|
label : "Ok",
|
||
|
className : "btn-secondary",
|
||
|
callback : function() {
|
||
|
if (callback)
|
||
|
callback();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
showPopup : function(title, content, fullscreen) {
|
||
|
if(fullscreen) {
|
||
|
title = title + '<i class="fa fa-arrows-alt cursor-pointer pull-right" onclick="$(\'.customPopup\').toggleClass(\'fullscreen\');" />';
|
||
|
}
|
||
|
bootbox.dialog({
|
||
|
size: "large",
|
||
|
message : content,
|
||
|
title : title,
|
||
|
className : "customPopup",
|
||
|
backdrop: true
|
||
|
});
|
||
|
},
|
||
|
showSuccess : function(message, callback) {
|
||
|
message = message || 'This operation succeeds';
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
title : "<i class=\"fa\"></i> SUCCESS",
|
||
|
className : "message-modal success",
|
||
|
buttons : {
|
||
|
confirm : {
|
||
|
label : "Ok",
|
||
|
className : "btn-success",
|
||
|
callback : function() {
|
||
|
if (callback) callback();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
showError : function(message, callback) {
|
||
|
message = message || 'This operation is failed';
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
/*title : "Error <i class=\"fa\"></i> ",*/
|
||
|
title : "Error",
|
||
|
className : "message-modal error",
|
||
|
buttons : {
|
||
|
confirm : {
|
||
|
label : "Ok",
|
||
|
className : "btn-danger",
|
||
|
callback : function() {
|
||
|
if (callback) callback();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
showWarn : function(message, callback) {
|
||
|
message = message || 'This operation is a warning.';
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
title : "<i class=\"fa\"></i> Warning",
|
||
|
className : "message-modal warning",
|
||
|
buttons : {
|
||
|
confirm : {
|
||
|
label : "Ok",
|
||
|
className : "btn-warning",
|
||
|
callback : function() {
|
||
|
if (callback) callback();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
showInfo : function(message, callback) {
|
||
|
message = message || 'For your information.';
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
title : "<i class=\"fa\"></i> Information",
|
||
|
className : "message-modal info",
|
||
|
buttons : {
|
||
|
confirm : {
|
||
|
label : "Ok",
|
||
|
className : "btn-info",
|
||
|
callback : function() {
|
||
|
if (callback) callback();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
showConfirm : function(message, callback) {
|
||
|
message = message || 'Are you sure?';
|
||
|
bootbox.dialog({
|
||
|
closeButton : false,
|
||
|
message : message,
|
||
|
title : "<i class=\"glyphicon\"></i>"+prop.confModal,
|
||
|
className : "message-modal confirm",
|
||
|
buttons : {
|
||
|
cancel : {
|
||
|
label : prop.btnNo,
|
||
|
className : "btn-default",
|
||
|
callback : function() {
|
||
|
if (callback) callback(false);
|
||
|
}
|
||
|
},
|
||
|
confirm : {
|
||
|
label : prop.btnYes,
|
||
|
className : "btn-info",
|
||
|
callback : function() {
|
||
|
if (callback) callback(true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
})();
|
||
|
|
||
|
function getContextPath() {
|
||
|
return window.contextPath;
|
||
|
}
|
||
|
|
||
|
function langSelect(lang) {
|
||
|
var url = window.location.href;
|
||
|
if (url.indexOf("lang=") > 0) {
|
||
|
url = url.substr(0, url.indexOf('lang=') - 1);
|
||
|
}
|
||
|
var separator = (url.indexOf("?") === -1) ? "?" : "&";
|
||
|
var newParam = separator + "lang=" + lang;
|
||
|
if ((location.hash == null || location.hash == '') && url.indexOf("#") > 0) {
|
||
|
url = url.replace('#', '') + newParam;
|
||
|
}
|
||
|
window.location.href = url + newParam;
|
||
|
}
|
||
|
|
||
|
function redirectURL(value) {
|
||
|
location.href = getContextPath() + value;
|
||
|
}
|
||
|
|
||
|
function refresh() {
|
||
|
location.reload();
|
||
|
}
|
||
|
|
||
|
function numberWithCommas(x) {
|
||
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||
|
}
|
||
|
|
||
|
function validateEmailAddress(email) {
|
||
|
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
||
|
return emailReg.test(email);
|
||
|
}
|
||
|
|
||
|
function starRating(opt) {
|
||
|
if (Number(opt.id) || opt.id == '0') {
|
||
|
return $('<span>' + getStar(opt.id) + " - " + $(opt.element).text() + '</span>');
|
||
|
}
|
||
|
return $('<span>' + $(opt.element).text() + '</span>');
|
||
|
}
|
||
|
|
||
|
function getStar(id) {
|
||
|
var star = {full: 'fa-star', half: 'fa-star-half-full', none: 'fa-star-o'}
|
||
|
var rating = "";
|
||
|
if(id == 0) {
|
||
|
for(let i=0;5 > i;i++) {
|
||
|
rating = rating +'<span class="fa ' + star.none + ' fa-lg"></span>';
|
||
|
}
|
||
|
} else {
|
||
|
for(let i=0;5 > i;i++) {
|
||
|
var rate = '';
|
||
|
if(id > i) {
|
||
|
if(Number.isInteger(Number(id))) {
|
||
|
rate = star.full;
|
||
|
} else {
|
||
|
var number = id > 0 ? Math.floor(id) : Math.ceil(id);
|
||
|
if(number > i ) {
|
||
|
rate = star.full;
|
||
|
} else {
|
||
|
rate = star.half;
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
rate = star.none;
|
||
|
}
|
||
|
rating = rating +'<span class="fa ' + rate +' fa-lg"></span>';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return rating;
|
||
|
}
|
||
|
|
||
|
function documentPopup(url, title, type, method) {
|
||
|
portalUtil.showMainLoading(true);
|
||
|
setTimeout(
|
||
|
function() {
|
||
|
var inputUrl = getContextPath();
|
||
|
inputUrl = inputUrl + "/" + url
|
||
|
inputUrl = encodeURI(inputUrl);
|
||
|
$.ajax({
|
||
|
async : false,
|
||
|
global : false,
|
||
|
headers : {
|
||
|
'X-CSRF-Token' : csrf_token
|
||
|
},
|
||
|
type : "GET",
|
||
|
action : 'xhttp',
|
||
|
url : inputUrl,
|
||
|
success : function(data) {
|
||
|
var doc = data;
|
||
|
console.log(doc);
|
||
|
var srcObj = getContextPath() + "/webjars/adminwrap/img/no_image.jpg";
|
||
|
var mimeType = "image/png";
|
||
|
if (doc.content != undefined) {
|
||
|
srcObj = 'data:' + doc.contentType + ';base64,' + doc.content;
|
||
|
mimeType = doc.contentType;
|
||
|
} else if (doc.reportBytes != undefined) {
|
||
|
srcObj = 'data:' + doc.mimeType + ';base64,' + doc.reportBytes;
|
||
|
mimeType = doc.mimeType;
|
||
|
}
|
||
|
var object = '<div style="background: transparent url(' + getContextPath() + '/webjars/material-pro/img/loading.gif) no-repeat center;height: 100% !important;">'
|
||
|
+ '<object width="100%" height="500px"'
|
||
|
+ ' data="' + srcObj + '" '
|
||
|
+ ' type="' + mimeType+ '" >'
|
||
|
+ '<param value="' + srcObj + '" name="src"/>'
|
||
|
+ '<param value="transparent" name="wmode"/>'
|
||
|
+ '</object></div>';
|
||
|
|
||
|
if(mimeType == 'application/pdf') {
|
||
|
title = '<i class="fa fa-file-pdf-o fa-fw fa2x" /> '+ title;
|
||
|
} else {
|
||
|
title = '<i class="fa fa-file-image-o fa-fw fa2x" /> '+ title;
|
||
|
}
|
||
|
portalUtil.showPopup(title, object, true)
|
||
|
}
|
||
|
}).done(function() {
|
||
|
portalUtil.showMainLoading(false);
|
||
|
});
|
||
|
}, 1000);
|
||
|
|
||
|
}
|
||
|
|
||
|
var userAgent = navigator.userAgent.toLowerCase(),
|
||
|
initialDate = new Date(),
|
||
|
|
||
|
$document = $(document),
|
||
|
$window = $(window),
|
||
|
$html = $("html"),
|
||
|
|
||
|
isDesktop = $html.hasClass("desktop"),
|
||
|
isIE = userAgent.indexOf("msie") != -1 ? parseInt(userAgent.split("msie")[1]) : userAgent.indexOf("trident") != -1 ? 11 : userAgent.indexOf("edge") != -1 ? 12 : false,
|
||
|
isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
|
||
|
isTouch = "ontouchstart" in window,
|
||
|
onloadCaptchaCallback,
|
||
|
plugins = {
|
||
|
pointerEvents: isIE < 11 ? "js/pointer-events.min.js" : false,
|
||
|
bootstrapTooltip: $("[data-toggle='tooltip']"),
|
||
|
bootstrapModalDialog: $('.modal'),
|
||
|
bootstrapTabs: $(".tabs-custom-init"),
|
||
|
rdNavbar: $(".rd-navbar"),
|
||
|
rdParallax: $(".rd-parallax"),
|
||
|
rdGoogleMaps: $(".rd-google-map"),
|
||
|
rdMailForm: $(".rd-mailform"),
|
||
|
rdInputLabel: $(".form-label"),
|
||
|
regula: $("[data-constraints]"),
|
||
|
owl: $(".owl-carousel"),
|
||
|
swiper: $(".swiper-slider"),
|
||
|
search: $(".rd-search"),
|
||
|
searchResults: $('.rd-search-results'),
|
||
|
statefulButton: $('.btn-stateful'),
|
||
|
isotope: $(".isotope"),
|
||
|
popover: $('[data-toggle="popover"]'),
|
||
|
viewAnimate: $('.view-animate'),
|
||
|
photoSwipeGallery: $("[data-photo-swipe-item]"),
|
||
|
radio: $("input[type='radio']"),
|
||
|
checkbox: $("input[type='checkbox']"),
|
||
|
customToggle: $("[data-custom-toggle]"),
|
||
|
facebookWidget: $('#fb-root'),
|
||
|
counter: $(".counter"),
|
||
|
progressLinear: $(".progress-linear"),
|
||
|
circleProgress: $(".progress-bar-circle"),
|
||
|
dateCountdown: $('.DateCountdown'),
|
||
|
pageLoader: $(".page-loader"),
|
||
|
captcha: $('.recaptcha'),
|
||
|
scroller: $(".scroll-wrap"),
|
||
|
flickrfeed: $(".flickr"),
|
||
|
stepper: $("input[type='number']"),
|
||
|
selectFilter: $("select"),
|
||
|
slick: $('.slick-slider'),
|
||
|
twitterfeed: $(".twitter"),
|
||
|
eventPost: $(".event-post-variant-1")
|
||
|
};
|
||
|
|
||
|
component = {
|
||
|
initSelect: function(){
|
||
|
$("select").each(function() {
|
||
|
var select = $(this);
|
||
|
select.select2({
|
||
|
allowClear: true,
|
||
|
placeholder: "",
|
||
|
theme: "bootstrap"
|
||
|
}).next().addClass(select.attr("class").match(/(input-sm)|(input-lg)|($)/i).toString().replace(new RegExp(",", 'g'), " "));
|
||
|
select.parent().addClass("bmd-form-group");
|
||
|
select.on("select2:open", function (e) { $(this).parent().addClass("is-focused"); });
|
||
|
select.on("select2:close", function (e) {
|
||
|
$(this).parent().removeClass("is-focused");
|
||
|
if($(this).val()) $(this).parent().addClass("is-filled has-success");
|
||
|
else $(this).parent().removeClass("is-filled has-success");
|
||
|
});
|
||
|
select.on("select2:select", function (e) { });
|
||
|
select.on("select2:unselect", function (e) { $(this).parent().removeClass("is-focused");});
|
||
|
});
|
||
|
},
|
||
|
initDatePicker: function() {
|
||
|
$('.datepicker').each(function() {
|
||
|
var datepicker = $(this);
|
||
|
datepicker.on('blur', function(e) {
|
||
|
var val = $(this).val();
|
||
|
if(val) {
|
||
|
$(this).parent().addClass("is-filled");
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
initIntlContact: function() {
|
||
|
/* Mobile International Input Initialization */
|
||
|
$(".input-contact").each (function () {
|
||
|
var contact = $(this);
|
||
|
var hiddenInput = contact.attr("name");
|
||
|
//contact.removeAttr("name");
|
||
|
var initialCountry = contact.attr('data-init-country');
|
||
|
if(initialCountry == undefined) {
|
||
|
initialCountry = "my";
|
||
|
}
|
||
|
contact.intlTelInput({
|
||
|
// allowDropdown: false,
|
||
|
// autoHideDialCode: false,
|
||
|
autoPlaceholder: "off",
|
||
|
// dropdownContainer: "body",
|
||
|
// excludeCountries: ["us"],
|
||
|
formatOnDisplay: true,
|
||
|
geoIpLookup: function(callback) {
|
||
|
$.get("http://ipinfo.io", function() {}, "jsonp").always(function(resp) {
|
||
|
var countryCode = (resp && resp.country) ? resp.country : "";
|
||
|
callback(countryCode);
|
||
|
});
|
||
|
},
|
||
|
//hiddenInput: hiddenInput,
|
||
|
initialCountry: initialCountry,
|
||
|
// nationalMode: false,
|
||
|
// onlyCountries: ['us', 'my'],
|
||
|
//placeholderNumberType: "MOBILE",
|
||
|
preferredCountries: ['my', 'bd'],
|
||
|
separateDialCode: true,
|
||
|
utilsScript: getContextPath() + "/webjars/adminwrap/js/plugins/jquery.intl-tel/js/utils.js"
|
||
|
});
|
||
|
var val = contact.val();
|
||
|
if(!val) contact.prev("div").css("display", "none");
|
||
|
contact.blur(function(e) {
|
||
|
var val = $(this).intlTelInput("getNumber");
|
||
|
var relatedTarget = e.originalEvent ? e.originalEvent.relatedTarget : '';
|
||
|
if(relatedTarget) {
|
||
|
var isFlag = $(relatedTarget).hasClass('iti__selected-flag');
|
||
|
if(!val && !isFlag) $(this).prev("div").css("display", "none");
|
||
|
}
|
||
|
});
|
||
|
contact.focus(function(e) {
|
||
|
var val = $(this).intlTelInput("getNumber");
|
||
|
var relatedTarget = e.originalEvent.relatedTarget;
|
||
|
var isFlag = $(relatedTarget).hasClass('iti__selected-flag');
|
||
|
if(!val) $(this).prev("div").css("display", "");
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
initFile: function() {
|
||
|
/**
|
||
|
* Initialize component to load lazily
|
||
|
*/
|
||
|
$(".fileupload-img-thumbnail-view").lazy({
|
||
|
placeholder: "data:image/gif;base64,R0lGODlhZABkAPQAAP///yR2/53C/n2t/lKS/leW/nKn/jyE/jN//kmN/myi/mWe/pC5/pe9/kKJ/iR2/4m1/l6a/ix7/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJBwAAACwAAAAAZABkAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zfMgoDw0csAgSEh/JBEBifucRymYBaaYzpdHjtuhba5cJLXoHDj3HZBykkIpDWAP0YrHsDiV5faB3CB3c8EHuFdisNDlMHTi4NEI2CJwWFewQuAwtBMAIKQZGSJAmVelVGEAaeXK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jTi+wMCKMs5TQAQO+iCPAQme00AEP/4IIw0DZLVAkLA0kGQBBajGQ5MLKIDiMUcmGYGVO0CQZXvnCIAkkFOsYQCH0XQVAwP+sRlgVvssadU8+6Cp3zz66JmfNBFE8EeMKrqZ46GIJqrooi6EAAAh+QQJBwAAACwAAAAAZABkAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv/0Baw2BoBI88g2N5MCCfNgZz6WBArzEl1dHEeluGw9Sh+JpTg+1y8GpABGdWQxFZWF0L7nLhEhAOgBFwcScNCYcOCXctAwsRbC5/gIGEJwuIh3xADJOdg5UjEQmJowlBYZ2AEKAkeZgFQZypB0asIgyYCatBCakEtiQMBQkFu0GGkwSfwGYQBovM0dLT1NXW19jZ2ts+AgYK
|
||
|
effect: "fadeIn",
|
||
|
effectTime: 2000,
|
||
|
});
|
||
|
|
||
|
// FileInput
|
||
|
$('.form-file-simple .inputFileVisible').click(function() {
|
||
|
$(this).siblings('.inputFileHidden').trigger('click');
|
||
|
});
|
||
|
|
||
|
$('.form-file-simple .inputFileHidden').change(function() {
|
||
|
var filename = $(this).val().replace(/C:\\fakepath\\/i, '');
|
||
|
$(this).siblings('.inputFileVisible').val(filename);
|
||
|
});
|
||
|
|
||
|
$('.form-file-multiple .inputFileVisible, .form-file-multiple .input-group-btn').click(function() {
|
||
|
$(this).parent().parent().find('.inputFileHidden').trigger('click');
|
||
|
$(this).parent().parent().addClass('is-focused');
|
||
|
});
|
||
|
|
||
|
$('.form-file-multiple .inputFileVisible, .form-file-multiple .input-group-btn').blur(function() {
|
||
|
if($(this).val()) $(this).parent().parent().addClass('is-filled');
|
||
|
else $(this).parent().parent().removeClass('is-filled');
|
||
|
})
|
||
|
|
||
|
$('.form-file-multiple .inputFileHidden').change(function() {
|
||
|
var names = '';
|
||
|
for (var i = 0; i < $(this).get(0).files.length; ++i) {
|
||
|
if (i < $(this).get(0).files.length - 1) {
|
||
|
names += $(this).get(0).files.item(i).name + ',';
|
||
|
} else {
|
||
|
names += $(this).get(0).files.item(i).name;
|
||
|
}
|
||
|
}
|
||
|
$(this).siblings('.input-group').find('.inputFileVisible').val(names);
|
||
|
});
|
||
|
|
||
|
$('.form-file-multiple .btn').on('focus', function() {
|
||
|
$(this).parent().siblings().trigger('focus');
|
||
|
});
|
||
|
|
||
|
$('.form-file-multiple .btn').on('focusout', function() {
|
||
|
$(this).parent().siblings().trigger('focusout');
|
||
|
});
|
||
|
},
|
||
|
initWidgetTool: function() {
|
||
|
/* Widget Toggle*/
|
||
|
$('.widget .tools').each (function (i) {
|
||
|
var accordion = $(this)
|
||
|
, toggle = accordion.find ('.widget-toggle')
|
||
|
, activePanel = accordion.find ('.widget-body').parent ()
|
||
|
activePanel.addClass ('show')
|
||
|
toggle.on ('click', function (e) {
|
||
|
var panel = $(this).parents ('.widget .shell').children(".widget-body");
|
||
|
var panelfooter = $(this).parents ('.widget .shell').children(".widget-footer");
|
||
|
if(panel.is(":hidden")) {
|
||
|
panel.show()
|
||
|
if(panelfooter.length != 0) panelfooter.show()
|
||
|
toggle.html('<i class="fa fa-chevron-up"></i>')
|
||
|
} else {
|
||
|
panel.hide();
|
||
|
if(panelfooter.length != 0) panelfooter.hide()
|
||
|
toggle.html('<i class="fa fa-chevron-down"></i>')
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
action = {
|
||
|
btnGroupOpen: '<div class="btn-group btn-group-sm" role="group">',
|
||
|
closeDiv: '</div>',
|
||
|
viewButton: '<button type="button" class="btn btn-sm btn-info view" data-toggle="tooltip" data-placement="left" title="View" >' +
|
||
|
'<i class="material-icons">keyboard_arrow_right</i></button>',
|
||
|
viewIconButton: '<button type="button" class="btn btn-sm btn-info btn-just-icon view" data-toggle="tooltip" data-placement="left" title="View" >' +
|
||
|
'<i class="material-icons">keyboard_arrow_right</i></button>',
|
||
|
editButton: '<button type="button" class="btn btn-sm btn-success edit" data-toggle="tooltip" data-placement="left" title="Edit" >' +
|
||
|
' <i class="material-icons">edit</i></button>',
|
||
|
abortButton: '<button type="button" class="btn btn-sm btn-danger deactivate" data-toggle="tooltip" data-placement="left" title="Abort" >' +
|
||
|
'<i class="material-icons">close</i></button>',
|
||
|
deactivateButton: '<button type="button" class="btn btn-sm btn-danger deactivate" data-toggle="tooltip" data-placement="left" title="Deactivate" >' +
|
||
|
'<i class="material-icons">close</i></button>',
|
||
|
btnDropdown: '<button type="button" class="btn btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" area-expended="false">' + '<i class="material-icon">arrow_drop_down</i></button>',
|
||
|
dropdownMenu: '<div class="dropdown-menu">',
|
||
|
dropdownView: '<a class="dropdown-item view">View</a>',
|
||
|
dropdownEdit: '<a class="dropdown-item edit">Edit</a>',
|
||
|
dropdownAbort: '<a class="dropdown-item deactivate">Abort</a>',
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Initialize All Scripts
|
||
|
*/
|
||
|
$document.ready(function () {
|
||
|
// ==============================================================
|
||
|
//tooltip
|
||
|
// ==============================================================
|
||
|
$(function () {
|
||
|
$('[data-toggle="tooltip"]').tooltip();
|
||
|
});
|
||
|
// ==============================================================
|
||
|
//Popover
|
||
|
// ==============================================================
|
||
|
$(function () {
|
||
|
$('[data-toggle="popover"]').popover();
|
||
|
});
|
||
|
|
||
|
$(document).on('keyup', '.input-amount', function() {
|
||
|
var x = $(this).val();
|
||
|
$(this).val(x.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||
|
});
|
||
|
|
||
|
$(document).on( 'blur', '.input-amount', function() {
|
||
|
var x = $(this).val();
|
||
|
$(this).val(x.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||
|
});
|
||
|
|
||
|
$(document).on( 'load', '.input-amount', function() {
|
||
|
var x = $(this).val();
|
||
|
$(this).val(x.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||
|
});
|
||
|
|
||
|
$(document).on('keypress', '.input-amount', function(e) {
|
||
|
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(document).on('keyup','.format-number', function() {
|
||
|
var x = $(this).val();
|
||
|
$(this).val(x.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||
|
});
|
||
|
|
||
|
$(document).on('keypress','.limit-number', function(e) {
|
||
|
if (e.which != 8 && e.which != 0
|
||
|
&& ((e.which < 48 && e.which != 46) || e.which > 57)) {
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(".input-letter").on('keypress', function(e) {
|
||
|
var reg_exp = /^[a-zA-Z\s]*$/;
|
||
|
var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
|
||
|
return reg_exp.test(key);
|
||
|
});
|
||
|
|
||
|
$(".input-letter-number").on('keypress', function(e) {
|
||
|
var reg_exp = /^[A-Za-z0-9]*$/;
|
||
|
var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
|
||
|
return reg_exp.test(key);
|
||
|
});
|
||
|
|
||
|
component.initSelect();
|
||
|
component.initDatePicker();
|
||
|
component.initIntlContact();
|
||
|
component.initWidgetTool();
|
||
|
|
||
|
});
|