Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AlekSIS/official/AlekSIS-App-Alsijil
  • sunweaver/AlekSIS-App-Alsijil
  • 8tincsoVluke/AlekSIS-App-Alsijil
  • perfreicpo/AlekSIS-App-Alsijil
  • noifobarep/AlekSIS-App-Alsijil
  • 7ingannisdo/AlekSIS-App-Alsijil
  • unmruntartpa/AlekSIS-App-Alsijil
  • balrorebta/AlekSIS-App-Alsijil
  • comliFdifwa/AlekSIS-App-Alsijil
  • 3ranaadza/AlekSIS-App-Alsijil
10 results
Show changes
Commits on Source (6)
...@@ -334,6 +334,15 @@ export default { ...@@ -334,6 +334,15 @@ export default {
<extra-mark-buttons <extra-mark-buttons
@input="handleMultipleAction('extraMark', $event)" @input="handleMultipleAction('extraMark', $event)"
/> />
<h4>{{ $t("alsijil.personal_notes.tardiness") }}</h4>
<tardiness-field
v-bind="documentationPartProps"
:loading="loading"
:disabled="loading"
:value="0"
:participations="selected"
@input="handleMultipleAction('tardiness', $event)"
/>
</div> </div>
</v-scroll-y-reverse-transition> </v-scroll-y-reverse-transition>
</template> </template>
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import documentationPartMixin from "../documentation/documentationPartMixin"; import documentationPartMixin from "../documentation/documentationPartMixin";
import ConfirmDialog from "aleksis.core/components/generic/dialogs/ConfirmDialog.vue"; import ConfirmDialog from "aleksis.core/components/generic/dialogs/ConfirmDialog.vue";
import PositiveSmallIntegerField from "aleksis.core/components/generic/forms/PositiveSmallIntegerField.vue"; import formRulesMixin from "aleksis.core/mixins/formRulesMixin.js";
export default { export default {
name: "TardinessField", name: "TardinessField",
components: { ConfirmDialog, PositiveSmallIntegerField }, components: { ConfirmDialog },
mixins: [documentationPartMixin], mixins: [documentationPartMixin, formRulesMixin],
props: { props: {
value: { value: {
type: Number, type: Number,
default: null, default: null,
required: false, required: false,
}, },
participation: { participations: {
type: Object, type: Array,
required: true, required: true,
}, },
}, },
...@@ -27,6 +27,40 @@ export default { ...@@ -27,6 +27,40 @@ export default {
let diff = lessonEnd.diff(lessonStart, "minutes"); let diff = lessonEnd.diff(lessonStart, "minutes");
return diff.toObject().minutes; return diff.toObject().minutes;
}, },
defaultTimes() {
const lessonStart = DateTime.fromISO(this.documentation.datetimeStart);
const lessonEnd = DateTime.fromISO(this.documentation.datetimeEnd);
const now = DateTime.now();
let current = [];
if (now >= lessonStart && now <= lessonEnd) {
const diff = parseInt(
now.diff(lessonStart, "minutes").toObject().minutes,
);
current.push({
text: diff,
value: diff,
current: true,
});
}
return current.concat([
{
text: 5,
value: 5,
},
{
text: 10,
value: 10,
},
{
text: 15,
value: 15,
},
]);
},
}, },
methods: { methods: {
lessonLengthRule(time) { lessonLengthRule(time) {
...@@ -46,14 +80,23 @@ export default { ...@@ -46,14 +80,23 @@ export default {
cancel() { cancel() {
this.saveValue(this.previousValue); this.saveValue(this.previousValue);
}, },
processValueObjectOptional(value) {
if (Object.hasOwn(value, "value")) {
return value.value;
}
return value;
},
set(newValue) { set(newValue) {
if (!newValue) { newValue = this.processValueObjectOptional(newValue);
if (!newValue || parseInt(newValue) === 0) {
// this is a DELETE action, show the dialog, ... // this is a DELETE action, show the dialog, ...
this.showDeleteConfirm = true; this.showDeleteConfirm = true;
return; return;
} }
this.saveValue(newValue); this.saveValue(parseInt(newValue));
}, },
}, },
data() { data() {
...@@ -69,17 +112,40 @@ export default { ...@@ -69,17 +112,40 @@ export default {
</script> </script>
<template> <template>
<positive-small-integer-field <v-combobox
outlined outlined
class="mt-1" class="mt-1"
prepend-inner-icon="mdi-clock-alert-outline" prepend-inner-icon="mdi-clock-alert-outline"
:suffix="$t('time.minutes')" :suffix="$t('time.minutes')"
:label="$t('alsijil.personal_notes.tardiness')" :label="$t('alsijil.personal_notes.tardiness')"
:rules="[lessonLengthRule]" :rules="
$rules()
.isANumber.isAWholeNumber.isGreaterThan(0)
.build([lessonLengthRule])
.map((f) => (v) => f(this.processValueObjectOptional(v)))
"
:items="defaultTimes"
:value="value" :value="value"
@change="set($event)" @change="set($event)"
v-bind="$attrs" v-bind="$attrs"
> >
<template #item="{ item }">
<v-list-item-icon v-if="item.current">
<v-icon>mdi-shimmer</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
{{
$tc(
item.current
? "alsijil.personal_notes.minutes_late_current"
: "time.minutes_n",
item.value,
)
}}
</v-list-item-title>
</v-list-item-content>
</template>
<template #append> <template #append>
<confirm-dialog <confirm-dialog
v-model="showDeleteConfirm" v-model="showDeleteConfirm"
...@@ -93,13 +159,13 @@ export default { ...@@ -93,13 +159,13 @@ export default {
{{ {{
$t("alsijil.personal_notes.confirm_delete_tardiness", { $t("alsijil.personal_notes.confirm_delete_tardiness", {
tardiness: previousValue, tardiness: previousValue,
name: participation.person.fullName, name: participations.map((p) => p.person.firstName).join(", "),
}) })
}} }}
</template> </template>
</confirm-dialog> </confirm-dialog>
</template> </template>
</positive-small-integer-field> </v-combobox>
</template> </template>
<style scoped> <style scoped>
......
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
"tardiness": "Tardiness", "tardiness": "Tardiness",
"late": "Late", "late": "Late",
"minutes_late": "on time | one minute late | {n} minutes late", "minutes_late": "on time | one minute late | {n} minutes late",
"minutes_late_current": "on time (based on current time) | one minute late (based on current time) | {n} minutes late (based on current time)",
"lesson_length_exceeded": "The tardiness exceeds the length of the lesson", "lesson_length_exceeded": "The tardiness exceeds the length of the lesson",
"confirm_delete": "Delete note?", "confirm_delete": "Delete note?",
"confirm_delete_explanation": "The note \"{note}\" for {name} will be removed.", "confirm_delete_explanation": "The note \"{note}\" for {name} will be removed.",
...@@ -141,6 +142,7 @@ ...@@ -141,6 +142,7 @@
"back_to_overview": "Back to overview" "back_to_overview": "Back to overview"
}, },
"time": { "time": {
"minutes": "minutes" "minutes": "minutes",
"minutes_n": "no minutes | one minute | {n} minutes"
} }
} }