fixed problem with supervisor search in student setup

parent 51c69a8d
......@@ -17,6 +17,8 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup';
$scope.supsForm = {};
/**
* Updates the student picture
* @param {Angular file array} $files Image to be uploaded
......@@ -136,8 +138,9 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
* The email used for search is fetched from $scope.email_sup.
*/
$scope.search_sup = function () {
console.log("--> " + $scope.supsForm.email_sup);
// Find tutor by email
$http.get(config.backend + '/sup/email/' + $scope.email_sup)
$http.get(config.backend + '/sup/email/' + $scope.supsForm.email_sup)
.success(function (data) {
if (data) {
$scope.supToAdd = data;
......@@ -173,7 +176,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// Add to the list of tutors in view
$scope.studentSupervisors.push($scope.supToAdd);
// Delete the email form field
$scope.email_sup = '';
$scope.supsForm.email_sup = '';
// Hide the message of supervisor founded
$scope.showmessagesupfound = false;
})
......@@ -214,7 +217,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// Search tutor by email
$scope.search_tutor = function () {
// Find tutor by email
$http.get(config.backend + '/sup/email/' + $scope.email_tutor)
$http.get(config.backend + '/sup/email/' + $scope.supsForm.email_tutor)
.success(function (data) {
// If it found the length is > 0
if (data) {
......@@ -252,7 +255,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// Add to the list of tutors in view
$scope.studentTutors.push($scope.tutorToAdd);
// Delete the email form field
$scope.email_tutor = '';
$scope.supsForm.email_tutor = '';
// Hide the message of tutor founded
$scope.showmessagetutorfound = false;
......
......@@ -94,7 +94,7 @@
<p>
<form role="search" ng-submit="search_sup()">
<div class="input-group">
<input type="email" class="form-control" placeholder="{{ 'search_sup_email' | translate }}" name="email_sup" id="email_sup" ng-model="email_sup" required>
<input type="email" class="form-control" placeholder="{{ 'search_sup_email' | translate }}" name="email_sup" id="email_sup" ng-model="supsForm.email_sup" required>
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
......@@ -134,7 +134,7 @@
<p>
<form role="search" ng-submit="search_tutor()">
<div class="input-group">
<input type="email" class="form-control" placeholder="{{ 'search_tutor_email' | translate }}" name="email_tutor" id="email_tutor" ng-model="email_tutor" required>
<input type="email" class="form-control" placeholder="{{ 'search_tutor_email' | translate }}" name="email_tutor" id="email_tutor" ng-model="supsForm.email_tutor" required>
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment