working on issue #951

parent eebde1a5
......@@ -260,7 +260,6 @@ module.exports = {
*/
create: function (req, res) {
var params = req.params.all();
var supervisor;
// Send email confirmation
function sendConfirmationMail(cb) {
......@@ -293,7 +292,7 @@ module.exports = {
sails.log.debug("Creating supervisor with params " + JSON.stringify(params));
if (!params.name || !params.surname || !params.gender || !params.password || !params.email )
res.badRequest("Invalid params");
return res.badRequest("Invalid params");
var supData = {
name: params.name,
......@@ -311,15 +310,11 @@ module.exports = {
if (params.id_off)
supData.id_off = params.id_off;
console.log("supData:\n" + JSON.stringify(supData));
Supervisor.create(supData)
.then(function (sup) {
if (!sup)
res.serverError("Supervisor created but returned null");
supervisor = sup;
return res.serverError("Supervisor created but returned null");
if (params.role === 'therapist_office' || params.role === 'tutor_office') {
sendConfirmationMail((err) => {
......@@ -332,9 +327,11 @@ module.exports = {
.then((off) => {
// link supervisor with office
supervisor.id_off = off.id;
delete supervisor.password;
supervisor.save();
console.log("supervisor: \n" + JSON.stringify(supervisor));
sup.id_off = off.id;
delete sup.password;
sup.save();
console.log("supervisor: \n" + JSON.stringify(supervisor));
// set supervisor as admin in the office
off.admin = supervisor.id;
......
......@@ -47,7 +47,7 @@
<hr>
<!-- 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="pull-left" ng-repeat="b in breadcrumbs">
<a ng-click="open_category_from_bc(b.id)">
......@@ -82,7 +82,7 @@
<div id="clearfix-infiniteScroll-parent" infinite-scroll="scroll()" infinite-scroll-container="'#collections'">
<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) -->
<div class="picto_options">
<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