Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,25 @@
/**
Cookie consent init
**/
var CookieConsent = function () {
var _init = function () {
$('.mt-cookie-consent-bar').cookieBar({
closeButton : '.mt-cookie-consent-btn'
});
};
return {
init: function () {
_init();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
CookieConsent.init();
});
}

View File

@@ -0,0 +1 @@
var CookieConsent=function(){var n=function(){$(".mt-cookie-consent-bar").cookieBar({closeButton:".mt-cookie-consent-btn"})};return{init:function(){n()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){CookieConsent.init()});

View File

@@ -0,0 +1,304 @@
/***
Wrapper/Helper Class for datagrid based on jQuery Datatable Plugin
***/
var Datatable = function() {
var tableOptions; // main options
var dataTable; // datatable object
var table; // actual table jquery object
var tableContainer; // actual table container object
var tableWrapper; // actual table wrapper jquery object
var tableInitialized = false;
var ajaxParams = {}; // set filter mode
var the;
var countSelectedRecords = function() {
var selected = $('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).size();
var text = tableOptions.dataTable.language.metronicGroupActions;
if (selected > 0) {
$('.table-group-actions > span', tableWrapper).text(text.replace("_TOTAL_", selected));
} else {
$('.table-group-actions > span', tableWrapper).text("");
}
};
return {
//main function to initiate the module
init: function(options) {
if (!$().dataTable) {
return;
}
the = this;
// default settings
options = $.extend(true, {
src: "", // actual table
filterApplyAction: "filter",
filterCancelAction: "filter_cancel",
resetGroupActionInputOnSuccess: true,
loadingMessage: 'Loading...',
dataTable: {
"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r><'table-scrollable't><'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>", // datatable layout
"pageLength": 10, // default records per page
"language": { // language settings
// metronic spesific
"metronicGroupActions": "_TOTAL_ records selected: ",
"metronicAjaxRequestGeneralError": "Could not complete request. Please check your internet connection",
// data tables spesific
"lengthMenu": "<span class='seperator'>|</span>View _MENU_ records",
"info": "<span class='seperator'>|</span>Found total _TOTAL_ records",
"infoEmpty": "No records found to show",
"emptyTable": "No data available in table",
"zeroRecords": "No matching records found",
"paginate": {
"previous": "Prev",
"next": "Next",
"last": "Last",
"first": "First",
"page": "Page",
"pageOf": "of"
}
},
"orderCellsTop": true,
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': false,
'targets': [0]
}],
"pagingType": "bootstrap_extended", // pagination type(bootstrap, bootstrap_full_number or bootstrap_extended)
"autoWidth": false, // disable fixed width and enable fluid table
"processing": false, // enable/disable display message box on record load
"serverSide": true, // enable/disable server side ajax loading
"ajax": { // define ajax settings
"url": "", // ajax URL
"type": "POST", // request type
"timeout": 20000,
"data": function(data) { // add request parameters before submit
$.each(ajaxParams, function(key, value) {
data[key] = value;
});
Metronic.blockUI({
message: tableOptions.loadingMessage,
target: tableContainer,
overlayColor: 'none',
cenrerY: true,
boxed: true
});
},
"dataSrc": function(res) { // Manipulate the data returned from the server
if (res.customActionMessage) {
Metronic.alert({
type: (res.customActionStatus == 'OK' ? 'success' : 'danger'),
icon: (res.customActionStatus == 'OK' ? 'check' : 'warning'),
message: res.customActionMessage,
container: tableWrapper,
place: 'prepend'
});
}
if (res.customActionStatus) {
if (tableOptions.resetGroupActionInputOnSuccess) {
$('.table-group-action-input', tableWrapper).val("");
}
}
if ($('.group-checkable', table).size() === 1) {
$('.group-checkable', table).attr("checked", false);
$.uniform.update($('.group-checkable', table));
}
if (tableOptions.onSuccess) {
tableOptions.onSuccess.call(undefined, the);
}
Metronic.unblockUI(tableContainer);
return res.data;
},
"error": function() { // handle general connection errors
if (tableOptions.onError) {
tableOptions.onError.call(undefined, the);
}
Metronic.alert({
type: 'danger',
icon: 'warning',
message: tableOptions.dataTable.language.metronicAjaxRequestGeneralError,
container: tableWrapper,
place: 'prepend'
});
Metronic.unblockUI(tableContainer);
}
},
"drawCallback": function(oSettings) { // run some code on table redraw
if (tableInitialized === false) { // check if table has been initialized
tableInitialized = true; // set table initialized
table.show(); // display table
}
Metronic.initUniform($('input[type="checkbox"]', table)); // reinitialize uniform checkboxes on each table reload
countSelectedRecords(); // reset selected records indicator
// callback for ajax data load
if (tableOptions.onDataLoad) {
tableOptions.onDataLoad.call(undefined, the);
}
}
}
}, options);
tableOptions = options;
// create table's jquery object
table = $(options.src);
tableContainer = table.parents(".table-container");
// apply the special class that used to restyle the default datatable
var tmp = $.fn.dataTableExt.oStdClasses;
$.fn.dataTableExt.oStdClasses.sWrapper = $.fn.dataTableExt.oStdClasses.sWrapper + " dataTables_extended_wrapper";
$.fn.dataTableExt.oStdClasses.sFilterInput = "form-control input-small input-sm input-inline";
$.fn.dataTableExt.oStdClasses.sLengthSelect = "form-control input-xsmall input-sm input-inline";
// initialize a datatable
dataTable = table.DataTable(options.dataTable);
// revert back to default
$.fn.dataTableExt.oStdClasses.sWrapper = tmp.sWrapper;
$.fn.dataTableExt.oStdClasses.sFilterInput = tmp.sFilterInput;
$.fn.dataTableExt.oStdClasses.sLengthSelect = tmp.sLengthSelect;
// get table wrapper
tableWrapper = table.parents('.dataTables_wrapper');
// build table group actions panel
if ($('.table-actions-wrapper', tableContainer).size() === 1) {
$('.table-group-actions', tableWrapper).html($('.table-actions-wrapper', tableContainer).html()); // place the panel inside the wrapper
$('.table-actions-wrapper', tableContainer).remove(); // remove the template container
}
// handle group checkboxes check/uncheck
$('.group-checkable', table).change(function() {
var set = $('tbody > tr > td:nth-child(1) input[type="checkbox"]', table);
var checked = $(this).is(":checked");
$(set).each(function() {
$(this).attr("checked", checked);
});
$.uniform.update(set);
countSelectedRecords();
});
// handle row's checkbox click
table.on('change', 'tbody > tr > td:nth-child(1) input[type="checkbox"]', function() {
countSelectedRecords();
});
// handle filter submit button click
table.on('click', '.filter-submit', function(e) {
e.preventDefault();
the.submitFilter();
});
// handle filter cancel button click
table.on('click', '.filter-cancel', function(e) {
e.preventDefault();
the.resetFilter();
});
},
submitFilter: function() {
the.setAjaxParam("action", tableOptions.filterApplyAction);
// get all typeable inputs
$('textarea.form-filter, select.form-filter, input.form-filter:not([type="radio"],[type="checkbox"])', table).each(function() {
the.setAjaxParam($(this).attr("name"), $(this).val());
});
// get all checkboxes
$('input.form-filter[type="checkbox"]:checked', table).each(function() {
the.addAjaxParam($(this).attr("name"), $(this).val());
});
// get all radio buttons
$('input.form-filter[type="radio"]:checked', table).each(function() {
the.setAjaxParam($(this).attr("name"), $(this).val());
});
dataTable.ajax.reload();
},
resetFilter: function() {
$('textarea.form-filter, select.form-filter, input.form-filter', table).each(function() {
$(this).val("");
});
$('input.form-filter[type="checkbox"]', table).each(function() {
$(this).attr("checked", false);
});
the.clearAjaxParams();
the.addAjaxParam("action", tableOptions.filterCancelAction);
dataTable.ajax.reload();
},
getSelectedRowsCount: function() {
return $('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).size();
},
getSelectedRows: function() {
var rows = [];
$('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).each(function() {
rows.push($(this).val());
});
return rows;
},
setAjaxParam: function(name, value) {
ajaxParams[name] = value;
},
addAjaxParam: function(name, value) {
if (!ajaxParams[name]) {
ajaxParams[name] = [];
}
skip = false;
for (var i = 0; i < (ajaxParams[name]).length; i++) { // check for duplicates
if (ajaxParams[name][i] === value) {
skip = true;
}
}
if (skip === false) {
ajaxParams[name].push(value);
}
},
clearAjaxParams: function(name, value) {
ajaxParams = {};
},
getDataTable: function() {
return dataTable;
},
getTableWrapper: function() {
return tableWrapper;
},
gettableContainer: function() {
return tableContainer;
},
getTable: function() {
return table;
}
};
};

View File

@@ -0,0 +1 @@
var FormWizard=function(){return{init:function(){function e(e){return e.id?"<img class='flag' src='../../assets/global/img/flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}if(jQuery().bootstrapWizard){$("#country_list").select2({placeholder:"Select",allowClear:!0,formatResult:e,width:"auto",formatSelection:e,escapeMarkup:function(e){return e}});var r=$("#submit_form"),t=$(".alert-danger",r),i=$(".alert-success",r);r.validate({doNotHideMessage:!0,errorElement:"span",errorClass:"help-block help-block-error",focusInvalid:!1,rules:{username:{minlength:5,required:!0},password:{minlength:5,required:!0},rpassword:{minlength:5,required:!0,equalTo:"#submit_form_password"},fullname:{required:!0},email:{required:!0,email:!0},phone:{required:!0},gender:{required:!0},address:{required:!0},city:{required:!0},country:{required:!0},card_name:{required:!0},card_number:{minlength:16,maxlength:16,required:!0},card_cvc:{digits:!0,required:!0,minlength:3,maxlength:4},card_expiry_date:{required:!0},"payment[]":{required:!0,minlength:1}},messages:{"payment[]":{required:"Please select at least one option",minlength:jQuery.validator.format("Please select at least one option")}},errorPlacement:function(e,r){"gender"==r.attr("name")?e.insertAfter("#form_gender_error"):"payment[]"==r.attr("name")?e.insertAfter("#form_payment_error"):e.insertAfter(r)},invalidHandler:function(e,r){i.hide(),t.show(),App.scrollTo(t,-200)},highlight:function(e){$(e).closest(".form-group").removeClass("has-success").addClass("has-error")},unhighlight:function(e){$(e).closest(".form-group").removeClass("has-error")},success:function(e){"gender"==e.attr("for")||"payment[]"==e.attr("for")?(e.closest(".form-group").removeClass("has-error").addClass("has-success"),e.remove()):e.addClass("valid").closest(".form-group").removeClass("has-error").addClass("has-success")},submitHandler:function(e){i.show(),t.hide(),e[0].submit()}});var a=function(){$("#tab4 .form-control-static",r).each(function(){var e=$('[name="'+$(this).attr("data-display")+'"]',r);if(e.is(":radio")&&(e=$('[name="'+$(this).attr("data-display")+'"]:checked',r)),e.is(":text")||e.is("textarea"))$(this).html(e.val());else if(e.is("select"))$(this).html(e.find("option:selected").text());else if(e.is(":radio")&&e.is(":checked"))$(this).html(e.attr("data-title"));else if("payment[]"==$(this).attr("data-display")){var t=[];$('[name="payment[]"]:checked',r).each(function(){t.push($(this).attr("data-title"))}),$(this).html(t.join("<br>"))}})},o=function(e,r,t){var i=r.find("li").length,o=t+1;$(".step-title",$("#form_wizard_1")).text("Step "+(t+1)+" of "+i),jQuery("li",$("#form_wizard_1")).removeClass("done");for(var n=r.find("li"),s=0;t>s;s++)jQuery(n[s]).addClass("done");1==o?$("#form_wizard_1").find(".button-previous").hide():$("#form_wizard_1").find(".button-previous").show(),o>=i?($("#form_wizard_1").find(".button-next").hide(),$("#form_wizard_1").find(".button-submit").show(),a()):($("#form_wizard_1").find(".button-next").show(),$("#form_wizard_1").find(".button-submit").hide()),App.scrollTo($(".page-title"))};$("#form_wizard_1").bootstrapWizard({nextSelector:".button-next",previousSelector:".button-previous",onTabClick:function(e,r,t,i){return!1},onNext:function(e,a,n){return i.hide(),t.hide(),0==r.valid()?!1:void o(e,a,n)},onPrevious:function(e,r,a){i.hide(),t.hide(),o(e,r,a)},onTabShow:function(e,r,t){var i=r.find("li").length,a=t+1,o=a/i*100;$("#form_wizard_1").find(".progress-bar").css({width:o+"%"})}}),$("#form_wizard_1").find(".button-previous").hide(),$("#form_wizard_1 .button-submit").click(function(){alert("Finished! Hope you like it :)")}).hide(),$("#country_list",r).change(function(){r.validate().element($(this))})}}}}();jQuery(document).ready(function(){FormWizard.init()});

View File

@@ -0,0 +1 @@
var FormWizard=function(){return{init:function(){function e(e){return e.id?"<img class='flag' src='../../assets/global/img/flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}if(jQuery().bootstrapWizard){$("#country_list").select2({placeholder:"Select",allowClear:!0,formatResult:e,width:"auto",formatSelection:e,escapeMarkup:function(e){return e}});var r=$("#submit_form"),t=$(".alert-danger",r),i=$(".alert-success",r);r.validate({doNotHideMessage:!0,errorElement:"span",errorClass:"help-block help-block-error",focusInvalid:!1,rules:{username:{minlength:5,required:!0},password:{minlength:5,required:!0},rpassword:{minlength:5,required:!0,equalTo:"#submit_form_password"},fullname:{required:!0},email:{required:!0,email:!0},phone:{required:!0},gender:{required:!0},address:{required:!0},city:{required:!0},country:{required:!0},card_name:{required:!0},card_number:{minlength:16,maxlength:16,required:!0},card_cvc:{digits:!0,required:!0,minlength:3,maxlength:4},card_expiry_date:{required:!0},"payment[]":{required:!0,minlength:1}},messages:{"payment[]":{required:"Please select at least one option",minlength:jQuery.validator.format("Please select at least one option")}},errorPlacement:function(e,r){"gender"==r.attr("name")?e.insertAfter("#form_gender_error"):"payment[]"==r.attr("name")?e.insertAfter("#form_payment_error"):e.insertAfter(r)},invalidHandler:function(e,r){i.hide(),t.show(),App.scrollTo(t,-200)},highlight:function(e){$(e).closest(".form-group").removeClass("has-success").addClass("has-error")},unhighlight:function(e){$(e).closest(".form-group").removeClass("has-error")},success:function(e){"gender"==e.attr("for")||"payment[]"==e.attr("for")?(e.closest(".form-group").removeClass("has-error").addClass("has-success"),e.remove()):e.addClass("valid").closest(".form-group").removeClass("has-error").addClass("has-success")},submitHandler:function(e){i.show(),t.hide(),e[0].submit()}});var a=function(){$("#tab4 .form-control-static",r).each(function(){var e=$('[name="'+$(this).attr("data-display")+'"]',r);if(e.is(":radio")&&(e=$('[name="'+$(this).attr("data-display")+'"]:checked',r)),e.is(":text")||e.is("textarea"))$(this).html(e.val());else if(e.is("select"))$(this).html(e.find("option:selected").text());else if(e.is(":radio")&&e.is(":checked"))$(this).html(e.attr("data-title"));else if("payment[]"==$(this).attr("data-display")){var t=[];$('[name="payment[]"]:checked',r).each(function(){t.push($(this).attr("data-title"))}),$(this).html(t.join("<br>"))}})},o=function(e,r,t){var i=r.find("li").length,o=t+1;$(".step-title",$("#form_wizard_1")).text("Step "+(t+1)+" of "+i),jQuery("li",$("#form_wizard_1")).removeClass("done");for(var n=r.find("li"),s=0;t>s;s++)jQuery(n[s]).addClass("done");1==o?$("#form_wizard_1").find(".button-previous").hide():$("#form_wizard_1").find(".button-previous").show(),o>=i?($("#form_wizard_1").find(".button-next").hide(),$("#form_wizard_1").find(".button-submit").show(),a()):($("#form_wizard_1").find(".button-next").show(),$("#form_wizard_1").find(".button-submit").hide()),App.scrollTo($(".page-title"))};$("#form_wizard_1").bootstrapWizard({nextSelector:".button-next",previousSelector:".button-previous",onTabClick:function(e,r,t,i){return!1},onNext:function(e,a,n){return i.hide(),t.hide(),0==r.valid()?!1:void o(e,a,n)},onPrevious:function(e,r,a){i.hide(),t.hide(),o(e,r,a)},onTabShow:function(e,r,t){var i=r.find("li").length,a=t+1,o=a/i*100;$("#form_wizard_1").find(".progress-bar").css({width:o+"%"})}}),$("#form_wizard_1").find(".button-previous").hide(),$("#form_wizard_1 .button-submit").click(function(){alert("Finished! Hope you like it :)")}).hide(),$("#country_list",r).change(function(){r.validate().element($(this))})}}}}();jQuery(document).ready(function(){FormWizard.init()});

View File

@@ -0,0 +1,972 @@
/**
Core script to handle the entire theme and core functions
**/
var Metronic = function () {
// IE mode
var isRTL = false;
var isIE8 = false;
var isIE9 = false;
var isIE10 = false;
var resizeHandlers = [];
var assetsPath = '/Metronic/assets/';
var globalImgPath = '/Metronic/assets/global/img/';
var globalPluginsPath = '/Metronic/assets/global/plugins/';
var globalCssPath = '/Metronic/assets/global/css/';
// theme layout color set
var brandColors = {
'blue': '#89C4F4',
'red': '#F3565D',
'green': '#1bbc9b',
'purple': '#9b59b6',
'grey': '#95a5a6',
'yellow': '#F8CB00'
};
// initializes main settings
var handleInit = function () {
if ($('body').css('direction') === 'rtl') {
isRTL = true;
}
isIE8 = !!navigator.userAgent.match(/MSIE 8.0/);
isIE9 = !!navigator.userAgent.match(/MSIE 9.0/);
isIE10 = !!navigator.userAgent.match(/MSIE 10.0/);
if (isIE10) {
$('html').addClass('ie10'); // detect IE10 version
}
if (isIE10 || isIE9 || isIE8) {
$('html').addClass('ie'); // detect IE10 version
}
};
// runs callback functions set by Metronic.addResponsiveHandler().
var _runResizeHandlers = function () {
// reinitialize other subscribed elements
for (var i = 0; i < resizeHandlers.length; i++) {
var each = resizeHandlers[i];
each.call();
}
};
// handle the layout reinitialization on window resize
var handleOnResize = function () {
var resize;
if (isIE8) {
var currheight;
$(window).resize(function () {
if (currheight == document.documentElement.clientHeight) {
return; //quite event since only body resized not window.
}
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function () {
_runResizeHandlers();
}, 50); // wait 50ms until window resize finishes.
currheight = document.documentElement.clientHeight; // store last body client height
});
} else {
$(window).resize(function () {
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function () {
_runResizeHandlers();
}, 50); // wait 50ms until window resize finishes.
});
}
};
// Handles portlet tools & actions
var handlePortletTools = function () {
// handle portlet remove
$('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function (e) {
e.preventDefault();
var portlet = $(this).closest(".portlet");
if ($('body').hasClass('page-portlet-fullscreen')) {
$('body').removeClass('page-portlet-fullscreen');
}
portlet.find('.portlet-title .fullscreen').tooltip('destroy');
portlet.find('.portlet-title > .tools > .reload').tooltip('destroy');
portlet.find('.portlet-title > .tools > .remove').tooltip('destroy');
portlet.find('.portlet-title > .tools > .config').tooltip('destroy');
portlet.find('.portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip('destroy');
portlet.remove();
});
// handle portlet fullscreen
$('body').on('click', '.portlet > .portlet-title .fullscreen', function (e) {
e.preventDefault();
var portlet = $(this).closest(".portlet");
if (portlet.hasClass('portlet-fullscreen')) {
$(this).removeClass('on');
portlet.removeClass('portlet-fullscreen');
$('body').removeClass('page-portlet-fullscreen');
portlet.children('.portlet-body').css('height', 'auto');
} else {
var height = Metronic.getViewPort().height -
portlet.children('.portlet-title').outerHeight() -
parseInt(portlet.children('.portlet-body').css('padding-top')) -
parseInt(portlet.children('.portlet-body').css('padding-bottom'));
$(this).addClass('on');
portlet.addClass('portlet-fullscreen');
$('body').addClass('page-portlet-fullscreen');
portlet.children('.portlet-body').css('height', height);
}
});
$('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function (e) {
e.preventDefault();
var el = $(this).closest(".portlet").children(".portlet-body");
var url = $(this).attr("data-url");
var error = $(this).attr("data-error-display");
if (url) {
Metronic.blockUI({
target: el,
animate: true,
overlayColor: 'none'
});
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function (res) {
Metronic.unblockUI(el);
el.html(res);
},
error: function (xhr, ajaxOptions, thrownError) {
Metronic.unblockUI(el);
var msg = 'Error on reloading the content. Please check your connection and try again.';
if (error == "toastr" && toastr) {
toastr.error(msg);
} else if (error == "notific8" && $.notific8) {
$.notific8('zindex', 11500);
$.notific8(msg, {
theme: 'ruby',
life: 3000
});
} else {
alert(msg);
}
}
});
} else {
// for demo purpose
Metronic.blockUI({
target: el,
animate: true,
overlayColor: 'none'
});
window.setTimeout(function () {
Metronic.unblockUI(el);
}, 1000);
}
});
// load ajax data on page init
$('.portlet .portlet-title a.reload[data-load="true"]').click();
$('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function (e) {
e.preventDefault();
var el = $(this).closest(".portlet").children(".portlet-body");
var elchek = $(this).data('idchekbox');
if ($(this).hasClass("collapse")) {
$(this).removeClass("collapse").addClass("expand");
el.slideUp(200);
if ($('#' + elchek)) {
$('#' + elchek).prop("checked", false);
}
} else {
$(this).removeClass("expand").addClass("collapse");
el.slideDown(200);
if ($('#' + elchek)) {
$('#' + elchek).prop("checked", true);
}
}
});
};
// Handles custom checkboxes & radios using jQuery Uniform plugin
var handleUniform = function () {
if (!$().uniform) {
return;
}
// var test = $("input[type=checkbox]:not(.toggle, .md-check, .md-radiobtn, .make-switch, .icheck, .switchmincheck, .overrydecheckbox,#Chk), input[type=radio]:not(.toggle, .md-check, .md-radiobtn, .star, .make-switch, .icheck)");
var test = $("input[type=checkbox].yt-uix-checkbox-on-off,input[type=checkbox].make-switchsd,input[type=checkbox].md-checksd,input[type=checkbox].make-switchsd,input[type=checkbox].md-checksd2, input[type=radio]:not(.toggle, .md-check, .md-radiobtn, .star, .make-switch, .icheck)");
if (test.size() > 0) {
test.each(function () {
if ($(this).parents(".checker").size() === 0) {
$(this).show();
$(this).uniform();
}
});
}
};
// Handlesmaterial design checkboxes
var handleMaterialDesign = function () {
// Material design ckeckbox and radio effects
$('body').on('click', '.md-checkbox > label, .md-radio > label', function () {
var the = $(this);
// find the first span which is our circle/bubble
var el = $(this).children('span:first-child');
// add the bubble class (we do this so it doesnt show on page load)
el.addClass('inc');
// clone it
var newone = el.clone(true);
// add the cloned version before our original
el.before(newone);
// remove the original so that it is ready to run on next click
$("." + el.attr("class") + ":last", the).remove();
});
if ($('body').hasClass('page-md')) {
// Material design click effect
// credit where credit's due; http://thecodeplayer.com/walkthrough/ripple-click-effect-google-material-design
$('body').on('click', 'a.btn, button.btn, input.btn, label.btn', function (e) {
var element, circle, d, x, y;
element = $(this);
if (element.find(".md-click-circle").length == 0) {
element.prepend("<span class='md-click-circle'></span>");
}
circle = element.find(".md-click-circle");
circle.removeClass("md-click-animate");
if (!circle.height() && !circle.width()) {
d = Math.max(element.outerWidth(), element.outerHeight());
circle.css({ height: d, width: d });
}
x = e.pageX - element.offset().left - circle.width() / 2;
y = e.pageY - element.offset().top - circle.height() / 2;
circle.css({ top: y + 'px', left: x + 'px' }).addClass("md-click-animate");
});
}
// Floating labels
var handleInput = function (el) {
if (el.val() != "") {
el.addClass('edited');
} else {
el.removeClass('edited');
}
}
$('body').on('keydown', '.form-md-floating-label > .form-control', function (e) {
handleInput($(this));
});
$('body').on('blur', '.form-md-floating-label > .form-control', function (e) {
handleInput($(this));
});
}
// Handles custom checkboxes & radios using jQuery iCheck plugin
var handleiCheck = function () {
if (!$().iCheck) {
return;
}
$('.icheck').each(function () {
var checkboxClass = $(this).attr('data-checkbox') ? $(this).attr('data-checkbox') : 'icheckbox_minimal-grey';
var radioClass = $(this).attr('data-radio') ? $(this).attr('data-radio') : 'iradio_minimal-grey';
if (checkboxClass.indexOf('_line') > -1 || radioClass.indexOf('_line') > -1) {
$(this).iCheck({
checkboxClass: checkboxClass,
radioClass: radioClass,
insert: '<div class="icheck_line-icon"></div>' + $(this).attr("data-label")
});
} else {
$(this).iCheck({
checkboxClass: checkboxClass,
radioClass: radioClass
});
}
});
};
// Handles Bootstrap switches
var handleBootstrapSwitch = function () {
if (!$().bootstrapSwitch) {
return;
}
$('.make-switch').bootstrapSwitch();
};
// Handles Bootstrap confirmations
var handleBootstrapConfirmation = function () {
if (!$().confirmation) {
return;
}
$('[data-toggle=confirmation]').confirmation({ container: 'body', btnOkClass: 'btn-xs btn-success', btnCancelClass: 'btn-xs btn-danger' });
}
// Handles Bootstrap Accordions.
var handleAccordions = function () {
$('body').on('shown.bs.collapse', '.accordion.scrollable', function (e) {
Metronic.scrollTo($(e.target));
});
};
// Handles Bootstrap Tabs.
var handleTabs = function () {
//activate tab if tab id provided in the URL
if (location.hash) {
var tabid = location.hash.substr(1);
$('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function () {
var tabid = $(this).attr("id");
$('a[href="#' + tabid + '"]').click();
});
$('a[href="#' + tabid + '"]').click();
}
if ($().tabdrop) {
$('.tabbable-tabdrop .nav-pills, .tabbable-tabdrop .nav-tabs').tabdrop({
text: '<i class="fa fa-ellipsis-v"></i>&nbsp;<i class="fa fa-angle-down"></i>'
});
}
};
// Handles Bootstrap Modals.
var handleModals = function () {
// fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal-open class.
$('body').on('hide.bs.modal', function () {
if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') === false) {
$('html').addClass('modal-open');
} else if ($('.modal:visible').size() <= 1) {
$('html').removeClass('modal-open');
}
});
// fix page scrollbars issue
$('body').on('show.bs.modal', '.modal', function () {
if ($(this).hasClass("modal-scroll")) {
$('body').addClass("modal-open-noscroll");
}
});
// fix page scrollbars issue
$('body').on('hide.bs.modal', '.modal', function () {
$('body').removeClass("modal-open-noscroll");
});
// remove ajax content and remove cache on modal closed
$('body').on('hidden.bs.modal', '.modal:not(.modal-cached)', function () {
$(this).removeData('bs.modal');
});
};
// Handles Bootstrap Tooltips.
var handleTooltips = function () {
// global tooltips
$('.tooltips').tooltip();
// portlet tooltips
$('.portlet > .portlet-title .fullscreen').tooltip({
container: 'body',
title: 'Fullscreen'
});
$('.portlet > .portlet-title > .tools > .reload').tooltip({
container: 'body',
title: 'Reload'
});
$('.portlet > .portlet-title > .tools > .remove').tooltip({
container: 'body',
title: 'Remove'
});
$('.portlet > .portlet-title > .tools > .config').tooltip({
container: 'body',
title: 'Settings'
});
$('.portlet > .portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip({
container: 'body',
title: 'Ocultar/Mostrar'
});
};
// Handles Bootstrap Dropdowns
var handleDropdowns = function () {
/*
Hold dropdown on click
*/
$('body').on('click', '.dropdown-menu.hold-on-click', function (e) {
e.stopPropagation();
});
};
var handleAlerts = function () {
$('body').on('click', '[data-close="alert"]', function (e) {
$(this).parent('.alert').hide();
$(this).closest('.note').hide();
e.preventDefault();
});
$('body').on('click', '[data-close="note"]', function (e) {
$(this).closest('.note').hide();
e.preventDefault();
});
$('body').on('click', '[data-remove="note"]', function (e) {
$(this).closest('.note').remove();
e.preventDefault();
});
};
// Handle Hower Dropdowns
var handleDropdownHover = function () {
$('[data-hover="dropdown"]').not('.hover-initialized').each(function () {
$(this).dropdownHover();
$(this).addClass('hover-initialized');
});
};
// Handles Bootstrap Popovers
// last popep popover
var lastPopedPopover;
var handlePopovers = function () {
$('.popovers').popover();
// close last displayed popover
$(document).on('click.bs.popover.data-api', function (e) {
if (lastPopedPopover) {
lastPopedPopover.popover('hide');
}
});
};
// Handles scrollable contents using jQuery SlimScroll plugin.
var handleScrollers = function () {
Metronic.initSlimScroll('.scroller');
};
// Handles Image Preview using jQuery Fancybox plugin
var handleFancybox = function () {
if (!jQuery.fancybox) {
return;
}
if ($(".fancybox-button").size() > 0) {
$(".fancybox-button").fancybox({
groupAttr: 'data-rel',
prevEffect: 'none',
nextEffect: 'none',
closeBtn: true,
helpers: {
title: {
type: 'inside'
}
}
});
}
};
// Fix input placeholder issue for IE8 and IE9
var handleFixInputPlaceholderForIE = function () {
//fix html5 placeholder attribute for ie7 & ie8
if (isIE8 || isIE9) { // ie8 & ie9
// this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
$('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () {
var input = $(this);
if (input.val() === '' && input.attr("placeholder") !== '') {
input.addClass("placeholder").val(input.attr('placeholder'));
}
input.focus(function () {
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
input.blur(function () {
if (input.val() === '' || input.val() == input.attr('placeholder')) {
input.val(input.attr('placeholder'));
}
});
});
}
};
// Handle Select2 Dropdowns
var handleSelect2 = function () {
if ($().select2) {
$('select.select2me').select2({
placeholder: "Select",
allowClear: true
});
}
};
//* END:CORE HANDLERS *//
return {
//main function to initiate the theme
init: function () {
//IMPORTANT!!!: Do not modify the core handlers call order.
//Core handlers
handleInit(); // initialize core variables
handleOnResize(); // set and handle responsive
//UI Component handlers
handleMaterialDesign(); // handle material design
handleUniform(); // hanfle custom radio & checkboxes
handleiCheck(); // handles custom icheck radio and checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleScrollers(); // handles slim scrolling contents
handleFancybox(); // handle fancy box
handleSelect2(); // handle custom Select2 dropdowns
handlePortletTools(); // handles portlet action bar functionality(refresh, configure, toggle, remove)
handleAlerts(); //handle closabled alerts
handleDropdowns(); // handle dropdowns
handleTabs(); // handle tabs
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleModals(); // handle modals
handleBootstrapConfirmation(); // handle bootstrap confirmations
// Hacks
handleFixInputPlaceholderForIE(); //IE8 & IE9 input placeholder issue fix
},
//main function to initiate core javascript after ajax complete
initAjax: function () {
handleUniform(); // handles custom radio & checkboxes
handleiCheck(); // handles custom icheck radio and checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleDropdownHover(); // handles dropdown hover
handleScrollers(); // handles slim scrolling contents
handleSelect2(); // handle custom Select2 dropdowns
handleFancybox(); // handle fancy box
handleDropdowns(); // handle dropdowns
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleBootstrapConfirmation(); // handle bootstrap confirmations
},
//init main components
initComponents: function () {
this.initAjax();
},
//public function to remember last opened popover that needs to be closed on click
setLastPopedPopover: function (el) {
lastPopedPopover = el;
},
//public function to add callback a function which will be called on window resize
addResizeHandler: function (func) {
resizeHandlers.push(func);
},
//public functon to call _runresizeHandlers
runResizeHandlers: function () {
_runResizeHandlers();
},
// wrMetronicer function to scroll(focus) to an element
scrollTo: function (el, offeset) {
var pos = (el && el.size() > 0) ? el.offset().top : 0;
if (el) {
if ($('body').hasClass('page-header-fixed')) {
pos = pos - $('.page-header').height();
}
pos = pos + (offeset ? offeset : -1 * el.height());
}
$('html,body').animate({
scrollTop: pos
}, 'slow');
},
initSlimScroll: function (el) {
$(el).each(function () {
if ($(this).attr("data-initialized")) {
return; // exit
}
var height;
if ($(this).attr("data-height")) {
height = $(this).attr("data-height");
} else {
height = $(this).css('height');
}
$(this).slimScroll({
allowPageScroll: true, // allow page scroll when the element scroll is ended
size: '7px',
color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'),
wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'),
position: isRTL ? 'left' : 'right',
height: height,
alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
disableFadeOut: true
});
$(this).attr("data-initialized", "1");
});
},
destroySlimScroll: function (el) {
$(el).each(function () {
if ($(this).attr("data-initialized") === "1") { // destroy existing instance before updating the height
$(this).removeAttr("data-initialized");
$(this).removeAttr("style");
var attrList = {};
// store the custom attribures so later we will reassign.
if ($(this).attr("data-handle-color")) {
attrList["data-handle-color"] = $(this).attr("data-handle-color");
}
if ($(this).attr("data-wrapper-class")) {
attrList["data-wrapper-class"] = $(this).attr("data-wrapper-class");
}
if ($(this).attr("data-rail-color")) {
attrList["data-rail-color"] = $(this).attr("data-rail-color");
}
if ($(this).attr("data-always-visible")) {
attrList["data-always-visible"] = $(this).attr("data-always-visible");
}
if ($(this).attr("data-rail-visible")) {
attrList["data-rail-visible"] = $(this).attr("data-rail-visible");
}
$(this).slimScroll({
wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
destroy: true
});
var the = $(this);
// reassign custom attributes
$.each(attrList, function (key, value) {
the.attr(key, value);
});
}
});
},
// function to scroll to the top
scrollTop: function () {
Metronic.scrollTo();
},
// wrMetronicer function to block element(indicate loading)
blockUI: function (options) {
options = $.extend(true, {}, options);
var html = '';
if (options.animate) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '">' + '<div class="block-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' + '</div>';
} else if (options.iconOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""></div>';
} else if (options.textOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><span>&nbsp;&nbsp;' + (options.message ? options.message : 'LOADING...') + '</span></div>';
} else {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""><span>&nbsp;&nbsp;' + (options.message ? options.message : 'LOADING...') + '</span></div>';
}
if (options.target) { // element blocking
var el = $(options.target);
if (el.height() <= ($(window).height())) {
options.cenrerY = true;
}
el.block({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
centerY: options.cenrerY !== undefined ? options.cenrerY : false,
css: {
top: '10%',
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#555',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
} else { // page blocking
$.blockUI({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
css: {
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#555',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
}
},
// wrMetronicer function to un-block element(finish loading)
unblockUI: function (target) {
if (target) {
$(target).unblock({
onUnblock: function () {
$(target).css('position', '');
$(target).css('zoom', '');
}
});
} else {
$.unblockUI();
}
},
startPageLoading: function (options) {
if (options && options.animate) {
$('.page-spinner-bar').remove();
$('body').append('<div class="page-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>');
} else {
$('.page-loading').remove();
$('body').append('<div class="page-loading"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif"/>&nbsp;&nbsp;<span>' + (options && options.message ? options.message : 'Loading...') + '</span></div>');
}
},
stopPageLoading: function () {
$('.page-loading, .page-spinner-bar').remove();
},
alert: function (options) {
options = $.extend(true, {
container: "", // alerts parent container(by default placed after the page breadcrumbs)
place: "append", // "append" or "prepend" in container
type: 'success', // alert's type
message: "", // alert's message
close: true, // make alert closable
reset: true, // close all previouse alerts first
focus: true, // auto scroll to the alert after shown
closeInSeconds: 0, // auto close after defined seconds
icon: "" // put icon before the message
}, options);
var id = Metronic.getUniqueID("Metronic_alert");
var html = '<div id="' + id + '" class="Metronic-alerts alert alert-' + options.type + ' fade in">' + (options.close ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>' : '') + (options.icon !== "" ? '<i class="fa-lg fa fa-' + options.icon + '"></i> ' : '') + options.message + '</div>';
if (options.reset) {
$('.Metronic-alerts').remove();
}
if (!options.container) {
if ($('body').hasClass("page-container-bg-solid")) {
$('.page-title').after(html);
} else {
if ($('.page-bar').size() > 0) {
$('.page-bar').after(html);
} else {
$('.page-breadcrumb').after(html);
}
}
} else {
if (options.place == "append") {
$(options.container).append(html);
} else {
$(options.container).prepend(html);
}
}
if (options.focus) {
Metronic.scrollTo($('#' + id));
}
if (options.closeInSeconds > 0) {
setTimeout(function () {
$('#' + id).remove();
}, options.closeInSeconds * 1000);
}
return id;
},
// initializes uniform elements
initUniform: function (els) {
if (els) {
$(els).each(function () {
if ($(this).parents(".checker").size() === 0) {
$(this).show();
$(this).uniform();
}
});
} else {
handleUniform();
}
},
//wrMetronicer function to update/sync jquery uniform checkbox & radios
updateUniform: function (els) {
$.uniform.update(els); // update the uniform checkbox & radios UI after the actual input control state changed
},
//public function to initialize the fancybox plugin
initFancybox: function () {
handleFancybox();
},
//public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
getActualVal: function (el) {
el = $(el);
if (el.val() === el.attr("placeholder")) {
return "";
}
return el.val();
},
//public function to get a paremeter by name from URL
getURLParameter: function (paramName) {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return unescape(val[1]);
}
}
return null;
},
// check for device touch support
isTouchDevice: function () {
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
},
// To get the correct viewport width based on http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
getViewPort: function () {
var e = window,
a = 'inner';
if (!('innerWidth' in window)) {
a = 'client';
e = document.documentElement || document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
};
},
getUniqueID: function (prefix) {
return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime());
},
// check IE8 mode
isIE8: function () {
return isIE8;
},
// check IE9 mode
isIE9: function () {
return isIE9;
},
//check RTL mode
isRTL: function () {
return isRTL;
},
// check IE8 mode
isAngularJsApp: function () {
return (typeof angular == 'undefined') ? false : true;
},
getAssetsPath: function () {
return assetsPath;
},
setAssetsPath: function (path) {
assetsPath = path;
},
setGlobalImgPath: function (path) {
globalImgPath = path;
},
getGlobalImgPath: function () {
return assetsPath + globalImgPath;
},
setGlobalPluginsPath: function (path) {
globalPluginsPath = path;
},
getGlobalPluginsPath: function () {
return assetsPath + globalPluginsPath;
},
getGlobalCssPath: function () {
return assetsPath + globalCssPath;
},
// get layout color code by color name
getBrandColor: function (name) {
if (brandColors[name]) {
return brandColors[name];
} else {
return '';
}
},
getResponsiveBreakpoint: function (size) {
// bootstrap responsive breakpoints
var sizes = {
'xs': 480, // extra small
'sm': 768, // small
'md': 992, // medium
'lg': 1200 // large
};
return sizes[size] ? sizes[size] : 0;
}
};
}();

View File

@@ -0,0 +1,25 @@
var QuickNav = function () {
return {
init: function () {
if( $('.quick-nav').length > 0 ) {
var stretchyNavs = $('.quick-nav');
stretchyNavs.each(function(){
var stretchyNav = $(this),
stretchyNavTrigger = stretchyNav.find('.quick-nav-trigger');
stretchyNavTrigger.on('click', function(event){
event.preventDefault();
stretchyNav.toggleClass('nav-is-visible');
});
});
$(document).on('click', function(event){
( !$(event.target).is('.quick-nav-trigger') && !$(event.target).is('.quick-nav-trigger span') ) && stretchyNavs.removeClass('nav-is-visible');
});
}
}
};
}();
QuickNav.init(); // init metronic core componets

View File

@@ -0,0 +1 @@
var QuickNav=function(){return{init:function(){if($(".quick-nav").length>0){var i=$(".quick-nav");i.each(function(){var i=$(this),n=i.find(".quick-nav-trigger");n.on("click",function(n){n.preventDefault(),i.toggleClass("nav-is-visible")})}),$(document).on("click",function(n){!$(n.target).is(".quick-nav-trigger")&&!$(n.target).is(".quick-nav-trigger span")&&i.removeClass("nav-is-visible")})}}}}();QuickNav.init();

View File

@@ -0,0 +1,170 @@
/**
Core script to handle the entire theme and core functions
**/
var QuickSidebar = function () {
// Handles quick sidebar toggler
var handleQuickSidebarToggler = function () {
// quick sidebar toggler
$('.dropdown-quick-sidebar-toggler a, .page-quick-sidebar-toggler, .quick-sidebar-toggler').click(function (e) {
$('body').toggleClass('page-quick-sidebar-open');
});
};
// Handles quick sidebar chats
var handleQuickSidebarChat = function () {
var wrapper = $('.page-quick-sidebar-wrapper');
var wrapperChat = wrapper.find('.page-quick-sidebar-chat');
var initChatSlimScroll = function () {
var chatUsers = wrapper.find('.page-quick-sidebar-chat-users');
var chatUsersHeight;
chatUsersHeight = wrapper.height() - wrapper.find('.nav-tabs').outerHeight(true);
// chat user list
App.destroySlimScroll(chatUsers);
chatUsers.attr("data-height", chatUsersHeight);
App.initSlimScroll(chatUsers);
var chatMessages = wrapperChat.find('.page-quick-sidebar-chat-user-messages');
var chatMessagesHeight = chatUsersHeight - wrapperChat.find('.page-quick-sidebar-chat-user-form').outerHeight(true);
chatMessagesHeight = chatMessagesHeight - wrapperChat.find('.page-quick-sidebar-nav').outerHeight(true);
// user chat messages
App.destroySlimScroll(chatMessages);
chatMessages.attr("data-height", chatMessagesHeight);
App.initSlimScroll(chatMessages);
};
initChatSlimScroll();
App.addResizeHandler(initChatSlimScroll); // reinitialize on window resize
wrapper.find('.page-quick-sidebar-chat-users .media-list > .media').click(function () {
wrapperChat.addClass("page-quick-sidebar-content-item-shown");
});
wrapper.find('.page-quick-sidebar-chat-user .page-quick-sidebar-back-to-list').click(function () {
wrapperChat.removeClass("page-quick-sidebar-content-item-shown");
});
var handleChatMessagePost = function (e) {
e.preventDefault();
var chatContainer = wrapperChat.find(".page-quick-sidebar-chat-user-messages");
var input = wrapperChat.find('.page-quick-sidebar-chat-user-form .form-control');
var text = input.val();
if (text.length === 0) {
return;
}
var preparePost = function(dir, time, name, avatar, message) {
var tpl = '';
tpl += '<div class="post '+ dir +'">';
tpl += '<img class="avatar" alt="" src="' + Layout.getLayoutImgPath() + avatar +'.jpg"/>';
tpl += '<div class="message">';
tpl += '<span class="arrow"></span>';
tpl += '<a href="#" class="name">Bob Nilson</a>&nbsp;';
tpl += '<span class="datetime">' + time + '</span>';
tpl += '<span class="body">';
tpl += message;
tpl += '</span>';
tpl += '</div>';
tpl += '</div>';
return tpl;
};
// handle post
var time = new Date();
var message = preparePost('out', (time.getHours() + ':' + time.getMinutes()), "Bob Nilson", 'avatar3', text);
message = $(message);
chatContainer.append(message);
chatContainer.slimScroll({
scrollTo: '1000000px'
});
input.val("");
// simulate reply
setTimeout(function(){
var time = new Date();
var message = preparePost('in', (time.getHours() + ':' + time.getMinutes()), "Ella Wong", 'avatar2', 'Lorem ipsum doloriam nibh...');
message = $(message);
chatContainer.append(message);
chatContainer.slimScroll({
scrollTo: '1000000px'
});
}, 3000);
};
wrapperChat.find('.page-quick-sidebar-chat-user-form .btn').click(handleChatMessagePost);
wrapperChat.find('.page-quick-sidebar-chat-user-form .form-control').keypress(function (e) {
if (e.which == 13) {
handleChatMessagePost(e);
return false;
}
});
};
// Handles quick sidebar tasks
var handleQuickSidebarAlerts = function () {
var wrapper = $('.page-quick-sidebar-wrapper');
var initAlertsSlimScroll = function () {
var alertList = wrapper.find('.page-quick-sidebar-alerts-list');
var alertListHeight;
alertListHeight = wrapper.height() - 80 - wrapper.find('.nav-justified > .nav-tabs').outerHeight();
// alerts list
App.destroySlimScroll(alertList);
alertList.attr("data-height", alertListHeight);
App.initSlimScroll(alertList);
};
initAlertsSlimScroll();
App.addResizeHandler(initAlertsSlimScroll); // reinitialize on window resize
};
// Handles quick sidebar settings
var handleQuickSidebarSettings = function () {
var wrapper = $('.page-quick-sidebar-wrapper');
var initSettingsSlimScroll = function () {
var settingsList = wrapper.find('.page-quick-sidebar-settings-list');
var settingsListHeight;
settingsListHeight = wrapper.height() - 80 - wrapper.find('.nav-justified > .nav-tabs').outerHeight();
// alerts list
App.destroySlimScroll(settingsList);
settingsList.attr("data-height", settingsListHeight);
App.initSlimScroll(settingsList);
};
initSettingsSlimScroll();
App.addResizeHandler(initSettingsSlimScroll); // reinitialize on window resize
};
return {
init: function () {
//layout handlers
handleQuickSidebarToggler(); // handles quick sidebar's toggler
handleQuickSidebarChat(); // handles quick sidebar's chats
handleQuickSidebarAlerts(); // handles quick sidebar's alerts
handleQuickSidebarSettings(); // handles quick sidebar's setting
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
QuickSidebar.init(); // init metronic core componets
});
}

View File

@@ -0,0 +1 @@
var QuickSidebar=function(){var i=function(){$(".dropdown-quick-sidebar-toggler a, .page-quick-sidebar-toggler, .quick-sidebar-toggler").click(function(i){$("body").toggleClass("page-quick-sidebar-open")})},a=function(){var i=$(".page-quick-sidebar-wrapper"),a=i.find(".page-quick-sidebar-chat"),e=function(){var e,t=i.find(".page-quick-sidebar-chat-users");e=i.height()-i.find(".nav-tabs").outerHeight(!0),App.destroySlimScroll(t),t.attr("data-height",e),App.initSlimScroll(t);var r=a.find(".page-quick-sidebar-chat-user-messages"),s=e-a.find(".page-quick-sidebar-chat-user-form").outerHeight(!0);s-=a.find(".page-quick-sidebar-nav").outerHeight(!0),App.destroySlimScroll(r),r.attr("data-height",s),App.initSlimScroll(r)};e(),App.addResizeHandler(e),i.find(".page-quick-sidebar-chat-users .media-list > .media").click(function(){a.addClass("page-quick-sidebar-content-item-shown")}),i.find(".page-quick-sidebar-chat-user .page-quick-sidebar-back-to-list").click(function(){a.removeClass("page-quick-sidebar-content-item-shown")});var t=function(i){i.preventDefault();var e=a.find(".page-quick-sidebar-chat-user-messages"),t=a.find(".page-quick-sidebar-chat-user-form .form-control"),r=t.val();if(0!==r.length){var s=function(i,a,e,t,r){var s="";return s+='<div class="post '+i+'">',s+='<img class="avatar" alt="" src="'+Layout.getLayoutImgPath()+t+'.jpg"/>',s+='<div class="message">',s+='<span class="arrow"></span>',s+='<a href="#" class="name">Bob Nilson</a>&nbsp;',s+='<span class="datetime">'+a+"</span>",s+='<span class="body">',s+=r,s+="</span>",s+="</div>",s+="</div>"},n=new Date,c=s("out",n.getHours()+":"+n.getMinutes(),"Bob Nilson","avatar3",r);c=$(c),e.append(c),e.slimScroll({scrollTo:"1000000px"}),t.val(""),setTimeout(function(){var i=new Date,a=s("in",i.getHours()+":"+i.getMinutes(),"Ella Wong","avatar2","Lorem ipsum doloriam nibh...");a=$(a),e.append(a),e.slimScroll({scrollTo:"1000000px"})},3e3)}};a.find(".page-quick-sidebar-chat-user-form .btn").click(t),a.find(".page-quick-sidebar-chat-user-form .form-control").keypress(function(i){return 13==i.which?(t(i),!1):void 0})},e=function(){var i=$(".page-quick-sidebar-wrapper"),a=function(){var a,e=i.find(".page-quick-sidebar-alerts-list");a=i.height()-80-i.find(".nav-justified > .nav-tabs").outerHeight(),App.destroySlimScroll(e),e.attr("data-height",a),App.initSlimScroll(e)};a(),App.addResizeHandler(a)},t=function(){var i=$(".page-quick-sidebar-wrapper"),a=function(){var a,e=i.find(".page-quick-sidebar-settings-list");a=i.height()-80-i.find(".nav-justified > .nav-tabs").outerHeight(),App.destroySlimScroll(e),e.attr("data-height",a),App.initSlimScroll(e)};a(),App.addResizeHandler(a)};return{init:function(){i(),a(),e(),t()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){QuickSidebar.init()});