var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); function info(title, content) { $('
').html(content).dialog({ modal: true, title: title, resizable: false, buttons: { OK: function() { $( this ).dialog( "close" ); } } }); } function confirmation(content, onConfirm) { $('
').html(content).dialog({ modal: true, title: 'Potwierdzenie', resizable: false, buttons: { OK: function() { onConfirm(); $(this).dialog("close"); }, Anuluj: function() { $(this).dialog("close"); } } }); } function showDialog(element, title, onConfirm) { element.dialog({ modal: true, title: title, resizable: false, buttons: { OK: function() { onConfirm(); $(this).dialog("close"); }, Anuluj: function() { $(this).dialog("close"); } } }); } function blockUI() { if(typeof $.blockUI == "function") { $.blockUI({ message : $("#waiting-dialog"), baseZ : 2000, overlayCSS: { backgroundColor: '#AAA', opacity: .3 }, css: { opacity: 1, border: 'none', backgroundColor: 'none', width: '40%', left: '30%' } }); } } $(document).ready(function () { $.datepicker.regional['pl'] = { closeText: 'Zamknij', prevText: '<Poprzedni', nextText: 'Następny>', currentText: 'Dziś', monthNames: [ 'Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień' ], monthNamesShort: [ 'Sty', 'Lu', 'Mar', 'Kw', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa', 'Lis', 'Gru' ], dayNames: [ 'Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota' ], dayNamesShort: [ 'Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'So' ], dayNamesMin: [ 'N', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So' ], weekHeader: 'Tydz', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: true, yearSuffix: '' }; $.datepicker.setDefaults($.datepicker.regional['pl']); }) $(document).ready(function () { jQuery.validator.addMethod("dateRange", function(value, element, params) { if(this.optional(element)) { return true; } var date1 = $(params[0]).datepicker('getDate'); var date2 = $(params[1]).datepicker('getDate'); return date1 < date2; }, jQuery.format("Data rozpoczęcia powinna być wcześniejsza niż data zakończenia")); }); $(document).ready(function () { $(document).ajaxStop($.unblockUI); $(".form").bind("submit", function() { if($(this).valid()) { blockUI(); } }) $(".text-btn").button(); $(".logout-btn").button({ icons : { primary : "ui-icon-power" } }); $(".my-data-btn").button({ icons : { primary : "ui-icon-contact" } }); $(".add-btn").button({ icons : { primary : "ui-icon-plus" } }); $(".edit-btn").button({ icons : { primary : "ui-icon-pencil" }, disabled: true }); $(".delete-btn").button({ icons : { primary : "ui-icon-trash" }, disabled: true }); $(".submit-btn").button({ icons : { primary : "ui-icon-check" } }); $(".cancel-btn").button({ icons : { primary : "ui-icon-cancel" } }); $(".export-btn").button({ icons : { primary : "ui-icon-print" } }); $(".auto-tabs").tabs(); $(".date-pick").datepicker(); $(".auto-validate").validate(); if(typeof tableToGrid == "function") { tableToGrid(".auto-grid", { rownumbers: true, cmTemplate: { title: false }, height: 400, width : 1022 }); tableToGrid(".auto-height-grid", { rownumbers: true, cmTemplate: { title: false }, height: '100%', width : 1022 }); tableToGrid(".auto-grid-tab", { rownumbers: true, cmTemplate: { title: false }, height: 400, width : 980 }); } });