summaryrefslogtreecommitdiff
path: root/dash/js
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2017-03-09 00:28:02 -0500
committerCarson Fleming <cflems@cflems.net>2017-03-09 00:28:02 -0500
commita44a0e047a7582fe7e31743e1b03a17cf2987f73 (patch)
tree1bb28593eb493cac175f2ed42ab108a4248e1ec1 /dash/js
parentf75fc7b47735ed73535478e4d70e62694247a586 (diff)
downloadbulletin-a44a0e047a7582fe7e31743e1b03a17cf2987f73.tar.gz
Created the ability to post ads, rating framework
Diffstat (limited to 'dash/js')
-rw-r--r--dash/js/dash.js40
1 files changed, 39 insertions, 1 deletions
diff --git a/dash/js/dash.js b/dash/js/dash.js
index d3c1a1a..7fbceac 100644
--- a/dash/js/dash.js
+++ b/dash/js/dash.js
@@ -12,10 +12,48 @@ function jxbtn (e) {
}
function axbtn (e) {
e.preventDefault();
- $(this).parents().filter('.job').hide(250);
+ if (window.confirm('Permanently remove this application?')) {
+ $(this).parents().filter('.job').hide(250);
+ $.get('headless.php?del='+$(this).attr('data-rid'), function (data) {
+ if (data != 'OK') window.alert('The application could not be permanently deleted. It has been removed from view for your convenience.');
+ });
+ }
+}
+function acbtn (e) {
+ e.preventDefault();
+ if (window.confirm('Hire this candidate the job?')) {
+ $(this).parents().filter('.job').hide(250);
+ $.get('headless.php?hire='+$(this).attr('data-rid'), function (data) {
+ if (data == 'OK') {
+ window.alert('This application has been approved for hire. You can rate your experience with this candidate under the \'Rate\' tab.');
+ window.location.href = '/dash/rate.php';
+ } else {
+ window.alert('We\'ve experienced an error trying to approve this application. Please try again another time.');
+ window.location.href = '/dash/';
+ }
+ });
+ }
+}
+function serveratings ($spaces) {
+ $.each($spaces, function (idx, me) {
+ var $me = $(me);
+ var rating = parseFloat($me.attr('data-rating'));
+ if (!rating && rating != 0) {
+ $me.html('<img class="norating" src="img/unrated.png" alt="Not Yet Rated" />');
+ } else {
+ var html = '';
+ for (var i = 1; i <= rating; i++) html += '<img class="star" src="img/star_given.png" alt="Full Star" />';
+ if (rating-Math.floor(rating) >= 0.5) html += '<img class="star" src="img/star_half.png" alt="Half Star" />'
+ i += Math.round(rating-Math.floor(rating));
+ for (; i <= 5; i++) html += '<img class="star" src="img/star_empty.png" alt="No Star" />';
+ $me.html(html);
+ }
+ });
}
$(function() {
$('.jobxbtn').click(jxbtn);
$('.appxbtn').click(axbtn);
+ $('.appcbtn').click(acbtn);
+ serveratings($('.ratingdata'));
});