Commit e8304e54 authored by ZeMKI's avatar ZeMKI
Browse files

Create a supervisor in the backend

* now there's a user interface to activate supervisors
* you can send test emails to check what's in there
* default text in app/utilities
* bugfixed keyenter 13 that was active on the whole website instead of only the interview
parent 5d142e17
......@@ -52,10 +52,15 @@ class CreateUserCommand extends Command
if ($this->store($role, $email, $user)) {
Mail::to($email)->send(new VerificationEmail($user));
Mail::to($email)->send(new VerificationEmail($user,config('utilities.emailDefaultText')));
$this->info('An email was sent to '.$user->email.' he/she needs to set the password.');
return true;
} else
{
$this->info('There it was an error during user creation, please try again.');
return false;
}
}
......
......@@ -178,6 +178,10 @@ class UserController extends Controller
{
// case from admin area
if($request->testEmail){
Mail::to($request->email)->send(new VerificationEmail(new User,$request->emailtext? $request->emailtext : config('utilities.emailDefaultText')));
return redirect('/admin/supervisor')->with(['message'=>'Test Email sent to '.$request->email]);
}
$editpermissions = Permission::where('name', 'like', '%interviews')->get()->toArray();
......@@ -202,16 +206,17 @@ class UserController extends Controller
// supervisor create a researcher
$user->supervised_by = Auth::user()->id;
Mail::to($user->email)->send(new VerificationEmail($user));
$user->save();
$user->attachRole($role, $study);
Mail::to($user->email)->send(new VerificationEmail($user,$request->emailtext? $request->emailtext : config('utilities.emailDefaultText')));
}
$user->attachPermissions($editpermissions, $study);
return response("An email verification was sent to " . $user->email . " please let the user open it");
if(!$request->emailtext)return response("An email verification was sent to " . $user->email . " please let the user open it");
else return redirect('/admin/supervisor')->with(['message'=>'User registered']);
}
......
......@@ -16,9 +16,10 @@ class VerificationEmail extends Mailable
*
* @return void
*/
public function __construct(User $user)
public function __construct(User $user, $emailtext)
{
$this->user = $user;
$this->emailtext = $emailtext;
}
/**
......@@ -28,6 +29,6 @@ class VerificationEmail extends Mailable
*/
public function build()
{
return $this->from('noreply@kommunikative-figurationen.de')->markdown('email.setpassword')->with(['user' => $this->user]);
return $this->from('no_reply@kommunikative-figurationen.de')->markdown('email.setpassword')->with(['user' => $this->user, 'text' => $this->emailtext]);
}
}
This diff is collapsed.
......@@ -734,12 +734,7 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
$(document).on('keydown', function (e) {
if (e.keyCode == 13) {
e.preventDefault();
}
}); // record animation
// record animation
$(document).ready(function () {
var divs = $('*[class^="rect"]');
 
......@@ -808,7 +803,12 @@ $(document).ready(function () {
}
},
mounted: function mounted() {
// Prevent pull refresh chrome
$(document).on('keydown', function (e) {
if (e.keyCode == 13) {
e.preventDefault();
}
}); // Prevent pull refresh chrome
var lastTouchY = 0;
var preventPullToRefresh = false;
window.document.body.addEventListener("touchstart", function (e) {
......@@ -16686,15 +16686,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var buefy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(buefy__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var vue_material_design_icons_styles_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-material-design-icons/styles.css */ "./node_modules/vue-material-design-icons/styles.css");
/* harmony import */ var vue_material_design_icons_styles_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue_material_design_icons_styles_css__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var interactjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! interactjs */ "./node_modules/interactjs/dist/interact.js");
/* harmony import */ var interactjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(interactjs__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var vue_material_design_icons_Plus_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue-material-design-icons/Plus.vue */ "./node_modules/vue-material-design-icons/Plus.vue");
/* harmony import */ var vue_material_design_icons_ArrowLeft_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue-material-design-icons/ArrowLeft.vue */ "./node_modules/vue-material-design-icons/ArrowLeft.vue");
/* harmony import */ var vue_material_design_icons_ArrowRight_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! vue-material-design-icons/ArrowRight.vue */ "./node_modules/vue-material-design-icons/ArrowRight.vue");
/* harmony import */ var vue_material_design_icons_TrashCan_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-material-design-icons/TrashCan.vue */ "./node_modules/vue-material-design-icons/TrashCan.vue");
/* harmony import */ var vue_material_design_icons_Pencil_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue-material-design-icons/Pencil.vue */ "./node_modules/vue-material-design-icons/Pencil.vue");
/* harmony import */ var vue_select__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue-select */ "./node_modules/vue-select/dist/vue-select.js");
/* harmony import */ var vue_select__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(vue_select__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var vue_material_design_icons_Plus_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue-material-design-icons/Plus.vue */ "./node_modules/vue-material-design-icons/Plus.vue");
/* harmony import */ var vue_material_design_icons_ArrowLeft_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue-material-design-icons/ArrowLeft.vue */ "./node_modules/vue-material-design-icons/ArrowLeft.vue");
/* harmony import */ var vue_material_design_icons_ArrowRight_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue-material-design-icons/ArrowRight.vue */ "./node_modules/vue-material-design-icons/ArrowRight.vue");
/* harmony import */ var vue_material_design_icons_Pencil_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! vue-material-design-icons/Pencil.vue */ "./node_modules/vue-material-design-icons/Pencil.vue");
/* harmony import */ var vue_select__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-select */ "./node_modules/vue-select/dist/vue-select.js");
/* harmony import */ var vue_select__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(vue_select__WEBPACK_IMPORTED_MODULE_6__);
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
......@@ -16709,10 +16706,8 @@ __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
 
 
 
window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
Vue.component('v-select', vue_select__WEBPACK_IMPORTED_MODULE_8___default.a);
Vue.component('v-select', vue_select__WEBPACK_IMPORTED_MODULE_6___default.a);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
......@@ -16828,10 +16823,10 @@ Vue.mixin({
window.app = new Vue({
el: '#app',
components: {
PlusIcon: vue_material_design_icons_Plus_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
ArrowRight: vue_material_design_icons_ArrowRight_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
ArrowLeft: vue_material_design_icons_ArrowLeft_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
Pencil: vue_material_design_icons_Pencil_vue__WEBPACK_IMPORTED_MODULE_7__["default"]
PlusIcon: vue_material_design_icons_Plus_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
ArrowRight: vue_material_design_icons_ArrowRight_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
ArrowLeft: vue_material_design_icons_ArrowLeft_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
Pencil: vue_material_design_icons_Pencil_vue__WEBPACK_IMPORTED_MODULE_5__["default"]
},
data: {
newstudy: {},
{
"/js/app.js": "/js/app.js?id=ae086bf49dbc84368c71",
"/js/app.js": "/js/app.js?id=3803ce4ea00beb99b3c5",
"/css/app.css": "/css/app.css?id=33e8c8db759d1aed6c23",
"/css/app_dompdf.css": "/css/app_dompdf.css?id=225174786ee9d00fe897",
"/js/manifest.js": "/js/manifest.js?id=844cdbfe9e6b6b56ae8f",
......
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
import Buefy from 'buefy'
import "vue-material-design-icons/styles.css"
import interact from 'interactjs'
import PlusIcon from "vue-material-design-icons/Plus.vue"
import ArrowLeft from "vue-material-design-icons/ArrowLeft.vue"
import ArrowRight from "vue-material-design-icons/ArrowRight.vue"
import TrashCan from "vue-material-design-icons/TrashCan.vue"
import Pencil from "vue-material-design-icons/Pencil.vue"
require('./bootstrap');
import Buefy from 'buefy'
import "vue-material-design-icons/styles.css"
import PlusIcon from "vue-material-design-icons/Plus.vue"
import ArrowLeft from "vue-material-design-icons/ArrowLeft.vue"
import ArrowRight from "vue-material-design-icons/ArrowRight.vue"
import Pencil from "vue-material-design-icons/Pencil.vue"
import vSelect from 'vue-select'
window.Vue = require('vue');
import vSelect from 'vue-select'
window.Vue = require('vue');
Vue.component('v-select', vSelect)
/**
......@@ -27,18 +23,18 @@ Vue.component('v-select', vSelect)
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('new-study', require('./components/newstudy.vue').default);
Vue.component('new-edit-user', require('./components/newedituser.vue').default);
Vue.component('user-overview', require('./components/overviewuser.vue').default);
Vue.component('new-interview', require('./components/newinterview.vue').default);
Vue.component('sorting', require('./components/sorting.vue').default);
Vue.component('consultsorting', require('./components/consultsorting.vue').default);
Vue.component('userpart', require('./components/userpart.vue').default);
Vue.config.devtools = true;
Vue.config.debug = true;
Vue.config.silent = false;
Vue.use(Buefy)
Vue.component('new-study', require('./components/newstudy.vue').default);
Vue.component('new-edit-user', require('./components/newedituser.vue').default);
Vue.component('user-overview', require('./components/overviewuser.vue').default);
Vue.component('new-interview', require('./components/newinterview.vue').default);
Vue.component('sorting', require('./components/sorting.vue').default);
Vue.component('consultsorting', require('./components/consultsorting.vue').default);
Vue.component('userpart', require('./components/userpart.vue').default);
Vue.config.devtools = true;
Vue.config.debug = true;
Vue.config.silent = false;
Vue.use(Buefy)
var bus = new Vue();
// Assign globally functions for getCookies and setCookies in JS
......@@ -46,8 +42,8 @@ var bus = new Vue();
Vue.mixin({
data() {
return {
fromidtoname:{
permissionsNames:{
fromidtoname: {
permissionsNames: {
1: "Only consult data",
2: "Can edit study",
3: "Can assign users to study",
......@@ -55,7 +51,7 @@ Vue.mixin({
5: "Can edit and create studies",
6: "Creator of the study"
},
permissionsVariables:{
permissionsVariables: {
onlyconsult: 1,
caneditstudy: 2,
canassignusers: 3,
......@@ -65,17 +61,17 @@ Vue.mixin({
}
}
}
},
computed: {
},
computed: {
url: function () {
return document.URL.split('/').pop();
}
},
methods: {
getCookie: function(cname) {
},
methods: {
getCookie: function (cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
......@@ -89,18 +85,18 @@ methods: {
setCookie: function (cname, cvalue, exdays) {
let d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires="+d.toUTCString();
let expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
},
deleteCookie: function(name){
deleteCookie: function (name) {
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
},
confirmdelete: function(id, name){
confirmdelete: function (id, name) {
this.$dialog.confirm(
{
title: 'Confirm Delete',
message: `Are you sure to delete the study `+name+' and all the deleted data?',
message: `Are you sure to delete the study ` + name + ' and all the deleted data?',
cancelText: 'Cancel',
confirmText: 'Delete',
type: 'is-danger',
......@@ -108,35 +104,34 @@ methods: {
}
);
},
deletestudy: function(id){
deletestudy: function (id) {
this.loading = true;
this.message = "";
let self = this;
axios.delete('studies/'+id,{data: id})
axios.delete('studies/' + id, {data: id})
.then(response => {
setTimeout(function(){
setTimeout(function () {
self.loading = false;
self.$snackbar.open("Study deleted");
window.location.href = '../mesort';
},500);
}, 500);
}).catch(function (error) {
console.log(error);
self.loading = false;
self.$snackbar.open("There it was an error during the request - refresh page and try again");
});
},
goto: function(url){
},
goto: function (url) {
window.location.href = url;
}
}
}
}
});
window.app = new Vue({
el: '#app',
components: {
......@@ -146,9 +141,7 @@ window.app = new Vue({
Pencil
},
data: {
newstudy: {
},
newstudy: {},
users: {},
newuser: {
showmodal: false,
......@@ -165,29 +158,31 @@ window.app = new Vue({
},
events: {
'showmodalparent': function(){
'showmodalparent': function () {
console.log("test")
}
},
methods: {
showmodal: function(id = null, study){
showmodal: function (id = null, study) {
this.newuser.showmodal = !this.newuser.showmodal;
this.newuser.edituser = id;
this.newuser.study = study;
// if(this.$refs.usertable) this.$refs.usertable.realodtable();
},
confirmgohome: function() {
confirmgohome: function () {
this.$dialog.confirm({
title: 'Cancel interview',
message: 'Do you want to cancel this interview?',
confirmText: 'go',
type: 'is-danger',
hasIcon: true,
onConfirm: () => {window.location.href = '../';}
onConfirm: () => {
window.location.href = '../';
}
})
},
setinterviewdname: function(studyid) {
setinterviewdname: function (studyid) {
this.$dialog.prompt({
message: `What's the interviewed name?`,
......@@ -198,9 +193,12 @@ window.app = new Vue({
},
onConfirm: (value) => {
if(value.length == 0){console.log("test")};
if (value.length == 0) {
console.log("test")
}
;
this.interview.interviewed = value;
window.location.href = 'interviews/new?study='+studyid+'&interviewed='+value;
window.location.href = 'interviews/new?study=' + studyid + '&interviewed=' + value;
}
})
},
......@@ -210,8 +208,8 @@ window.app = new Vue({
this.$forceUpdate();
},
showtoast: function(message){
showtoast: function (message) {
window.app.$snackbar.open(message);
}
}
}
});
......@@ -122,11 +122,6 @@
</template>
<script>
$(document).on('keydown', function (e) {
if ((e.keyCode == 13)) {
e.preventDefault();
}
});
......@@ -208,6 +203,13 @@
}
},
mounted() {
$(document).on('keydown', function (e) {
if ((e.keyCode == 13)) {
e.preventDefault();
}
});
// Prevent pull refresh chrome
var lastTouchY = 0;
var preventPullToRefresh = false;
......
......@@ -2,10 +2,21 @@
<body>
<!-- START NAV -->
@include('layouts.nav')
<!-- END NAV -->
<div class="container" id="app">
<!-- START NAV -->
@include('layouts.nav')
<!-- END NAV -->
<div class="container" id="app">
@if(session()->has('message'))
<b-notification
:active.sync="mainNotification"
aria-close-label="Close notification"
type="is-danger"
role="alert"
>
{{session()->get('message')}}
</b-notification>
@endif
<div class="columns">
......@@ -14,7 +25,7 @@
@yield('content')
</div>
</div>
</div>
</div>
</body>
......
......@@ -14,7 +14,7 @@
<div class="level">
<div class="column">
<h1 class="title">Create a Supervisor</h1>
<p class="subtitle"> some text to explain what a supervisor is and can do</p>
<h6 class="subtitle has-text-danger">A valid email is required. <br> If you don't enter the email text, the default will be used.</h6>
<form method="POST" action="{{url('admin/users/supervisor')}}" class="" style="padding-top: 40px">
@csrf
<input type="hidden" value="2" name="role">
......@@ -23,20 +23,28 @@
Email
</label>
<div class="control">
<input type="text" class="input" name="email">
<input type="text" class="input" name="email" required>
</div>
</div>
<div class="field">
<p class="text-base">You can use markdown in this field, it will be rendered in the email.</p>
<label for="email" class="label">
Email text
</label>
<textarea class="textarea" name="email" placeholder="e.g. Hello world"></textarea>
<textarea class="textarea" name="emailtext" rows="3" cols="10"></textarea>
</div>
<div class="level">
<div class="field">
<div class="control">
<input type="checkbox" name="testEmail" value="true"> Don't create user but send email<br>
</div>
</div>
<div class="field">
<div class="control">
<button class="button is-link">Send email</button>
......
......@@ -24,6 +24,7 @@
<p class="control has-icon-left">
<input id="password" type="password"
class="input {{ $errors->has('password') ? ' is-invalid' : '' }}" name="password"
minlength="6"
required>
<span class="icon is-small is-left">
<i class="fas fa-lock"></i>
......
@component('mail::message')
@component('mail::panel')
PLEASE SET A PASSWORD AND ENTER MESORT
{!! (new Parsedown)->text($text) !!}
<a href="{{url('setpassword')."?token=".($user->password_token ? $user->password_token : '')}}" title="set password">{{url('setpassword')."?token=".($user->password_token ? $user->password_token : '')}}</a>
@component('mail::button', ['url' => url('setpassword')."?token=".$user->password_token])
Confirm account and set password
@endcomponent
@component('mail::button', ['url' => url('setpassword')."?token=".($user->password_token ? $user->password_token : '')])
Set Mesort Password
@endcomponent
@endcomponent
Thanks,<br>
{{ config('app.name') }}
Thanks,<br>
{{ config('app.name') }} Team
@endcomponent
......@@ -31,7 +31,6 @@ Route::group(['prefix' => 'admin', 'middleware' => ['role:superadministrator']],
Route::get('/', 'AdminController@index');
Route::get('/supervisor', 'AdminController@supervisorindex');
Route::post('/users/supervisor', 'UserController@store');
});
Route::group(['middleware' => 'auth'], function () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment