You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.5 KiB
144 lines
3.5 KiB
function handleNameForm(data){
|
|
if (data.success){
|
|
var fname = $this.find('#id_first_name').val()
|
|
var lname = $this.find('#id_last_name').val()
|
|
$this.parent().parent().prev().html(fname+' '+lname)
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleHomeForm(data){
|
|
if (data.success){
|
|
var country = $this.find('#id_country option:selected').text();
|
|
var city = $this.find('#id_city option:selected').text();
|
|
|
|
$this.parent().parent().prev();
|
|
$this.parent().parent().prev().prev().find('a').attr('#');
|
|
$this.parent().parent().prev().prev().find('a').html(country);
|
|
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleWorkForm(data){
|
|
if (data.success){
|
|
var position = $this.find('#id_position').val();
|
|
var work = $this.find('#id_work').val();
|
|
|
|
var result = position;
|
|
if (work!=''){
|
|
result = result + ' в ' + work;
|
|
}
|
|
|
|
$this.parent().parent().prev().html(result);
|
|
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleAboutCompanyForm(data){
|
|
if (data.success){
|
|
var about_company = $this.find('#id_about_company').val();
|
|
$this.parent().parent().prev().html(about_company);
|
|
$this.next().click();
|
|
}
|
|
}
|
|
|
|
function handleSocialForm(data){
|
|
if (data.success){
|
|
var fb = $this.find('#id_facebook').val();
|
|
var li = $this.find('#id_linkedin').val();
|
|
var tw = $this.find('#id_twitter').val();
|
|
var vk = $this.find('#id_vk').val();
|
|
|
|
if (fb==''){fb = '#';}
|
|
if (li==''){li = '#';}
|
|
if (tw==''){tw = '#';}
|
|
if (vk==''){vk = '#';}
|
|
|
|
var $ul = $this.parent().parent().prev();
|
|
$ul.find('li:eq(0) a').attr('href', fb);
|
|
$ul.find('li:eq(1) a').attr('href', li);
|
|
$ul.find('li:eq(2) a').attr('href', vk);
|
|
$ul.find('li:eq(3) a').attr('href', tw);
|
|
|
|
$this.next().click();
|
|
}
|
|
}
|
|
|
|
function handlePhoneForm(data){
|
|
if (data.success){
|
|
var phone = $this.find('#id_phone').val()
|
|
phone = '+'+phone.replace(/(\d{2})(\d{3})(\d{3})(\d{4})/, "$1 $2 $3 $4");
|
|
$this.parent().parent().prev().html(phone)
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleEmailForm(data){
|
|
if (data.success){
|
|
var email = $this.find('#id_email').val()
|
|
$this.parent().parent().prev().html(email)
|
|
$this.parent().parent().prev().attr('href', 'mailto:'+url)
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleWebPageForm(data){
|
|
if (data.success){
|
|
var url = $this.find('#id_web_page').val()
|
|
$this.parent().parent().prev().attr('href', url)
|
|
$this.parent().parent().prev().html(url)
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function handleAboutForm(data){
|
|
if (data.success){
|
|
var about = $this.find('#id_about').val()
|
|
$this.parent().parent().prev().html(about)
|
|
$this.next().click()
|
|
}
|
|
}
|
|
|
|
function formHandler(id, handleFunction){
|
|
$(id).on('submit', function(event){
|
|
event.preventDefault()
|
|
$this = $(this)
|
|
var url = $this.attr('action');
|
|
var formData = $this.serialize();
|
|
$.post(url, formData, handleFunction);
|
|
});
|
|
}
|
|
|
|
|
|
$(document).ready(function(){
|
|
formHandler('#home_form', handleHomeForm);
|
|
formHandler('#name_form', handleNameForm);
|
|
formHandler('#work_form', handleWorkForm);
|
|
formHandler('#about_company_form', handleAboutCompanyForm);
|
|
formHandler('#social_form', handleSocialForm);
|
|
formHandler('#phone_form', handlePhoneForm);
|
|
//formHandler('#email_form', handleEmailForm);
|
|
formHandler('#web_page_form', handleWebPageForm);
|
|
formHandler('#about_form', handleAboutForm);
|
|
|
|
//$('#id_country').onchange = function(){alert('111');}
|
|
$('#id_country').on('change', function(){alert('111');})
|
|
|
|
$('.pcm-next, .pcm-prev').on('click', function(e){
|
|
e.preventDefault();
|
|
var url = $(this).attr('href');
|
|
$.get(url, handleCalendar);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
handleCalendar = function(data){
|
|
|
|
console.log(data);
|
|
}
|
|
|