Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Formularz zamówienia przesyki
- */
- $(".postal").mask("99-999");
- $(".nip").mask("999-999-99-99");
- $('.toggles label, .new-radio label:not(.none)').click(function()
- {
- var dataID = $(this).children().attr('name');
- var dataValue = $(this).children().attr('value');
- $('input#' +dataID+ '_data').attr('value',dataValue);
- $(this).trigger('checkPrice');
- if(dataID == 'usluga') {
- var openForm = $(this).children().attr('id');
- $('div#przesylki div#koperta, div#przesylki div#paczka, div#przesylki div#paleta').slideUp();
- $('div#przesylki div#' +openForm).slideDown();
- }
- });
- $('#send input.ajaxCheck').focusout(function()
- {
- $(this).trigger('checkPrice');
- });
- $('article#send').on('checkPrice',function()
- {
- $('#send #price strong').remove();
- var priceBox = $('#send #price span');
- var getPrice = parseFloat($(priceBox).text().replace(",", "."));
- var Usluga = $('input#usluga_data').val();
- var Ubezp = $('#send input[name=ubezp]').val();
- var Pobranie = $('input#pobranie_data').val();
- var getContents = $('form#send').serializeArray();
- $.ajax({
- type: "POST",
- url: "../../assets/price.php",
- data:
- {
- Usluga : Usluga,
- Ubezp : Ubezp,
- Pobranie : Pobranie,
- getContents : getContents
- },
- success: function(theResponse)
- {
- if(theResponse != 0)
- {
- $(priceBox).stop().animate({opacity:.05},400);
- setTimeout(function()
- {
- $(priceBox).stop().text(theResponse.toString().replace(".", ",")).animate({opacity:1},400);
- },400);
- }
- var newPrice = Math.round(((theResponse.toString().replace(",", ".")) - getPrice) * 100) / 100;
- if(theResponse == 0)
- {
- $('#send #price strong').stop().animate({top:'0',opacity:0},0);
- }
- else if(theResponse > getPrice)
- {
- $(priceBox).after('<strong>+ ' +parseFloat(newPrice)+ ' zł</strong>');
- $('#send #price strong').stop().animate({top:'-50px',opacity:0},1000);
- }
- else
- {
- $(priceBox).after('<strong>' +parseFloat(newPrice)+ ' zł</strong>');
- $('#send #price strong').stop().animate({top:'70px',opacity:0},1000);
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement