implemented additional todo functionality
This commit is contained in:
@@ -3,16 +3,8 @@
|
||||
function todo_actions()
|
||||
{
|
||||
$actions = '
|
||||
<div class="todo_actions">
|
||||
<form method="post">
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
<button name="action" value="new">New</button>
|
||||
</form>
|
||||
<div id="todo_actions">
|
||||
<button value="new" class="button">New</button>
|
||||
</div>
|
||||
';
|
||||
|
||||
|
||||
@@ -51,14 +51,12 @@ function todo_display($todos)
|
||||
<div class="todo_category_window">
|
||||
';
|
||||
|
||||
foreach ($categories as $c)
|
||||
$c = array_reverse($c);
|
||||
|
||||
foreach (array_keys($categories) as $key)
|
||||
$display .= todo_category($key, $categories[$key]);
|
||||
|
||||
$display .= '
|
||||
</div>
|
||||
' . todo_modal(null, 'new_todo_item') . '
|
||||
</div>
|
||||
';
|
||||
|
||||
|
||||
@@ -2,27 +2,24 @@
|
||||
|
||||
function todo_item($todo)
|
||||
{
|
||||
$item = '
|
||||
$item = '
|
||||
<div class="todo_item bottom_margin top_padding bottom_padding sm_border">
|
||||
<div class="row left_margin">
|
||||
<div class="column center">
|
||||
<label class="form_checkbox_container no_margin">
|
||||
<input type="hidden" name="todo_id" value="' . $todo['todo_id'] . '">
|
||||
<input type="hidden" name="todo_id" value="' . (isset($todo['todo_id']) ? $todo['todo_id'] : '') . '">
|
||||
|
||||
<input type="checkbox"' . ($todo['status'] == 'completed' ? ' checked' : '') . '>
|
||||
<input type="checkbox"' . (!empty($todo) ? ($todo['status'] == 'completed' ? ' checked' : '') : '') . '>
|
||||
<span class="checkmark no_margin"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="column center">
|
||||
<small>' . $todo['task'] . '</small>
|
||||
<div class="column center modal_activation_area">
|
||||
<small>' . $todo['title'] . '</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="todo_item_details" style="display: none;">
|
||||
|
||||
' . todo_modal($todo, null) . '
|
||||
</div>
|
||||
';
|
||||
|
||||
return $item;
|
||||
return $item;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,76 @@
|
||||
<?php
|
||||
function modal() {}
|
||||
function todo_modal($todo = [], $id = null)
|
||||
{
|
||||
if (!isset($todo)) {
|
||||
$todo['created_at'] = '';
|
||||
$todo['updated_at'] = '';
|
||||
$todo['completed_at'] = '';
|
||||
$todo['todo_id'] = '';
|
||||
$todo['title'] = '';
|
||||
$todo['description'] = '';
|
||||
$todo['priority'] = '';
|
||||
$todo['due_date'] = '';
|
||||
}
|
||||
|
||||
$modal = '
|
||||
<div class="modal card todo_item_details"' . (isset($id) ? ' id="' . $id . '"' : '') . '>
|
||||
<div id="modal_content">
|
||||
<div class="form_card">
|
||||
<div class="row_space_between">
|
||||
<h5 class="underline">Item View</h5>
|
||||
';
|
||||
|
||||
if (!empty($todo['title'])) {
|
||||
$modal .= '
|
||||
<div class="column over_right_margin">
|
||||
<small>Created: ' . $todo['created_at'] . '</small>
|
||||
<small>Updated: ' . $todo['updated_at'] . '</small>
|
||||
<small>Completed: ' . $todo['completed_at'] . '</small>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
$modal .= '
|
||||
</div>
|
||||
<span class="modal_close">×</span>
|
||||
<form>
|
||||
<input type="hidden" name="todo_id" value="' . (!empty($todo['todo_id']) ? $todo['todo_id'] : '-1') . '">
|
||||
|
||||
<div class="row">
|
||||
<div class="column full_width">
|
||||
<label for="title">Title:</label>
|
||||
<input id="title" name="title" value="' . $todo['title'] . '" placeholder="Task Title" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="column full_width">
|
||||
<label for="description">Description:</label>
|
||||
<textarea id="description" name="description">' . $todo['description'] . '</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_space_between">
|
||||
<div class="column">
|
||||
<label for="priority">Priority:</label>
|
||||
<select id="priority" name="priority">
|
||||
<option value="low"' . ($todo['priority'] == 'low' ? ' checked' : '') . '>Low</option>
|
||||
<option value="medium"' . ($todo['priority'] == 'medium' ? ' checked' : '') . '>Medium</option>
|
||||
<option value="high"' . ($todo['priority'] == 'high' ? ' checked' : '') . '>High</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="column">
|
||||
<label for="due_date">Due Date:</label>
|
||||
<input type="datetime-local" id="due_date" name="due_date" value="' . format_date($todo['due_date']) . '">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" class="button" value="' . (!empty($todo['todo_id']) ? 'Update Item' : 'Create Item') . '">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $modal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user