Merge pull request #8126 from aignatov-bio/ai-sci-11423-small-fixes-for-forms

Small form fixes [SCI-11423][SCI-11433]
This commit is contained in:
aignatov-bio 2025-01-09 15:01:35 +01:00 committed by GitHub
commit e3a5a48bdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 62 additions and 30 deletions

View file

@ -91,6 +91,12 @@
@apply border-sn-science-blue; @apply border-sn-science-blue;
} }
.sci-input-container-v2 textarea:disabled {
background-color: var(--sn-super-light-grey);
color: var(--sn-grey);
border: 1px solid var(--sn-light-grey);
}
.sci-input-container-v2 .history-flyout li:hover { .sci-input-container-v2 .history-flyout li:hover {
@apply bg-sn-super-light-grey; @apply bg-sn-super-light-grey;
} }

View file

@ -17,9 +17,15 @@
<button class="btn btn-secondary mb-0.5" <button class="btn btn-secondary mb-0.5"
:disabled="disabled" :disabled="disabled"
v-if="field.attributes.allow_not_applicable" v-if="field.attributes.allow_not_applicable"
:class="{'!bg-sn-super-light-blue !border-sn-blue': markAsNa}" :class="{'!bg-sn-super-light-blue !border-sn-blue': markAsNa && !disabled }"
@click="markAsNa = !markAsNa"> @click="markAsNa = !markAsNa">
<div class="w-4 h-4 !border-sn-blue border rounded-sm flex items-center justify-center" :class="{'bg-sn-blue': markAsNa}"> <div class="w-4 h-4 border rounded-sm flex items-center justify-center"
:class="{
'bg-sn-blue': markAsNa && !disabled,
'bg-sn-grey-500': markAsNa && disabled,
'!border-sn-blue': !disabled,
'border-sn-grey-500': disabled
}">
<i class="sn-icon sn-icon-check text-white" style="font-size: 16px !important;"></i> <i class="sn-icon sn-icon-check text-white" style="font-size: 16px !important;"></i>
</div> </div>
{{ i18n.t('forms.fields.mark_as_na') }} {{ i18n.t('forms.fields.mark_as_na') }}

View file

@ -1,25 +1,30 @@
<template> <template>
<div> <div class='relative'>
<div v-if="range" class="flex items-center gap-4"> <template v-if="range">
<DateTimePicker <div class="flex items-center gap-4">
@change="updateFromDate" <DateTimePicker
:mode="mode" @change="updateFromDate"
:defaultValue="fromValue" :mode="mode"
:clearable="true" :defaultValue="fromValue"
:disabled="fieldDisabled" :clearable="true"
:placeholder="i18n.t('forms.fields.from')" :disabled="fieldDisabled"
:class="{'error': !validValue}" :placeholder="fieldDisabled ? '' : i18n.t('forms.fields.from')"
/> :class="{'error': !validValue}"
<DateTimePicker />
@change="updateToDate" <DateTimePicker
:defaultValue="toValue" @change="updateToDate"
:mode="mode" :defaultValue="toValue"
:disabled="fieldDisabled" :mode="mode"
:clearable="true" :disabled="fieldDisabled"
:placeholder="i18n.t('forms.fields.to')" :clearable="true"
:class="{'error': !validValue}" :placeholder="fieldDisabled ? '' : i18n.t('forms.fields.to')"
/> :class="{'error': !validValue}"
</div> />
</div>
<span v-if="!validValue" class="text-xs text-sn-delete-red block absolute -bottom-3.5">
{{ i18n.t('forms.fields.not_valid_range') }}
</span>
</template>
<DateTimePicker <DateTimePicker
v-else v-else
@change="updateDate" @change="updateDate"
@ -27,7 +32,7 @@
:mode="mode" :mode="mode"
:disabled="fieldDisabled" :disabled="fieldDisabled"
:clearable="true" :clearable="true"
:placeholder="i18n.t(`forms.fields.add_${mode}`)" :placeholder="fieldDisabled ? '' : i18n.t(`forms.fields.add_${mode}`)"
/> />
</div> </div>
</template> </template>

View file

@ -8,6 +8,7 @@
:multiple="true" :multiple="true"
:withCheckboxes="true" :withCheckboxes="true"
:clearable="true" :clearable="true"
:placeholder="fieldDisabled ? ' ' : null"
/> />
</div> </div>
</template> </template>

View file

@ -1,6 +1,7 @@
<template> <template>
<div class="sci-input-container-v2 mb-2" :class="{'error': !isValidValue}" :data-error="errorMessage"> <div class="sci-input-container-v2 mb-2" :class="{'error': !isValidValue}" :data-error="errorMessage">
<input type="number" v-model="value" class="sci-input" :disabled="fieldDisabled" @change="saveValue" :placeholder="i18n.t('forms.fields.add_number')"></input> <input type="number" v-model="value" class="sci-input" :disabled="fieldDisabled" @change="saveValue"
:placeholder="fieldDisabled ? '' : i18n.t('forms.fields.add_number')"></input>
</div> </div>
</template> </template>
@ -23,7 +24,7 @@ export default {
return true; return true;
} }
if (validations.response_validation.type === 'between' && validations.response_validation.enabled) { if (validations.response_validation.type === 'between' && validations.response_validation.enabled && this.value) {
return this.value >= validations.response_validation.min return this.value >= validations.response_validation.min
&& this.value <= validations.response_validation.max; && this.value <= validations.response_validation.max;
} }

View file

@ -6,6 +6,7 @@
:value="value" :value="value"
@change="saveValue" @change="saveValue"
:clearable="true" :clearable="true"
:placeholder="fieldDisabled ? ' ' : null"
/> />
</div> </div>
</template> </template>

View file

@ -1,6 +1,11 @@
<template> <template>
<div class="sci-input-container-v2 h-24"> <div class="sci-input-container-v2 h-24">
<textarea class="sci-input" :value="value" :disabled="fieldDisabled" @change="saveValue" :placeholder="i18n.t('forms.fields.add_text')"></textarea> <textarea
class="sci-input"
:value="value"
:disabled="fieldDisabled"
@change="saveValue"
:placeholder="fieldDisabled ? '' : i18n.t('forms.fields.add_text')"></textarea>
</div> </div>
</template> </template>

View file

@ -5,7 +5,12 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
<h4 class="modal-title" id="modal-move-result-element"> <h4 class="modal-title" id="modal-move-result-element">
{{ i18n.t(`protocols.steps.modals.form_modal.title`) }} <template v-if="anyForms">
{{ i18n.t(`protocols.steps.modals.form_modal.title`) }}
</template>
<template v-else>
{{ i18n.t(`protocols.steps.modals.form_modal.no_forms_title`) }}
</template>
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View file

@ -43,8 +43,8 @@
:data-e2e="`e2e-TX-${dataE2e}`" :data-e2e="`e2e-TX-${dataE2e}`"
@click="enableEdit($event)" @click="enableEdit($event)"
> >
<span :class="{'truncate': singleLine }" :title="sa_value || placeholder" v-if="smartAnnotation" v-html="sa_value || placeholder" ></span> <span :class="{'truncate': singleLine }" class="py-1" :title="sa_value || placeholder" v-if="smartAnnotation" v-html="sa_value || placeholder" ></span>
<span :class="{'truncate': singleLine}" :title="newValue || placeholder" v-else>{{newValue || placeholder}}</span> <span :class="{'truncate': singleLine}" class="py-1" :title="newValue || placeholder" v-else>{{newValue || placeholder}}</span>
</div> </div>
<div <div

View file

@ -1088,6 +1088,7 @@ en:
to: "To" to: "To"
add_date: "Add date" add_date: "Add date"
add_datetime: "Add date & time" add_datetime: "Add date & time"
not_valid_range: "Range is not valid"
index: index:
head_title: "Forms" head_title: "Forms"
toolbar: toolbar:
@ -3887,6 +3888,7 @@ en:
confirm: 'Delete forever' confirm: 'Delete forever'
form_modal: form_modal:
title: "Insert form" title: "Insert form"
no_forms_title: "No available forms found"
description: "Select a form you want to add to your protocol" description: "Select a form you want to add to your protocol"
label: "Form" label: "Form"
placeholder: "Select a form" placeholder: "Select a form"