2019-05-23 08:58:48 +02:00
|
|
|
<script src="/js/list.js" charset="utf-8"></script>
|
2019-05-19 18:37:00 +02:00
|
|
|
<div class="container mt-5">
|
|
|
|
<h1>Liste</h1>
|
|
|
|
</div>
|
|
|
|
<div class="container">
|
|
|
|
<form action="api/list/new" method="post" class="d-flex flex-column">
|
|
|
|
<button type="button" id="remove" class="btn btn-primary align-self-end mt-4">Auswahl entfernen</button>
|
|
|
|
<?php
|
2019-05-26 18:02:06 +02:00
|
|
|
include $_SESSION["docroot"] . '/php/classes.list.php';
|
|
|
|
$units = new units;
|
|
|
|
$shopping = new shopping;
|
2019-05-19 18:37:00 +02:00
|
|
|
|
2019-05-26 18:02:06 +02:00
|
|
|
$div_item_row_classes = "d-flex flex-row justify-content-start align-items-center rounded-lg mt-1 text-light";
|
|
|
|
$div_item_checkbox_classes = "align-self-center p-1 pl-2";
|
|
|
|
$input_item_checkbox_classes = "checkbox";
|
|
|
|
$div_item_quantity_classes = "p-1 col-3";
|
|
|
|
$div_item_name_classes = "p-1 font-weight-bold";
|
|
|
|
$div_item_menu = "ml-auto mr-2";
|
2019-05-26 18:58:08 +02:00
|
|
|
$button_dropdown_classes = "dropdown-menu-button btn pt-0 pb-0";
|
2019-05-19 18:37:00 +02:00
|
|
|
|
2019-05-26 18:02:06 +02:00
|
|
|
foreach ($shopping->list as $index => $item) {
|
|
|
|
if ($index % 2 == 0) {
|
|
|
|
$color_theme = "bg-primary";
|
2019-05-26 18:19:56 +02:00
|
|
|
$button_theme = "btn-primary";
|
2019-05-26 18:02:06 +02:00
|
|
|
} else {
|
|
|
|
$color_theme = "bg-secondary";
|
2019-05-26 18:19:56 +02:00
|
|
|
$button_theme = "btn-secondary";
|
2019-05-26 18:02:06 +02:00
|
|
|
}
|
|
|
|
if ($item->Erledigt) {
|
|
|
|
$div_item_row_color_classes = "bg-success";
|
2019-05-26 18:58:08 +02:00
|
|
|
$button_dropdown_color_classes = "btn-success";
|
2019-05-26 18:02:06 +02:00
|
|
|
$checked = "checked";
|
|
|
|
} else {
|
|
|
|
$div_item_row_color_classes = $color_theme;
|
2019-05-26 18:58:08 +02:00
|
|
|
$button_dropdown_color_classes = $button_theme;
|
2019-05-26 18:02:06 +02:00
|
|
|
$checked = "";
|
2019-05-19 18:37:00 +02:00
|
|
|
}
|
2019-05-26 18:02:06 +02:00
|
|
|
|
|
|
|
print_r("<div class='list-row $div_item_row_classes $div_item_row_color_classes'>");
|
2019-05-26 18:49:12 +02:00
|
|
|
print_r("<div class='$div_item_checkbox_classes'><input type='checkbox' class='$input_item_checkbox_classes' data-buttoncolor='$button_theme' data-color='$color_theme' data-id='$item->ID' $checked></div>");
|
2019-05-26 18:13:26 +02:00
|
|
|
print_r("<div class='$div_item_quantity_classes'>$item->Anzahl $item->Einheit</div>");
|
|
|
|
print_r("<div class='$div_item_name_classes'>$item->Name</div>");
|
2019-05-26 18:22:58 +02:00
|
|
|
print_r("<div class='$div_item_menu dropdown'>");
|
2019-05-26 18:58:08 +02:00
|
|
|
print_r("<button type='button' class='$button_dropdown_classes $button_dropdown_color_classes' id='dropdown-menu-button-dataID-" . $item->ID . "' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>");
|
2019-05-26 18:38:06 +02:00
|
|
|
print_r("<i class='fas fa-angle-down'></i>");
|
2019-05-26 18:32:05 +02:00
|
|
|
print_r("</button>");
|
2019-05-26 19:01:43 +02:00
|
|
|
print_r("<div class='dropdown-menu dropdown-menu-right' aria-labelledby='dropdown-menu-button-dataID-" . $item->ID . "'>");
|
2019-05-26 18:41:54 +02:00
|
|
|
print_r("<button type='button' class='dropdown-item'><i class='fas fa-edit'></i> Bearbeiten</button>");
|
|
|
|
print_r("<button type='button' class='dropdown-item'><i class='fas fa-trash-alt'></i> Löschen</button>");
|
2019-05-26 18:13:26 +02:00
|
|
|
print_r("</div>");
|
2019-05-26 18:10:23 +02:00
|
|
|
print_r("</div>");
|
2019-05-26 18:02:06 +02:00
|
|
|
print_r("</div>");
|
|
|
|
}
|
2019-05-19 19:16:15 +02:00
|
|
|
?>
|
2019-05-19 18:37:00 +02:00
|
|
|
|
2019-05-19 19:16:15 +02:00
|
|
|
<div class="input-group mb-3 mt-3" data-id='new'>
|
|
|
|
<div class="input-group-prepend col-3 p-0">
|
|
|
|
<input type='number' name='anzahl' value='1' class='w-50'>
|
2019-05-26 19:27:47 +02:00
|
|
|
<select class="form-control w-50" name="einheit">
|
2019-05-19 19:16:15 +02:00
|
|
|
<?php
|
2019-05-26 18:02:06 +02:00
|
|
|
foreach ($units->list as $index => $unit) {
|
|
|
|
if ($unit->Standard) {
|
|
|
|
$selected = "selected";
|
|
|
|
} else {
|
|
|
|
$selected = NULL;
|
2019-05-19 19:16:15 +02:00
|
|
|
}
|
2019-05-26 18:02:06 +02:00
|
|
|
print_r("<option value='$unit->ID' $selected>$unit->Name</option>");
|
|
|
|
}
|
2019-05-19 19:16:15 +02:00
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-05-26 18:02:06 +02:00
|
|
|
<input type="text" name='name' class="form-control" id="nameField" placeholder="Item" aria-label="Item" aria-describedby="button-addon2" autocomplete='off' required>
|
2019-05-19 19:16:15 +02:00
|
|
|
<div class="input-group-append">
|
|
|
|
<button class="btn btn-outline-secondary" type="submit" id="button-addon2"><i class="fas fa-plus"></i></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-05-19 18:37:00 +02:00
|
|
|
|
|
|
|
</form>
|
2019-05-26 18:02:06 +02:00
|
|
|
</div>
|