issue #183 fixed

parent 2de63f63
......@@ -471,7 +471,8 @@ module.exports = {
* }
*/
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 (req.body.password) {
supervisor.password = req.body.password;
......@@ -483,11 +484,13 @@ module.exports = {
supervisor.gender = req.body.gender || supervisor.gender;
supervisor.pic = req.body.pic || supervisor.pic;
supervisor.address = req.body.address || supervisor.address;
supervisor.postalCode = req.body.postalCode || supervisor.postalCode;
supervisor.country = req.body.country || supervisor.country;
supervisor.email = req.body.email || supervisor.email;
supervisor.phone = req.body.phone || supervisor.phone;
supervisor.lang = req.body.lang || supervisor.lang;
supervisor.ttsEngine = req.body.ttsEngine || supervisor.ttsEngine;
supervisor.office = req.body.office || supervisor.office;
supervisor.save(function (error) {
if (error) {
res.serverError();
......
......@@ -84,14 +84,13 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
name: supervisor.name,
surname: supervisor.surname,
address: supervisor.address,
postalCode: supervisor.address,
postalCode: supervisor.postalCode,
country: supervisor.country,
email: supervisor.email,
actualEmail: supervisor.email,
phone: supervisor.phone,
password: '',
password_confirm: '',
gender: supervisor.gender,
password: supervisor.password,
password_confirm: supervisor.password_confirm,
lang: supervisor.lang,
office: supervisor.office
};
......@@ -101,13 +100,6 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
$scope.save_supervisor = function(){
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
var supid = supervisor.id;
delete supervisor.id;
......
......@@ -9,7 +9,9 @@
<div class="row">
<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 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">
......@@ -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 class="ops">
<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>
</tr>
</table>
......@@ -47,4 +49,4 @@
<!-- 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>
\ No newline at end of file
</div>
......@@ -15,7 +15,7 @@
</div>
<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 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