Commit 138bb6bd authored by ZeMKI's avatar ZeMKI

Network sorting changes

* bugfixed network sortings.
* centralized bounds and center calculation for network sorting.
parent d93eea24
This diff is collapsed.
This diff is collapsed.
......@@ -474,6 +474,10 @@ window.app = new Vue(
}
},
togglePersonModal()
{
this.$store.dispatch('togglePersonModal')
},
toggleModal(id = '')
{
const body = document.querySelector(
......@@ -795,6 +799,7 @@ window.app = new Vue(
,
confirmgohome: function()
{
let self = this;
this.$buefy.dialog.confirm(
{
title: 'Cancel interview',
......@@ -804,6 +809,29 @@ window.app = new Vue(
hasIcon: true,
onConfirm: () =>
{
for (
let i = 1;
i <= self.sortingtotal;
i++
)
{
if (self.sortingType ==
2)
{
clearInterval(
self.$refs['thenewinterview'].$refs['sortingContainer' +
i][0].interval)
localStorage.setItem(
'tokens' +
i,
null
);
localStorage.removeItem(
'tokens' +
i);
}
}
window.location.href = '../';
},
});
......
......@@ -6,9 +6,9 @@
ref="sorting-preview"
:circles="sorting.numberofcircles"
:sortingdetails="sorting.description"
:sections="sorting.sectionNumber"
:sectionsNumber="sorting.sectionNumber"
:sortingid="selectedSorting"
:names="sorting.sections"
:sections="sorting.sections"
:centerLabel="sorting.centerLabel"
></sorting-preview>
</div>
......@@ -233,7 +233,7 @@
<div class="w-full">
<label class="label inline">{{trans('Name of the sections')}}</label>
<label class="label inline">{{trans('Name of the sections')}} *</label>
<div class="md:flex md:items-center mb-6">
<div class="md:w-1/3"></div>
<label class="md:w-2/3 block font-bold">
......@@ -245,12 +245,13 @@
</div>
<span v-for="section,index in sorting.sections" class="block relative">
<input :key="index" v-model="sorting.sections[index].name" type="text"
class="w-2/3 bg-gray-200 focus:outline-none focus:shadow-outline border border-gray-300 py-2 px-4 block appearance-none leading-normal inline" maxlength="20">
:class="response.indexOf(errormessages.centerLabel) > -1 ? 'bg-gray-200 focus:outline-none focus:shadow-outline border border-gray-300 py-2 px-4 block w-2/3 appearance-none leading-normal inline border-red-500': 'bg-gray-200 border-gray-300 focus:outline-none focus:shadow-outline border py-2 px-4 block w-2/3 appearance-none leading-normal inline'"
maxlength="20">
<div class="inline-block relative w-1/4">
<v-select :options="colors"
:disabled="sorting.casualcolors"
:value="sorting.sections[index].color"
class=" py-2"
class=" bg-gray-200 border-gray-300 text-xs"
@input="color => updateSectionColor(index,color)"
>
<template slot="option" slot-scope="option">
......@@ -270,6 +271,7 @@
</div>
</div>
<span v-show="selectedSorting !== 2">
<label class="label is-small mt-5">
{{trans('Add attributes to tokens? Choose from a set:')}}
</label>
......@@ -284,7 +286,7 @@
<img v-for="image in classifiers[0]"
v-show="(sorting.classifier ? sorting.classifier.name == image.name : false)"
:src="image.dirname" class="w-5 h-5 inline">
</span>
</div>
<div :class="{'hidden': openTab !== 3, 'block': openTab === 3}">
......@@ -595,7 +597,7 @@
author: '',
editable: false,
fetching: false,
selectedSorting: 2,
selectedSorting: 1,
sorting: {
id: 1,
minvalue: 0,
......@@ -671,6 +673,8 @@
question: this.trans('Please check all the questions.') + '<br>',
multipleanswer: this.trans('One of your Multiple Choice is empty.') + '<br>',
centerLabel: this.trans('Select a label for the center of the sorting.') + '<br>',
sections: this.trans('Please fill all the sections names.') + '<br>',
colors: this.trans('Please select all the section\'s label colors or select casual colors.') + '<br>',
},
};
},
......@@ -820,7 +824,7 @@
},
'presort.questions': function(newVal, oldVal)
{
console.log(newVal);
}
,
'postsort.number': function(newVal, oldVal)
......@@ -882,7 +886,6 @@
if (!this.fetching)
{
console.log('token number watcher fired');
if (newVal < 0 || oldVal < 0)
{
newVal = 0;
......@@ -983,8 +986,23 @@
this.selectedSorting = _.parseInt(this.studydata.sorting[0].id);
if (this.studydata.sorting[0].id === 2)
{
this.sorting.sections = [];
this.sorting.sectionNumber = _.parseInt(this.studydata.sortings[0].pivot.details.substr(this.studydata.sortings[0].pivot.details.indexOf('divisions|') + 10, 1));
this.sorting.sections = _.pickBy(this.studydata.sortings[0].pivot.details.substr(this.studydata.sortings[0].pivot.details.indexOf('names|') + 6).split('||')[0].split('|'));
let self = this;
let namesAndColor = this.studydata.sortings[0].pivot.details.substr(this.studydata.sortings[0].pivot.details.indexOf('names|') + 6).split('||')[0].split('|');
_.forEach(namesAndColor, function(value, key)
{
let color = value.substr(value.indexOf(';color:') + 7, value.length) === 'casual' ? '' : value.substr(value.indexOf(';color:') + 7, value.length) ;
self.sorting.sections.push({name:value.substr(0, value.indexOf(';color:')), color: color})
});
if (this.sorting.sections[0].color === '')
{
this.sorting.casualcolors = true;
}
//this.sorting.sections = _.pickBy(this.studydata.sortings[0].pivot.details.substr(this.studydata.sortings[0].pivot.details.indexOf('names|') + 6).split('||')[0].split('|'));
this.sorting.centerLabel = substrInBetween(this.studydata.sortings[0].pivot.details, 'center|', '||');
}
......@@ -1064,7 +1082,6 @@
self.presort.questions[i].ismultiple = true;
_.times(self.studydata.q.presort[i].answers.length, function(x)
{
console.log(x);
if (self.studydata.q.presort[i].answers[x].answer.type == 'multi')
{
self.presort.questions[i].answers[x] = self.studydata.q.presort[i].answers[x].answer.answer;
......@@ -1240,6 +1257,12 @@
let study = {};
this.loading = true;
if(this.sorting.id === 2)
{
this.sorting.tokens = []
}
_.merge(
study,
{id: this.studydata.id},
......@@ -1300,7 +1323,7 @@
this.response += this.errormessages.short_description;
}
if (_.find(this.sorting.tokens, {name: ''}))
if (this.sorting.id !== 2 &&_.find(this.sorting.tokens, {name: ''}))
{
this.response += this.errormessages.tokens;
}
......@@ -1310,6 +1333,16 @@
this.response += this.errormessages.centerLabel;
}
if (this.sorting.id == 2 && _.find(this.sorting.sections, {name: ''}))
{
this.response += this.errormessages.sections;
}
if (this.sorting.id == 2 && this.sorting.casualcolors === false && _.find(this.sorting.sections, {color: ''}))
{
this.response += this.errormessages.colors;
}
if (_.find(this.presort.questions, function(o)
{
if (!o.isopen && !o.ismultiple && !o.isscale && !o.isonechoice)
......
......@@ -14,6 +14,10 @@ export default new Vuex.Store(
{
state: {
newinterview: {
center_x: 0,
center_y: 0,
bounds: {},
parentPos: 0,
imagepreset: [],
newtoken: {},
fetchtoken: false,
......@@ -50,6 +54,13 @@ export default new Vuex.Store(
{
state.newinterview = interview;
},
setCenterAndBounds(state,payload)
{
state.newinterview.center_x = payload.center_x
state.newinterview.center_y = payload.center_y
state.newinterview.bounds = payload.bounds
state.newinterview.parentPos = payload.parentPos
},
imagepreset(
state,
images)
......@@ -269,9 +280,26 @@ export default new Vuex.Store(
error);
state.newinterview.uploadProgress = 0;
});
},
togglePersonModal({commit,state})
{
const body = document.querySelector(
'body');
const modal = document.querySelector(
'.modal'+state.newinterview.sorting);
modal.classList.toggle(
'opacity-0');
modal.classList.toggle(
'pointer-events-none');
body.classList.toggle(
'modal-active');
window.scrollTo(0, 0);
document.body.scrollTop = 0;
}
},
getters: {
fetchtoken: state => state.newinterview.fetchtoken,
}
});
......@@ -145,7 +145,7 @@
@if(Auth::user()->hasRole(['admin','supervisor']))
<a class="select-none text-white mt-2 inline min-w-full hover:no-underline uppercase text-2xl font-extrabold"
href="#"
@click="confirmdelete({{$study->id}}, '{{$study->name}}')">
@click="confirmdelete({{$study->id}}, '{{addslashes($study->name)}}')">
<div
class="min-w-full text-center bg-red-400 hover:text-gray-100 hover:bg-red-600">
{{ __('Delete Study') }}
......@@ -153,7 +153,7 @@
</a>
<a class="select-none text-bacl mt-2 inline min-w-full hover:no-underline uppercase text-2xl font-extrabold"
href="#"
@click="confirmduplicate({{$study->id}}, '{{$study->name}}')">
@click="confirmduplicate({{$study->id}}, '{{addslashes($study->name)}}')">
<div
class="min-w-full text-center bg-yellow-400 hover:text-white hover:bg-yellow-600">
......
......@@ -5,11 +5,7 @@
href="https://mesoftware.org/index.php/mesort/" title="Mesort Manual"
rel="noopener noreferrer"> {{ __('Mesort Manual') }} </a>
<a target="_blank" class="font-semibold ml-4 hover:bg-blue-300 hover:text-white px-4"
href="{{config('utilities.emailFeedbackText')}}"
>
{{ __('Email Feedback') }}
</a>
<a class="font-semibold ml-4 hover:bg-blue-300 hover:text-white px-4"
href="{{url('/')}}"
>
......
......@@ -17,13 +17,13 @@
</a>
<a @click="interviewconfirmpreviouspage"
class="bg-red-600 text-white p-2 mx-2"
v-if="interviewpage >= 1 && presortQuestions"
v-if="interviewpage >= 1 && presortQuestions && sorting == 1"
>
< {{__('Questions')}}
</a>
<a @click="interviewconfirmpreviouspage"
<a @click="interviewconfirmpreviouspage"w
class="bg-red-600 text-white p-2 mx-2"
v-else-if="interviewpage == 2 && sorting > 1"
v-else-if="interviewpage == 1 && sorting > 1"
>
< {{ __('Previous Sorting') }}
......@@ -70,7 +70,7 @@
<a class="text-center bg-green-500 hover:text-gray-300 hover:bg-green-800 p-2 ml-2" @click="interviewaddtoken" v-if="sortingType == 1">
<strong>{{ __('Add Token') }}</strong>
</a>
<a class="text-center bg-green-500 hover:text-gray-300 hover:bg-green-800 p-2 ml-2" @click="toggleModal()" v-if="sortingType == 2">
<a class="text-center bg-green-500 hover:text-gray-300 hover:bg-green-800 p-2 ml-2" @click="togglePersonModal()" v-if="sortingType == 2">
<strong>{{ __('Add Person') }}</strong>
</a>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment