From b9e724efdba4bb299bcf64fc1ef987878af0fcee Mon Sep 17 00:00:00 2001 From: ZeMKI Date: Mon, 8 Jun 2020 13:55:01 +0200 Subject: [PATCH] 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. --- .idea/workspace.xml | 72 +- app/Answer.php | 33 +- app/Helpers/Helper.php | 6 +- .../Controllers/Auth/RegisterController.php | 20 +- app/Http/Controllers/HomeController.php | 7 +- .../Controllers/NotificationController.php | 29 + app/Http/Controllers/StudyController.php | 99 +- app/Profile.php | 2 +- app/User.php | 64 +- config/enums.php | 9 + ..._04_145119_create_users_profiles_table.php | 13 +- ...173558_add_newsletter_to_user_profiles.php | 26 + resources/js/app.js | 1663 ++++++++++------- resources/js/components/newstudy.vue | 21 +- resources/sass/_variables.scss | 4 +- resources/views/auth/register.blade.php | 9 + resources/views/home.blade.php | 14 +- resources/views/layouts/nav.blade.php | 4 +- routes/web.php | 1 + 19 files changed, 1322 insertions(+), 774 deletions(-) create mode 100644 config/enums.php create mode 100644 database/migrations/2020_06_02_173558_add_newsletter_to_user_profiles.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6dea454..45e3392 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,25 @@ + + - - - - + + + + + + + + + + + + + + + @@ -287,47 +302,63 @@ - + - + + + + + + + + + - + - + - + - + - + - + + + + + + + + + - + - + @@ -335,16 +366,16 @@ - + - + - + - + @@ -362,10 +393,11 @@ - + - + + diff --git a/app/Answer.php b/app/Answer.php index bdc39a4..7488d53 100755 --- a/app/Answer.php +++ b/app/Answer.php @@ -7,15 +7,14 @@ use Illuminate\Http\Request; /** * App\Answer - * - * @property int $id - * @property int|null $question_id - * @property array $answer - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at + * @property int $id + * @property int|null $question_id + * @property array $answer + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \Illuminate\Database\Eloquent\Collection|\App\Interview[] $interviews - * @property-read int|null $interviews_count - * @property-read \App\Question|null $question + * @property-read int|null $interviews_count + * @property-read \App\Question|null $question * @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 query() @@ -45,17 +44,22 @@ class Answer extends Model */ public static function saveResultQuestions(Request $request, Interview $interview): void { - foreach ($request->input('results_questions') as $key => $value) { - if (is_numeric($key)) { + foreach ($request->input('results_questions') as $key => $value) + { + if (is_numeric($key)) + { $answer = Answer::where('id', '=', $key)->first(); $question = Question::where('id', '=', $answer->question_id)->first(); $answertype = $answer->answer['type']; - if ($answertype === 'open' || $answertype === 'scale') { + if ($answertype === 'open' || $answertype === 'scale') + { $interview->answers()->attach($key, ['result' => $value, 'question_id' => $question->id]); } } - if ($key === 'multi' || $key === 'onechoice') { - foreach ($value as $answer) { + if ($key === 'multi' || $key === 'onechoice') + { + foreach ($value as $answer) + { $answer = Answer::where('id', '=', $answer['id'])->first(); $question = Question::where('id', '=', $answer->question_id)->first(); $interview->answers()->attach($answer['id'], ['question_id' => $question->id]); @@ -70,7 +74,8 @@ class Answer extends Model */ public static function assignAnswersToQuestion(Interview $interview, $data): void { - foreach ($data['questions'] as $question) { + foreach ($data['questions'] as $question) + { $question['available_answers'] = $question->availableAnswers(); $question['answers'] = $question->answers()->having('pivot_interview_id', '=', $interview->id)->get(); } diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 2515c6a..5da29c4 100755 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -103,6 +103,7 @@ class Helper $array = array_values($temp_array); return $array; } + /** * @param $string * @param $start @@ -113,12 +114,11 @@ class Helper { $string = ' ' . $string; $ini = strpos($string, $start); - if ($ini === 0 || $ini === false) return ''; - $ini += strlen($start); $len = strpos($string, $end, $ini) - $ini; - if (strpos($string, $end, $ini) === false) { + if (strpos($string, $end, $ini) === false) + { $len = strlen($string) - 1; } return substr($string, $ini, $len); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index e1751c5..b8c7182 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -8,6 +8,7 @@ use App\Role; use App\User; use Helper; use Illuminate\Foundation\Auth\RegistersUsers; +use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Validator; use Spatie\WebhookServer\WebhookCall; @@ -65,6 +66,7 @@ class RegisterController extends Controller */ protected function create($data) { + $userexist = User::where('email', '=', $data['email'])->first(); $role = Role::where('name', 'supervisor')->first(); @@ -78,17 +80,25 @@ class RegisterController extends Controller $user->password_token = Helper::random_str(30); $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') ->first(); $user->supervised_by = $user->id; $user->attachPermissions([$createStudyPermission]); $user->attachRole($role); - WebhookCall::create() - ->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') - ->payload(['text' => 'User '.$data['email'].' has registered on Mesort. We have a total of '.User::all()->count().' users!']) - ->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') - ->dispatch(); + if (!App::environment('local')) { + WebhookCall::create() + ->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') + ->payload(['text' => 'User '.$data['email'].' has registered on Mesort. We have a total of '.User::all()->count().' users!']) + ->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3') + ->dispatch(); + } + $user->save(); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f3f8178..ce74ae8 100755 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,8 +2,12 @@ namespace App\Http\Controllers; +use App\Helpers\NewsletterStatus; use Auth; +use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\View\Factory; use Illuminate\Http\Response; +use Illuminate\View\View; use Session; class HomeController extends Controller @@ -19,11 +23,12 @@ class HomeController extends Controller /** * Show the application dashboard. - * @return Response + * @return Application|Factory|View */ public function index() { $data['studies'] = Auth::user()->studies; + $data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED'); return view('home', $data); } diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index ba93310..95fec65 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -6,6 +6,9 @@ use App\Notifications\NotificationFromStaff; use App\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Notification; +use mysql_xdevapi\Exception; +use phpDocumentor\Reflection\Types\Boolean; +use PhpParser\Node\Expr\Cast\Bool_; class NotificationController extends Controller { @@ -38,5 +41,31 @@ class NotificationController extends Controller $user->notify(new NotificationFromStaff(['title' => $request->input('title'), 'message' => $request->input('message')])); 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); + + } + + + } } diff --git a/app/Http/Controllers/StudyController.php b/app/Http/Controllers/StudyController.php index c463b43..98fd24c 100755 --- a/app/Http/Controllers/StudyController.php +++ b/app/Http/Controllers/StudyController.php @@ -22,15 +22,14 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\View\View; -use Image; -use Storage; class StudyController extends Controller { 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); abort(403, 'You reached the max number of studies'); } @@ -46,14 +45,18 @@ class StudyController extends Controller $copy = $study->replicate(); $copy->save(); $study->load('questions', 'sortings', 'tokens'); - foreach ($study->getRelations() as $relationName => $values) { - if ($relationName === "sortings") { + foreach ($study->getRelations() as $relationName => $values) + { + if ($relationName === "sortings") + { $request = new Request(); $request->replace(['details' => $study->sortings[0]->pivot->details, 'sortingid' => $study->sortings[0]->id]); Sorting::store($request, $copy); - } else if ($relationName === "questions") { + } else if ($relationName === "questions") + { $this->CopyQuestionsRemoveInterviews($study, $copy); - } else if ($relationName === "tokens") { + } else if ($relationName === "tokens") + { $this->RemoveTokensCreatedDuringInterview($values); $copy->{$relationName}()->attach($values); } @@ -69,20 +72,21 @@ class StudyController extends Controller */ private function CopyQuestionsRemoveInterviews(Study $study, Study $copy): void { - foreach ($study->questions as $question) { + foreach ($study->questions as $question) + { $copiedQuestion = $copy->questions()->create($question->toArray()); $answers = Answer::where('question_id', $question->id)->get(); - foreach ($answers as $answer) { + foreach ($answers as $answer) + { $answer->question_id = $copiedQuestion->id; $copiedQuestion->answers()->create($answer->toArray()); - } // remove interviews - foreach ($copiedQuestion->answers as $answer) { + foreach ($copiedQuestion->answers as $answer) + { $answer->interviews()->detach(); $answer->interviews()->delete(); - } } } @@ -93,8 +97,10 @@ class StudyController extends Controller private function RemoveTokensCreatedDuringInterview(&$values): void { // remove tokens created during interview - foreach ($values as $index => $token) { - if ($token->author == 0) { + foreach ($values as $index => $token) + { + if ($token->author == 0) + { unset($values[$index]); } } @@ -117,11 +123,13 @@ class StudyController extends Controller public function store(Request $request, $dummy = false) { - if ($dummy != false) { + if ($dummy != false) + { $userForStudy = User::where('id', $dummy)->first(); $request = new Request(config('utilities.dummyStudy1')); } else $userForStudy = Auth::user(); - if (!$request->has('name') || !$request->has('description')) { + if (!$request->has('name') || !$request->has('description')) + { return response()->json('Data are not valid', 422); } $newStudy = new Study(); @@ -143,32 +151,43 @@ class StudyController extends Controller } /** + * Save the tokens to the database, if any. * @param Study $study * @param Request $request * @param $token */ public function saveTokens(Study $study, Request $request, &$token): void { - foreach ($request->get('sorting')['tokens'] as $tokenToSave) { + + if($request->get('sorting')['tokens']){ + foreach ($request->get('sorting')['tokens'] as $tokenToSave) + { Token::store($tokenToSave, $study); } + } } /** + * Save the questions to database, if any. * @param $questions * @param $study * @param bool $edit */ public function saveQuestionsAnswers($questions, $study, $edit = false) { - if ($edit) { - foreach ($study->questions as $questionToReset) { + if ($edit) + { + foreach ($study->questions as $questionToReset) + { Answer::where('question_id', '=', $questionToReset['id'])->delete(); Question::destroy($questionToReset['id']); } } - if (array_key_exists('question', $questions[0])) { - foreach ($questions as $questionToSave) { + $atLeastOneQuestion = array_key_exists('question', $questions[0]); + if ($atLeastOneQuestion) + { + foreach ($questions as $questionToSave) + { $question = new Question(); $question->question = $questionToSave['question']; $question->detail = $questions[0]['type']; @@ -180,13 +199,16 @@ class StudyController extends Controller } /** + * Save the answers for a given question. * @param $questionToSave * @param Question $question */ private function saveAnswers($questionToSave, Question $question): void { - if ($questionToSave['ismultiple']) { - foreach ($questionToSave['answers'] as $answerToSave) { + if ($questionToSave['ismultiple']) + { + foreach ($questionToSave['answers'] as $answerToSave) + { $answer = new Answer(); $answer->question_id = $question->id; $answerJson = ['type' => 'multi', 'answer' => $answerToSave]; @@ -194,8 +216,10 @@ class StudyController extends Controller $answer->save(); } } - if ($questionToSave['isonechoice']) { - foreach ($questionToSave['answers'] as $answerToSave) { + if ($questionToSave['isonechoice']) + { + foreach ($questionToSave['answers'] as $answerToSave) + { $answer = new Answer(); $answer->question_id = $question->id; $answerJson = ['type' => 'onechoice', 'answer' => $answerToSave]; @@ -203,14 +227,16 @@ class StudyController extends Controller $answer->save(); } } - if ($questionToSave['isopen']) { + if ($questionToSave['isopen']) + { $answer = new Answer(); $answerJson = ['type' => 'open', 'answer' => '']; $answer->question_id = $question->id; $answer->answer = $answerJson; $answer->save(); } - if ($questionToSave['isscale']) { + if ($questionToSave['isscale']) + { $answer = new Answer(); $answerJson = ['type' => 'scale', 'answer' => ['min' => $questionToSave['scalemin'], 'max' => $questionToSave['scalemax'], 'minlabel' => $questionToSave['minlabel'], 'maxlabel' => $questionToSave['maxlabel']]]; $answer->question_id = $question->id; @@ -247,11 +273,13 @@ class StudyController extends Controller public function update(Study $study, Request $request) { $this->authorize($study); - if (!$request->has('name')) { + if (!$request->has('name')) + { return response()->json('Data are not valid', 422); } $study = Study::where('id', '=', $request->input('id'))->with('questions')->first(); - if (!$study->isEditable()) { + if (!$study->isEditable()) + { return back()->withInput(); } // sorting @@ -280,7 +308,8 @@ class StudyController extends Controller public function removeTokensFromStudy(Study $study): void { $available_tokens = $study->available_tokens()->pluck('tokens.id')->toArray(); - foreach ($available_tokens as $tokensToDelete) { + foreach ($available_tokens as $tokensToDelete) + { $to = Token::where('id', '=', $tokensToDelete)->first(); $study->tokens()->detach($to->id); $to->delete(); @@ -295,11 +324,13 @@ class StudyController extends Controller public function destroy(Study $study, Request $request) { - if (!auth()->user()->hasRole(['admin', 'supervisor'])) { + if (!auth()->user()->hasRole(['admin', 'supervisor'])) + { abort(403, 'You are not allowed to edit this study'); } if (!auth()->user()->can('delete-studies', $study->id)) return response('You are not authorized to delete this study.', 403); - foreach ($study->interviews as $interview) { + foreach ($study->interviews as $interview) + { File::delete($interview->sorting_screenshot); $interview->answers()->detach(); $interview->answers()->delete(); @@ -333,11 +364,11 @@ class StudyController extends Controller public function deleteallbyuser(User $user, Request $request) { $studies = Study::where('user_id', $user->id)->get(); - foreach ($studies as $study) { + foreach ($studies as $study) + { $study->delete(); } auth()->user()->addAction('delete all studies by user', $request->url(), 'user deleted studies for the user ' . $user->email); return response()->json(['message' => 'Studies Deleted!'], 200); - } } diff --git a/app/Profile.php b/app/Profile.php index 35d2667..9ed7e54 100755 --- a/app/Profile.php +++ b/app/Profile.php @@ -41,7 +41,7 @@ class Profile extends Model * @var array */ protected $fillable = [ - 'name', 'address', 'workaddress', 'phonenumber1', 'phonenumber2', + 'name', 'address', 'workaddress', 'phonenumber1', 'phonenumber2','newsletter', ]; public function user() diff --git a/app/User.php b/app/User.php index 7a380cd..6069a94 100755 --- a/app/User.php +++ b/app/User.php @@ -2,8 +2,6 @@ namespace App; -use Auth; -use DB; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; @@ -12,30 +10,29 @@ use Laratrust\Traits\LaratrustUserTrait; /** * App\User - * - * @property int $id - * @property string $email - * @property string $password - * @property string|null $remember_token - * @property string|null $last_login_date - * @property int|null $supervised_by - * @property string|null $password_token - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property \Illuminate\Support\Carbon|null $deleted_at - * @property string|null $email_verified_at - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Interview[] $interviews - * @property-read int|null $interviews_count + * @property int $id + * @property string $email + * @property string $password + * @property string|null $remember_token + * @property string|null $last_login_date + * @property int|null $supervised_by + * @property string|null $password_token + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @property \Illuminate\Support\Carbon|null $deleted_at + * @property string|null $email_verified_at + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Interview[] $interviews + * @property-read int|null $interviews_count * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications - * @property-read int|null $notifications_count - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Permission[] $permissions - * @property-read int|null $permissions_count - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Role[] $roles - * @property-read int|null $roles_count - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Study[] $rolesTeams - * @property-read int|null $roles_teams_count - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Study[] $studies - * @property-read int|null $studies_count + * @property-read int|null $notifications_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Permission[] $permissions + * @property-read int|null $permissions_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Role[] $roles + * @property-read int|null $roles_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Study[] $rolesTeams + * @property-read int|null $roles_teams_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Study[] $studies + * @property-read int|null $studies_count * @method static \Illuminate\Database\Eloquent\Builder|\App\User newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\User newQuery() * @method static \Illuminate\Database\Query\Builder|\App\User onlyTrashed() @@ -64,6 +61,7 @@ class User extends Authenticatable implements MustVerifyEmail use LaratrustUserTrait; use Notifiable; use SoftDeletes; + /** * The attributes that are mass assignable. * @var array @@ -108,6 +106,22 @@ class User extends Authenticatable implements MustVerifyEmail return in_array(13, $this->permissions()->pluck('id')->toArray()); } + public function profile() + { + return $this->hasOne(Profile::class); + } + + /** + * + */ + public function addProfile($user) + { + $profile = new Profile(); + $profile->user_id = $user->id; + $profile->save(); + return $profile; + } + /** * @param $name * @param $url diff --git a/config/enums.php b/config/enums.php new file mode 100644 index 0000000..4c73f60 --- /dev/null +++ b/config/enums.php @@ -0,0 +1,9 @@ + [ + 'SUBSCRIBED' => 2, + 'NOT SUBSCRIBED' => 1, + 'NOT DECIDED' => 0, + ] +]; diff --git a/database/migrations/2018_10_04_145119_create_users_profiles_table.php b/database/migrations/2018_10_04_145119_create_users_profiles_table.php index 1df7512..ec679fb 100644 --- a/database/migrations/2018_10_04_145119_create_users_profiles_table.php +++ b/database/migrations/2018_10_04_145119_create_users_profiles_table.php @@ -16,14 +16,13 @@ class CreateUsersProfilesTable extends Migration Schema::create('users_profiles', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned()->references('id')->on('users')->onDelete('cascade'); - $table->string('name', 255); - $table->string('address', 255); - $table->date('birthday'); - $table->string('phonenumber1', 190); - $table->string('phonenumber2', 190); - $table->string('workaddress', 255); + $table->string('name', 255)->nullable(); + $table->string('address', 255)->nullable(); + $table->date('birthday')->nullable(); + $table->string('phonenumber1', 190)->nullable(); + $table->string('phonenumber2', 190)->nullable(); + $table->string('workaddress', 255)->nullable(); $table->timestamps(); - $table->foreign('user_id')->references('id')->on('users'); diff --git a/database/migrations/2020_06_02_173558_add_newsletter_to_user_profiles.php b/database/migrations/2020_06_02_173558_add_newsletter_to_user_profiles.php new file mode 100644 index 0000000..46c8ad5 --- /dev/null +++ b/database/migrations/2020_06_02_173558_add_newsletter_to_user_profiles.php @@ -0,0 +1,26 @@ +tinyInteger('newsletter')->default(0)->nullable(); + + }); + } + + public function down() + { + Schema::table('users_profiles', function (Blueprint $table) + { + // + }); + + } +} diff --git a/resources/js/app.js b/resources/js/app.js index a23544c..b09ff88 100755 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,713 +1,1082 @@ -import moment from "moment"; -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 Caret from "vue-material-design-icons/ChevronDown.vue" -import homeicon from "vue-material-design-icons/Home.vue" -import Bell from "vue-material-design-icons/Bell.vue" -import Read from "vue-material-design-icons/Read.vue" -import vSelect from 'vue-select' - -import Vuex, {mapState} from 'vuex' -import store from './store'; - -require('./bootstrap'); - - -window.Vue = require('vue'); -Vue.component('v-select', vSelect) - -if (process.env.MIX_ENV_MODE === 'production') { +import moment + from 'moment'; +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 Caret + from 'vue-material-design-icons/ChevronDown.vue'; +import homeicon + from 'vue-material-design-icons/Home.vue'; +import Bell + from 'vue-material-design-icons/Bell.vue'; +import Read + from 'vue-material-design-icons/Read.vue'; +import vSelect + from 'vue-select'; + +import Vuex, {mapState} from 'vuex'; +import store + from './store'; + +require( + './bootstrap'); + +window.Vue = require( + 'vue'); +Vue.component( + 'v-select', + vSelect, +); + +if (process.env.MIX_ENV_MODE === + 'production') +{ Vue.config.devtools = false; Vue.config.debug = false; Vue.config.silent = true; -} else { +} +else +{ Vue.config.devtools = true; Vue.config.debug = true; Vue.config.silent = false; } -Vue.prototype.trans = (key) => { - return _.isUndefined(window.trans[key]) ? key : window.trans[key]; -}; +Vue.prototype.trans = (key) => + { + return _.isUndefined( + window.trans[key]) ? + key : + window.trans[key]; + }; /** * Next, we will create a fresh Vue application instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ -Vue.use(Buefy); -Vue.use(Vuex); - - -Vue.component('new-interview', require('./components/Interview/newinterview.vue').default); -Vue.component('circle-sorting', require('./components/Interview/circle-sorting.vue').default); -Vue.component('new-token', require('./components/Interview/newtokenmodal.vue').default); -Vue.component('interview-list', require('./components/Interview/interviewlist.vue').default); -Vue.component('q-sort', require('./components/Interview/q-sort.vue').default); -Vue.component('network-sorting', require('./components/Interview/network-sorting.vue').default); -Vue.component('sorting-preview', require('./components/Interview/sorting_preview.vue').default); - -Vue.component('userpart', require('./components/userpart.vue').default); -Vue.component('url-list', require('./components/publicurllist').default); -Vue.component('new-study', require('./components/newstudy.vue').default); -Vue.component('new-edit-user', require('./components/modalnewedituser.vue').default); -Vue.component('action-table', require('./components/actiontable.vue').default); -Vue.component('user-table', require('./components/usertable.vue').default); - +Vue.use( + Buefy); +Vue.use( + Vuex); + +Vue.component( + 'new-interview', + require( + './components/Interview/newinterview.vue').default, +); +Vue.component( + 'circle-sorting', + require( + './components/Interview/circle-sorting.vue').default, +); +Vue.component( + 'new-token', + require( + './components/Interview/newtokenmodal.vue').default, +); +Vue.component( + 'interview-list', + require( + './components/Interview/interviewlist.vue').default, +); +Vue.component( + 'q-sort', + require( + './components/Interview/q-sort.vue').default, +); +Vue.component( + 'network-sorting', + require( + './components/Interview/network-sorting.vue').default, +); +Vue.component( + 'sorting-preview', + require( + './components/Interview/sorting_preview.vue').default, +); + +Vue.component( + 'userpart', + require( + './components/userpart.vue').default, +); +Vue.component( + 'url-list', + require( + './components/publicurllist').default, +); +Vue.component( + 'new-study', + require( + './components/newstudy.vue').default, +); +Vue.component( + 'new-edit-user', + require( + './components/modalnewedituser.vue').default, +); +Vue.component( + 'action-table', + require( + './components/actiontable.vue').default, +); +Vue.component( + 'user-table', + require( + './components/usertable.vue').default, +); var bus = new Vue(); -Vue.mixin({ - data() { - return { - productionUrl: process.env.MIX_ENV_MODE === 'production' ? '/mesort' : '' - } - }, - computed: { - url: function () { - return document.URL.split('/').pop(); - } - }, - methods: { - getCookie: function (cname) { - let name = cname + "="; - let ca = document.cookie.split(';'); - for (let i = 0; i < ca.length; i++) { - let c = ca[i]; - while (c.charAt(0) == ' ') { - c = c.substring(1); - } - if (c.indexOf(name) == 0) { - return c.substring(name.length, c.length); - } - } - return ""; +Vue.mixin( + { + data() + { + return { + productionUrl: process.env.MIX_ENV_MODE === + 'production' ? + '/mesort' : + '', + }; }, - setCookie: function (cname, cvalue, exdays) { - let d = new Date(); - d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); - let expires = "expires=" + d.toUTCString(); - document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; + computed: { + url: function() + { + return document.URL.split( + '/'). + pop(); + }, }, - deleteCookie: function (name) { - document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;'; + methods: { + getCookie: function(cname) + { + let name = cname + + '='; + let ca = document.cookie.split( + ';'); + for ( + let i = 0; + i < + ca.length; + i++ + ) + { + let c = ca[i]; + while (c.charAt( + 0) == + ' ') + { + c = c.substring( + 1); + } + if (c.indexOf( + name) == + 0) + { + return c.substring( + name.length, + c.length, + ); + } + } + return ''; + }, + setCookie: function( + cname, + cvalue, + exdays) + { + let d = new Date(); + d.setTime( + d.getTime() + + (exdays * + 24 * + 60 * + 60 * + 1000)); + let expires = 'expires=' + + d.toUTCString(); + document.cookie = cname + + '=' + + cvalue + + ';' + + expires + + ';path=/'; + }, + deleteCookie: function(name) + { + document.cookie = name + + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;'; + }, + confirmdelete: function( + id, + name) + { + + this.$buefy.dialog.confirm( + { + title: 'Confirm Delete', + message: `Are you sure to delete the study ` + + name + + ' and all the deleted data?', + cancelText: 'Cancel', + confirmText: 'Delete', + type: 'is-danger', + onConfirm: () => this.deletestudy( + id), + }, + ); + }, + deletestudy: function(id) + { + this.loading = true; + this.message = ''; + let self = this; + axios.delete( + 'studies/' + + id, + {data: id}, + ). + then( + response => + { + setTimeout( + function() + { + self.loading = false; + self.$buefy.snackbar.open( + 'Study deleted'); + + window.location.href = '../mesort'; + + }, + 500, + ); + + }). + catch( + function(error) + { + console.log( + error); + self.loading = false; + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); + }, + goto: function(url) + { + window.location.href = url; + }, }, - confirmdelete: function (id, name) { - this.$buefy.dialog.confirm( + }); + +window.app = new Vue( + { + el: '#app', + components: { + PlusIcon, + ArrowRight, + ArrowLeft, + Pencil, + Caret, + homeicon, + Bell, + Read, + }, + store, + computed: { + ...mapState( { - title: 'Confirm Delete', - message: `Are you sure to delete the study ` + name + ' and all the deleted data?', - cancelText: 'Cancel', - confirmText: 'Delete', - type: 'is-danger', - onConfirm: () => this.deletestudy(id) - } - ); + interviewpagenames: state => state.newinterview.pagenames, + interviewpage: state => state.newinterview.page, + buttonnames: state => state.newinterview.buttonnames, + sorting: state => state.newinterview.sorting, + sortingtotal: state => state.newinterview.sortingtotal, + presortQuestions: state => state.newinterview.presortQuestions, + postsortQuestions: state => state.newinterview.postsortQuestions, + + }), }, - deletestudy: function (id) { - this.loading = true; - this.message = ""; + data: { + newstudy: {}, + users: {}, + newuser: { + showmodal: false, + edituser: 0, + study: 0, + activeTab: 0, + }, + interview: { + interviewed: '', + study: '', + url: '', + }, + registration: { + password: null, + password_length: 0, + contains_six_characters: false, + contains_number: false, + contains_letters: false, + contains_special_character: false, + valid_password: false, + }, + shownotificationbox: false, + usernotifications: [], + howmanyunreadnotifications: 0, + }, + created() + { let self = this; - axios.delete('studies/' + id, {data: id}) - .then(response => { - setTimeout(function () { - self.loading = false; - self.$buefy.snackbar.open("Study deleted"); - window.location.href = '../mesort'; - - }, 500); + if (this.url == + '') + { + let self = this; + axios.post( + 'users/notifications'). + then( + response => + { + self.usernotifications = response.data; + self.howmanyunreadnotifications = 0; + for ( + let i = 0; + i < + self.usernotifications.length; + i++ + ) + { + if (_.isNull( + self.usernotifications[i].read_at)) + { + self.howmanyunreadnotifications++; + } + } + + }). + catch( + function(error) + { + console.log( + error); + self.loading = false; + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); + } - }).catch(function (error) { - console.log(error); - self.loading = false; - self.$buefy.snackbar.open("There it was an error during the request - refresh page and try again"); - }); }, - goto: function (url) { - window.location.href = url; - } - } - -}); - -window.app = new Vue({ - el: '#app', - components: { - PlusIcon, - ArrowRight, - ArrowLeft, - Pencil, - Caret, - homeicon, - Bell, - Read - }, - store, - computed: { - ...mapState({ - interviewpagenames: state => state.newinterview.pagenames, - interviewpage: state => state.newinterview.page, - buttonnames: state => state.newinterview.buttonnames, - sorting: state => state.newinterview.sorting, - sortingtotal: state => state.newinterview.sortingtotal, - presortQuestions: state => state.newinterview.presortQuestions, - postsortQuestions: state => state.newinterview.postsortQuestions - - - }) - }, - data: { - newstudy: {}, - users: {}, - newuser: { - showmodal: false, - edituser: 0, - study: 0, - activeTab: 0 - }, - interview: { - interviewed: "", - study: "", - url: "" - }, - registration: { - password: null, - password_length: 0, - contains_six_characters: false, - contains_number: false, - contains_letters: false, - contains_special_character: false, - valid_password: false + events: { + 'showmodalparent': function() + { + console.log( + 'show modal parent'); + }, }, - shownotificationbox: false, - usernotifications: [], - howmanyunreadnotifications: 0 - }, - created() { - let self = this; + methods: { + iWantNewsletter(will) + { + console.log(will) + let subscribed = (will === + 'true'); + console.log(subscribed) + let self = this; + axios.post( + 'users/subscribe', + {"subscribed":subscribed} + ). + then( + response => + { + console.log(response); + self.$buefy.snackbar.open( + response.data.message); + let newsDiv = document.querySelector(".newsletter"); - if (this.url == "") { - let self = this; - axios.post('users/notifications') - .then(response => { - self.usernotifications = response.data; - self.howmanyunreadnotifications = 0; - for (let i = 0; i < self.usernotifications.length; i++) { - if (_.isNull(self.usernotifications[i].read_at)) self.howmanyunreadnotifications++; - } - }).catch(function (error) { - console.log(error); - self.loading = false; - self.$buefy.snackbar.open("There it was an error during the request - refresh page and try again"); - }); - } + newsDiv.classList.remove('opacity-100'); + newsDiv.classList.add('opacity-0'); + setTimeout(() => { newsDiv.classList.add('hidden') }, 500); + self.$forceUpdate(); - }, - events: { - 'showmodalparent': function () { - console.log("show modal parent") - } - }, - methods: { - copyInterviewUrlToClipboard() { - if (this.interview.url != "") { + }). + catch( + function(error) + { - let testingCodeToCopy = document.querySelector('#publicUrl') - testingCodeToCopy.setAttribute('type', 'text') // 不是 hidden 才能複製 - testingCodeToCopy.select() - let self = this; + console.log( + error); - try { - var successful = document.execCommand('copy'); - var msg = successful ? 'successful' : 'unsuccessful'; - self.$buefy.snackbar.open("Url copied to Clipboard."); - } catch (err) { - self.$buefy.snackbar.open("Unable to copy."); - } - - /* unselect the range */ - window.getSelection().removeAllRanges() - } else { - this.$buefy.snackbar.open("The url is empty."); + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); - } + }, + copyInterviewUrlToClipboard() + { + if (this.interview.url != + '') + { - }, - toggleModal(id = "") { - const body = document.querySelector('body') - const modal = document.querySelector('.modal') - modal.classList.toggle('opacity-0') - modal.classList.toggle('pointer-events-none') - body.classList.toggle('modal-active') - - if (id != "" && id != this.interview.study) { - this.interview.url = ""; - this.$forceUpdate(); - } - if (id != "") this.interview.study = id; - }, - createPublicUrl() { - let self = this; - axios.post('interview/publicurl/create', {study: this.interview.study}) - .then(response => { - // if set to read set background different + let testingCodeToCopy = document.querySelector( + '#publicUrl'); + testingCodeToCopy.setAttribute( + 'type', + 'text', + ); + testingCodeToCopy.select(); + let self = this; + + try + { + var successful = document.execCommand( + 'copy'); + var msg = successful ? + 'successful' : + 'unsuccessful'; + self.$buefy.snackbar.open( + 'Url copied to Clipboard.'); + } + catch (err) + { + self.$buefy.snackbar.open( + 'Unable to copy.'); + } - self.$buefy.snackbar.open(response.data.message); - self.interview.url = response.data.url; + /* unselect the range */ + window.getSelection(). + removeAllRanges(); + } + else + { + this.$buefy.snackbar.open( + 'The url is empty.'); - self.$forceUpdate(); + } - }).catch(function (error) { + }, + toggleModal(id = '') + { + const body = document.querySelector( + 'body'); + const modal = document.querySelector( + '.modal'); + modal.classList.toggle( + 'opacity-0'); + modal.classList.toggle( + 'pointer-events-none'); + body.classList.toggle( + 'modal-active'); + + if (id != + '' && + id != + this.interview.study) + { + this.interview.url = ''; + this.$forceUpdate(); + } + if (id != + '') + { + this.interview.study = id; + } + }, + createPublicUrl() + { + let self = this; + axios.post( + 'interview/publicurl/create', + {study: this.interview.study}, + ). + then( + response => + { + // if set to read set background different + + self.$buefy.snackbar.open( + response.data.message); + self.interview.url = response.data.url; + + self.$forceUpdate(); + + }). + catch( + function(error) + { + + console.log( + error); + + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); + + }, + checkPassword() + { + this.registration.password_length = this.registration.password.length; + const special_chars = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; + + if (this.registration.password_length > + 5) + { + this.registration.contains_six_characters = true; + } + else + { + this.registration.contains_six_characters = false; + } - console.log(error); + this.registration.contains_number = /\d/.test( + this.registration.password); + this.registration.contains_letters = /[a-z]/.test( + this.registration.password); + this.registration.contains_special_character = special_chars.test( + this.registration.password); + + if (this.registration.contains_six_characters === + true && + this.registration.contains_letters === + true && + this.registration.contains_number === + true) + { + this.registration.valid_password = true; + } + else + { + this.registration.valid_password = false; + } + }, - self.$buefy.snackbar.open("There it was an error during the request - refresh page and try again"); - }); + formatdate: function(date) + { - }, - checkPassword() { - this.registration.password_length = this.registration.password.length; - const special_chars = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; - - if (this.registration.password_length > 5) { - this.registration.contains_six_characters = true; - } else { - this.registration.contains_six_characters = false; - } + //moment.defaultFormat = "DD.MM.YYYY HH:mm"; + var localeData = moment.localeData(); + var format = localeData.longDateFormat( + 'L') + + ' ' + + localeData.longDateFormat( + 'LT'); - this.registration.contains_number = /\d/.test(this.registration.password); - this.registration.contains_letters = /[a-z]/.test(this.registration.password); - this.registration.contains_special_character = special_chars.test(this.registration.password); + console.log( + (navigator.languages && + navigator.languages.length) ? + navigator.languages[0] : + navigator.language); - if (this.registration.contains_six_characters === true && - this.registration.contains_letters === true && - this.registration.contains_number === true) { - this.registration.valid_password = true; - } else { - this.registration.valid_password = false; - } - }, + //console.log((navigator.languages && navigator.languages.length) ? navigator.languages[0] : navigator.language); - formatdate: function (date) { + return moment( + String( + date)). + format( + this.getLocaleDateString()); - //moment.defaultFormat = "DD.MM.YYYY HH:mm"; - var localeData = moment.localeData(); - var format = localeData.longDateFormat('L') + ' ' + localeData.longDateFormat('LT'); + } + , + togglenotification: function(id) + { + let self = this; + axios.post( + 'users/notifications/update', + {notification: id}, + ). + then( + response => + { + // if set to read set background different + self.$buefy.snackbar.open( + 'Notification set to read'); + let notification = _.find( + self.usernotifications, + function(o) + { + return o.id === + id; + }, + ); + + notification.read_at = response.data; + self.howmanyunreadnotifications--; + self.$forceUpdate(); + }). + catch( + function(error) + { + + console.log( + error); + self.loading = false; + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); + } + , + confirmduplicate: function( + id, + name) + { - console.log((navigator.languages && navigator.languages.length) ? navigator.languages[0] : navigator.language); + let confirmDelete = this.$buefy.dialog.confirm( + { + title: 'Confirm Duplicate', + message: 'Do you want to duplicate the study "' + + name + + '" ?', + cancelText: 'Cancel', + confirmText: 'Yes Duplicate Study', + hasIcon: true, + type: 'is-warning', + onConfirm: () => this.duplicatestudy( + id), + }, + ); + } + , + duplicatestudy: function(id) + { + this.loading = true; + this.message = ''; + let self = this; + axios.get( + 'studies/' + + id + + '/duplicate'). + then( + response => + { + setTimeout( + function() + { + self.loading = false; + self.$buefy.snackbar.open( + 'Study duplicated'); + + window.location.reload(); + + }, + 500, + ); + + }). + catch( + function(error) + { + console.log( + error); + self.loading = false; + self.$buefy.snackbar.open( + 'There it was an error during the request - refresh page and try again'); + }); + } + , + confirmdelete: function( + id, + name) + { - //console.log((navigator.languages && navigator.languages.length) ? navigator.languages[0] : navigator.language); + let confirmDelete = this.$buefy.dialog.confirm( + { + title: 'Confirm Delete', + message: `
You are about to delete the study
` + + name + + '
and all its content?
Continue?
', + cancelText: 'Cancel', + confirmText: 'YES \n Delete Study', + hasIcon: true, + type: 'is-danger', + onConfirm: () => this.deletestudy( + id), + }, + ); + } + , + deletestudy: function(id) + { + this.loading = true; + this.message = ''; + let self = this; + axios.delete( + 'studies/' + + id, + {data: id}, + ). + then( + response => + { + setTimeout( + function() + { + self.loading = false; + self.$buefy.snackbar.open( + 'Study deleted'); + + window.location.reload(); + + }, + 500, + ); + + }). + catch( + function(error) + { - return moment(String(date)).format(this.getLocaleDateString()); + self.loading = false; + self.$buefy.snackbar.open( + error.response.data); - } - , - togglenotification: function (id) { - let self = this; + }); + } + , + interviewconfirmpreviouspage: function() + { + this.$refs.thenewinterview.confirmpreviouspage(); + } + , + interviewconfirmnextpage: function() + { + this.$refs.thenewinterview.confirmnextpage(); + } + , + interviewaddsorting: function() + { + this.$refs.thenewinterview.addSorting(); + } + , + interviewaddtoken: function() + { + store.commit( + 'newtokenmodal'); + } + , + showdropdown: function(id) + { + document.getElementById( + id). + classList. + toggle( + 'hidden'); + } + , + 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() + { + this.$buefy.dialog.confirm( + { + title: 'Cancel interview', + message: 'Do you want to cancel this interview?', + confirmText: 'go', + type: 'is-danger', + hasIcon: true, + onConfirm: () => + { + window.location.href = '../'; + }, + }); + } + , + setinterviewdname: function(studyid) + { - axios.post('users/notifications/update', {notification: id}) - .then(response => { - // if set to read set background different - self.$buefy.snackbar.open("Notification set to read"); - let notification = _.find(self.usernotifications, function (o) { - return o.id === id; + this.$buefy.dialog.prompt( + { + message: `What's the interviewed name?`, + confirmText: 'Start Interview', + inputAttrs: { + placeholder: '', + maxlength: 20, + required: false, + + }, + onConfirm: (value) => + { + this.interview.interviewed = value; + window.location.href = 'interviews/new?study=' + + studyid + + '&interviewed=' + + value; + }, }); - notification.read_at = response.data; - self.howmanyunreadnotifications--; - self.$forceUpdate(); - }).catch(function (error) { - - console.log(error); - self.loading = false; - self.$buefy.snackbar.open("There it was an error during the request - refresh page and try again"); - }); - } - , - confirmduplicate: function (id, name) { - - let confirmDelete = this.$buefy.dialog.confirm( - { - title: 'Confirm Duplicate', - message: 'Do you want to duplicate the study "' + name + '" ?', - cancelText: 'Cancel', - confirmText: 'Yes Duplicate Study', - hasIcon: true, - type: 'is-warning', - onConfirm: () => this.duplicatestudy(id) + setTimeout( + function() + { + + let el = document.querySelector( + '.modal-card input'); + document.activeElement.blur(); + + }, + 100, + ); + } - ); - } - , - duplicatestudy: function (id) { - this.loading = true; - this.message = ""; - let self = this; - axios.get('studies/' + id + '/duplicate') - .then(response => { - setTimeout(function () { - self.loading = false; - self.$buefy.snackbar.open("Study duplicated"); - - window.location.reload(); - - }, 500); - - }).catch(function (error) { - console.log(error); - self.loading = false; - self.$buefy.snackbar.open("There it was an error during the request - refresh page and try again"); - }); - } - , - confirmdelete: function (id, name) { - - let confirmDelete = this.$buefy.dialog.confirm( - { - title: 'Confirm Delete', - message: `
You are about to delete the study
` + name + '
and all its content?
Continue?
', - cancelText: 'Cancel', - confirmText: 'YES \n Delete Study', - hasIcon: true, - type: 'is-danger', - onConfirm: () => this.deletestudy(id) + , + reloadusers: function(r) + { + + this.users[r[1]] = r[0]; + this.$forceUpdate(); + } - ); - } - , - deletestudy: function (id) { - this.loading = true; - this.message = ""; - let self = this; - axios.delete('studies/' + id, {data: id}) - .then(response => { - setTimeout(function () { - self.loading = false; - self.$buefy.snackbar.open("Study deleted"); - - window.location.reload(); - - }, 500); - - }).catch(function (error) { - - self.loading = false; - self.$buefy.snackbar.open(error.response.data); - - }); - } - , - interviewconfirmpreviouspage: function () { - this.$refs.thenewinterview.confirmpreviouspage(); - } - , - interviewconfirmnextpage: function () { - this.$refs.thenewinterview.confirmnextpage(); - } - , - interviewaddsorting: function () { - this.$refs.thenewinterview.addSorting(); - } - , - interviewaddtoken: function () { - store.commit('newtokenmodal') - } - , - showdropdown: function (id) { - document.getElementById(id).classList.toggle("hidden"); - } - , - 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 () { - this.$buefy.dialog.confirm({ - title: 'Cancel interview', - message: 'Do you want to cancel this interview?', - confirmText: 'go', - type: 'is-danger', - hasIcon: true, - onConfirm: () => { - window.location.href = '../'; + , + showtoast: function(message) + { + window.app.$buefy.snackbar.open( + message); } - }) - } - , - setinterviewdname: function (studyid) { - - this.$buefy.dialog.prompt({ - message: `What's the interviewed name?`, - confirmText: "Start Interview", - inputAttrs: { - placeholder: '', - maxlength: 20, - required: false + , + getLocaleDateString: function() + { + var formats = { + 'ar-SA': 'DD/MM/YY HH:mm', + 'bg-BG': 'DD.M.YYYY HH:mm', + 'ca-ES': 'DD/MM/YYYY HH:mm', + 'zh-TW': 'YYYY/M/d HH:mm', + 'cs-CZ': 'DD.M.YYYY HH:mm', + 'da-DK': 'DD-MM-YYYY HH:mm', + 'de-DE': 'DD.MM.YYYY HH:mm', + 'el-GR': 'd/M/YYYY HH:mm', + 'en-US': 'M/d/YYYY HH:mm', + 'fi-FI': 'DD.M.YYYY HH:mm', + 'fr-FR': 'DD/MM/YYYY HH:mm', + 'he-IL': 'DD/MM/YYYY HH:mm', + 'hu-HU': 'YYYY. MM. DD. HH:mm', + 'is-IS': 'DD.M.YYYY HH:mm', + 'it-IT': 'DD/MM/YYYY HH:mm', + 'ja-JP': 'YYYY/MM/DD HH:mm', + 'ko-KR': 'YYYY-MM-DD HH:mm', + 'nl-NL': 'd-M-YYYY HH:mm', + 'nb-NO': 'DD.MM.YYYY HH:mm', + 'pl-PL': 'YYYY-MM-DD HH:mm', + 'pt-BR': 'd/M/YYYY HH:mm', + 'ro-RO': 'DD.MM.YYYY HH:mm', + 'ru-RU': 'DD.MM.YYYY HH:mm', + 'hr-HR': 'DD.M.YYYY HH:mm', + 'sk-SK': 'DD. M. YYYY HH:mm', + 'sq-AL': 'YYYY-MM-DD HH:mm', + 'sv-SE': 'YYYY-MM-DD HH:mm', + 'th-TH': 'DD/M/YYYY HH:mm', + 'tr-TR': 'DD.MM.YYYY HH:mm', + 'ur-PK': 'DD/MM/YYYY HH:mm', + 'id-ID': 'DD/MM/YYYY HH:mm', + 'uk-UA': 'DD.MM.YYYY HH:mm', + 'be-BY': 'DD.MM.YYYY HH:mm', + 'sl-SI': 'DD.M.YYYY HH:mm', + 'et-EE': 'DD.MM.YYYY HH:mm', + 'lv-LV': 'YYYY.MM.DD. HH:mm', + 'lt-LT': 'YYYY.MM.DD HH:mm', + 'fa-IR': 'MM/DD/YYYY HH:mm', + 'vi-VN': 'DD/MM/YYYY HH:mm', + 'hy-AM': 'DD.MM.YYYY HH:mm', + 'az-Latn-AZ': 'DD.MM.YYYY HH:mm', + 'eu-ES': 'YYYY/MM/DD HH:mm', + 'mk-MK': 'DD.MM.YYYY HH:mm', + 'af-ZA': 'YYYY/MM/DD HH:mm', + 'ka-GE': 'DD.MM.YYYY HH:mm', + 'fo-FO': 'DD-MM-YYYY HH:mm', + 'hi-IN': 'DD-MM-YYYY HH:mm', + 'ms-MY': 'DD/MM/YYYY HH:mm', + 'kk-KZ': 'DD.MM.YYYY HH:mm', + 'ky-KG': 'DD.MM.YY HH:mm', + 'sw-KE': 'M/d/YYYY HH:mm', + 'uz-Latn-UZ': 'DD/MM YYYY HH:mm', + 'tt-RU': 'DD.MM.YYYY HH:mm', + 'pa-IN': 'DD-MM-YY HH:mm', + 'gu-IN': 'DD-MM-YY HH:mm', + 'ta-IN': 'DD-MM-YYYY HH:mm', + 'te-IN': 'DD-MM-YY HH:mm', + 'kn-IN': 'DD-MM-YY HH:mm', + 'mr-IN': 'DD-MM-YYYY HH:mm', + 'sa-IN': 'DD-MM-YYYY HH:mm', + 'mn-MN': 'YY.MM.DD HH:mm', + 'gl-ES': 'DD/MM/YY HH:mm', + 'kok-IN': 'DD-MM-YYYY HH:mm', + 'syr-SY': 'DD/MM/YYYY HH:mm', + 'dv-MV': 'DD/MM/YY HH:mm', + 'ar-IQ': 'DD/MM/YYYY HH:mm', + 'zh-CN': 'YYYY/M/d HH:mm', + 'de-CH': 'DD.MM.YYYY HH:mm', + 'en-GB': 'DD/MM/YYYY HH:mm', + 'es-MX': 'DD/MM/YYYY HH:mm', + 'fr-BE': 'd/MM/YYYY HH:mm', + 'it-CH': 'DD.MM.YYYY HH:mm', + 'nl-BE': 'd/MM/YYYY HH:mm', + 'nn-NO': 'DD.MM.YYYY HH:mm', + 'pt-PT': 'DD-MM-YYYY HH:mm', + 'sr-Latn-CS': 'DD.M.YYYY HH:mm', + 'sv-FI': 'DD.M.YYYY HH:mm', + 'az-Cyrl-AZ': 'DD.MM.YYYY HH:mm', + 'ms-BN': 'DD/MM/YYYY HH:mm', + 'uz-Cyrl-UZ': 'DD.MM.YYYY HH:mm', + 'ar-EG': 'DD/MM/YYYY HH:mm', + 'zh-HK': 'd/M/YYYY HH:mm', + 'de-AT': 'DD.MM.YYYY HH:mm', + 'en-AU': 'd/MM/YYYY HH:mm', + 'es-ES': 'DD/MM/YYYY HH:mm', + 'fr-CA': 'YYYY-MM-DD HH:mm', + 'sr-Cyrl-CS': 'DD.M.YYYY HH:mm', + 'ar-LY': 'DD/MM/YYYY HH:mm', + 'zh-SG': 'd/M/YYYY HH:mm', + 'de-LU': 'DD.MM.YYYY HH:mm', + 'en-CA': 'DD/MM/YYYY HH:mm', + 'es-GT': 'DD/MM/YYYY HH:mm', + 'fr-CH': 'DD.MM.YYYY HH:mm', + 'ar-DZ': 'DD-MM-YYYY HH:mm', + 'zh-MO': 'D/M/YYYY HH:mm', + 'de-LI': 'DD.MM.YYYY HH:mm', + 'en-NZ': 'd/MM/YYYY HH:mm', + 'es-CR': 'DD/MM/YYYY HH:mm', + 'fr-LU': 'DD/MM/YYYY HH:mm', + 'ar-MA': 'DD-MM-YYYY HH:mm', + 'en-IE': 'DD/MM/YYYY HH:mm', + 'es-PA': 'MM/DD/YYYY HH:mm', + 'fr-MC': 'DD/MM/YYYY HH:mm', + 'ar-TN': 'DD-MM-YYYY HH:mm', + 'en-ZA': 'YYYY/MM/DD HH:mm', + 'es-DO': 'DD/MM/YYYY HH:mm', + 'ar-OM': 'DD/MM/YYYY HH:mm', + 'en-JM': 'DD/MM/YYYY HH:mm', + 'es-VE': 'DD/MM/YYYY HH:mm', + 'ar-YE': 'DD/MM/YYYY HH:mm', + 'en-029': 'MM/DD/YYYY HH:mm', + 'es-CO': 'DD/MM/YYYY HH:mm', + 'ar-SY': 'DD/MM/YYYY HH:mm', + 'en-BZ': 'DD/MM/YYYY HH:mm', + 'es-PE': 'DD/MM/YYYY HH:mm', + 'ar-JO': 'DD/MM/YYYY HH:mm', + 'en-TT': 'DD/MM/YYYY HH:mm', + 'es-AR': 'DD/MM/YYYY HH:mm', + 'ar-LB': 'DD/MM/YYYY HH:mm', + 'en-ZW': 'M/d/YYYY HH:mm', + 'es-EC': 'DD/MM/YYYY HH:mm', + 'ar-KW': 'DD/MM/YYYY HH:mm', + 'en-PH': 'M/d/YYYY HH:mm', + 'es-CL': 'DD-MM-YYYY HH:mm', + 'ar-AE': 'DD/MM/YYYY HH:mm', + 'es-UY': 'DD/MM/YYYY HH:mm', + 'ar-BH': 'DD/MM/YYYY HH:mm', + 'es-PY': 'DD/MM/YYYY HH:mm', + 'ar-QA': 'DD/MM/YYYY HH:mm', + 'es-BO': 'DD/MM/YYYY HH:mm', + 'es-SV': 'DD/MM/YYYY HH:mm', + 'es-HN': 'DD/MM/YYYY HH:mm', + 'es-NI': 'DD/MM/YYYY HH:mm', + 'es-PR': 'DD/MM/YYYY HH:mm', + 'am-ET': 'd/M/YYYY HH:mm', + 'tzm-Latn-DZ': 'DD-MM-YYYY HH:mm', + 'iu-Latn-CA': 'd/MM/YYYY HH:mm', + 'sma-NO': 'DD.MM.YYYY HH:mm', + 'mn-Mong-CN': 'YYYY/M/d HH:mm', + 'gd-GB': 'DD/MM/YYYY HH:mm', + 'en-MY': 'd/M/YYYY HH:mm', + 'prs-AF': 'DD/MM/YY HH:mm', + 'bn-BD': 'DD-MM-YY HH:mm', + 'wo-SN': 'DD/MM/YYYY HH:mm', + 'rw-RW': 'M/d/YYYY HH:mm', + 'qut-GT': 'DD/MM/YYYY HH:mm', + 'sah-RU': 'MM.DD.YYYY HH:mm', + 'gsw-FR': 'DD/MM/YYYY HH:mm', + 'co-FR': 'DD/MM/YYYY HH:mm', + 'oc-FR': 'DD/MM/YYYY HH:mm', + 'mi-NZ': 'DD/MM/YYYY HH:mm', + 'ga-IE': 'DD/MM/YYYY HH:mm', + 'se-SE': 'YYYY-MM-DD HH:mm', + 'br-FR': 'DD/MM/YYYY HH:mm', + 'smn-FI': 'DD.M.YYYY HH:mm', + 'moh-CA': 'M/d/YYYY HH:mm', + 'arn-CL': 'DD-MM-YYYY HH:mm', + 'ii-CN': 'YYYY/M/d HH:mm', + 'dsb-DE': 'DD. M. YYYY HH:mm', + 'ig-NG': 'd/M/YYYY HH:mm', + 'kl-GL': 'DD-MM-YYYY HH:mm', + 'lb-LU': 'DD/MM/YYYY HH:mm', + 'ba-RU': 'DD.MM.YY HH:mm', + 'nso-ZA': 'YYYY/MM/DD HH:mm', + 'quz-BO': 'DD/MM/YYYY HH:mm', + 'yo-NG': 'd/M/YYYY HH:mm', + 'ha-Latn-NG': 'd/M/YYYY HH:mm', + 'fil-PH': 'M/d/YYYY HH:mm', + 'ps-AF': 'DD/MM/YY HH:mm', + 'fy-NL': 'd-M-YYYY HH:mm', + 'ne-NP': 'M/d/YYYY HH:mm', + 'se-NO': 'DD.MM.YYYY HH:mm', + 'iu-Cans-CA': 'd/M/YYYY HH:mm', + 'sr-Latn-RS': 'DD.M.YYYY HH:mm', + 'si-LK': 'YYYY-MM-DD HH:mm', + 'sr-Cyrl-RS': 'DD.M.YYYY HH:mm', + 'lo-LA': 'DD/MM/YYYY HH:mm', + 'km-KH': 'YYYY-MM-DD HH:mm', + 'cy-GB': 'DD/MM/YYYY HH:mm', + 'bo-CN': 'YYYY/M/d HH:mm', + 'sms-FI': 'DD.M.YYYY HH:mm', + 'as-IN': 'DD-MM-YYYY HH:mm', + 'ml-IN': 'DD-MM-YY HH:mm', + 'en-IN': 'DD-MM-YYYY HH:mm', + 'or-IN': 'DD-MM-YY HH:mm', + 'bn-IN': 'DD-MM-YY HH:mm', + 'tk-TM': 'DD.MM.YY HH:mm', + 'bs-Latn-BA': 'DD.M.YYYY HH:mm', + 'mt-MT': 'DD/MM/YYYY HH:mm', + 'sr-Cyrl-ME': 'DD.M.YYYY HH:mm', + 'se-FI': 'DD.M.YYYY HH:mm', + 'zu-ZA': 'YYYY/MM/DD HH:mm', + 'xh-ZA': 'YYYY/MM/DD HH:mm', + 'tn-ZA': 'YYYY/MM/DD HH:mm', + 'hsb-DE': 'DD. M. YYYY HH:mm', + 'bs-Cyrl-BA': 'DD.M.YYYY HH:mm', + 'tg-Cyrl-TJ': 'DD.MM.YY HH:mm', + 'sr-Latn-BA': 'DD.M.YYYY HH:mm', + 'smj-NO': 'DD.MM.YYYY HH:mm', + 'rm-CH': 'DD/MM/YYYY HH:mm', + 'smj-SE': 'YYYY-MM-DD HH:mm', + 'quz-EC': 'DD/MM/YYYY HH:mm', + 'quz-PE': 'DD/MM/YYYY HH:mm', + 'hr-BA': 'DD.M.YYYY. HH:mm', + 'sr-Latn-ME': 'DD.M.YYYY HH:mm', + 'sma-SE': 'YYYY-MM-DD HH:mm', + 'en-SG': 'd/M/YYYY HH:mm', + 'ug-CN': 'YYYY-M-d HH:mm', + 'sr-Cyrl-BA': 'DD.M.YYYY HH:mm', + 'es-US': 'M/DD/YYYY HH:mm', + }; + + return formats[navigator.language] || + 'DD/MM/YYYY HH:mm'; }, - onConfirm: (value) => { - this.interview.interviewed = value; - window.location.href = 'interviews/new?study=' + studyid + '&interviewed=' + value; - } - }) - - setTimeout(function () { - - let el = document.querySelector('.modal-card input'); - document.activeElement.blur(); - - }, 100); - - - } - , - reloadusers: function (r) { - - this.users[r[1]] = r[0]; - this.$forceUpdate(); - - } - , - showtoast: function (message) { - window.app.$buefy.snackbar.open(message); - } - , - getLocaleDateString: function () { - - var formats = { - "ar-SA": "DD/MM/YY HH:mm", - "bg-BG": "DD.M.YYYY HH:mm", - "ca-ES": "DD/MM/YYYY HH:mm", - "zh-TW": "YYYY/M/d HH:mm", - "cs-CZ": "DD.M.YYYY HH:mm", - "da-DK": "DD-MM-YYYY HH:mm", - "de-DE": "DD.MM.YYYY HH:mm", - "el-GR": "d/M/YYYY HH:mm", - "en-US": "M/d/YYYY HH:mm", - "fi-FI": "DD.M.YYYY HH:mm", - "fr-FR": "DD/MM/YYYY HH:mm", - "he-IL": "DD/MM/YYYY HH:mm", - "hu-HU": "YYYY. MM. DD. HH:mm", - "is-IS": "DD.M.YYYY HH:mm", - "it-IT": "DD/MM/YYYY HH:mm", - "ja-JP": "YYYY/MM/DD HH:mm", - "ko-KR": "YYYY-MM-DD HH:mm", - "nl-NL": "d-M-YYYY HH:mm", - "nb-NO": "DD.MM.YYYY HH:mm", - "pl-PL": "YYYY-MM-DD HH:mm", - "pt-BR": "d/M/YYYY HH:mm", - "ro-RO": "DD.MM.YYYY HH:mm", - "ru-RU": "DD.MM.YYYY HH:mm", - "hr-HR": "DD.M.YYYY HH:mm", - "sk-SK": "DD. M. YYYY HH:mm", - "sq-AL": "YYYY-MM-DD HH:mm", - "sv-SE": "YYYY-MM-DD HH:mm", - "th-TH": "DD/M/YYYY HH:mm", - "tr-TR": "DD.MM.YYYY HH:mm", - "ur-PK": "DD/MM/YYYY HH:mm", - "id-ID": "DD/MM/YYYY HH:mm", - "uk-UA": "DD.MM.YYYY HH:mm", - "be-BY": "DD.MM.YYYY HH:mm", - "sl-SI": "DD.M.YYYY HH:mm", - "et-EE": "DD.MM.YYYY HH:mm", - "lv-LV": "YYYY.MM.DD. HH:mm", - "lt-LT": "YYYY.MM.DD HH:mm", - "fa-IR": "MM/DD/YYYY HH:mm", - "vi-VN": "DD/MM/YYYY HH:mm", - "hy-AM": "DD.MM.YYYY HH:mm", - "az-Latn-AZ": "DD.MM.YYYY HH:mm", - "eu-ES": "YYYY/MM/DD HH:mm", - "mk-MK": "DD.MM.YYYY HH:mm", - "af-ZA": "YYYY/MM/DD HH:mm", - "ka-GE": "DD.MM.YYYY HH:mm", - "fo-FO": "DD-MM-YYYY HH:mm", - "hi-IN": "DD-MM-YYYY HH:mm", - "ms-MY": "DD/MM/YYYY HH:mm", - "kk-KZ": "DD.MM.YYYY HH:mm", - "ky-KG": "DD.MM.YY HH:mm", - "sw-KE": "M/d/YYYY HH:mm", - "uz-Latn-UZ": "DD/MM YYYY HH:mm", - "tt-RU": "DD.MM.YYYY HH:mm", - "pa-IN": "DD-MM-YY HH:mm", - "gu-IN": "DD-MM-YY HH:mm", - "ta-IN": "DD-MM-YYYY HH:mm", - "te-IN": "DD-MM-YY HH:mm", - "kn-IN": "DD-MM-YY HH:mm", - "mr-IN": "DD-MM-YYYY HH:mm", - "sa-IN": "DD-MM-YYYY HH:mm", - "mn-MN": "YY.MM.DD HH:mm", - "gl-ES": "DD/MM/YY HH:mm", - "kok-IN": "DD-MM-YYYY HH:mm", - "syr-SY": "DD/MM/YYYY HH:mm", - "dv-MV": "DD/MM/YY HH:mm", - "ar-IQ": "DD/MM/YYYY HH:mm", - "zh-CN": "YYYY/M/d HH:mm", - "de-CH": "DD.MM.YYYY HH:mm", - "en-GB": "DD/MM/YYYY HH:mm", - "es-MX": "DD/MM/YYYY HH:mm", - "fr-BE": "d/MM/YYYY HH:mm", - "it-CH": "DD.MM.YYYY HH:mm", - "nl-BE": "d/MM/YYYY HH:mm", - "nn-NO": "DD.MM.YYYY HH:mm", - "pt-PT": "DD-MM-YYYY HH:mm", - "sr-Latn-CS": "DD.M.YYYY HH:mm", - "sv-FI": "DD.M.YYYY HH:mm", - "az-Cyrl-AZ": "DD.MM.YYYY HH:mm", - "ms-BN": "DD/MM/YYYY HH:mm", - "uz-Cyrl-UZ": "DD.MM.YYYY HH:mm", - "ar-EG": "DD/MM/YYYY HH:mm", - "zh-HK": "d/M/YYYY HH:mm", - "de-AT": "DD.MM.YYYY HH:mm", - "en-AU": "d/MM/YYYY HH:mm", - "es-ES": "DD/MM/YYYY HH:mm", - "fr-CA": "YYYY-MM-DD HH:mm", - "sr-Cyrl-CS": "DD.M.YYYY HH:mm", - "ar-LY": "DD/MM/YYYY HH:mm", - "zh-SG": "d/M/YYYY HH:mm", - "de-LU": "DD.MM.YYYY HH:mm", - "en-CA": "DD/MM/YYYY HH:mm", - "es-GT": "DD/MM/YYYY HH:mm", - "fr-CH": "DD.MM.YYYY HH:mm", - "ar-DZ": "DD-MM-YYYY HH:mm", - "zh-MO": "D/M/YYYY HH:mm", - "de-LI": "DD.MM.YYYY HH:mm", - "en-NZ": "d/MM/YYYY HH:mm", - "es-CR": "DD/MM/YYYY HH:mm", - "fr-LU": "DD/MM/YYYY HH:mm", - "ar-MA": "DD-MM-YYYY HH:mm", - "en-IE": "DD/MM/YYYY HH:mm", - "es-PA": "MM/DD/YYYY HH:mm", - "fr-MC": "DD/MM/YYYY HH:mm", - "ar-TN": "DD-MM-YYYY HH:mm", - "en-ZA": "YYYY/MM/DD HH:mm", - "es-DO": "DD/MM/YYYY HH:mm", - "ar-OM": "DD/MM/YYYY HH:mm", - "en-JM": "DD/MM/YYYY HH:mm", - "es-VE": "DD/MM/YYYY HH:mm", - "ar-YE": "DD/MM/YYYY HH:mm", - "en-029": "MM/DD/YYYY HH:mm", - "es-CO": "DD/MM/YYYY HH:mm", - "ar-SY": "DD/MM/YYYY HH:mm", - "en-BZ": "DD/MM/YYYY HH:mm", - "es-PE": "DD/MM/YYYY HH:mm", - "ar-JO": "DD/MM/YYYY HH:mm", - "en-TT": "DD/MM/YYYY HH:mm", - "es-AR": "DD/MM/YYYY HH:mm", - "ar-LB": "DD/MM/YYYY HH:mm", - "en-ZW": "M/d/YYYY HH:mm", - "es-EC": "DD/MM/YYYY HH:mm", - "ar-KW": "DD/MM/YYYY HH:mm", - "en-PH": "M/d/YYYY HH:mm", - "es-CL": "DD-MM-YYYY HH:mm", - "ar-AE": "DD/MM/YYYY HH:mm", - "es-UY": "DD/MM/YYYY HH:mm", - "ar-BH": "DD/MM/YYYY HH:mm", - "es-PY": "DD/MM/YYYY HH:mm", - "ar-QA": "DD/MM/YYYY HH:mm", - "es-BO": "DD/MM/YYYY HH:mm", - "es-SV": "DD/MM/YYYY HH:mm", - "es-HN": "DD/MM/YYYY HH:mm", - "es-NI": "DD/MM/YYYY HH:mm", - "es-PR": "DD/MM/YYYY HH:mm", - "am-ET": "d/M/YYYY HH:mm", - "tzm-Latn-DZ": "DD-MM-YYYY HH:mm", - "iu-Latn-CA": "d/MM/YYYY HH:mm", - "sma-NO": "DD.MM.YYYY HH:mm", - "mn-Mong-CN": "YYYY/M/d HH:mm", - "gd-GB": "DD/MM/YYYY HH:mm", - "en-MY": "d/M/YYYY HH:mm", - "prs-AF": "DD/MM/YY HH:mm", - "bn-BD": "DD-MM-YY HH:mm", - "wo-SN": "DD/MM/YYYY HH:mm", - "rw-RW": "M/d/YYYY HH:mm", - "qut-GT": "DD/MM/YYYY HH:mm", - "sah-RU": "MM.DD.YYYY HH:mm", - "gsw-FR": "DD/MM/YYYY HH:mm", - "co-FR": "DD/MM/YYYY HH:mm", - "oc-FR": "DD/MM/YYYY HH:mm", - "mi-NZ": "DD/MM/YYYY HH:mm", - "ga-IE": "DD/MM/YYYY HH:mm", - "se-SE": "YYYY-MM-DD HH:mm", - "br-FR": "DD/MM/YYYY HH:mm", - "smn-FI": "DD.M.YYYY HH:mm", - "moh-CA": "M/d/YYYY HH:mm", - "arn-CL": "DD-MM-YYYY HH:mm", - "ii-CN": "YYYY/M/d HH:mm", - "dsb-DE": "DD. M. YYYY HH:mm", - "ig-NG": "d/M/YYYY HH:mm", - "kl-GL": "DD-MM-YYYY HH:mm", - "lb-LU": "DD/MM/YYYY HH:mm", - "ba-RU": "DD.MM.YY HH:mm", - "nso-ZA": "YYYY/MM/DD HH:mm", - "quz-BO": "DD/MM/YYYY HH:mm", - "yo-NG": "d/M/YYYY HH:mm", - "ha-Latn-NG": "d/M/YYYY HH:mm", - "fil-PH": "M/d/YYYY HH:mm", - "ps-AF": "DD/MM/YY HH:mm", - "fy-NL": "d-M-YYYY HH:mm", - "ne-NP": "M/d/YYYY HH:mm", - "se-NO": "DD.MM.YYYY HH:mm", - "iu-Cans-CA": "d/M/YYYY HH:mm", - "sr-Latn-RS": "DD.M.YYYY HH:mm", - "si-LK": "YYYY-MM-DD HH:mm", - "sr-Cyrl-RS": "DD.M.YYYY HH:mm", - "lo-LA": "DD/MM/YYYY HH:mm", - "km-KH": "YYYY-MM-DD HH:mm", - "cy-GB": "DD/MM/YYYY HH:mm", - "bo-CN": "YYYY/M/d HH:mm", - "sms-FI": "DD.M.YYYY HH:mm", - "as-IN": "DD-MM-YYYY HH:mm", - "ml-IN": "DD-MM-YY HH:mm", - "en-IN": "DD-MM-YYYY HH:mm", - "or-IN": "DD-MM-YY HH:mm", - "bn-IN": "DD-MM-YY HH:mm", - "tk-TM": "DD.MM.YY HH:mm", - "bs-Latn-BA": "DD.M.YYYY HH:mm", - "mt-MT": "DD/MM/YYYY HH:mm", - "sr-Cyrl-ME": "DD.M.YYYY HH:mm", - "se-FI": "DD.M.YYYY HH:mm", - "zu-ZA": "YYYY/MM/DD HH:mm", - "xh-ZA": "YYYY/MM/DD HH:mm", - "tn-ZA": "YYYY/MM/DD HH:mm", - "hsb-DE": "DD. M. YYYY HH:mm", - "bs-Cyrl-BA": "DD.M.YYYY HH:mm", - "tg-Cyrl-TJ": "DD.MM.YY HH:mm", - "sr-Latn-BA": "DD.M.YYYY HH:mm", - "smj-NO": "DD.MM.YYYY HH:mm", - "rm-CH": "DD/MM/YYYY HH:mm", - "smj-SE": "YYYY-MM-DD HH:mm", - "quz-EC": "DD/MM/YYYY HH:mm", - "quz-PE": "DD/MM/YYYY HH:mm", - "hr-BA": "DD.M.YYYY. HH:mm", - "sr-Latn-ME": "DD.M.YYYY HH:mm", - "sma-SE": "YYYY-MM-DD HH:mm", - "en-SG": "d/M/YYYY HH:mm", - "ug-CN": "YYYY-M-d HH:mm", - "sr-Cyrl-BA": "DD.M.YYYY HH:mm", - "es-US": "M/DD/YYYY HH:mm" - }; - - return formats[navigator.language] || 'DD/MM/YYYY HH:mm'; - } - } -}); + }, + }); diff --git a/resources/js/components/newstudy.vue b/resources/js/components/newstudy.vue index 085088f..ebc414a 100755 --- a/resources/js/components/newstudy.vue +++ b/resources/js/components/newstudy.vue @@ -179,7 +179,7 @@ @@ -505,7 +505,7 @@ + @click.prevent="savestudy()" :value="trans('Create new study')"> {{ $errors->first('password') }} @endif +
+ + +

{!!__('By registering you confirmed that you read the Privacy Policy')!!}

+ +

{{__('Privacy Policy')}}

+
+ @endif @@ -71,7 +83,7 @@ + @click="toggleModal({{$study->id}})">