Optimized chore schedule help text

This commit is contained in:
Bernd Bestel 2022-02-09 19:52:19 +01:00
parent 0d1f2ad09d
commit c9a2041fae
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 29 additions and 43 deletions

View File

@ -351,9 +351,6 @@ msgstr ""
msgid "This means %s will be removed from stock"
msgstr ""
msgid "This means the next execution of this chore is scheduled %s days after the last execution"
msgstr ""
msgid "Removed %1$s of %2$s from stock"
msgstr ""
@ -1259,18 +1256,24 @@ msgstr ""
msgid "Assignment type"
msgstr ""
msgid "This means the next execution of this chore is scheduled 1 day after the last execution"
msgstr ""
msgid "This means the next execution of this chore is scheduled %s day after the last execution"
msgid_plural "This means the next execution of this chore is scheduled %s days after the last execution"
msgstr[0] ""
msgstr[1] ""
msgid "This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below"
msgstr ""
msgid "This means the next execution of this chore is scheduled every week on the selected weekdays"
msgid_plural "This means the next execution of this chore is scheduled every %s weeks on the selected weekdays"
msgstr[0] ""
msgstr[1] ""
msgid "This means the next execution of this chore is scheduled on the selected day every month"
msgid_plural "This means the next execution of this chore is scheduled on the selected day every %s months"
msgstr[0] ""
msgstr[1] ""
msgid "This means the next execution of this chore is not scheduled"
msgstr ""
msgid "This means the next execution of this chore is scheduled on the below selected day of each month"
msgstr ""
msgid "This means the next execution of this chore will not be assigned to anyone"
msgstr ""
@ -1435,20 +1438,10 @@ msgstr ""
msgid "Period interval"
msgstr ""
msgid "This means the next execution of this chore should only be scheduled every %s days"
msgstr ""
msgid "This means the next execution of this chore should only be scheduled every %s weeks"
msgstr ""
msgid "This means the next execution of this chore should only be scheduled every %s months"
msgstr ""
msgid "This means the next execution of this chore is scheduled each year on the same day (based on the start date)"
msgstr ""
msgid "This means the next execution of this chore should only be scheduled every %s years"
msgstr ""
msgid "This means the next execution of this chore is scheduled every year on the same day (based on the start date)"
msgid_plural "This means the next execution of this chore is scheduled every %s years on the same day (based on the start date)"
msgstr[0] ""
msgstr[1] ""
msgid "Transfer"
msgstr ""

View File

@ -138,7 +138,7 @@ setTimeout(function()
Grocy.Components.ProductPicker.GetPicker().trigger('change');
}, 100);
$('.input-group-chore-period-type').on('change', function(e)
$('.input-group-chore-period-type').on('change keyup', function(e)
{
var periodType = $('#period_type').val();
var periodDays = $('#period_days').val();
@ -146,43 +146,38 @@ $('.input-group-chore-period-type').on('change', function(e)
$(".period-type-input").addClass("d-none");
$(".period-type-" + periodType).removeClass("d-none");
$('#chore-period-type-info').attr("data-original-title", "");
$("#period_config").val("");
if (periodType === 'manually')
{
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is not scheduled'));
$('#chore-schedule-info').text(__t('This means the next execution of this chore is not scheduled'));
}
else if (periodType === 'dynamic-regular')
{
$("label[for='period_days']").text(__t("Period days"));
$("#period_days").attr("min", "0");
$("#period_days").removeAttr("max");
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled %s days after the last execution', periodDays.toString()));
$('#chore-schedule-info').text(__n(periodDays, "This means the next execution of this chore is scheduled %s day after the last execution", "This means the next execution of this chore is scheduled %s days after the last execution"));
}
else if (periodType === 'daily')
{
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled 1 day after the last execution'));
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s days', periodInterval.toString()));
$('#chore-schedule-info').text(__n(periodInterval, "This means the next execution of this chore is scheduled %s day after the last execution", "This means the next execution of this chore is scheduled %s days after the last execution"));
}
else if (periodType === 'weekly')
{
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
$('#chore-schedule-info').text(__n(periodInterval, "This means the next execution of this chore is scheduled every week on the selected weekdays", "This means the next execution of this chore is scheduled every %s weeks on the selected weekdays"));
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function() { return this.value; }).get().join(","));
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
}
else if (periodType === 'monthly')
{
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled on the below selected day of each month'));
$('#chore-schedule-info').text(__n(periodInterval, "This means the next execution of this chore is scheduled on the selected day every month", "This means the next execution of this chore is scheduled on the selected day every %s months"));
$("label[for='period_days']").text(__t("Day of month"));
$("#period_days").attr("min", "1");
$("#period_days").attr("max", "31");
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString()));
}
else if (periodType === 'yearly')
{
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled each year on the same day (based on the start date)'));
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString()));
$('#chore-schedule-info').text(__n(periodInterval, 'This means the next execution of this chore is scheduled every year on the same day (based on the start date)', 'This means the next execution of this chore is scheduled every %s years on the same day (based on the start date)'));
}
Grocy.FrontendHelpers.ValidateForm('chore-form');

View File

@ -66,11 +66,7 @@
</div>
<div class="form-group">
<label for="period_type">{{ $__t('Period type') }}&nbsp;<i id="chore-period-type-info"
class="fas fa-question-circle text-muted"
data-toggle="tooltip"
data-trigger="hover click"
title=""></i></label>
<label for="period_type">{{ $__t('Period type') }}</label>
<select required
class="custom-control custom-select input-group-chore-period-type"
id="period_type"
@ -165,10 +161,12 @@
'value' => $value,
'min' => '1',
'additionalCssClasses' => 'input-group-chore-period-type',
'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly',
'hintId' => 'chore-period-interval-info'
'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly'
))
<p id="chore-schedule-info"
class="form-text text-info mt-n2"></p>
@php
$value = date('Y-m-d H:i:s');
if ($mode == 'edit')