Files
deckflow/templates/personal.php
Patrick Niebeling 05f50ea068 First commit
2025-03-12 10:33:41 +01:00

50 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<form id="deckflow-settings">
<h2>Deck Flow Regeln</h2>
<label for="board">Board auswählen:</label>
<select id="board" onchange="updateStacks()">
<option value="">-- Wähle ein Board --</option>
<?php foreach ($_['boards'] as $board): ?>
<option value="<?php p($board['id']); ?>"><?php p($board['title']); ?></option>
<?php endforeach; ?>
</select>
<label for="source_stack">Quell-Stapel:</label>
<select id="source_stack"></select>
<label for="target_stack">Ziel-Stapel:</label>
<select id="target_stack"></select>
<button type="button" onclick="addRule()"> Hinzufügen</button>
</form>
<script>
let stacks = <?php echo json_encode($_['stacks']); ?>;
function updateStacks() {
let boardId = document.getElementById('board').value;
let sourceSelect = document.getElementById('source_stack');
let targetSelect = document.getElementById('target_stack');
sourceSelect.innerHTML = '';
targetSelect.innerHTML = '';
if (stacks[boardId]) {
stacks[boardId].forEach(stack => {
sourceSelect.add(new Option(stack.title, stack.id));
targetSelect.add(new Option(stack.title, stack.id));
});
}
}
function addRule() {
let boardId = document.getElementById('board').value;
let sourceStack = document.getElementById('source_stack').value;
let targetStack = document.getElementById('target_stack').value;
fetch('/apps/deckflow/settings/addRule', {
method: 'POST',
body: JSON.stringify({ board_id: boardId, source_stack: sourceStack, target_stack: targetStack }),
headers: { 'Content-Type': 'application/json' }
}).then(() => location.reload());
}
</script>