Commit b9e724ef authored by ZeMKI's avatar ZeMKI

Newsletter and code optimization

* now users require a profile.
* new column on profile: newsletter.
* using config.enums for newsletter status.
* now you can define 0 pre-defined tokens for a study.
* css optimization.
parent 6ecca000
...@@ -2,12 +2,25 @@ ...@@ -2,12 +2,25 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="b51d2beb-a115-4b2a-80a2-b27cfb404d6c" name="Default Changelist" comment=""> <list default="true" id="b51d2beb-a115-4b2a-80a2-b27cfb404d6c" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/config/enums.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/database/migrations/2020_06_02_173558_add_newsletter_to_user_profiles.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/AllInterviewTokenExport.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/AllInterviewTokenExport.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Answer.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Answer.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/InterviewTokenExport.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/InterviewTokenExport.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Helpers/Helper.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Helpers/Helper.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/components/Interview/newinterview.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/components/Interview/newinterview.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/Auth/RegisterController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Auth/RegisterController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/components/Interview/sorting_preview.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/components/Interview/sorting_preview.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/HomeController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/HomeController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/NotificationController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/NotificationController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/StudyController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/StudyController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Profile.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Profile.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/User.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/User.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2018_10_04_145119_create_users_profiles_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2018_10_04_145119_create_users_profiles_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/components/newstudy.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/components/newstudy.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/resources/js/components/newstudy.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/components/newstudy.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/sass/_variables.scss" beforeDir="false" afterPath="$PROJECT_DIR$/resources/sass/_variables.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/auth/register.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/auth/register.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/home.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/home.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/layouts/nav.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/layouts/nav.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -268,6 +281,8 @@ ...@@ -268,6 +281,8 @@
<workItem from="1590484643170" duration="25829000" /> <workItem from="1590484643170" duration="25829000" />
<workItem from="1590656055131" duration="4234000" /> <workItem from="1590656055131" duration="4234000" />
<workItem from="1590665422138" duration="4114000" /> <workItem from="1590665422138" duration="4114000" />
<workItem from="1591103340019" duration="9647000" />
<workItem from="1591616407634" duration="531000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -287,47 +302,63 @@ ...@@ -287,47 +302,63 @@
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="770" y="559" key="ComposerInitDialogKey/0.0.2048.1280@0.0.2048.1280" timestamp="1589809796036" /> <state x="770" y="559" key="ComposerInitDialogKey/0.0.2048.1280@0.0.2048.1280" timestamp="1589809796036" />
<state width="2006" height="405" key="GridCell.Tab.0.bottom" timestamp="1590665409302"> <state x="901" y="511" key="Create Database Migration" timestamp="1591112158519">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state width="2006" height="491" key="GridCell.Tab.0.bottom/0.0.2048.1280@0.0.2048.1280" timestamp="1590419278940" /> <state x="901" y="511" key="Create Database Migration/0.0.2048.1280@0.0.2048.1280" timestamp="1591112158519" />
<state x="906" y="571" key="Create Model" timestamp="1591112276657">
<screen x="0" y="0" width="2048" height="1280" />
</state>
<state x="906" y="571" key="Create Model/0.0.2048.1280@0.0.2048.1280" timestamp="1591112276657" />
<state width="2006" height="405" key="GridCell.Tab.0.bottom" timestamp="1591199738713">
<screen x="0" y="0" width="2048" height="1280" />
</state>
<state width="2006" height="405" key="GridCell.Tab.0.bottom/0.0.2048.1280@0.0.2048.1280" timestamp="1591199738713" />
<state width="2006" height="406" key="GridCell.Tab.0.bottom/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860387" /> <state width="2006" height="406" key="GridCell.Tab.0.bottom/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860387" />
<state width="2006" height="406" key="GridCell.Tab.0.bottom/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941151" /> <state width="2006" height="406" key="GridCell.Tab.0.bottom/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941151" />
<state width="2006" height="405" key="GridCell.Tab.0.bottom/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409302" /> <state width="2006" height="405" key="GridCell.Tab.0.bottom/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409302" />
<state width="1878" height="406" key="GridCell.Tab.0.bottom/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747932" /> <state width="1878" height="406" key="GridCell.Tab.0.bottom/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747932" />
<state width="2006" height="405" key="GridCell.Tab.0.center" timestamp="1590665409301"> <state width="2006" height="405" key="GridCell.Tab.0.center" timestamp="1591199738712">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state width="2006" height="491" key="GridCell.Tab.0.center/0.0.2048.1280@0.0.2048.1280" timestamp="1590419278939" /> <state width="2006" height="405" key="GridCell.Tab.0.center/0.0.2048.1280@0.0.2048.1280" timestamp="1591199738712" />
<state width="2006" height="406" key="GridCell.Tab.0.center/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860386" /> <state width="2006" height="406" key="GridCell.Tab.0.center/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860386" />
<state width="2006" height="406" key="GridCell.Tab.0.center/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941150" /> <state width="2006" height="406" key="GridCell.Tab.0.center/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941150" />
<state width="2006" height="405" key="GridCell.Tab.0.center/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409301" /> <state width="2006" height="405" key="GridCell.Tab.0.center/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409301" />
<state width="1878" height="406" key="GridCell.Tab.0.center/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747929" /> <state width="1878" height="406" key="GridCell.Tab.0.center/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747929" />
<state width="2006" height="405" key="GridCell.Tab.0.left" timestamp="1590665409301"> <state width="2006" height="405" key="GridCell.Tab.0.left" timestamp="1591199738709">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state width="2006" height="491" key="GridCell.Tab.0.left/0.0.2048.1280@0.0.2048.1280" timestamp="1590419278938" /> <state width="2006" height="405" key="GridCell.Tab.0.left/0.0.2048.1280@0.0.2048.1280" timestamp="1591199738709" />
<state width="2006" height="406" key="GridCell.Tab.0.left/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860385" /> <state width="2006" height="406" key="GridCell.Tab.0.left/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860385" />
<state width="2006" height="406" key="GridCell.Tab.0.left/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941149" /> <state width="2006" height="406" key="GridCell.Tab.0.left/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941149" />
<state width="2006" height="405" key="GridCell.Tab.0.left/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409301" /> <state width="2006" height="405" key="GridCell.Tab.0.left/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409301" />
<state width="1878" height="406" key="GridCell.Tab.0.left/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747922" /> <state width="1878" height="406" key="GridCell.Tab.0.left/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747922" />
<state width="2006" height="405" key="GridCell.Tab.0.right" timestamp="1590665409302"> <state width="2006" height="405" key="GridCell.Tab.0.right" timestamp="1591199738712">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state width="2006" height="491" key="GridCell.Tab.0.right/0.0.2048.1280@0.0.2048.1280" timestamp="1590419278939" /> <state width="2006" height="405" key="GridCell.Tab.0.right/0.0.2048.1280@0.0.2048.1280" timestamp="1591199738712" />
<state width="2006" height="406" key="GridCell.Tab.0.right/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860386" /> <state width="2006" height="406" key="GridCell.Tab.0.right/128.-1057.1920.1057/0.23.2048.1257@0.23.2048.1257" timestamp="1590060860386" />
<state width="2006" height="406" key="GridCell.Tab.0.right/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941150" /> <state width="2006" height="406" key="GridCell.Tab.0.right/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590058941150" />
<state width="2006" height="405" key="GridCell.Tab.0.right/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409302" /> <state width="2006" height="405" key="GridCell.Tab.0.right/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665409302" />
<state width="1878" height="406" key="GridCell.Tab.0.right/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747931" /> <state width="1878" height="406" key="GridCell.Tab.0.right/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168747931" />
<state x="801" y="371" key="NewPhpClassDialog" timestamp="1591119868791">
<screen x="0" y="0" width="2048" height="1280" />
</state>
<state x="801" y="371" key="NewPhpClassDialog/0.0.2048.1280@0.0.2048.1280" timestamp="1591119868791" />
<state x="835" y="570" key="NewPhpFileDialog" timestamp="1591119861931">
<screen x="0" y="0" width="2048" height="1280" />
</state>
<state x="835" y="570" key="NewPhpFileDialog/0.0.2048.1280@0.0.2048.1280" timestamp="1591119861931" />
<state x="0" y="23" width="2048" height="1257" key="SettingsEditor" timestamp="1590665405159"> <state x="0" y="23" width="2048" height="1257" key="SettingsEditor" timestamp="1590665405159">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="0" y="23" width="2048" height="1257" key="SettingsEditor/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590056101932" /> <state x="0" y="23" width="2048" height="1257" key="SettingsEditor/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590056101932" />
<state x="0" y="23" key="SettingsEditor/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665405159" /> <state x="0" y="23" key="SettingsEditor/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665405159" />
<state x="754" y="390" width="597" height="524" key="StructurePopup" timestamp="1590686482515"> <state x="754" y="390" width="597" height="524" key="StructurePopup" timestamp="1591089727978">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="754" y="390" width="597" height="524" key="StructurePopup/0.0.2048.1280@0.0.2048.1280" timestamp="1590686482515" /> <state x="754" y="390" width="597" height="524" key="StructurePopup/0.0.2048.1280@0.0.2048.1280" timestamp="1591089727978" />
<state x="754" y="390" width="597" height="524" key="StructurePopup/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054141097" /> <state x="754" y="390" width="597" height="524" key="StructurePopup/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054141097" />
<state x="754" y="390" width="598" height="526" key="StructurePopup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590666782790" /> <state x="754" y="390" width="598" height="526" key="StructurePopup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590666782790" />
<state x="772" y="-751" width="560" height="443" key="StructurePopup/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168084313" /> <state x="772" y="-751" width="560" height="443" key="StructurePopup/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590168084313" />
...@@ -335,16 +366,16 @@ ...@@ -335,16 +366,16 @@
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="349" y="331" key="com.intellij.ide.ui.customization.CustomizableActionsPanel$EditIconDialog/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665402287" /> <state x="349" y="331" key="com.intellij.ide.ui.customization.CustomizableActionsPanel$EditIconDialog/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590665402287" />
<state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1590581191374"> <state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1591186286502">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2048.1280@0.0.2048.1280" timestamp="1590581191374" /> <state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2048.1280@0.0.2048.1280" timestamp="1591186286502" />
<state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054170589" /> <state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054170589" />
<state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590404098131" /> <state x="799" y="561" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590404098131" />
<state x="708" y="373" width="632" height="534" key="find.popup" timestamp="1590406250473"> <state x="1038" y="638" width="632" height="534" key="find.popup" timestamp="1591115078673">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="708" y="373" width="632" height="534" key="find.popup/0.0.2048.1280@0.0.2048.1280" timestamp="1589968436681" /> <state x="1038" y="638" width="632" height="534" key="find.popup/0.0.2048.1280@0.0.2048.1280" timestamp="1591115078673" />
<state x="708" y="373" width="632" height="534" key="find.popup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590406250473" /> <state x="708" y="373" width="632" height="534" key="find.popup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590406250473" />
<state x="899" y="515" width="250" height="278" key="jetbrains.javascript.buildTools.run-task-popup" timestamp="1590568927491"> <state x="899" y="515" width="250" height="278" key="jetbrains.javascript.buildTools.run-task-popup" timestamp="1590568927491">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
...@@ -362,10 +393,11 @@ ...@@ -362,10 +393,11 @@
</state> </state>
<state x="824" y="505" key="scopes/128.-1057.1920.1057/0.0.2048.1280@0.0.2048.1280" timestamp="1590055889310" /> <state x="824" y="505" key="scopes/128.-1057.1920.1057/0.0.2048.1280@0.0.2048.1280" timestamp="1590055889310" />
<state x="824" y="505" width="498" height="379" key="scopes/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590055356254" /> <state x="824" y="505" width="498" height="379" key="scopes/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590055356254" />
<state x="689" y="291" width="670" height="676" key="search.everywhere.popup" timestamp="1590689990547"> <state x="689" y="291" width="670" height="676" key="search.everywhere.popup" timestamp="1591617063454">
<screen x="0" y="0" width="2048" height="1280" /> <screen x="0" y="0" width="2048" height="1280" />
</state> </state>
<state x="689" y="291" width="670" height="676" key="search.everywhere.popup/0.0.2048.1280@0.0.2048.1280" timestamp="1590689990547" /> <state x="689" y="291" width="670" height="676" key="search.everywhere.popup/0.0.2048.1280@0.0.2048.1280" timestamp="1591617063454" />
<state x="689" y="291" width="670" height="676" key="search.everywhere.popup/0.23.2048.1257@0.23.2048.1257" timestamp="1591115561349" />
<state x="689" y="291" width="670" height="676" key="search.everywhere.popup/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054146808" /> <state x="689" y="291" width="670" height="676" key="search.everywhere.popup/128.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590054146808" />
<state x="689" y="292" width="715" height="677" key="search.everywhere.popup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590667028046" /> <state x="689" y="292" width="715" height="677" key="search.everywhere.popup/65.-1080.1920.1080/0.0.2048.1280@0.0.2048.1280" timestamp="1590667028046" />
<state x="711" y="-834" width="670" height="571" key="search.everywhere.popup/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590165045513" /> <state x="711" y="-834" width="670" height="571" key="search.everywhere.popup/65.-1080.1920.1080/0.0.2048.1280@65.-1080.1920.1080" timestamp="1590165045513" />
......
...@@ -7,15 +7,14 @@ use Illuminate\Http\Request; ...@@ -7,15 +7,14 @@ use Illuminate\Http\Request;
/** /**
* App\Answer * App\Answer
* * @property int $id
* @property int $id * @property int|null $question_id
* @property int|null $question_id * @property array $answer
* @property array $answer * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Interview[] $interviews * @property-read \Illuminate\Database\Eloquent\Collection|\App\Interview[] $interviews
* @property-read int|null $interviews_count * @property-read int|null $interviews_count
* @property-read \App\Question|null $question * @property-read \App\Question|null $question
* @method static \Illuminate\Database\Eloquent\Builder|\App\Answer newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Answer newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Answer newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Answer newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Answer query() * @method static \Illuminate\Database\Eloquent\Builder|\App\Answer query()
...@@ -45,17 +44,22 @@ class Answer extends Model ...@@ -45,17 +44,22 @@ class Answer extends Model
*/ */
public static function saveResultQuestions(Request $request, Interview $interview): void public static function saveResultQuestions(Request $request, Interview $interview): void
{ {
foreach ($request->input('results_questions') as $key => $value) { foreach ($request->input('results_questions') as $key => $value)
if (is_numeric($key)) { {
if (is_numeric($key))
{
$answer = Answer::where('id', '=', $key)->first(); $answer = Answer::where('id', '=', $key)->first();
$question = Question::where('id', '=', $answer->question_id)->first(); $question = Question::where('id', '=', $answer->question_id)->first();
$answertype = $answer->answer['type']; $answertype = $answer->answer['type'];
if ($answertype === 'open' || $answertype === 'scale') { if ($answertype === 'open' || $answertype === 'scale')
{
$interview->answers()->attach($key, ['result' => $value, 'question_id' => $question->id]); $interview->answers()->attach($key, ['result' => $value, 'question_id' => $question->id]);
} }
} }
if ($key === 'multi' || $key === 'onechoice') { if ($key === 'multi' || $key === 'onechoice')
foreach ($value as $answer) { {
foreach ($value as $answer)
{
$answer = Answer::where('id', '=', $answer['id'])->first(); $answer = Answer::where('id', '=', $answer['id'])->first();
$question = Question::where('id', '=', $answer->question_id)->first(); $question = Question::where('id', '=', $answer->question_id)->first();
$interview->answers()->attach($answer['id'], ['question_id' => $question->id]); $interview->answers()->attach($answer['id'], ['question_id' => $question->id]);
...@@ -70,7 +74,8 @@ class Answer extends Model ...@@ -70,7 +74,8 @@ class Answer extends Model
*/ */
public static function assignAnswersToQuestion(Interview $interview, $data): void public static function assignAnswersToQuestion(Interview $interview, $data): void
{ {
foreach ($data['questions'] as $question) { foreach ($data['questions'] as $question)
{
$question['available_answers'] = $question->availableAnswers(); $question['available_answers'] = $question->availableAnswers();
$question['answers'] = $question->answers()->having('pivot_interview_id', '=', $interview->id)->get(); $question['answers'] = $question->answers()->having('pivot_interview_id', '=', $interview->id)->get();
} }
......
...@@ -103,6 +103,7 @@ class Helper ...@@ -103,6 +103,7 @@ class Helper
$array = array_values($temp_array); $array = array_values($temp_array);
return $array; return $array;
} }
/** /**
* @param $string * @param $string
* @param $start * @param $start
...@@ -113,12 +114,11 @@ class Helper ...@@ -113,12 +114,11 @@ class Helper
{ {
$string = ' ' . $string; $string = ' ' . $string;
$ini = strpos($string, $start); $ini = strpos($string, $start);
if ($ini === 0 || $ini === false) return ''; if ($ini === 0 || $ini === false) return '';
$ini += strlen($start); $ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini; $len = strpos($string, $end, $ini) - $ini;
if (strpos($string, $end, $ini) === false) { if (strpos($string, $end, $ini) === false)
{
$len = strlen($string) - 1; $len = strlen($string) - 1;
} }
return substr($string, $ini, $len); return substr($string, $ini, $len);
......
...@@ -8,6 +8,7 @@ use App\Role; ...@@ -8,6 +8,7 @@ use App\Role;
use App\User; use App\User;
use Helper; use Helper;
use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Spatie\WebhookServer\WebhookCall; use Spatie\WebhookServer\WebhookCall;
...@@ -65,6 +66,7 @@ class RegisterController extends Controller ...@@ -65,6 +66,7 @@ class RegisterController extends Controller
*/ */
protected function create($data) protected function create($data)
{ {
$userexist = User::where('email', '=', $data['email'])->first(); $userexist = User::where('email', '=', $data['email'])->first();
$role = Role::where('name', 'supervisor')->first(); $role = Role::where('name', 'supervisor')->first();
...@@ -78,17 +80,25 @@ class RegisterController extends Controller ...@@ -78,17 +80,25 @@ class RegisterController extends Controller
$user->password_token = Helper::random_str(30); $user->password_token = Helper::random_str(30);
$user->save(); $user->save();
$profile = $user->addProfile($user);
$profile->newsletter = array_key_exists('newsletter',$data) ? config('enums.newsletter_status.SUBSCRIBED') : config('enums.newsletter_status.NOT SUBSCRIBED');
$profile->save();
$createStudyPermission = Permission::where('name', 'create-studies') $createStudyPermission = Permission::where('name', 'create-studies')
->first(); ->first();
$user->supervised_by = $user->id; $user->supervised_by = $user->id;
$user->attachPermissions([$createStudyPermission]); $user->attachPermissions([$createStudyPermission]);
$user->attachRole($role); $user->attachRole($role);
WebhookCall::create() if (!App::environment('local')) {
->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') WebhookCall::create()
->payload(['text' => 'User '.$data['email'].' has registered on Mesort. We have a total of '.User::all()->count().' users!']) ->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') ->payload(['text' => 'User '.$data['email'].' has registered on Mesort. We have a total of '.User::all()->count().' users!'])
->dispatch(); ->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->dispatch();
}
$user->save(); $user->save();
......
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\NewsletterStatus;
use Auth; use Auth;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\View\View;
use Session; use Session;
class HomeController extends Controller class HomeController extends Controller
...@@ -19,11 +23,12 @@ class HomeController extends Controller ...@@ -19,11 +23,12 @@ class HomeController extends Controller
/** /**
* Show the application dashboard. * Show the application dashboard.
* @return Response * @return Application|Factory|View
*/ */
public function index() public function index()
{ {
$data['studies'] = Auth::user()->studies; $data['studies'] = Auth::user()->studies;
$data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
return view('home', $data); return view('home', $data);
} }
......
...@@ -6,6 +6,9 @@ use App\Notifications\NotificationFromStaff; ...@@ -6,6 +6,9 @@ use App\Notifications\NotificationFromStaff;
use App\User; use App\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use mysql_xdevapi\Exception;
use phpDocumentor\Reflection\Types\Boolean;
use PhpParser\Node\Expr\Cast\Bool_;
class NotificationController extends Controller class NotificationController extends Controller
{ {
...@@ -38,5 +41,31 @@ class NotificationController extends Controller ...@@ -38,5 +41,31 @@ class NotificationController extends Controller
$user->notify(new NotificationFromStaff(['title' => $request->input('title'), 'message' => $request->input('message')])); $user->notify(new NotificationFromStaff(['title' => $request->input('title'), 'message' => $request->input('message')]));
return view('admin.notifications', ['message' => 'Notification sent to ' . $request->input('email')]); return view('admin.notifications', ['message' => 'Notification sent to ' . $request->input('email')]);
}
public function addToNewsletter(Request $request)
{
$subscribe = $request->input('subscribed') ? config('enums.newsletter_status.SUBSCRIBED') : config('enums.newsletter_status.NOT SUBSCRIBED');
try
{
if(auth()->user()->profile()->exists())
{
auth()->user()->profile->newsletter = $subscribe;
auth()->user()->profile->save();
}else{
$profile = auth()->user()->addProfile(auth()->user());
$profile->newsletter = $subscribe;
$profile->save();
}
return response()->json(['message' => 'Your preference was saved!','r' => $subscribe], 200);
}catch (Exception $exception)
{
return response()->json(['message' => 'A problem occurred, contact the administrator.'], 500);
}
} }
} }
...@@ -22,15 +22,14 @@ use Illuminate\Http\RedirectResponse; ...@@ -22,15 +22,14 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\View\View; use Illuminate\View\View;
use Image;
use Storage;
class StudyController extends Controller class StudyController extends Controller
{ {
public function create(Request $request) public function create(Request $request)
{ {
if (Auth::user()->hasReachMaxNumberOfStudies()) { if (Auth::user()->hasReachMaxNumberOfStudies())
{
auth()->user()->addAction('trying to create a study', $request->url(), 'Max numbers of studies reached for user ' . auth()->user()->email); auth()->user()->addAction('trying to create a study', $request->url(), 'Max numbers of studies reached for user ' . auth()->user()->email);
abort(403, 'You reached the max number of studies'); abort(403, 'You reached the max number of studies');
} }
...@@ -46,14 +45,18 @@ class StudyController extends Controller ...@@ -46,14 +45,18 @@ class StudyController extends Controller
$copy = $study->replicate(); $copy = $study->replicate();
$copy->save(); $copy->save();
$study->load('questions', 'sortings', 'tokens'); $study->load('questions', 'sortings', 'tokens');
foreach ($study->getRelations() as $relationName => $values) { foreach ($study->getRelations() as $relationName => $values)
if ($relationName === "sortings") { {
if ($relationName === "sortings")
{
$request = new Request(); $request = new Request();
$request->replace(['details' => $study->sortings[0]->pivot->details, 'sortingid' => $study->sortings[0]->id]); $request->replace(['details' => $study->sortings[0]->pivot->details, 'sortingid' => $study->sortings[0]->id]);
Sorting::store($request, $copy); Sorting::store($request, $copy);
} else if ($relationName === "questions") { } else if ($relationName === "questions")
{
$this->CopyQuestionsRemoveInterviews($study, $copy); $this->CopyQuestionsRemoveInterviews($study, $copy);
} else if ($relationName === "tokens") { } else if ($relationName === "tokens")
{
$this->RemoveTokensCreatedDuringInterview($values); $this->RemoveTokensCreatedDuringInterview($values);
$copy->{$relationName}()->attach($values); $copy->{$relationName}()->attach($values);
} }
...@@ -69,20 +72,21 @@ class StudyController extends Controller ...@@ -69,20 +72,21 @@ class StudyController extends Controller
*/ */
private function CopyQuestionsRemoveInterviews(Study $study, Study $copy): void private function CopyQuestionsRemoveInterviews(Study $study, Study $copy): void
{ {
foreach ($study->questions as $question) { foreach ($study->questions as $question)
{
$copiedQuestion = $copy->questions()->create($question->toArray()); $copiedQuestion = $copy->questions()->create($question->toArray());
$answers = Answer::where('question_id', $question->id)->get(); $answers = Answer::where('question_id', $question->id)->get();
foreach ($answers as $answer) { foreach ($answers as $answer)
{
$answer->question_id = $copiedQuestion->id; $answer->question_id = $copiedQuestion->id;
$copiedQuestion->answers()->create($answer->toArray()); $copiedQuestion->answers()->create($answer->toArray());
} }
// remove interviews // remove interviews
foreach ($copiedQuestion->answers as $answer) { foreach ($copiedQuestion->answers as $answer)
{
$answer->interviews()->detach(); $answer->interviews()->detach();
$answer->interviews()->delete(); $answer->interviews()->delete();
} }
} }
} }
...@@ -93,8 +97,10 @@ class StudyController extends Controller ...@@ -93,8 +97,10 @@ class StudyController extends Controller
private function RemoveTokensCreatedDuringInterview(&$values): void private function RemoveTokensCreatedDuringInterview(&$values): void
{ {
// remove tokens created during interview // remove tokens created during interview
foreach ($values as $index => $token) { foreach ($values as $index => $token)
if ($token->author == 0) { {
if ($token->author == 0)
{
unset($values[$index]); unset($values[$index]);
} }
} }
...@@ -117,11 +123,13 @@ class StudyController extends Controller ...@@ -117,11 +123,13 @@ class StudyController extends Controller
public function store(Request $request, $dummy = false) public function store(Request $request, $dummy = false)
{ {
if ($dummy != false) { if ($dummy != false)
{
$userForStudy = User::where('id', $dummy)->first(); $userForStudy = User::where('id', $dummy)->first();
$request = new Request(config('utilities.dummyStudy1')); $request = new Request(config('utilities.dummyStudy1'));
} else $userForStudy = Auth::user();