mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Merge branch 'master' into ticket-app-master
# Conflicts: # src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php # src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php # src/Bundle/ChillPersonBundle/Resources/public/types.ts # src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
<div class="grey-card">
|
||||
<ul :class="listClasses" v-if="picked.length && displayPicked">
|
||||
<li v-for="p in picked" @click="removeEntity(p)" :key="p.type + p.id">
|
||||
<span
|
||||
v-if="'me' === p"
|
||||
class="chill_denomination current-user updatedBy"
|
||||
>{{ trans(USER_CURRENT_USER) }}</span
|
||||
>
|
||||
<span
|
||||
v-else
|
||||
:class="getBadgeClass(p)"
|
||||
class="chill_denomination"
|
||||
:style="getBadgeStyle(p)"
|
||||
@@ -12,7 +18,18 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
<li class="add-persons">
|
||||
<li v-if="isCurrentUserPicker" class="btn btn-sm btn-misc">
|
||||
<label class="flex items-center gap-2">
|
||||
<input
|
||||
:checked="picked.indexOf('me') >= 0 ? true : null"
|
||||
ref="itsMeCheckbox"
|
||||
:type="multiple ? 'checkbox' : 'radio'"
|
||||
@change="selectItsMe"
|
||||
/>
|
||||
{{ trans(USER_CURRENT_USER) }}
|
||||
</label>
|
||||
</li>
|
||||
<li class="add-persons">
|
||||
<add-persons
|
||||
:options="addPersonsOptions"
|
||||
:key="uniqid"
|
||||
@@ -44,6 +61,7 @@ import {
|
||||
PICK_ENTITY_USER_GROUP,
|
||||
PICK_ENTITY_PERSON,
|
||||
PICK_ENTITY_THIRDPARTY,
|
||||
USER_CURRENT_USER,
|
||||
trans,
|
||||
} from "translator";
|
||||
import { addNewEntities } from "ChillMainAssets/types";
|
||||
@@ -62,6 +80,7 @@ const props = defineProps<{
|
||||
displayPicked?: boolean;
|
||||
suggested?: Entities[];
|
||||
label?: string;
|
||||
isCurrentUserPicker: boolean // must default to false
|
||||
}>();
|
||||
|
||||
const emits = defineEmits<{
|
||||
@@ -70,6 +89,7 @@ const emits = defineEmits<{
|
||||
(e: "addNewEntityProcessEnded"): void;
|
||||
}>();
|
||||
|
||||
const itsMeCheckbox = ref(null);
|
||||
const addPersons = ref();
|
||||
|
||||
const addPersonsOptions = computed(
|
||||
@@ -118,10 +138,13 @@ const translatedListOfTypes = computed(() => {
|
||||
|
||||
const listClasses = computed(() => ({
|
||||
"badge-suggest": true,
|
||||
"remove-items": props.removableIfSet !== false,
|
||||
"remove-items": props.removableIfSet,
|
||||
inline: true,
|
||||
}));
|
||||
|
||||
const selectItsMe = (event) =>
|
||||
event.target.checked ? addNewSuggested("me") : removeEntity("me");
|
||||
|
||||
function addNewSuggested(entity: Entities) {
|
||||
emits("addNewEntity", { entity });
|
||||
}
|
||||
@@ -135,30 +158,32 @@ function addNewEntity({ selected }: addNewEntities) {
|
||||
emits("addNewEntityProcessEnded");
|
||||
}
|
||||
|
||||
function removeEntity(entity: Entities) {
|
||||
if (props.removableIfSet === false) {
|
||||
return;
|
||||
}
|
||||
emits("removeEntity", { entity });
|
||||
}
|
||||
|
||||
const removeEntity = (entity) => {
|
||||
if (!props.removableIfSet) return;
|
||||
if (entity === "me" && itsMeCheckbox.value) {
|
||||
itsMeCheckbox.value.checked = false;
|
||||
}
|
||||
emits("removeEntity", { entity });
|
||||
};
|
||||
|
||||
function getBadgeClass(entities: Entities) {
|
||||
if (entities.type !== "user_group") {
|
||||
return entities.type;
|
||||
}
|
||||
return "";
|
||||
if (entities.type !== "user_group") {
|
||||
return entities.type;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getBadgeStyle(entities: Entities) {
|
||||
if (entities.type === "user_group") {
|
||||
return [
|
||||
`ul.badge-suggest li > span {
|
||||
if (entities.type === "user_group") {
|
||||
return [
|
||||
`ul.badge-suggest li > span {
|
||||
color: ${entities.foregroundColor}!important;
|
||||
border-bottom-color: ${entities.backgroundColor};
|
||||
}`,
|
||||
];
|
||||
}
|
||||
return [];
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -265,4 +290,8 @@ ul.badge-suggest li > span.person {
|
||||
ul.badge-suggest li > span.thirdparty {
|
||||
border-bottom-color: rgb(198.9, 72, 98.1);
|
||||
}
|
||||
.current-user {
|
||||
color: var(--bs-body-color);
|
||||
background-color: var(--bs-chill-l-gray) !important;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user