update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -34,6 +34,7 @@ class="active"
|
||||
<h3 class="box-title">{!! Lang::get('lang.email_information_and_settings') !!}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div id="head"></div>
|
||||
<div id="alert" style="display:none;">
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
@@ -134,7 +135,7 @@ class="active"
|
||||
<div class="col-xs-2 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
|
||||
{!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!}
|
||||
{!! $errors->first('fetching_encryption', '<spam class="help-block">:message</spam>') !!}
|
||||
{!!Form::select('fetching_encryption',[''=>'-----Select-----', 'none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!}
|
||||
{!!Form::select('fetching_encryption',[''=>'-----Select-----','ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!}
|
||||
</div>
|
||||
<div class="col-xs-2 form-group {!! $errors->has('imap_authentication') ? 'has-error' : ''!!}" id="imap_authentication_error">
|
||||
{!! Form::label('fetching_authentication',Lang::get('lang.authentication')) !!}
|
||||
@@ -169,7 +170,7 @@ class="active"
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_protocol') ? 'has-error' : ''!!}" id="sending_protocol_error">
|
||||
{!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!}
|
||||
{!! $errors->first('sending_protocol', '<spam class="help-block">:message</spam>') !!}
|
||||
{!!Form::select('sending_protocol',['smtp'=>'SMTP', 'mail' => 'PHP-MAIL'],null,['class' => 'form-control select']) !!}
|
||||
{!!Form::select('sending_protocol',[''=>'Select','Drives'=>$services],null,['class' => 'form-control select','id'=>'service']) !!}
|
||||
</div>
|
||||
<!-- sending hoost -->
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_host') ? 'has-error' : ''!!}" id="sending_host_error">
|
||||
@@ -187,7 +188,7 @@ class="active"
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_encryption') ? 'has-error' : ''!!}" id="sending_encryption_error">
|
||||
{!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!}
|
||||
{!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!}
|
||||
{!!Form::select('sending_encryption',[''=>'-----Select-----', 'none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select']) !!}
|
||||
{!!Form::select('sending_encryption',[''=>'-----Select-----','ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select']) !!}
|
||||
</div>
|
||||
<div class="col-xs-2 form-group {!! $errors->has('smtp_authentication') ? 'has-error' : ''!!}" id="smtp_authentication_error">
|
||||
{!! Form::label('sending_authentication',Lang::get('lang.authentication')) !!}
|
||||
@@ -198,6 +199,7 @@ class="active"
|
||||
<input type="checkbox" name="smtp_validate" id="smtp_validate"> {!! Lang::get('lang.validate_certificates_from_tls_or_ssl_server') !!}
|
||||
</div>
|
||||
</div>
|
||||
<div id="response"></div>
|
||||
<!-- Internal notes -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!}
|
||||
@@ -235,237 +237,70 @@ class="active"
|
||||
|
||||
<script type="text/javascript">
|
||||
//submit form
|
||||
$('#form').on('submit', function() {
|
||||
$('#form').on('submit', function () {
|
||||
var form_data = $(this).serialize();
|
||||
$("#spin").addClass("fa-spin");
|
||||
var email_address = document.getElementById('email_address').value;
|
||||
var email_name = document.getElementById('email_name').value;
|
||||
var department = document.getElementById('department').value;
|
||||
var priority = document.getElementById('priority').value;
|
||||
var help_topic = document.getElementById('help_topic').value;
|
||||
var password = document.getElementById('password').value;
|
||||
var fetching_status = $('input#fetching_status[type="checkbox"]:checked', this).val();
|
||||
var fetching_protocol = document.getElementById('fetching_protocol').value;
|
||||
var fetching_host = document.getElementById('fetching_host').value;
|
||||
var fetching_port = document.getElementById('fetching_port').value;
|
||||
var fetching_encryption = document.getElementById('fetching_encryption').value;
|
||||
var sending_status = $('input#sending_status[type="checkbox"]:checked', this).val();
|
||||
var sending_protocol = document.getElementById('sending_protocol').value;
|
||||
var sending_host = document.getElementById('sending_host').value;
|
||||
var sending_port = document.getElementById('sending_port').value;
|
||||
var sending_encryption = document.getElementById('sending_encryption').value;
|
||||
|
||||
var filter_number = /^([0-9])/;
|
||||
var error_list = [];
|
||||
var error = "";
|
||||
// checking for validation of email
|
||||
if (email_address) {
|
||||
var filter_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
||||
if (!filter_email.test(email_address)) {
|
||||
var error = "Please provide a valid email address";
|
||||
error_list.push(error);
|
||||
$("#email_address_error").addClass("has-error");
|
||||
}
|
||||
} else if (email_address == "") {
|
||||
var error = "Email Address is a required field";
|
||||
error_list.push(error);
|
||||
$("#email_address_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of email name
|
||||
if (email_name == "") {
|
||||
var error = "Email Name is a required field";
|
||||
error_list.push(error);
|
||||
$("#email_name_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of department
|
||||
if (department == "") {
|
||||
} else if (department) {
|
||||
if (!filter_number.test(department)) {
|
||||
var error = "Please provide a valid department";
|
||||
error_list.push(error);
|
||||
$("#department_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of priority
|
||||
if (priority == "") {
|
||||
} else if (priority) {
|
||||
if (!filter_number.test(priority)) {
|
||||
var error = "Please provide a valid priority";
|
||||
error_list.push(error);
|
||||
$("#priority_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of help topic
|
||||
if (help_topic == "") {
|
||||
} else if (priority) {
|
||||
if (!filter_number.test(priority)) {
|
||||
var error = "Please provide a valid priority";
|
||||
error_list.push(error);
|
||||
$("#priority_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of password
|
||||
if (password == "") {
|
||||
var error = "Password is a required field";
|
||||
error_list.push(error);
|
||||
$("#password_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of fetching host
|
||||
if (fetching_status == 'on') {
|
||||
if (fetching_host == "") {
|
||||
var error = "Fetching Host is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_host_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_host_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of fetching port
|
||||
if (fetching_port == "") {
|
||||
var error = "Fetching Port is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_port_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_port_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of mailbox protocol
|
||||
if (fetching_encryption == "") {
|
||||
var error = "Fetching Encryption is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_encryption_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_encryption_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of mailbox protocol
|
||||
if (fetching_protocol == "") {
|
||||
var error = "Fetching Protocol is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_protocol_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_protocol_error").removeClass("has-error");
|
||||
}
|
||||
|
||||
} else {
|
||||
// checking for validation of fetching port
|
||||
if (fetching_port) {
|
||||
if (!filter_number.test(fetching_port)) {
|
||||
var error = "The Fetching Port Number must be an integer";
|
||||
error_list.push(error);
|
||||
$("#fetching_port_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
}
|
||||
// checking for validation of sending status
|
||||
if (sending_status == 'on') {
|
||||
if (sending_protocol == 'smtp') {
|
||||
// checking for validation of sending host
|
||||
if (sending_host == "") {
|
||||
var error = "Sending Host is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_host_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending port
|
||||
if (sending_port == "") {
|
||||
var error = "Sending Port is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_port_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending encryption
|
||||
if (sending_encryption == "") {
|
||||
var error = "Sending Encryption is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_encryption_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending protocol
|
||||
if (sending_protocol == "") {
|
||||
var error = "Transfer Protocol is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_protocol_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
} else if(sending_protocol == 'mail') {
|
||||
$("#sending_host_error").val('');
|
||||
$("#sending_port_error").val('');
|
||||
$("#sending_encryption_error").val('');
|
||||
$("#sending_protocol_error").val('');
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
} else {
|
||||
// checking for validation of fetching port
|
||||
if (sending_port) {
|
||||
if (!filter_number.test(sending_port)) {
|
||||
var error = "The Sending Port Number must be an integer";
|
||||
error_list.push(error);
|
||||
$("#sending_port_error").addClass("has-error");
|
||||
}
|
||||
} else {
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
}
|
||||
// executing error chatch
|
||||
if (error) {
|
||||
var ssss = "";
|
||||
$.each(error_list, function(key, value) {
|
||||
ssss += "<li class='error-message-padding'>" + value + "</li>";
|
||||
});
|
||||
if (ssss) {
|
||||
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>" + ssss + "</div></div>";
|
||||
$('#alert').empty();
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
$("#spin").removeClass("fa-spin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Ajax communicating to backend for further Checking/Saving the details
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{!! route('validating.email.settings') !!}",
|
||||
dataType: "html",
|
||||
dataType: "json",
|
||||
data: form_data,
|
||||
headers: {
|
||||
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
|
||||
},
|
||||
beforeSend: function() {
|
||||
beforeSend: function () {
|
||||
$('#alert').empty();
|
||||
$("#click").trigger("click");
|
||||
},
|
||||
success: function(response) {
|
||||
if (response == 1) {
|
||||
$("#close").trigger("click");
|
||||
var error_result = "<div class='alert alert-success alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>Your details saved successfully</div></div>";
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
} else {
|
||||
$("#close").trigger("click");
|
||||
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>" + response + "</div></div>";
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
success: function (json) {
|
||||
console.log(json);
|
||||
$("#close").trigger("click");
|
||||
var errorsHtml = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>Unable to process the details </div></div>";
|
||||
$('#alert').empty();
|
||||
$('#alert').html(errorsHtml);
|
||||
$('#alert').show();
|
||||
return false;
|
||||
var res = "";
|
||||
$.each(json.result, function (idx, topic) {
|
||||
if (idx === "success") {
|
||||
res = "<div class='alert alert-success'>" + topic + "</div>";
|
||||
}
|
||||
if (idx === "fails") {
|
||||
res = "<div class='alert alert-danger'>" + topic + "</div>";
|
||||
}
|
||||
});
|
||||
|
||||
$("#head").html(res);
|
||||
$('html, body').animate({scrollTop: $("#form").offset().top}, 500);
|
||||
},
|
||||
error: function (json) {
|
||||
console.log(json);
|
||||
$("#close").trigger("click");
|
||||
var res = "";
|
||||
$.each(json.responseJSON, function (idx, topic) {
|
||||
res += "<li>" + topic + "</li>";
|
||||
});
|
||||
$("#head").html("<div class='alert alert-danger'><strong>Whoops!</strong> There were some problems with your input.<br><br><ul>" + res + "</ul></div>");
|
||||
$('html, body').animate({scrollTop: $("#form").offset().top}, 500);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var serviceid = $("#service").val();
|
||||
send(serviceid);
|
||||
$("#service").on('change', function () {
|
||||
serviceid = $("#service").val();
|
||||
send(serviceid);
|
||||
});
|
||||
function send(serviceid) {
|
||||
$.ajax({
|
||||
url: "{{url('mail/config/service')}}",
|
||||
dataType: "html",
|
||||
data: {'service': serviceid},
|
||||
success: function (response) {
|
||||
$("#response").html(response);
|
||||
},
|
||||
error: function (response) {
|
||||
$("#response").html(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@stop
|
||||
@@ -35,6 +35,7 @@ class="active"
|
||||
<h3 class="box-title">{!! Lang::get('lang.email_information_and_settings') !!}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div id="head"></div>
|
||||
<div id="alert" style="display:none;">
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
@@ -60,7 +61,7 @@ class="active"
|
||||
<div class="col-xs-4 form-group {!! $errors->has('password') ? 'has-error' : ''!!}" id="password_error">
|
||||
{!! Form::label('password',Lang::get('lang.password')) !!} <span class="text-red"> *</span>
|
||||
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
|
||||
<input type="password" name="password" class="form-control" id="password" value={!! Crypt::decrypt($emails->password) !!} >
|
||||
<input type="password" name="password" class="form-control" id="password" value={!! $emails->password !!} >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,23 +145,19 @@ class="active"
|
||||
{!! $errors->first('fetching_encryption', '<spam class="help-block">:message</spam>') !!}
|
||||
<select name="fetching_encryption" class='form-control' id='fetching_encryption'>
|
||||
<option value=""> -----Select----- </option>
|
||||
|
||||
<option <?php
|
||||
if ($emails->fetching_encryption == 'none') {
|
||||
echo 'selected="selected"';
|
||||
}
|
||||
?> value="none">None</option>
|
||||
<option <?php
|
||||
if ($emails->fetching_encryption == '/ssl/novalidate-cert' || $emails->fetching_encryption === '/ssl/validate-cert') {
|
||||
if ($emails->fetching_encryption == 'ssl' || $emails->fetching_encryption === 'ssl') {
|
||||
echo 'selected="selected"';
|
||||
}
|
||||
?> value="ssl">SSL</option>
|
||||
<option <?php
|
||||
if ($emails->fetching_encryption == '/tls/novalidate-cert' || $emails->fetching_encryption === '/tls/validate-cert') {
|
||||
if ($emails->fetching_encryption == 'tls' || $emails->fetching_encryption === 'tls') {
|
||||
echo 'selected="selected"';
|
||||
}
|
||||
?> value="tls">TLS</option>
|
||||
<option <?php
|
||||
if ($emails->fetching_encryption == '/starttls/novalidate-cert' || $emails->fetching_encryption === '/starttls/validate-cert') {
|
||||
if ($emails->fetching_encryption == 'starttls' || $emails->fetching_encryption === 'starttls') {
|
||||
echo 'selected="selected"';
|
||||
}
|
||||
?> value="starttls">STARTTLS</option>
|
||||
@@ -203,7 +200,7 @@ class="active"
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_protocol') ? 'has-error' : ''!!}" id="sending_protocol_error">
|
||||
{!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!}
|
||||
{!! $errors->first('sending_protocol', '<spam class="help-block">:message</spam>') !!}
|
||||
{!!Form::select('sending_protocol',['smtp'=>'SMTP', 'mail' => 'PHP-MAIL'],null,['class' => 'form-control select']) !!}
|
||||
{!!Form::select('sending_protocol',[''=>'Select','Drives'=>$services],$emails->getCurrentDrive(),['class' => 'form-control select','id'=>'service']) !!}
|
||||
</div>
|
||||
<!-- sending hoost -->
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_host') ? 'has-error' : ''!!}" id="sending_host_error">
|
||||
@@ -221,7 +218,7 @@ class="active"
|
||||
<div class="col-xs-2 form-group {!! $errors->has('sending_encryption') ? 'has-error' : ''!!}" id="sending_encryption_error">
|
||||
{!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!}
|
||||
{!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!}
|
||||
{!!Form::select('sending_encryption',[''=>'-----Select-----', 'none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select']) !!}
|
||||
{!!Form::select('sending_encryption',[''=>'-----Select-----','ssl' => 'SSL', 'tls' => 'TLS', 'starttls' => 'STARTTLS'],null,['class' => 'form-control select']) !!}
|
||||
</div>
|
||||
<div class="col-xs-2 form-group {!! $errors->has('smtp_authentication') ? 'has-error' : ''!!}" id="smtp_authentication_error">
|
||||
{!! Form::label('sending_authentication',Lang::get('lang.authentication')) !!}
|
||||
@@ -232,6 +229,7 @@ class="active"
|
||||
<input type="checkbox" name="smtp_validate" id="smtp_validate"> {!! Lang::get('lang.validate_certificates_from_tls_or_ssl_server') !!}
|
||||
</div>
|
||||
</div>
|
||||
<div id="response"></div>
|
||||
<!-- Internal notes -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!}
|
||||
@@ -268,241 +266,71 @@ class="active"
|
||||
</div>
|
||||
</div>
|
||||
<button style="display:none" data-toggle="modal" data-target="#loadingpopup" id="click"></button>
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
//submit form
|
||||
$('#form').on('submit', function() {
|
||||
$('#form').on('submit', function () {
|
||||
var form_data = $(this).serialize();
|
||||
$("#spin").addClass("fa-spin");
|
||||
var email_address = document.getElementById('email_address').value;
|
||||
var email_name = document.getElementById('email_name').value;
|
||||
var department = document.getElementById('department').value;
|
||||
var priority = document.getElementById('priority').value;
|
||||
var help_topic = document.getElementById('help_topic').value;
|
||||
var password = document.getElementById('password').value;
|
||||
var fetching_status = $('input#fetching_status[type="checkbox"]:checked', this).val();
|
||||
var fetching_protocol = document.getElementById('fetching_protocol').value;
|
||||
var fetching_host = document.getElementById('fetching_host').value;
|
||||
var fetching_port = document.getElementById('fetching_port').value;
|
||||
var fetching_encryption = document.getElementById('fetching_encryption').value;
|
||||
var sending_status = $('input#sending_status[type="checkbox"]:checked', this).val();
|
||||
var sending_protocol = document.getElementById('sending_protocol').value;
|
||||
var sending_host = document.getElementById('sending_host').value;
|
||||
var sending_port = document.getElementById('sending_port').value;
|
||||
var sending_encryption = document.getElementById('sending_encryption').value;
|
||||
|
||||
var filter_number = /^([0-9])/;
|
||||
var error_list = [];
|
||||
var error = "";
|
||||
// checking for validation of email
|
||||
if (email_address) {
|
||||
var filter_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
||||
if (!filter_email.test(email_address)) {
|
||||
var error = "Please provide a valid email address";
|
||||
error_list.push(error);
|
||||
$("#email_address_error").addClass("has-error");
|
||||
}
|
||||
} else if (email_address == "") {
|
||||
var error = "Email Address is a required field";
|
||||
error_list.push(error);
|
||||
$("#email_address_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of email name
|
||||
if (email_name == "") {
|
||||
var error = "Email Name is a required field";
|
||||
error_list.push(error);
|
||||
$("#email_name_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of department
|
||||
if (department == "") {
|
||||
} else if (department) {
|
||||
if (!filter_number.test(department)) {
|
||||
var error = "Please provide a valid department";
|
||||
error_list.push(error);
|
||||
$("#department_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of priority
|
||||
if (priority == "") {
|
||||
} else if (priority) {
|
||||
if (!filter_number.test(priority)) {
|
||||
var error = "Please provide a valid priority";
|
||||
error_list.push(error);
|
||||
$("#priority_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of help topic
|
||||
if (help_topic == "") {
|
||||
} else if (priority) {
|
||||
if (!filter_number.test(priority)) {
|
||||
var error = "Please provide a valid priority";
|
||||
error_list.push(error);
|
||||
$("#priority_error").addClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of password
|
||||
if (password == "") {
|
||||
var error = "Password is a required field";
|
||||
error_list.push(error);
|
||||
$("#password_error").addClass("has-error");
|
||||
}
|
||||
// checking for validation of fetching host
|
||||
if (fetching_status == 'on') {
|
||||
if (fetching_host == "") {
|
||||
var error = "Fetching Host is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_host_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_host_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of fetching port
|
||||
if (fetching_port == "") {
|
||||
var error = "Fetching Port is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_port_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_port_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of mailbox protocol
|
||||
if (fetching_encryption == "") {
|
||||
var error = "Fetching Encryption is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_encryption_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_encryption_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of mailbox protocol
|
||||
if (fetching_protocol == "") {
|
||||
var error = "Fetching Protocol is a required field";
|
||||
error_list.push(error);
|
||||
$("#fetching_protocol_error").addClass("has-error");
|
||||
} else {
|
||||
$("#fetching_protocol_error").removeClass("has-error");
|
||||
}
|
||||
} else {
|
||||
// checking for validation of fetching port
|
||||
if (fetching_port) {
|
||||
if (!filter_number.test(fetching_port)) {
|
||||
var error = "The Fetching Port Number must be an integer";
|
||||
error_list.push(error);
|
||||
$("#fetching_port_error").addClass("has-error");
|
||||
}
|
||||
} else {
|
||||
$("#fetching_port_error").removeClass("has-error");
|
||||
}
|
||||
}
|
||||
// checking for validation of sending status
|
||||
// checking for validation of sending status
|
||||
if (sending_status == 'on') {
|
||||
if (sending_protocol == 'smtp') {
|
||||
// checking for validation of sending host
|
||||
if (sending_host == "") {
|
||||
var error = "Sending Host is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_host_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending port
|
||||
if (sending_port == "") {
|
||||
var error = "Sending Port is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_port_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending encryption
|
||||
if (sending_encryption == "") {
|
||||
var error = "Sending Encryption is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_encryption_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
}
|
||||
// checking for validation of sending protocol
|
||||
if (sending_protocol == "") {
|
||||
var error = "Transfer Protocol is a required field";
|
||||
error_list.push(error);
|
||||
$("#sending_protocol_error").addClass("has-error");
|
||||
} else {
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
} else if(sending_protocol == 'mail') {
|
||||
$("#sending_host_error").val('');
|
||||
$("#sending_port_error").val('');
|
||||
$("#sending_encryption_error").val('');
|
||||
$("#sending_protocol_error").val('');
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
} else {
|
||||
// checking for validation of fetching port
|
||||
if (sending_port) {
|
||||
if (!filter_number.test(sending_port)) {
|
||||
var error = "The Sending Port Number must be an integer";
|
||||
error_list.push(error);
|
||||
$("#sending_port_error").addClass("has-error");
|
||||
}
|
||||
} else {
|
||||
$("#sending_host_error").removeClass("has-error");
|
||||
$("#sending_port_error").removeClass("has-error");
|
||||
$("#sending_encryption_error").removeClass("has-error");
|
||||
$("#sending_protocol_error").removeClass("has-error");
|
||||
}
|
||||
}
|
||||
// executing error chatch
|
||||
if (error) {
|
||||
var ssss = "";
|
||||
$.each(error_list, function(key, value) {
|
||||
ssss += "<li class='error-message-padding'>" + value + "</li>";
|
||||
});
|
||||
if (ssss) {
|
||||
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>" + ssss + "</div></div>";
|
||||
$('#alert').empty();
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
$("#spin").removeClass("fa-spin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Ajax communicating to backend for further Checking/Saving the details
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{!! route('validating.email.settings.update', $emails->id ) !!}",
|
||||
dataType: "html",
|
||||
dataType: "json",
|
||||
data: form_data,
|
||||
headers: {
|
||||
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
|
||||
},
|
||||
beforeSend: function() {
|
||||
beforeSend: function () {
|
||||
$('#alert').empty();
|
||||
$("#click").trigger("click");
|
||||
},
|
||||
success: function(response) {
|
||||
if (response == 1) {
|
||||
$("#close").trigger("click");
|
||||
var error_result = "<div class='alert alert-success alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>Your details saved successfully</div></div>";
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
} else {
|
||||
$("#close").trigger("click");
|
||||
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>" + response + "</div></div>";
|
||||
$('#alert').html(error_result);
|
||||
$('#alert').show();
|
||||
}
|
||||
success: function (json) {
|
||||
console.log(json.result);
|
||||
$("#close").trigger("click");
|
||||
var res = "";
|
||||
$.each(json.result, function (idx, topic) {
|
||||
if (idx === "success") {
|
||||
res = "<div class='alert alert-success'>" + topic + "</div>";
|
||||
}
|
||||
if (idx === "fails") {
|
||||
res = "<div class='alert alert-danger'>" + topic + "</div>";
|
||||
}
|
||||
});
|
||||
|
||||
$("#head").html(res);
|
||||
$('html, body').animate({scrollTop: $("#form").offset().top}, 500);
|
||||
},
|
||||
error: function (json) {
|
||||
$("#close").trigger("click");
|
||||
var res = "";
|
||||
$.each(json.responseJSON, function (idx, topic) {
|
||||
res += "<li>" + topic + "</li>";
|
||||
});
|
||||
$("#head").html("<div class='alert alert-danger'><strong>Whoops!</strong> There were some problems with your input.<br><br><ul>" + res + "</ul></div>");
|
||||
$('html, body').animate({scrollTop: $("#form").offset().top}, 500);
|
||||
}
|
||||
// ,
|
||||
// error: function (response) {
|
||||
// $("#close").trigger("click");
|
||||
// var errorsHtml = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><div id='alert-message'>Unable to process the details </div></div>";
|
||||
// $('#alert').empty();
|
||||
// $('#alert').html(errorsHtml);
|
||||
// $('#alert').show();
|
||||
// return false;
|
||||
// }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var serviceid = $("#service").val();
|
||||
send(serviceid);
|
||||
$("#service").on('change', function () {
|
||||
serviceid = $("#service").val();
|
||||
send(serviceid);
|
||||
});
|
||||
function send(serviceid) {
|
||||
$.ajax({
|
||||
url: "{{url('mail/config/service')}}",
|
||||
dataType: "html",
|
||||
data: {'service': serviceid,'emailid':{{$emails->id}}},
|
||||
success: function (response) {
|
||||
$("#response").html(response);
|
||||
},
|
||||
error: function (response) {
|
||||
$("#response").html(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@stop
|
||||
|
||||
Reference in New Issue
Block a user