-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from rpiambulance/remove-web-forms
- Loading branch information
Showing
7 changed files
with
15 additions
and
563 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1 @@ | ||
angular.module('ContactCtrl', []).controller('ContactCtrl', ['$scope', '$http', function($scope, $http) { | ||
$scope.formData = { | ||
name: "", | ||
email: "", | ||
phone: "", | ||
subject: "", | ||
message: "" | ||
}; | ||
|
||
sweetAlert("Heads up!", "Due to some changes with our hosting service, our email forms are currently not working. We are trying our best to resolve the issue. For now, please contact us directly at [email protected].", 'error'); | ||
|
||
|
||
var autocompleteValidate = function () { | ||
var corrected = {}; | ||
for (var d in $scope.formData) { | ||
if($scope.formData.hasOwnProperty(d)) { | ||
if(document.getElementById(d).value !== $scope.formData[d] && d != "g-recaptcha-response") { | ||
corrected[d] = document.getElementById(d).value; | ||
} else { | ||
corrected[d] = $scope.formData[d]; | ||
} | ||
} | ||
} | ||
return corrected; | ||
}; | ||
|
||
$scope.clearForm = function () { | ||
for (var d in $scope.formData) { | ||
if ($scope.formData.hasOwnProperty(d)) | ||
$scope.formData[d] = ""; | ||
} | ||
}; | ||
|
||
$scope.submitForm = function () { | ||
if(!document.getElementById("g-recaptcha-response")) { | ||
return; | ||
} | ||
|
||
$scope.formData["g-recaptcha-response"] = document.getElementById("g-recaptcha-response").value; | ||
|
||
$http({ | ||
method: 'POST', | ||
url: '.contact_submit.php', | ||
data: autocompleteValidate(), // pass in data as strings | ||
headers: {'Content-Type': 'application/x-www-form-urlencoded'} // set the headers so angular passing info as form data (not request payload) | ||
}).success(function (data) { | ||
if (!data.success) { | ||
console.log("it failed!"); | ||
// if not successful, bind errors to error variables | ||
if(data.errors.name) { | ||
$scope.errorName = data.errors.name; | ||
} | ||
if(data.errors.email) { | ||
$scope.errorEmail = data.errors.email; | ||
} | ||
if(data.errors.message) { | ||
$scope.errorTextarea = data.errors.message; | ||
} | ||
if(data.messageError) { | ||
$scope.submissionMessage = data.messageError; | ||
} | ||
|
||
$scope.submission = true; //shows the error message | ||
} else { | ||
$scope.showContactSuccess = true; | ||
// if successful, bind success message to message | ||
$scope.submissionMessage = data.messageSuccess; | ||
$scope.formData = {}; // form fields are emptied with this line | ||
$scope.submission = true; //shows the success message | ||
sweetAlert("Message Sent!", "Thanks for reaching out to us. You should have received a copy of your email to the address you provided. One of our members should be in touch with you shortly.", "success"); | ||
} | ||
}); | ||
}; | ||
}]); | ||
angular.module('ContactCtrl', []).controller('ContactCtrl', ['$scope', '$http', function($scope, $http) {}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1 @@ | ||
angular.module('CoverageCtrl', []).controller('CoverageCtrl', ['$scope', '$http', function ($scope, $http) { | ||
$scope.showModal = false; | ||
$scope.currentTier = ""; | ||
$scope.submission = false; | ||
$scope.formData = { | ||
orgName: "", | ||
name: "", | ||
phone: "", | ||
eventName: "", | ||
loc: "", | ||
date: "", | ||
time: "", | ||
type: "", | ||
attendance: "", | ||
duration: "" | ||
}; | ||
|
||
sweetAlert("Heads up!", "Due to some changes with our hosting service, our email forms are currently not working. We are trying our best to resolve the issue. For now, please contact us directly at [email protected].", 'error'); | ||
|
||
$scope.getAttendanceLims = function () { | ||
return { | ||
"Tier I": "15-99", | ||
"Tier II": "100-4999", | ||
"Tier III": "5000+" | ||
}[$scope.currentTier]; | ||
}; | ||
|
||
$scope.toggleModal = function (id) { | ||
$scope.currentTier = id; | ||
$scope.showModal = !$scope.showModal; | ||
if ($scope.showModal == false && $scope.sumbission == false) { | ||
sweetAlert("Heads up!", "You've just closed the form, but have not submitted anything.", "error"); | ||
} | ||
}; | ||
|
||
var autocompleteValidate = function () { | ||
var corrected = {}; | ||
for (var d in $scope.formData) { | ||
if($scope.formData.hasOwnProperty(d) && d != 'tier') { | ||
if(document.getElementById(d).value !== $scope.formData[d] && d != "g-recaptcha-response") { | ||
corrected[d] = document.getElementById(d).value; | ||
} else { | ||
corrected[d] = $scope.formData[d]; | ||
} | ||
} else if(d == 'tier') { | ||
corrected[d] = $scope.formData[d]; | ||
} | ||
} | ||
return corrected; | ||
}; | ||
|
||
$scope.clearForm = function () { | ||
for (var d in $scope.formData) { | ||
if ($scope.formData.hasOwnProperty(d)) | ||
$scope.formData[d] = ""; | ||
} | ||
}; | ||
|
||
$scope.submitForm = function () { | ||
if(!document.getElementById("g-recaptcha-response")) { | ||
return; | ||
} | ||
$scope.formData["g-recaptcha-response"] = document.getElementById("g-recaptcha-response").value; | ||
$scope.formData.tier = $scope.currentTier; | ||
console.log(autocompleteValidate()); | ||
$http({ | ||
method: 'POST', | ||
url: '.email_submit.php', | ||
data: autocompleteValidate(), // pass in data as strings | ||
headers: {'Content-Type': 'application/x-www-form-urlencoded'} // set the headers so angular passing info as form data (not request payload) | ||
}).success(function (data) { | ||
console.log(data); | ||
if (!data.success) { | ||
console.log("it failed!"); | ||
// if not successful, bind errors to error variables | ||
if(data.errors.name) { | ||
$scope.errorName = data.errors.name; | ||
} | ||
if(data.messageError) { | ||
$scope.submissionMessage = data.messageError; | ||
} | ||
sweetAlert("Heads up!", "You've just closed the form, but have not submitted anything. Please make sure all fields are filled out and that you have completed the Captcha.", "error"); | ||
$scope.submission = true; //shows the error message | ||
} else { | ||
$scope.showCoverageSuccess = true; | ||
// if successful, bind success message to message | ||
$scope.submissionMessage = data.messageSuccess; | ||
$scope.formData = {}; // form fields are emptied with this line | ||
$scope.submission = true; //shows the success message | ||
sweetAlert("Thanks!", "Thanks for submitting a request for EMS coverage. You should have received a copy of your reqest to the email you provided. Our Second Leiutenant should be in touch with you shortly.", "success"); | ||
} | ||
}); | ||
}; | ||
}]); | ||
angular.module('CoverageCtrl', []).controller('CoverageCtrl', ['$scope', '$http', function ($scope, $http) {}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<section id="contact-info"> | ||
<div class="center"> | ||
<h2>Contact Us</h2> | ||
<p class="lead">Shoot us an email using the form below! Or come visit us!</p> | ||
<p class="lead">Shoot us an email at <a href="mailto:[email protected]">[email protected]</a> — Or come visit us!</p> | ||
<p class="lead">You can also give us a call at <a href="tel:5189007742">(518) 900-RPIA</a></p> | ||
<p class="lead">Experiencing a medical emergency? <span style="color: #c52d2f;"><strong>Dial 911</strong></span></p> | ||
</div> | ||
<div class="gmap-area"> | ||
<div class="container"> | ||
|
@@ -51,60 +53,6 @@ <h5>RPI Ambulance Mailing</h5> | |
</div> | ||
</section> <!--/gmap_area --> | ||
|
||
<section id="contact-page"> | ||
<div class="container"> | ||
<div class="center"> | ||
<h2>Drop us a line!</h2> | ||
<p class="lead">Use this from to send us an email. We'll get back to you soon!</p> | ||
<div class="alert alert-success alert-dismissible" ng-show="showContactSuccess" role="alert"> | ||
<button type="button" class="close" ng-click="showContactSuccess = false"><span | ||
aria-hidden="true">×</span></button> | ||
<i class="fa fa-paper-plane"></i><strong> Success!</strong> Your email was successfully sent. Thank you | ||
for reaching out to us! | ||
</div> | ||
</div> | ||
<div class="row contact-wrap"> | ||
<div class="status alert alert-success" style="display: none"></div> | ||
<form id="main-contact-form" class="contact-form" name="contact-form" role="form" ng-submit="submitForm()" | ||
novalidate> | ||
<div class="col-sm-5 col-sm-offset-1"> | ||
<div class="form-group"> | ||
<label for="name">Name<sup class="text-danger">*</sup></label> | ||
<input type="text" name="name" id="name" ng-model="name" class="form-control" | ||
required="required"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email">Email<sup class="text-danger">*</sup></label> | ||
<input type="email" name="email" id="email" ng-model="email" class="form-control" | ||
required="required"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="phone">Phone</label> | ||
<input type="tel" id="phone" name="phone" ng-model="phone" class="form-control"> | ||
</div> | ||
<div class="form-group"> | ||
<div class="g-recaptcha" data-sitekey="6LdHKxUTAAAAAGTBpgYEJZDoAz1uGqG_tX_gQb1K"></div> | ||
</div> | ||
</div> | ||
<div class="col-sm-5"> | ||
<div class="form-group"> | ||
<label for="subject">Subject<sup class="text-danger">*</sup></label> | ||
<input type="text" name="subject" id="subject" ng-model="subject" class="form-control" | ||
required="required"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message">Message<sup class="text-danger">*</sup></label> | ||
<textarea name="message" id="message" ng-model="message" required="required" | ||
class="form-control" rows="8"></textarea> | ||
</div> | ||
<div class="btn-toolbar"> | ||
<button class="btn btn-default btn-lg" type="reset" ng-click="clearForm()">Clear Form</button> | ||
<button type="submit" name="submit" class="btn btn-primary btn-lg">Submit Message</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div><!--/.row--> | ||
</div><!--/.container--> | ||
</section><!--/#contact-page--> | ||
|
||
|
||
<script src='https://www.google.com/recaptcha/api.js'></script> |
Oops, something went wrong.