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" msgid "This means %s will be removed from stock"
msgstr "" 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" msgid "Removed %1$s of %2$s from stock"
msgstr "" msgstr ""
@ -1259,18 +1256,24 @@ msgstr ""
msgid "Assignment type" msgid "Assignment type"
msgstr "" msgstr ""
msgid "This means the next execution of this chore is scheduled 1 day after the last execution" msgid "This means the next execution of this chore is scheduled %s day after the last execution"
msgstr "" 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" msgid "This means the next execution of this chore is scheduled every week on the selected weekdays"
msgstr "" 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" msgid "This means the next execution of this chore is not scheduled"
msgstr "" 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" msgid "This means the next execution of this chore will not be assigned to anyone"
msgstr "" msgstr ""
@ -1435,20 +1438,10 @@ msgstr ""
msgid "Period interval" msgid "Period interval"
msgstr "" msgstr ""
msgid "This means the next execution of this chore should only be scheduled every %s days" msgid "This means the next execution of this chore is scheduled every year on the same day (based on the start date)"
msgstr "" 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] ""
msgid "This means the next execution of this chore should only be scheduled every %s weeks" msgstr[1] ""
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 "Transfer" msgid "Transfer"
msgstr "" msgstr ""

View File

@ -138,7 +138,7 @@ setTimeout(function()
Grocy.Components.ProductPicker.GetPicker().trigger('change'); Grocy.Components.ProductPicker.GetPicker().trigger('change');
}, 100); }, 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 periodType = $('#period_type').val();
var periodDays = $('#period_days').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-input").addClass("d-none");
$(".period-type-" + periodType).removeClass("d-none"); $(".period-type-" + periodType).removeClass("d-none");
$('#chore-period-type-info').attr("data-original-title", "");
$("#period_config").val(""); $("#period_config").val("");
if (periodType === 'manually') 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') else if (periodType === 'dynamic-regular')
{ {
$("label[for='period_days']").text(__t("Period days")); $("label[for='period_days']").text(__t("Period days"));
$("#period_days").attr("min", "0"); $("#period_days").attr("min", "0");
$("#period_days").removeAttr("max"); $("#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') 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-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"));
$('#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()));
} }
else if (periodType === 'weekly') 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(",")); $("#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') 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")); $("label[for='period_days']").text(__t("Day of month"));
$("#period_days").attr("min", "1"); $("#period_days").attr("min", "1");
$("#period_days").attr("max", "31"); $("#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') 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-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)'));
$('#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()));
} }
Grocy.FrontendHelpers.ValidateForm('chore-form'); Grocy.FrontendHelpers.ValidateForm('chore-form');

View File

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