File: /home/awaldron/www/archive/teampay/js/custom.js
/* Admin sidebar starts */
$(document).ready(function(){
$(window).resize(function()
{
if($(window).width() >= 991){
$(".sidey").slideDown(350);
}
});
});
$(document).ready(function(){
$(".has_submenu > a").click(function(e){
e.preventDefault();
var menu_li = $(this).parent("li");
var menu_ul = $(this).next("ul");
if(menu_li.hasClass("open")){
menu_ul.slideUp(350);
menu_li.removeClass("open")
}
else{
$(".nav > li > ul").slideUp(350);
$(".nav > li").removeClass("open");
menu_ul.slideDown(350);
menu_li.addClass("open");
}
});
});
$(document).ready(function(){
$(".sidebar-dropdown a").on('click',function(e){
e.preventDefault();
if(!$(this).hasClass("dropy")) {
// hide any open menus and remove all other classes
$(".sidey").slideUp(350);
$(".sidebar-dropdown a").removeClass("dropy");
// open our new menu and add the dropy class
$(".sidey").slideDown(350);
$(this).addClass("dropy");
}
else if($(this).hasClass("dropy")) {
$(this).removeClass("dropy");
$(".sidey").slideUp(350);
}
});
});
/* Admin sidebar navigation ends */
/* ********************************************************** */
/* ************************************** */
/* Progressbar animation starts */
setTimeout(function(){
$('.progress-animated .progress-bar').each(function() {
var me = $(this);
var perc = me.attr("data-percentage");
//TODO: left and right text handling
var current_perc = 0;
var progress = setInterval(function() {
if (current_perc>=perc) {
clearInterval(progress);
} else {
current_perc +=1;
me.css('width', (current_perc)+'%');
}
me.text((current_perc)+'%');
}, 25);
});
},125);
/* Progressbar animation ends */
/* ************************************** */
/* Slider starts */
$(function() {
// Horizontal slider
$( "#master1, #master2" ).slider({
value: 60,
orientation: "horizontal",
range: "min",
animate: true
});
$( "#master4, #master3" ).slider({
value: 80,
orientation: "horizontal",
range: "min",
animate: true
});
$("#master5, #master6").slider({
range: true,
min: 0,
max: 400,
values: [ 75, 200 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
// Vertical slider
$( "#eq > span" ).each(function() {
// read initial values from markup and remove that
var value = parseInt( $( this ).text(), 10 );
$( this ).empty().slider({
value: value,
range: "min",
animate: true,
orientation: "vertical"
});
});
});
/* Slider ends */
/* ************************************** */
/* Scroll to Top starts */
$(".totop").hide();
$(function(){
$(window).scroll(function(){
if ($(this).scrollTop()>300)
{
$('.totop').slideDown();
}
else
{
$('.totop').slideUp();
}
});
$('.totop a').click(function (e) {
e.preventDefault();
$('body,html').animate({scrollTop: 0}, 500);
});
});
/* Scroll to top ends */
/* ************************************** */
/* ************************************** */
/* Date and picker starts */
$(function() {
$('#datetimepicker1').datetimepicker({
pickTime: false
});
});
$(function() {
$('#datetimepicker2').datetimepicker({
pickDate: false
});
});
$(function() {
$( "#todaydate" ).datepicker();
});
/* Date and time picker ends */
/* ************************************** */
/* Special Fee Switch */
$('.player_special').change(function() {
if ( $(this).is(':checked') ) {
$(this).closest('.form-group').next('.form-player-fee').css('display','inline-block');
} else {
$(this).closest('.form-group').next('.form-player-fee').css('display','none');
}
});
$('.dtpicker').datepicker();
$('#edit_player_id').change(function() {
var thisId = $(this).val();
var minpay = $('#minpay'+thisId).val();
var owes = $('#playerowes'+thisId).val();
$('#minpay-msg').html(minpay);
$('#minpayment').val(minpay);
$('#playerowes').val(owes);
$('#pay_amt').keyup();
});
$('#pay_amt').keyup(function() {
var thisOwes = $('#playerowes').val();
var thisPayAmt = $(this).val();
var remain = thisOwes - thisPayAmt;
if ((remain < 10) && (remain > 0)) {
$('#badpay, #badpaynote').show();
$('#pay-submit').attr('disabled','disabled');
} else {
$('#badpay, #badpaynote').hide();
$('#pay-submit').removeAttr('disabled');
}
});
$("button[id^=delplayer-]").click(function() {
var delok = confirm('Are you sure you want to delete this player?');
if (delok) {
var thisId = $(this).attr('id').substr(10);
window.location = '/my_teams/delplayer/'+thisId;
}
});
$("button[id^=dupteam-]").click(function() {
var dupok = confirm('Are you sure you duplicate this team for a new season?');
if (dupok) {
var thisId = $(this).attr('id').substr(8);
window.location = '/my_teams/dupteam/'+thisId;
}
});
$("button[id^=arcteam-]").click(function() {
var dupok = confirm('Are you sure you archive this team?');
if (dupok) {
var thisId = $(this).attr('id').substr(8);
window.location = '/my_teams/arcteam/'+thisId;
}
});
$("button[id^=restoreteam-]").click(function() {
var dupok = confirm('Are you sure you want to restore this team to your active team list?');
if (dupok) {
var thisId = $(this).attr('id').substr(12);
window.location = '/my_teams/restoreteam/'+thisId;
}
});
$('.req').prepend('<span><i class="fa fa-asterisk"></i></span> ');
$('.ttip').tooltip();
$('.fphone').mask("(999) 999-9999");