259 lines
No EOL
8.5 KiB
JavaScript
259 lines
No EOL
8.5 KiB
JavaScript
$(function () {
|
|
// $('.selectpicker').selectpicker();
|
|
// $('[data-toggle="tooltip"]').tooltip();
|
|
});
|
|
|
|
|
|
function update_modal_data_load(e, $ele) {
|
|
var ele = $ele,
|
|
url = ele.data('url'),
|
|
data = {data:ele.data('data'), target:ele.data('target')} ,
|
|
contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
|
|
|
|
console.log(data);
|
|
console.log(url);
|
|
$.ajax({
|
|
url: url,
|
|
data: data,
|
|
type: "POST",
|
|
dataType: "json",
|
|
cache: false,
|
|
contentType: contentType,
|
|
encode: true,
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
},
|
|
success: function(data) {
|
|
// do what ever you want here. add content to <div> if it was not 1 .
|
|
$(data.target).find('.modal-content').html(data.response);
|
|
// $('.selectpicker').selectpicker(["refresh"]);
|
|
// $('.input-daterange').datepicker({toggleActive: true,format: 'dd.mm.yyyy'});
|
|
$(data.target).modal('show');
|
|
},
|
|
error: function(xhr, status, errorThrown) {
|
|
console.log(xhr);
|
|
console.log(xhr.responseText);
|
|
console.log(status);
|
|
console.log("Sorry, there was a problem!");
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
|
|
jQuery(document).ready(function() {
|
|
$(".update_modal_data_load").on('click', function (e) {
|
|
e.preventDefault();
|
|
update_modal_data_load(e, $(this));
|
|
});
|
|
|
|
$('.datepicker-base').datepicker({
|
|
orientation: 'auto right',
|
|
calendarWeeks: true,
|
|
todayBtn: 'linked',
|
|
//daysOfWeekDisabled: '1',
|
|
todayHighlight: true,
|
|
multidate: false,
|
|
daysOfWeekHighlighted: '0,6',
|
|
autoclose: true,
|
|
format: 'dd.mm.yyyy',
|
|
language: 'de',
|
|
clearBtn: true,
|
|
});
|
|
|
|
$('.datepicker-birthday').datepicker({
|
|
todayBtn: 'linked',
|
|
// daysOfWeekDisabled: '1',
|
|
multidate: false,
|
|
daysOfWeekHighlighted: '0,6',
|
|
autoclose: true,
|
|
format: 'dd.mm.yyyy',
|
|
language: 'de',
|
|
clearBtn: true,
|
|
startView: 2,
|
|
|
|
});
|
|
|
|
$('.b-material-datetime-picker').bootstrapMaterialDatePicker({
|
|
weekStart: 1,
|
|
format : 'DD.MM.YYYY HH:mm',
|
|
shortTime: false,
|
|
nowButton : true,
|
|
clearButton: true,
|
|
lang: 'de',
|
|
//currentDate: ''
|
|
});
|
|
|
|
});
|
|
|
|
function _scrollTo(to, offset) {
|
|
$('html,body').animate({scrollTop: $(to).offset().top - offset}, 800);
|
|
}
|
|
|
|
/*
|
|
$(function() {
|
|
$('.select2-main').each(function() {
|
|
$(this)
|
|
.wrap('<div class="position-relative"></div>')
|
|
.select2({
|
|
placeholder: 'Bitte wählen',
|
|
dropdownParent: $(this).parent(),
|
|
});
|
|
})
|
|
$('.select2-sub').each(function() {
|
|
$(this)
|
|
.wrap('<div class="position-relative"></div>')
|
|
.select2({
|
|
placeholder: 'Bitte wählen',
|
|
dropdownParent: $(this).parent(),
|
|
closeOnSelect: false
|
|
});
|
|
})
|
|
});
|
|
*/
|
|
/*
|
|
jQuery(document).ready(function() {
|
|
|
|
$('.main-branch').on('change', function () {
|
|
|
|
target = $(this).data('target');
|
|
if ($(this).is(':checked')) {
|
|
$(target).stop().show('slow');
|
|
} else {
|
|
$(target).stop().hide('slow');
|
|
$(target).find('.custom-control-input').prop('checked', false);
|
|
}
|
|
});
|
|
|
|
var $form = $('#lead-form-validation');
|
|
if($form.find('#company_country_id').length){
|
|
$form.find('#company_country_id').on('change', function(){
|
|
$form.find('#company_pre_phone_id').val($(this).val());
|
|
$form.find('#company_pre_phone_id').selectpicker('refresh');
|
|
});
|
|
}
|
|
|
|
if($form.find('#country_id').length){
|
|
$form.find('#country_id').on('change', function(){
|
|
$form.find('#pre_phone_id').val($(this).val());
|
|
$form.find('#pre_phone_id').selectpicker('refresh');
|
|
|
|
$form.find('#pre_mobil_id').val($(this).val());
|
|
$form.find('#pre_mobil_id').selectpicker('refresh');
|
|
});
|
|
}
|
|
|
|
|
|
|
|
});
|
|
*/
|
|
|
|
/*
|
|
function trigger_company($ele, $speed){
|
|
if($ele.val() == 1){
|
|
$('.show_company_holder').show($speed);
|
|
$('.show_company_holder').find('#company_name').prop('required', true);
|
|
$('.show_company_holder').find('#company_country_id').prop('required', true);
|
|
|
|
}else{
|
|
$('.show_company_holder').hide($speed);
|
|
$('.show_company_holder').find('#company_name').prop('required', false);
|
|
$('.show_company_holder').find('#company_country_id').prop('required', false);
|
|
}
|
|
}
|
|
|
|
$( document ).ready(function() {
|
|
|
|
// With validation
|
|
var $form = $('#lead-form-validation');
|
|
$form.find('#company').on('change', function () {
|
|
trigger_company($(this), 'slow');
|
|
});
|
|
|
|
trigger_company($form.find('#company'), 0);
|
|
|
|
// Set up validator
|
|
$form.validate({
|
|
rules: {
|
|
'email': {
|
|
required: true,
|
|
email: true,
|
|
remote:
|
|
{
|
|
url: "{{ route('user_check_mail') }}",
|
|
type: "post",
|
|
data:
|
|
{
|
|
user_id: function()
|
|
{
|
|
return $('#lead-form-validation :input[name="user_id"]').val();
|
|
},
|
|
email: function()
|
|
{
|
|
return $('#lead-form-validation :input[name="email"]').val();
|
|
}
|
|
},
|
|
encode: true,
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
},
|
|
}
|
|
},
|
|
'email-confirm': {
|
|
required: true,
|
|
equalTo: "#email"
|
|
},
|
|
'accepted_data_protection': {
|
|
required: true
|
|
},
|
|
},
|
|
errorPlacement: function errorPlacement(error, element) {
|
|
$(element).parents('.form-group').append(
|
|
error.addClass('invalid-feedback small d-block')
|
|
)
|
|
},
|
|
highlight: function (element) {
|
|
if ($(element).hasClass('selectpicker')) {
|
|
$(element).parent().addClass('is-invalid');
|
|
}
|
|
$(element).addClass('is-invalid');
|
|
},
|
|
unhighlight: function (element) {
|
|
$(element).removeClass('is-invalid');
|
|
$(element).parents('.form-group').find('.is-invalid').removeClass('is-invalid');
|
|
},
|
|
messages : {
|
|
required: "{{__('This field is required.')}}",
|
|
company_country_id : {
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
accepted_data_protection : {
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
salutation : {
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
company_name : {
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
last_name : {
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
equalTo : "{{__('Please enter the same value again.')}}",
|
|
'email-confirm' : {
|
|
equalTo : "{{__('Please enter the same value again.')}}",
|
|
required: "{{__('This field is required.')}}",
|
|
},
|
|
email: {
|
|
required : "{{__('This field is required.')}}",
|
|
email: "{{ __('Please enter a valid email address.') }}",
|
|
remote : "{{ __('This E-mail is already in use.') }}"
|
|
},
|
|
},
|
|
onkeyup: false
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
*/ |