50 lines
1.8 KiB
PHP
50 lines
1.8 KiB
PHP
<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>
|