working on issue #951

parent eebde1a5
...@@ -260,7 +260,6 @@ module.exports = { ...@@ -260,7 +260,6 @@ module.exports = {
*/ */
create: function (req, res) { create: function (req, res) {
var params = req.params.all(); var params = req.params.all();
var supervisor;
// Send email confirmation // Send email confirmation
function sendConfirmationMail(cb) { function sendConfirmationMail(cb) {
...@@ -293,7 +292,7 @@ module.exports = { ...@@ -293,7 +292,7 @@ module.exports = {
sails.log.debug("Creating supervisor with params " + JSON.stringify(params)); sails.log.debug("Creating supervisor with params " + JSON.stringify(params));
if (!params.name || !params.surname || !params.gender || !params.password || !params.email ) if (!params.name || !params.surname || !params.gender || !params.password || !params.email )
res.badRequest("Invalid params"); return res.badRequest("Invalid params");
var supData = { var supData = {
name: params.name, name: params.name,
...@@ -311,15 +310,11 @@ module.exports = { ...@@ -311,15 +310,11 @@ module.exports = {
if (params.id_off) if (params.id_off)
supData.id_off = params.id_off; supData.id_off = params.id_off;
console.log("supData:\n" + JSON.stringify(supData));
Supervisor.create(supData) Supervisor.create(supData)
.then(function (sup) { .then(function (sup) {
if (!sup) if (!sup)
res.serverError("Supervisor created but returned null"); return res.serverError("Supervisor created but returned null");
supervisor = sup;
if (params.role === 'therapist_office' || params.role === 'tutor_office') { if (params.role === 'therapist_office' || params.role === 'tutor_office') {
sendConfirmationMail((err) => { sendConfirmationMail((err) => {
...@@ -332,9 +327,11 @@ module.exports = { ...@@ -332,9 +327,11 @@ module.exports = {
.then((off) => { .then((off) => {
// link supervisor with office // link supervisor with office
supervisor.id_off = off.id; console.log("supervisor: \n" + JSON.stringify(supervisor));
delete supervisor.password; sup.id_off = off.id;
supervisor.save(); delete sup.password;
sup.save();
console.log("supervisor: \n" + JSON.stringify(supervisor));
// set supervisor as admin in the office // set supervisor as admin in the office
off.admin = supervisor.id; off.admin = supervisor.id;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<hr> <hr>
<!-- Bread and categories --> <!-- Bread and categories -->
<div id="bread_and_categories" ng-show="source == 'symbolstx'" class="panel panel-default"> <div id="bread_and_categories" ng-show="source == 'symbolstx'" class="panel panel-default" style="z-index:1000">
<div class="panel-heading"> <div class="panel-heading">
<div class="pull-left" ng-repeat="b in breadcrumbs"> <div class="pull-left" ng-repeat="b in breadcrumbs">
<a ng-click="open_category_from_bc(b.id)"> <a ng-click="open_category_from_bc(b.id)">
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<div id="clearfix-infiniteScroll-parent" infinite-scroll="scroll()" infinite-scroll-container="'#collections'"> <div id="clearfix-infiniteScroll-parent" infinite-scroll="scroll()" infinite-scroll-container="'#collections'">
<div class="picto_peq pull-left" ng-repeat="p in pictos" > <div class="picto_peq pull-left" ng-repeat="p in pictos" >
<img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter" style="z-index:9000"/> <img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter"/>
<!-- Options to remove picto (Only for own pictos) --> <!-- Options to remove picto (Only for own pictos) -->
<div class="picto_options"> <div class="picto_options">
<a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate }}" ng-show="source == 'ownpictos'"> <a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate }}" ng-show="source == 'ownpictos'">
......
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