issue #183 fixed

parent 2de63f63
...@@ -471,7 +471,8 @@ module.exports = { ...@@ -471,7 +471,8 @@ module.exports = {
* } * }
*/ */
update: function (req, res) { update: function (req, res) {
Supervisor.findOne({ id: req.params.id }).then(function (supervisor) { Supervisor.findOne({ id: req.params.id })
.then(function (supervisor) {
if (supervisor) { if (supervisor) {
if (req.body.password) { if (req.body.password) {
supervisor.password = req.body.password; supervisor.password = req.body.password;
...@@ -483,11 +484,13 @@ module.exports = { ...@@ -483,11 +484,13 @@ module.exports = {
supervisor.gender = req.body.gender || supervisor.gender; supervisor.gender = req.body.gender || supervisor.gender;
supervisor.pic = req.body.pic || supervisor.pic; supervisor.pic = req.body.pic || supervisor.pic;
supervisor.address = req.body.address || supervisor.address; supervisor.address = req.body.address || supervisor.address;
supervisor.postalCode = req.body.postalCode || supervisor.postalCode;
supervisor.country = req.body.country || supervisor.country; supervisor.country = req.body.country || supervisor.country;
supervisor.email = req.body.email || supervisor.email; supervisor.email = req.body.email || supervisor.email;
supervisor.phone = req.body.phone || supervisor.phone; supervisor.phone = req.body.phone || supervisor.phone;
supervisor.lang = req.body.lang || supervisor.lang; supervisor.lang = req.body.lang || supervisor.lang;
supervisor.ttsEngine = req.body.ttsEngine || supervisor.ttsEngine; supervisor.ttsEngine = req.body.ttsEngine || supervisor.ttsEngine;
supervisor.office = req.body.office || supervisor.office;
supervisor.save(function (error) { supervisor.save(function (error) {
if (error) { if (error) {
res.serverError(); res.serverError();
......
...@@ -84,14 +84,13 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor ...@@ -84,14 +84,13 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
name: supervisor.name, name: supervisor.name,
surname: supervisor.surname, surname: supervisor.surname,
address: supervisor.address, address: supervisor.address,
postalCode: supervisor.address, postalCode: supervisor.postalCode,
country: supervisor.country, country: supervisor.country,
email: supervisor.email, email: supervisor.email,
actualEmail: supervisor.email,
phone: supervisor.phone, phone: supervisor.phone,
password: '',
password_confirm: '',
gender: supervisor.gender, gender: supervisor.gender,
password: supervisor.password,
password_confirm: supervisor.password_confirm,
lang: supervisor.lang, lang: supervisor.lang,
office: supervisor.office office: supervisor.office
}; };
...@@ -101,13 +100,6 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor ...@@ -101,13 +100,6 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
$scope.save_supervisor = function(){ $scope.save_supervisor = function(){
var supervisor = $scope.formdatasupervisor; var supervisor = $scope.formdatasupervisor;
// Checking new email
// If no change, it is deleted from supervisor object
if (supervisor.email == supervisor.actualEmail){
delete supervisor.email;
delete supervisor.actualEmail;
}
// Delete id to prevent the user update it // Delete id to prevent the user update it
var supid = supervisor.id; var supid = supervisor.id;
delete supervisor.id; delete supervisor.id;
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<div class="row"> <div class="row">
<div class="col-xs-3"> <div class="col-xs-3">
<button type="button" class="btn btn-success btn-circle btn-lg" ng-click="resetForm(); hideofficeadd = false" title="{{'add'|translate}}"><i class="glyphicon glyphicon-plus"></i></button> <a ng-click="resetForm(); hideofficeadd = false" class="btn btn-success btn-sm" role="button">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {{ 'add_office' | translate }}
</a>
</div> </div>
<div class="col-xs-6 input-group"> <div class="col-xs-6 input-group">
<input type="text" ng-model="search_offices" id="search_offices" placeholder="{{ 'filter' | translate }}" class="form-control" aria-describedby="basic-addon2"> <input type="text" ng-model="search_offices" id="search_offices" placeholder="{{ 'filter' | translate }}" class="form-control" aria-describedby="basic-addon2">
...@@ -34,8 +36,8 @@ ...@@ -34,8 +36,8 @@
<td><span class="color_blue">{{office.admin.name}} {{office.admin.surname}}</span><br />{{office.admin.email}} <br />{{office.admin.phone}}</td> <td><span class="color_blue">{{office.admin.name}} {{office.admin.surname}}</span><br />{{office.admin.email}} <br />{{office.admin.phone}}</td>
<td class="ops"> <td class="ops">
<a ng-click="update_office(office)" title="{{'edit'|translate}}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a> <a ng-click="update_office(office)" title="{{'edit'|translate}}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a ng-click="delete_office(office)" title="{{'delete'|translate}}"><span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a> <a ng-click="delete_office(office)" title="{{'delete'|translate}}"><span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -47,4 +49,4 @@ ...@@ -47,4 +49,4 @@
<!-- Update Office Form --> <!-- Update Office Form -->
<div ng-include="'modules/admin/views/offices_update.html'" class="col-md-4" ng-init="hideofficeupdate = true" ng-hide="hideofficeupdate"></div> <div ng-include="'modules/admin/views/offices_update.html'" class="col-md-4" ng-init="hideofficeupdate = true" ng-hide="hideofficeupdate"></div>
</div> </div>
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" id="supervisor_postal_code" placeholder="{{ 'postal_code' | translate }}" required ng-model="formdata.postalCode" ng-change="formdata.postalCode = formdata.postalCode.toUpperCase()"/> <input type="text" class="form-control" id="supervisor_postal_code" placeholder="{{ 'postal_code' | translate }}" required ng-model="formdatasupervisor.postalCode" ng-change="formdatasupervisor.postalCode = formdatasupervisor.postalCode.toUpperCase()"/>
</div> </div>
<div class="form-group"> <div class="form-group">
......
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