Commit d16f79eb authored by ZeMKI's avatar ZeMKI
Browse files

Better interview page

* solved a (new) bug that occurred when adding a token from interview
* better interview "view" page for qsort
* better profile - still WIP
parent 0374dab2
......@@ -24,6 +24,7 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Mail;
use Illuminate\View\View;
use App\Action;
use Carbon\Carbon;
class UserController extends Controller
{
......@@ -51,8 +52,14 @@ class UserController extends Controller
*/
public function show()
{
$data['actions'] = Action::join('users', 'users.id', 'actions.user_id')->where('users.id', '=', auth()->user()->id)->orderBy('actions.id', 'desc')->paginate('10');
ray($data);
$data['actions'] = Action::join('users', 'users.id', 'actions.user_id')->where('users.id', '=', auth()->user()->id)->orderBy('actions.id', 'desc')->paginate(10);
foreach ($data['actions'] as $action) {
$action->time = Carbon::parse($action['time'])->format('d.m.Y h:s:i');
}
$data['profile'] = auth()->user()->profile;
return view('user.profile', $data);
}
......
......@@ -45,12 +45,13 @@ class Token extends Model
*/
public static function store($tokenToSave, $study, $isInterview = false)
{
ray($tokenToSave, $study);
$imageIsPreset = ((isset($tokenToSave['ispreset']) && $tokenToSave['ispreset'])
|| (isset($tokenToSave['file']['ispreset']) && $tokenToSave['file']['ispreset']))
|| (isset($tokenToSave['image_path'])
&& strpos($tokenToSave['image_path'], 'presets') !== false);
ray($tokenToSave);
ray($imageIsPreset);
ray($isInterview);
if ($imageIsPreset) {
// save only preset path
$token = new self;
......@@ -131,7 +132,6 @@ class Token extends Model
$image = isset($tokenToSave['fileUpload']) && $tokenToSave['fileUpload'] != [] ? $tokenToSave['fileUpload']['base64'] : $tokenToSave['base64'];
}
} else {
ray("no image to upload");
$image = config('utilities.sortingBasicIcon');
}
$name = $tokenToSave['name'];
......
......@@ -30,8 +30,8 @@ Another Responsible Researcher(s)',
0 =>
array(
'name' => 'first token',
'file' => NULL,
'path' => NULL,
'file' => null,
'path' => null,
'ispreset' => false,
),
1 =>
......@@ -42,7 +42,7 @@ Another Responsible Researcher(s)',
'basename' => 'Discord.png',
'dirname' => 'https://mesort.test/images/presets_tokens/Discord.png',
),
'path' => NULL,
'path' => null,
'base64' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAKPUlEQVR4Xu1deXCV1RX/3e8RFMJaFpFNlgRkdQQEpkAVGJVWihUtrehYk9QylT+ckaDUTqft2IUKsa0zdQaEpAxqbaRYtNVWkQpVUUEWkbKDsu8YErbE953Oj5tnHiTvvdzvLblf+M5Mhpl8dznn/O4995xzzw0KAVmlAWUVNwEzCACxbBEEgASAWKYBy9gJdkgAiGUasIydYIcEgFimAcvYCXZIYwTk6VJpJhUYD4U+Im5XF8i2TM6UsuMolInrHFQONpdnY+Uvp6jKVE2Q1A6ZvUi6O1Xuz0KOmipQzVPFlM/GKVNwF0mV82ThNHU8Wd49AzKnRB6CK39USjVLlolG0r8MCvmFeWppMvJ4AmROcfhXCs5Pk5m4MfYVEVFKzSjMV7/3Kp8xINwZSjDf64SNv5+4StRdMwrUq15kNQKkqFi6uSLbAjMVX9UCOR6uUjmzpqkyU1DMACkJLxBxCkwnuRLbu+L+5rGCkLFZrzcgdG3dcjkGpRq1S5u6xSMHZ+SprkopMRmz3oAUFctEAV4zGfyKb6swvDBPrTHRQ/0BKZFHRVBkMvgV31bhgcI8tdhED/UGZM7CcJFSzqMmg1/pbUVh1sw89TsTPdQfkOLwswrOj00Gv+LbKnd2YV7oJyZ6CAAx0ZZp2wAQU42luX0ASJoVbDp8AIipxtLcPgAkzQo2HT4AxFRjaW4fAJJmBZsO31gAUQro2A7o1glo1wZo0xJYtgI4f8FMI61aAN/6BvBFOXDiC2DfIeDICUCMsktmc17S2u+AXNsB6J8D9O0BNLtai3a6Ati9H1j7KVBWbqYcgjlsINCrG9C8erxzF4Ctu4FPdwBHT5iNZ9zar4D07gaMuAEgIKQLlcCGrVpxx0/p37VpBXT8GsBVz5/sZkDIAZo00d+rvgTCYeDMOQ0if7gb+C93HMfu2xMY1AfIqu6z9xCwegOw/7Cx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uPfefMkXsY6CWTnzHzn4qOFp0okF678zVFqkDEDmQKkmtExjshiQHl4SmksWsY7uMDQx/LVOk78i3nSPDvLnafg3G/ESCYBIWM/L5WmLSswHSIPQimfvkSvW8URsxX9tWihTHeVFCmoBEVN1b0yDUg0s3MXyHUqhAFw0VEA35sycXBoZp6q9Yc1ikpkpIi8DKiuCXdLQwKSkLlG1OCZYulQKfJSQtc4ACRzqDNQ3lfhPumKmhXTNQ4AyRwgkZniusYBIJkHJOIaO64sqeXYBIA0DCAxXeMAkIYDJDLzJa5xAEjDA0IOvnKNlTyftv82zw5R/cMFXeMLCiPrimXiSeHxz3r5RzF+4zQAxDLEAkACQCzTgGXsBDskAMQyDVjGzv8B5x9focON0ScAAAAASUVORK5CYII=',
'ispreset' => true,
),
......@@ -66,8 +66,8 @@ Another Responsible Researcher(s)',
'isscale' => false,
'scalemin' => 0,
'scalemax' => 100,
'minlabel' => NULL,
'maxlabel' => NULL,
'minlabel' => null,
'maxlabel' => null,
'numberofanswer' => 3,
'answers' =>
array(
......@@ -86,8 +86,8 @@ Another Responsible Researcher(s)',
'isscale' => false,
'scalemin' => 0,
'scalemax' => 100,
'minlabel' => NULL,
'maxlabel' => NULL,
'minlabel' => null,
'maxlabel' => null,
'numberofanswer' => 3,
'answers' =>
array(
......@@ -122,5 +122,6 @@ Another Responsible Researcher(s)',
),
),
),
'maxNumberOfStudies' => 15
"countries" => array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"),
'maxNumberOfStudies' => 15,
];
......@@ -54,9 +54,10 @@
/>
<span
v-if="t.drag"
class="inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-100 text-gray-800 token-label"
class="inline-flex overflow-visible items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-100 text-gray-800 token-label"
:id="'tokenlabel' + t.id"
v-html="t.name"
style="word-break: keep-all"
></span
><br />
......@@ -167,9 +168,10 @@
<span
v-if="t.drag"
class="inline-flex items-center text-sm font-medium text-gray-800 bg-gray-100 rounded-md token-label"
class="inline-flex items-center overflow-visible text-sm font-medium text-gray-800 bg-gray-100 rounded-md token-label"
:id="'tokenlabel' + t.id"
v-html="t.name"
style="word-break: keep-all"
></span
><br />
......
......@@ -8,7 +8,7 @@
-->
<div
class="fixed inset-0 z-10 overflow-y-auto"
class="fixed inset-0 z-50 overflow-y-auto"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
......
......@@ -12,7 +12,9 @@
<!-- Add margin if you want to see some of the overlay behind the modal-->
<div class="px-6 py-4 text-left modal-content">
<!--Body-->
<p>{{ trans(extremeQuestion.q) }}</p>
<h2 class="mb-2 text-xl font-medium text-gray-900">
{{ trans(extremeQuestion.q) }}
</h2>
<textarea
required
......@@ -25,7 +27,7 @@
<!--Footer-->
<div class="flex justify-end pt-2">
<button
class="p-3 px-4 mr-2 text-blue-500 bg-transparent rounded-lg hover:bg-gray-100 hover:text-blue-400"
class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
@click.prevent="answerExtremePlace"
>
{{ trans("Save and Close") }}
......@@ -38,14 +40,14 @@
<div
v-show="toggleCards"
class="relative z-30 flex-wrap w-1/3 h-64 py-2 m-0 overflow-visible font-bold bg-green-400 sm:text-xs md:text-xs lg:text-base remove-from-screenshot"
style="left:51%;"
style="left: 51%"
>
<div
v-for="(t, index) in tokens"
:key="index"
:id="t.id"
class="z-50 inline-flex m-1"
style="width: 50px;height: 50px;z-index:100;"
style="width: 50px; height: 50px; z-index: 100"
@click="updateselecttoken(t)"
@mouseleave="hoverfalse(index)"
@mouseover="hovertrue(index)"
......@@ -60,7 +62,7 @@
<img
:src="t.image_path"
alt="token"
style="width: 50px;height: 50px;z-index:100;"
style="width: 50px; height: 50px; z-index: 100"
/>
</div>
<div
......@@ -72,7 +74,11 @@
:alt="t.properties.description"
:src="t.image_path"
class="block"
style="min-width: 150px;min-height: 150px;z-index:100;"
style="
min-width: 150px;
min-height: 150px;
z-index: 100;
"
/>
<p class="text-2xl font-bold text-white">{{ t.name }}</p>
<p class="text-sm text-gray-100">
......@@ -87,9 +93,9 @@
:class="qsortClass"
:style="
'left: 50%;transform: translateX(-50%);' +
'top:' +
top.toString() +
'%;'
'top:' +
top.toString() +
'%;'
"
>
<div
......@@ -154,7 +160,7 @@ export default {
"maxnumber",
"availabletokens",
"qsortshownumbers",
"extremeQuestion"
"extremeQuestion",
],
data() {
return {
......@@ -168,17 +174,17 @@ export default {
tokenId: -1,
temporaryAnswer: "",
answers: [],
replacingToken: -1
}
replacingToken: -1,
},
};
},
watch: {
qsortSizeIndex: function(newVal, oldVal) {
qsortSizeIndex: function (newVal, oldVal) {
this.setCellSize();
}
},
},
computed: {
anotherNumberClass: function() {
anotherNumberClass: function () {
switch (this.qsortSizeIndex) {
case 0:
return "bg-white text-black qsortlg:w-8 qsortmd:w-16 qsortsm:w-12 qsortlg:h-8 qsortmd:h-16 qsortsm:h-12 select-none inline-block align-top justify-center";
......@@ -208,7 +214,7 @@ export default {
" qsortmd:h-16 qsortsm:h-12 select-none inline-block align-top justify-center"
);
},
numberClass: function() {
numberClass: function () {
switch (this.qsortSizeIndex) {
case 0:
return "bg-white text-black qsortlg:w-8 qsortmd:w-16 qsortsm:w-12 qsortlg:h-12 qsortmd:h-8 qsortsm:h-8 select-none inline-block align-middle justify-center";
......@@ -236,14 +242,14 @@ export default {
"qsortmd:w-16 qsortsm:w-12 qsortlg:h-12 qsortmd:h-8 qsortsm:h-8 select-none inline-block align-middle justify-center"
);
},
qsortClass: function() {
qsortClass: function () {
return (
"grid grid-cols-" +
this.itemsnumber +
" gap-0 text-center absolute mx-auto w-auto grid-flow-col"
);
},
columnCss: function() {
columnCss: function () {
return (
"qsortlg:w-" +
this.sizes[this.qsortSizeIndex] +
......@@ -252,7 +258,7 @@ export default {
" grid-flow-row gap-0 "
);
},
squareCssEmpty: function() {
squareCssEmpty: function () {
return (
"bg-pink-400 opacity-0 qsortlg:w-" +
this.sizes[this.qsortSizeIndex] +
......@@ -261,36 +267,37 @@ export default {
" qsortmd:h-16 qsortsm:h-12"
);
},
squareCss: function() {
squareCss: function () {
return (
"bg-gray-900 text-white border border-solid border-white qsortlg:w-" +
"bg-gradient-to-r from-gray-900 via-blue-500 to-white text-white border border-solid border-white qsortlg:w-" +
this.sizes[this.qsortSizeIndex] +
" qsortmd:w-16 qsortsm:w-12 qsortlg:h-" +
this.sizes[this.qsortSizeIndex] +
" qsortmd:h-16 qsortsm:h-12 select-none inline-block align-middle justify-center"
);
},
basicWidth: function() {
basicWidth: function () {
return this.sizes[this.qsortSizeIndex];
},
top: function() {
top: function () {
return this.baseTop * this.distance[this.qsortDistanceIndex];
},
containerWidth: function() {
containerWidth: function () {
return this.sizes[this.qsortSizeIndex] * this.itemsnumber * 2 * 2;
},
eachContainerHeight: function() {
eachContainerHeight: function () {
return this.sizes[this.qsortSizeIndex] * this.maxnumber * 2;
},
...mapState({
toggleCards: state => state.newinterview.toggleCards,
sortingtotal: state => state.newinterview.sortingtotal,
currentsorting: state => state.newinterview.sorting,
currentpage: state => state.newinterview.page,
selectedToken: state => state.newinterview.selectedToken,
qsortSizeIndex: state => state.newinterview.qsortSizeIndex,
qsortDistanceIndex: state => state.newinterview.qsortDistanceIndex
})
toggleCards: (state) => state.newinterview.toggleCards,
sortingtotal: (state) => state.newinterview.sortingtotal,
currentsorting: (state) => state.newinterview.sorting,
currentpage: (state) => state.newinterview.page,
selectedToken: (state) => state.newinterview.selectedToken,
qsortSizeIndex: (state) => state.newinterview.qsortSizeIndex,
qsortDistanceIndex: (state) =>
state.newinterview.qsortDistanceIndex,
}),
},
mounted() {
this.createtokens();
......@@ -303,20 +310,20 @@ export default {
this.arrayOfQsort.forEach((o, i, a) =>
a[i].forEach((x, j, b) => (b[j] = ""))
);
setTimeout(function() {
setTimeout(function () {
let tokens = document.getElementsByClassName("cards");
for (let i = 0; i < tokens.length; i++) {
tokens[i].addEventListener("click", tokenListener, false);
}
let tokenListener = e => {
let tokenListener = (e) => {
let description = document.getElementById("tokendescription");
self.mousePosition.x = e.clientX;
self.mousePosition.y = e.clientY - 58;
_.forEach(
self.$refs["sortingContainer" + self.sortingtotal][0],
function(section, i) {
function (section, i) {
element.style.transform =
"translateY(" + (e.clientY - 10) + "px)";
element.style.transform +=
......@@ -329,17 +336,17 @@ export default {
}, 1500);
let self = this;
setTimeout(function() {
setTimeout(function () {
self.setCellSize();
}, 75);
},
methods: {
checkIfTokenIsMovedOnTopOfAnotherExtreme: function(existingAnswer) {
checkIfTokenIsMovedOnTopOfAnotherExtreme: function (existingAnswer) {
if (
existingAnswer &&
this.extremes.replacingToken !== existingAnswer.token_id
) {
_.remove(this.extremes.answers, a => {
_.remove(this.extremes.answers, (a) => {
return a.token_id === existingAnswer.token_id;
});
}
......@@ -348,7 +355,7 @@ export default {
// same token sorted again
let existingAnswer = _.find(this.extremes.answers, [
"token_id",
this.extremes.tokenId
this.extremes.tokenId,
]);
console.group(existingAnswer);
......@@ -358,7 +365,7 @@ export default {
this.checkIfTokenIsMovedOnTopOfAnotherExtreme(existingAnswer);
let replaceExistingToken = _.find(this.extremes.answers, [
"token_id",
this.extremes.replacingToken
this.extremes.replacingToken,
]);
replaceExistingToken.token_id = this.extremes.tokenId;
replaceExistingToken.answer = this.extremes.temporaryAnswer;
......@@ -368,7 +375,7 @@ export default {
this.extremes.answers.push({
token_id: this.extremes.tokenId,
answer: this.extremes.temporaryAnswer,
question: this.extremeQuestion
question: this.extremeQuestion,
});
} else {
console.log("same token sorted again.");
......@@ -403,7 +410,7 @@ export default {
}
}
},
setCellSize: function() {
setCellSize: function () {
let windowSize = window.innerWidth;
let widthMultiplier = this.sizes[this.qsortSizeIndex];
let top = 6;
......@@ -426,7 +433,7 @@ export default {
element.style.top = top.toString() + "%";
},
assignTokenToCell: function(key, n, skip) {
assignTokenToCell: function (key, n, skip) {
if (!_.isEmpty(this.selectedToken) && !skip) {
if (
(key === 0 || key === this.columns.length - 1) &&
......@@ -435,7 +442,7 @@ export default {
if (!_.isEmpty(this.arrayOfQsort[key][n])) {
this.extremes.replacingToken = _.find(
this.tokens,
t => t.id === this.arrayOfQsort[key][n].id
(t) => t.id === this.arrayOfQsort[key][n].id
).id;
}
this.toggleModal(this.selectedToken.id);
......@@ -443,7 +450,7 @@ export default {
let tokenToChange = _.find(
this.tokens,
t => t.id === this.selectedToken.id
(t) => t.id === this.selectedToken.id
);
let tokenAlreadySorted = !_.isEmpty(
tokenToChange.arrayofQsortPosition
......@@ -456,16 +463,16 @@ export default {
if (!_.isEmpty(this.arrayOfQsort[key][n])) {
let tokenOccupyingSpace = _.find(
this.tokens,
t => t.id === this.arrayOfQsort[key][n].id
(t) => t.id === this.arrayOfQsort[key][n].id
);
delete tokenOccupyingSpace.arrayofQsortPosition;
}
let answerObject = _.find(
this.extremes.answers,
a => a.token_id === tokenToChange.id
(a) => a.token_id === tokenToChange.id
);
if (answerObject) {
_.remove(this.extremes.answers, a => {
_.remove(this.extremes.answers, (a) => {
return a.token_id === answerObject.token_id;
});
}
......@@ -475,7 +482,7 @@ export default {
this.$store.commit("updateselectedtoken", {});
tokenToChange.position = [
key + 1,
Math.abs(n - (this.arrayOfQsort[key].length - 1))
Math.abs(n - (this.arrayOfQsort[key].length - 1)),
];
} else {
if (
......@@ -485,11 +492,11 @@ export default {
) {
let token_id = _.find(
this.tokens,
t => t.id === this.arrayOfQsort[key][n].id
(t) => t.id === this.arrayOfQsort[key][n].id
).id;
let answerObject = _.find(
this.extremes.answers,
a => a.token_id === token_id
(a) => a.token_id === token_id
);
this.extremes.replacingToken = token_id;
......@@ -498,23 +505,23 @@ export default {
}
}
},
updateselecttoken: function(token) {
updateselecttoken: function (token) {
this.$store.commit("updateselectedtoken", token);
this.$store.commit("updateToggleCards", !this.toggleCards);
this.$forceUpdate();
},
hovertrue: function(i) {
hovertrue: function (i) {
Vue.set(this.tokens[i], "hover", true);
this.descriptionShowninToken = this.tokens[i];
this.$forceUpdate();
},
hoverfalse: function(i) {
hoverfalse: function (i) {
Vue.set(this.tokens[i], "hover", false);
this.descriptionShowninToken.hover = false;
this.$forceUpdate();
},
createtokens: function() {
createtokens: function () {
this.tokens = this.availabletokens;
for (var i = 0; i < this.tokens.length; i++) {
let tokensorting =
......@@ -523,7 +530,7 @@ export default {
circle: 0,
distance: 0,
sorting: tokensorting,
classifiers: []
classifiers: [],
};
this.tokens[i].position = 0;
this.tokens[i].drag = true;
......@@ -532,8 +539,8 @@ export default {
this.tokens[i].properties
);
}
}
}
},
},
};
</script>
......
......@@ -17,20 +17,28 @@ $columnValues = $baseArray;
<div class="w-2/3 mx-auto print:w-full">
<h1 class="text-4xl font-bold">{{$study->name}}</h1>
<h2 class="text-sm font-bold">
{{$study->description}}
</h2>
<p class="text-base">
<p class="inline font-bold">{{__('Interview done by')}}:</p> {{$author}}<br>
<p class="inline font-bold">{{__('Interviewed')}}: </p>{{$interview->interviewed}} <br>
<p class="inline font-bold">{{__('From')}}: </p>{{date('d.m.Y H:i:s', strtotime($interview->start))}}
- <p class="inline font-bold">{{__('To')}}: </p>{{date('d.m.Y H:i:s', strtotime($interview->end))}}
</p>
<div class="bg-white">
<div class="px-4 py-8">
<div class="text-center">
<h2 class="text-base font-semibold tracking-wide text-indigo-600 uppercase">{{__('Project')}}</h2>
<p class="mt-1 text-4xl font-extrabold text-gray-900 sm:text-5xl sm:tracking-tight lg:text-6xl">
{{$study->name}}</p>
<p class="max-w-xl mx-auto my-4 text-xl text-gray-500">{{$study->description}}.</p>
<p class="text-base">
<p class="inline font-bold">{{__('Interview done by')}}:</p> {{$author}}<br>
<p class="inline font-bold">{{__('Interviewed')}}: </p>{{$interview->interviewed}} <br>
<p class="inline font-bold">{{__('From')}}: </p>{{date('d.m.Y H:i:s', strtotime($interview->start))}}
- <p class="inline font-bold">{{__('To')}}: </p>{{date('d.m.Y H:i:s', strtotime($interview->end))}}
</p>
<hr>
</div>
</div>
</div>
<hr>
<h1 class="text-4xl font-bold uppercase ">{{__('Sorting(s)')}}</h1>
<h1 class="mt-4 text-4xl font-bold uppercase">{{__('Sorting(s)')}}</h1>
<?php $i = 1 ?>
<div class="block w-full h-auto mt-2">
......@@ -47,9 +55,9 @@ $columnValues = $baseArray;
</b-tabs>
</div>
<h1 class="text-2xl font-bold">{{__('Created Tokens')}}</h1>
@forelse($createdtokens->unique('id') as $token)
<h2 class="text-2xl font-bold">{{__('Created Tokens')}}</h2>
<div class="flex">
<div class="self-center flex-shrink-0 mr-4">
<img src="{{$token->image_path}}" alt="token created" class="block w-10" />
......@@ -64,159 +72,283 @@ $columnValues = $baseArray;
@empty
@if($study->sortings[0]->id !== 3)
<h1 class="text-2xl font-bold">{{__('0 Created Tokens')}}</h1>
@else
<h1>TOKEN NAME - {{$study->sortings[0]->id === 3 ? __('POSITION (COLUMN,ROW) - COLUMN VALUE - ANSWER TO WHY IT WAS
SORTED ON THE EXTREMES') : __('POSITION')}}</h1>
{!! isset($extremequestion) ? __('Question set for extremes: ').$extremequestion->question.'<br>' : '' !!}
@foreach($sortingtoken as $token)
@if(is_array(json_decode($token->getOriginal()['pivot_valutation'])->position))
{{$token->name}} - {{__('Position')}}:
{{implode(",",json_decode($token->getOriginal()['pivot_valutation'])->position)}} -
{{array_key_exists(json_decode($token->getOriginal()['pivot_valutation'])->position[0] - 1,$columnValues) ??
$columnValues[json_decode($token->getOriginal()['pivot_valutation'])->position[0] - 1]}} - {{$token->answer}}<br>
<h2 class="text-2xl font-bold">{{__('0 Created Tokens')}}</h2>
@else
{{$token->name}} - {{__('No Position Specified')}}<br>
@endif
@endforeach
<div class="px-4 sm:px-6 lg:px-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h3 class="text-xl font-semibold text-gray-900">{!! isset($extremequestion) ? __('Question set for
extremes: ').$extremequestion->question.'<br>' : '' !!}</h3>
</div>
</div>
<div class="flex flex-col mt-8">
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
<table class="min-w-full divide-y divide-gray-300">
<thead class="bg-gray-50">
<tr class="divide-x divide-gray-200">