107 lines
6.2 KiB
PHP
107 lines
6.2 KiB
PHP
<div class="page-header">
|
|
<h2>
|
|
<?= t('Recurring schedule') ?>
|
|
<?php if ($has_due_date): ?>
|
|
<small>(<?= $this->url->link(date('Y-m-d H:i', $task['date_due']), 'TaskModificationController', 'edit', array('task_id' => $task['id']), false, 'js-modal-large') ?>)</small>
|
|
<?php else: ?>
|
|
<small>-- <?= $this->url->link(t('set a due date'), 'TaskModificationController', 'edit', array('task_id' => $task['id']), false, 'js-modal-large') ?></small>
|
|
<?php endif ?>
|
|
</h2>
|
|
</div>
|
|
|
|
<?php if ($is_clone): ?>
|
|
|
|
<p class="alert alert-info">
|
|
<?= t('This card is a copy generated by RecoReco, so it cannot itself be made recurring.') ?>
|
|
<?php if ($source_id): ?>
|
|
<?= $this->url->link(t('Open the recurring template'), 'TaskViewController', 'show', array('task_id' => $source_id)) ?>
|
|
<?php endif ?>
|
|
</p>
|
|
|
|
<?php else: ?>
|
|
|
|
<?php $can_recur = $has_due_date && ! $is_native && $has_target ?>
|
|
|
|
<?php if (! $has_due_date): ?>
|
|
<p class="alert alert-info"><?= t('Please set a due date first. RecoReco uses the card due date as the recurrence anchor.') ?></p>
|
|
<?php elseif ($is_native): ?>
|
|
<p class="alert alert-info">
|
|
<?= t('This card uses Kanboard built-in recurrence.') ?>
|
|
<?= $this->url->link(t('Edit built-in recurrence'), 'TaskRecurrenceController', 'edit', array('task_id' => $task['id']), false, 'js-modal-medium') ?>
|
|
</p>
|
|
<?php elseif (! $has_target): ?>
|
|
<p class="alert alert-info"><?= t('Add a target column first.') ?></p>
|
|
<?php endif ?>
|
|
|
|
<form method="post" action="<?= $this->url->href('RecurrenceController', 'save', array('plugin' => 'RecoReco', 'task_id' => $task['id'])) ?>" autocomplete="off" data-recoreco-current="<?= (int) $task['column_id'] ?>">
|
|
<?= $this->form->csrf() ?>
|
|
|
|
<?= $this->form->label(t('Make recurring'), 'recoreco_enabled') ?>
|
|
<div class="recoreco-radios">
|
|
<label style="display:inline-block; margin-right:16px;">
|
|
<input type="radio" name="recoreco_enabled" value="0" <?= $values['recoreco_enabled'] == 1 ? '' : 'checked="checked"' ?>> <?= t('No') ?>
|
|
</label>
|
|
<label style="display:inline-block; margin-right:16px;">
|
|
<input type="radio" name="recoreco_enabled" value="1" <?= $values['recoreco_enabled'] == 1 ? 'checked="checked"' : '' ?> <?= $can_recur ? '' : 'disabled="disabled"' ?>> <?= t('Yes') ?>
|
|
</label>
|
|
</div>
|
|
|
|
<?= $this->form->label(t('Target column'), 'recoreco_target_column') ?>
|
|
<?= $this->form->select('recoreco_target_column', $columns_list, $values) ?>
|
|
|
|
<?= $this->form->label(t('Trigger column'), 'recoreco_trigger_column') ?>
|
|
<div class="recoreco-trigger" style="display:flex; align-items:center; gap:8px;">
|
|
<?= $this->form->select('recoreco_trigger_column', array('any' => t('Any')) + $all_columns, $values) ?>
|
|
<label style="white-space:nowrap;">
|
|
<input type="checkbox" name="recoreco_trigger_invert" value="1" <?= $values['recoreco_trigger_invert'] == 1 ? 'checked="checked"' : '' ?>> <?= t('any but selected') ?>
|
|
</label>
|
|
</div>
|
|
<p class="form-help"><?= t('Recurrence fires only while the card sits in a triggering column; the target column never triggers.') ?></p>
|
|
|
|
<?= $this->form->checkbox('recoreco_move', t('Move the card instead of creating a copy'), 1, $values['recoreco_move'] == 1) ?>
|
|
<p class="form-help"><?= t('Relocate this one card to the target column each period instead of spawning a copy.') ?></p>
|
|
|
|
<?= $this->form->label(t('Frequency'), 'recoreco_frequency') ?>
|
|
<?= $this->form->select('recoreco_frequency', $frequency_list, $values) ?>
|
|
|
|
<div class="recoreco-lastday">
|
|
<?= $this->form->checkbox('recoreco_last_day', t('Fires on last day/weekday of the month'), 1, $values['recoreco_last_day'] == 1) ?>
|
|
</div>
|
|
|
|
<?= $this->form->label(t('Create the copy this many days before the due date'), 'recoreco_days_before') ?>
|
|
<input type="number" name="recoreco_days_before" min="0" value="<?= $this->text->e($values['recoreco_days_before']) ?>">
|
|
|
|
<?= $this->form->checkbox('recoreco_link_copies', t('Link copies to the template'), 1, $values['recoreco_link_copies'] == 1) ?>
|
|
<p class="form-help"><?= t('Links each copy back to the template (a count and quick navigation). Off by default.') ?></p>
|
|
|
|
<?php $following = $fb_enabled && $values['recoreco_follow_finance'] == 1 ?>
|
|
<?php $limit_display = (int) $values['recoreco_limit'] > 0 ? (int) $values['recoreco_limit'] : '' ?>
|
|
<div class="recoreco-limit-group"
|
|
data-fb-current="<?= $this->text->e($fb_current) ?>"
|
|
data-fb-total="<?= $this->text->e($fb_total) ?>"
|
|
data-rr-count="<?= (int) $values['recoreco_count'] ?>"
|
|
data-rr-limit="<?= $this->text->e($limit_display) ?>">
|
|
|
|
<?php if ($fb_enabled): ?>
|
|
<?= $this->form->checkbox('recoreco_follow_finance', t('Follow FinanceBuddy installments'), 1, $following) ?>
|
|
<p class="form-help"><?= t('Stop recurring when the installment plan ends, following the card total and current installment.') ?></p>
|
|
<?php endif ?>
|
|
|
|
<?= $this->form->label(t('Recurrence'), 'recoreco_count') ?>
|
|
<div class="recoreco-limit-inline" style="display:flex; align-items:center; gap:6px;">
|
|
<input type="number" name="recoreco_count" min="1" style="width:5em;"
|
|
value="<?= $this->text->e($following ? $fb_current : $values['recoreco_count']) ?>"
|
|
<?= $following ? 'disabled="disabled"' : '' ?>>
|
|
<span><?= t('of') ?></span>
|
|
<input type="number" name="recoreco_limit" min="1" style="width:5em;"
|
|
value="<?= $this->text->e($following ? $fb_total : $limit_display) ?>"
|
|
<?= $following ? 'disabled="disabled"' : '' ?>>
|
|
</div>
|
|
<p class="form-help"><?= t('Current recurrence and how many to run. Leave the second box empty to recur forever.') ?></p>
|
|
</div>
|
|
|
|
<?= $this->modal->submitButtons() ?>
|
|
</form>
|
|
|
|
<?php endif ?>
|