Actualización
This commit is contained in:
1 parent
1da7c3f3b9
commit
4aff98e77b
3147 files changed
+320647
No files matched your search
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
function showSliders(maxPercentage, type, defaultValues) {
|
||||
|
||||
defaultValues = defaultValues || "0";
|
||||
|
||||
var sliderCounter = 1;
|
||||
var percentage = 0;
|
||||
var minPercentage = 0;
|
||||
|
||||
$("#selectBox option:selected").each(function() {
|
||||
|
||||
var count = $("#selectBox option:selected").length;
|
||||
|
||||
percentage = maxPercentage / count;
|
||||
percentage = parseInt(percentage);
|
||||
|
||||
verifyMaxPercentage = percentage * count;
|
||||
if (verifyMaxPercentage !== maxPercentage && sliderCounter === 1) {
|
||||
percentage = percentage + (maxPercentage - verifyMaxPercentage);
|
||||
}
|
||||
|
||||
beneficiaryId = $(this).val();
|
||||
beneficiaryName = $(this).text();
|
||||
|
||||
var verify;
|
||||
|
||||
var slidersValue = defaultValues.toString().split(',');
|
||||
|
||||
if (type === 'default') {
|
||||
|
||||
percentage = slidersValue[sliderCounter - 1];
|
||||
percentage = parseInt(percentage);
|
||||
$("#panelSliders").append("<span id=" + beneficiaryId + ">" + beneficiaryName + "</span> - [ <span class='value' >" + percentage + "</span> % ] <div class='panelSliders'></div>");
|
||||
|
||||
} else if (type === 'renew') {
|
||||
|
||||
$("#panelSliders").append("<span id=" + beneficiaryId + " >" + beneficiaryName + "</span> - [ <span class='value' >" + percentage + "</span> % ] <div class='panelSliders'></div>");
|
||||
|
||||
}
|
||||
|
||||
verifyPaypalAccountByBeneficiary(beneficiaryId);
|
||||
|
||||
sliderCounter++;
|
||||
stepSlide = count - 1;
|
||||
|
||||
if (stepSlide === 0) {
|
||||
(type === 'default') ? minPercentage = 0 : minPercentage = 100;
|
||||
(type === 'default') ? stepSlide = 100 : stepSlide = 1;
|
||||
}
|
||||
|
||||
|
||||
$( "#panelSliders .panelSliders" ).slider({
|
||||
value: percentage,
|
||||
min: minPercentage,
|
||||
max: maxPercentage,
|
||||
step: stepSlide,
|
||||
animate: true,
|
||||
slide: function( event, ui ) {
|
||||
|
||||
$(this).prev(".value").text(ui.value);
|
||||
|
||||
var total = 0;
|
||||
var sliders = $( "#panelSliders .panelSliders" );
|
||||
|
||||
sliders.not(this).each(function() {
|
||||
value = $(this).slider("option", "value");
|
||||
total += value;
|
||||
});
|
||||
|
||||
total += ui.value;
|
||||
var delta = 100 - total;
|
||||
|
||||
sliders.not(this).each(function() {
|
||||
|
||||
var t = $(this);
|
||||
value = t.slider("option", "value");
|
||||
|
||||
var newValue = value + (delta/stepSlide);
|
||||
|
||||
if (newValue < 0 || ui.value == 100)
|
||||
newValue = 0;
|
||||
if (newValue > 100)
|
||||
newValue = 100;
|
||||
|
||||
t.prev('.value').text(newValue);
|
||||
t.slider('value', newValue);
|
||||
|
||||
});
|
||||
|
||||
$("[name=\'commissions\']").val(getSlidersValues());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("[name=\'commissions\']").val(getSlidersValues());
|
||||
showCorrectSliderHandler();
|
||||
};
|
||||
|
||||
function getSlidersValues() {
|
||||
var commissions = "";
|
||||
|
||||
$( "#panelSliders .panelSliders" ).each(function() {
|
||||
commissions += $(this).prev(".value").text() + ',';
|
||||
});
|
||||
|
||||
commissions = commissions.substring(0, commissions.length-1);
|
||||
|
||||
return commissions;
|
||||
}
|
||||
|
||||
function showCorrectSliderHandler() {
|
||||
var correctHandler = [];
|
||||
|
||||
$("#panelSliders > span").each(function () {
|
||||
if ($(this).hasClass('value')) {
|
||||
correctHandler.push($(this).text());
|
||||
}
|
||||
});
|
||||
|
||||
var counter = 0;
|
||||
|
||||
$("#panelSliders .panelSliders > span").each(function () {
|
||||
if ($(this).hasClass('ui-slider-handle')) {
|
||||
$(this).css('left', correctHandler[counter]+'%');
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function verifyPaypalAccountByBeneficiary(userId) {
|
||||
|
||||
return $.ajax({
|
||||
data: 'id='+userId,
|
||||
url: 'buycourses.ajax.php?a=verifyPaypal',
|
||||
type: 'POST',
|
||||
success: function(response) {
|
||||
$("#"+userId).append(' '+response);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d.call(c,a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'></div></div></div></div></div>",header:"<div class='modal-header'><h4 class='modal-title'></h4></div>",footer:"<div class='modal-footer'></div>",closeButton:"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>×</button>",form:"<form class='bootbox-form'></form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",textarea:"<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'></select>",checkbox:"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",date:"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",time:"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",number:"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",password:"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback.call(this):!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,!1)},a.buttons.confirm.callback=function(){return a.callback.call(this,!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback.call(this,c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!b.isArray(k))throw new Error("Please pass an array of input options");if(!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new
Line truncated
|
||||
Reference in new issue
Block a user