Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function DashboardCtrl($scope, $http, $filter, $rootScope, $location, $timeout, $routeParams, HackerRank) {
- $rootScope.companyname = $routeParams.companyname;
- $rootScope.metaTitle = 'Find Jobs fast';
- $rootScope.metaDescription = 'The best jobs from a variety of employers across many industries.';
- $scope.$on('$locationChangeStart', function(event) {
- $('#JobModal').modal('hide');
- });
- $scope.WentRealInterview = false;
- $scope.WentRealInterviewStyle = '42%';
- $scope.progress = 0.50;
- $scope.IndustryFilter = '';
- $scope.FullPartFilter = '';
- $scope.CurrentQuestionTest = 'Describe your strengths and weaknesses';
- $scope.VisaStatus = '';
- $rootScope.CurrentList = [];
- $scope.TakeAptitudeTest = function(JobIDGiven) {
- console.log(JobIDGiven);
- $location.path('/aptitude-multiple-test/' + JobIDGiven);
- }
- $scope.TakeAptitudeTestMobile = function(JobIDGiven) {
- console.log(JobIDGiven);
- $location.path('/aptitude-multiple-test/' + JobIDGiven);
- }
- $scope.GoToRealInterview = function() {
- $http.post('GetVideoJobId.php', {
- "data": $scope.Job_id,
- Question: $scope.CurrentQuestion
- }).success(function(data, status) {
- for (var i = 0; i < $rootScope.CurrentList.length; i++) {
- if ($scope.Job_id == $rootScope.CurrentList[i].id) {
- $rootScope.CurrentList[i].VideoAnswers = [{
- location: '',
- student: ''
- }];
- }
- }
- }).error(function(data, status) {});
- // $scope.CurrentQuestion = $scope.VideoQuestions[0].questions;
- $('#WebCamModal').modal('hide');
- $scope.WentRealInterview = true;
- $scope.WentRealInterviewStyle = '';
- $('#WebCamModalTest').modal('show');
- }
- $scope.ShowModalVideoPlayer = function(Job) {
- $location.path('/practice-video/' + Job.id);
- //window.location.reload(true);
- // window.location = window.location.href + '?' + new Date().getTime();
- // location.reload(true); // works for safari
- // window.location.reload();
- }
- /*
- $scope.ShowModalVideoPlayer = function (Job) {
- $scope.WentRealInterviewStyle = '42%';
- $scope.VideoQuestions = Job.VideoQuestions;
- $scope.CurrentQuestion = Job.VideoQuestions[0].questions;
- $scope.Job_id = Job.id;
- $scope.name = Job.name;
- $scope.location = Job.location;
- $scope.Website = Job.website;
- $scope.PostDate = Job.CurDate;
- $scope.DaysDeadline = Job.DaysDeadline;
- $scope.biography = Job.biography;
- $scope.LocalInt = Job.LocalInt;
- $scope.type = Job.type;
- $scope.FullPart = Job.Fullpart;
- $scope.remuneration = Job.remuneration;
- $scope.profile = Job.profile
- $scope.Status = Job.Status;
- $scope.realtasks = Job.realtasks;
- $scope.DisplayMatchingModal = Job.DisplayMatching;
- $scope.DisplayNumberMatching = Job.Matching;
- $scope.realskills = Job.realskills;
- $scope.Perks = Job.Perks;
- $scope.Companyname = Job.Companyname;
- $scope.profile = Job.profile;
- $scope.Culture = Job.Culture;
- $scope.Life = Job.Life;
- $scope.deadline = Job.deadline;
- $scope.duration = Job.Duration;
- $scope.employerBiography = Job.employerBiography;
- $("#webcamModal").modal('show');
- $scope.WentRealInterview = false;
- }
- */
- $scope.CloseVideoInterviewModal = function() {
- $("#webcamModal").modal('hide');
- }
- $scope.ShowVideoRecordingVar = 1;
- $scope.VideoClassOne = 'video-tabs-active';
- $scope.VideoClassTwo = '';
- $scope.VideoClassThree = '';
- $scope.ShowVideoRecordingTap = function(num) {
- if (num == 1) {
- $scope.ShowVideoRecordingVar = 1;
- $scope.VideoClassOne = 'video-tabs-active';
- $scope.VideoClassTwo = '';
- $scope.VideoClassThree = '';
- } else if (num == 2) {
- $scope.ShowVideoRecordingVar = 2;
- $scope.VideoClassOne = '';
- $scope.VideoClassTwo = 'video-tabs-active';
- $scope.VideoClassThree = '';
- } else if (num == 3) {
- $scope.ShowVideoRecordingVar = 3;
- $scope.VideoClassOne = '';
- $scope.VideoClassTwo = '';
- $scope.VideoClassThree = 'video-tabs-active';
- }
- }
- $scope.PendingTableClass = 'sm-header-item sm-active active';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.ContactedTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = true;
- $rootScope.CountPending = 0;
- $rootScope.CountShortlisted = 0;
- $rootScope.CountContacted = 0;
- $rootScope.CountDeclined = 0;
- $rootScope.CountPassed = 0;
- $rootScope.CountVideo = 0;
- $rootScope.CountPhone = 0;
- $rootScope.CountInterview = 0;
- $rootScope.CountDeclined = 0;
- $rootScope.ApplyGeneralJobModal = function() {
- $http.post('ApplyStudentJob.php', {
- "data": $scope.ModalJob.id
- }).success(function(data, status) {
- $rootScope.CountPending++;
- $scope.ModalJob.Status = 'pending';
- $rootScope.CurrentList.push($scope.ModalJob);
- }).error(function(data, status) {});
- }
- $scope.DisplayInDashboardModal = function(Job) {
- $scope.ModalJob = Job;
- $scope.ModalId = Job.id;
- $scope.GraduateInternship = Job.GraduateInternship;
- $scope.name = Job.name;
- $scope.VideoQuestions = Job.VideoQuestions;
- $scope.location = Job.location;
- $scope.Website = Job.website;
- $scope.PostDate = Job.CurDate;
- $scope.DaysDeadline = Job.DaysDeadline;
- $scope.biography = Job.biography;
- $scope.LocalInt = Job.LocalInt;
- $scope.type = Job.type;
- $scope.FullPart = Job.Fullpart;
- $scope.remuneration = Job.remuneration;
- $scope.profile = Job.profile;
- $scope.Status = Job.Status;
- $scope.realtasks = Job.realtasks;
- $scope.DisplayMatchingModal = Job.DisplayMatching;
- $scope.DisplayNumberMatching = Job.Matching;
- $scope.realskills = Job.realskills;
- $scope.Perks = Job.Perks;
- $scope.Companyname = Job.Companyname;
- $scope.nameSpace = $scope.name.replace(/[\s]/g, '-');
- $scope.CompanynameSpace = $scope.Companyname.replace(/[\s]/g, '-');
- $scope.profile = Job.profile;
- $scope.Culture = Job.Culture;
- $scope.Life = Job.Life;
- $scope.deadline = Job.deadline;
- $scope.duration = Job.Duration;
- $scope.employerBiography = Job.employerBiography;
- $scope.PictureOneModal = Job.PictureOne;
- $scope.PictureTwoModal = Job.PictureTwo;
- $scope.PictureThreeModal = Job.PictureThree;
- if ($scope.PictureThreeModal == '') {
- $scope.PictureThreeModal = 'New-Icons/Company_placeholder_2.jpg';
- }
- if ($scope.PictureTwoModal == '') {
- $scope.PictureTwoModal = 'New-Icons/Company_placeholder_2.jpg';
- }
- if ($scope.PictureOneModal == '') {
- $scope.PictureOneModal = 'New-Icons/Company_placeholder.jpg';
- }
- }
- $rootScope.ShortlistGeneralJobModal = function() {
- $http.post('ShortlistStudentJob.php', {
- "data": $scope.ModalJob.id
- }).success(function(data, status) {
- $rootScope.CountShortlisted++;
- $scope.ModalJob.Status = 'shortlisted';
- $rootScope.CurrentList.push($scope.ModalJob);
- }).error(function(data, status) {});
- }
- $rootScope.RemoveShortlistGeneralJobModal = function() {
- $http.post('RemoveShortlistStudentJob.php', {
- "data": $scope.ModalJob.id
- }).success(function(data, status) {
- $rootScope.CountShortlisted--;
- $scope.ModalJob.Status = '';
- for (var i = 0; i < $rootScope.CurrentList.length; i++) {
- if ($rootScope.CurrentList[i].id == $scope.ModalJob.id) {
- $rootScope.CurrentList.splice($rootScope.CurrentList.indexOf($rootScope.CurrentList[i]));
- }
- }
- }).error(function(data, status) {});
- }
- $rootScope.ApplyGeneralJob = function(App) {
- $http.post('ApplyStudentJob.php', {
- "data": App.id
- }).success(function(data, status) {
- $rootScope.CountPending++;
- App.Status = 'pending';
- $rootScope.CurrentList.push(App);
- }).error(function(data, status) {});
- }
- $rootScope.ShortlistGeneralJob = function(App) {
- if (App.Status != 'pending') {
- $http.post('ShortlistStudentJob.php', {
- "data": App.id
- }).success(function(data, status) {
- $rootScope.CountShortlisted++;
- App.Status = 'shortlisted';
- $rootScope.CurrentList.push(App);
- }).error(function(data, status) {});
- }
- }
- $rootScope.RemoveShortlistGeneralJob = function(App) {
- $http.post('RemoveShortlistStudentJob.php', {
- "data": App.id
- }).success(function(data, status) {
- $rootScope.CountShortlisted--;
- App.Status = '';
- for (var i = 0; i < $rootScope.CurrentList.length; i++) {
- if ($rootScope.CurrentList[i].id == App.id) {
- $rootScope.CurrentList.splice($rootScope.CurrentList.indexOf($rootScope.CurrentList[i]), 1);
- }
- }
- }).error(function(data, status) {});
- }
- $scope.PendingTableClass = 'sm-header-item sm-active-dashboard';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.myFilter = {
- Status: 'pending'
- };
- $scope.ChangeBoxClass = function(num) {
- if (num == 1) {
- $scope.PendingTableClass = 'sm-header-item sm-active-dashboard';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'pending'
- };
- } else if (num == 2) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item sm-active-dashboard';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'passed'
- };
- } else if (num == 3) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item sm-active-dashboard';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'EmployerShortlisted'
- };
- } else if (num == 4) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item sm-active-dashboard';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'Video'
- };
- } else if (num == 5) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item sm-active-dashboard';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'Phone'
- };
- } else if (num == 6) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item sm-active-dashboard';
- $scope.DeclinedTableClass = 'sm-header-item';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'Interview'
- };
- } else if (num == 7) {
- $scope.PendingTableClass = 'sm-header-item';
- $scope.PassedTableClass = 'sm-header-item';
- $scope.ShortlistedTableClass = 'sm-header-item';
- $scope.VideoTableClass = 'sm-header-item';
- $scope.PhoneTableClass = 'sm-header-item';
- $scope.InterviewTableClass = 'sm-header-item';
- $scope.DeclinedTableClass = 'sm-header-item sm-active-dashboard';
- $scope.ShowGeneralJobs = false;
- $scope.myFilter = {
- Status: 'declined'
- };
- }
- }
- var lockJobs = function() {
- $rootScope.CurrentList.forEach(function(el, i, arr) {
- arr[i].locked = true;
- });
- }
- $scope.getTestStatus = function() {
- // get all tests taken by user
- var email = $rootScope.email;
- console.log(email);
- $http.post("getApplicantTests.php", { "email": $rootScope.email }).then(function (data) {
- // iterate trough all jobs in CurrentList, change message on button
- var funData = data.data;
- console.log(funData);
- for (var j = 0; j < $rootScope.CurrentList.length; j++) {
- for (var k = 0; k < $rootScope.CurrentList[j].hrlinks.length; k++) {
- for (var i = 0; i < funData.length; i++) {
- if (funData[i].test_id === $rootScope.CurrentList[j].hrlinks[k].test_id) {
- if (funData[i].status === "incomplete" &&
- !$rootScope.CurrentList[j].hrlinks[k].name.startsWith("Invite sent!")) {
- $rootScope.CurrentList[j].hrlinks[k].name += " - Resend Invite";
- } else if (funData[i].status === "complete") {
- $rootScope.CurrentList[j].hrlinks[k].name += " - Completed";
- $rootScope.CurrentList[j].hrlinks[k].disabled = true;
- }
- }
- }
- }
- }
- });
- }
- $http.get('GetApplicantJobs.php').success(function(data) {
- $rootScope.CurrentList = data;
- for (var i = 0; i < $rootScope.CurrentList.length; i++) {
- if ($rootScope.CurrentList[i].Status == 'passed') {
- $rootScope.CountPassed++;
- } else if ($rootScope.CurrentList[i].Status == 'pending') {
- console.log($rootScope.CurrentList[i].Status);
- $rootScope.CountPending++;
- } else if ($rootScope.CurrentList[i].Status == 'EmployerShortlisted') {
- $rootScope.CountShortlisted++;
- } else if ($rootScope.CurrentList[i].Status == 'Video') {
- $rootScope.CountVideo++;
- } else if ($rootScope.CurrentList[i].Status == 'Phone') {
- $rootScope.CountPhone++;
- } else if ($rootScope.CurrentList[i].Status == 'Interview') {
- $rootScope.CountInterview++;
- } else if ($rootScope.CurrentList[i].Status == 'declined') {
- $rootScope.CountDeclined++;
- }
- }
- $scope.getTestStatus();
- }).error(function(data) {
- $scope.CurrentEmployerJobs = data || "Request failed";
- });
- $scope.sendHackerRankInvite = function(job_id, test_id, employer_id) {
- var email = $rootScope.email;
- var jobIndex = -1;
- var testIndex = -1;
- // find the job so we can update the message
- for (var i = 0; i < $rootScope.CurrentList.length; i++) {
- if ($rootScope.CurrentList[i].id === job_id) {
- jobIndex = i;
- break;
- }
- }
- // find the test so we can disable the button after sending.
- for (var i = 0; i < $rootScope.CurrentList[jobIndex].hrlinks.length; i++) {
- if ($rootScope.CurrentList[jobIndex].hrlinks[i].test_id === test_id) {
- testIndex = i;
- }
- }
- var oldName = $rootScope.CurrentList[jobIndex].hrlinks[testIndex].name;
- $rootScope.CurrentList[jobIndex].hrlinks[testIndex].name = "Sending invite...";
- $rootScope.CurrentList[jobIndex].hrlinks[testIndex].disabled = true;
- HackerRank.getAccount(employer_id).then(function (data) {
- $http.post("sendHackerRankEmail.php",
- { "username" : email,
- "send_email" : "true",
- "force" : "true",
- "hide_login_credentials" : "true",
- "test_result_url": "http://43.243.201.96/catchTestData.php",
- "access_token" : data.data.access_token,
- "test_id" : test_id,
- "job_id" : job_id
- }
- ).then(function(data2) {
- if (!data2.data.data) {
- $rootScope.CurrentList[jobIndex].message = "This employer's HackerRank account is unavailable at this time. "
- + " They will be contacted in order to rectify this issue.";
- $rootScope.CurrentList[jobIndex].hrlinks[testIndex].name = oldName;
- lockJobs();
- return;
- }
- if (data2.data.data.status === true) {
- $rootScope.CurrentList[jobIndex].message = null;
- $rootScope.CurrentList[jobIndex].hrlinks[testIndex].name = "Invite sent! "
- + "Check your email inbox.";
- } else {
- $rootScope.CurrentList[jobIndex].message = "Invite not sent. Have you already taken this test? Refresh the page to update any status, and try again if necessary.";
- }
- }, function(err) {
- console.log(err.message);
- });
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement