mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Start working on tasks feature
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
<script src="{{ $U('/viewjs/components/datetimepicker.js', true) }}?v={{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
|
||||
|
||||
<div class="form-group">
|
||||
<label for="{{ $id }}">{{ $L($label) }} <span class="small text-muted"><time id="datetimepicker-timeago" class="timeago timeago-contextual"></time>@if(!empty($hint))<br>{{ $L($hint) }}@endif</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group date datetimepicker @if(!empty($additionalCssClasses)){{ $additionalCssClasses }}@endif" id="{{ $id }}" data-target-input="nearest">
|
||||
<input type="text" required class="form-control datetimepicker-input"
|
||||
<input type="text" @if($isRequired) required @endif class="form-control datetimepicker-input"
|
||||
data-target="#{{ $id }}" data-format="{{ $format }}"
|
||||
data-init-with-now="{{ BoolToString($initWithNow) }}"
|
||||
data-limit-end-to-now="{{ BoolToString($limitEndToNow) }}"
|
||||
|
@@ -84,6 +84,12 @@
|
||||
<span class="nav-link-text">{{ $L('Recipes') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" data-toggle="tooltip" data-placement="right" title="{{ $L('Tasks') }}" data-nav-for-page="tasks">
|
||||
<a class="nav-link discrete-link" href="{{ $U('/tasks') }}">
|
||||
<i class="fas fa-tasks"></i>
|
||||
<span class="nav-link-text">{{ $L('Tasks') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item mt-4" data-toggle="tooltip" data-placement="right" title="{{ $L('Purchase') }}" data-nav-for-page="purchase">
|
||||
<a class="nav-link discrete-link" href="{{ $U('/purchase') }}">
|
||||
|
63
views/taskform.blade.php
Normal file
63
views/taskform.blade.php
Normal file
@@ -0,0 +1,63 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@if($mode == 'edit')
|
||||
@section('title', $L('Edit task'))
|
||||
@else
|
||||
@section('title', $L('Create task'))
|
||||
@endif
|
||||
|
||||
@section('viewJsName', 'taskform')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<h1>@yield('title')</h1>
|
||||
|
||||
<script>Grocy.EditMode = '{{ $mode }}';</script>
|
||||
|
||||
@if($mode == 'edit')
|
||||
<script>Grocy.EditObjectId = {{ $task->id }};</script>
|
||||
@endif
|
||||
|
||||
<form id="task-form" novalidate>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">{{ $L('Name') }}</label>
|
||||
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $task->name }}@endif">
|
||||
<div class="invalid-feedback">{{ $L('A name is required') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">{{ $L('Description') }}</label>
|
||||
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $task->description }}@endif</textarea>
|
||||
</div>
|
||||
|
||||
@include('components.datetimepicker', array(
|
||||
'id' => 'due',
|
||||
'label' => 'Due',
|
||||
'format' => 'YYYY-MM-DD',
|
||||
'initWithNow' => false,
|
||||
'limitEndToNow' => false,
|
||||
'limitStartToNow' => false,
|
||||
'invalidFeedback' => $L('A due dat is required'),
|
||||
'nextInputSelector' => '',
|
||||
'additionalCssClasses' => 'date-only-datetimepicker',
|
||||
'isRequired' => false
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category_id">{{ $L('Category') }}</label>
|
||||
<select class="form-control" id="category_id" name="category_id">
|
||||
<option></option>
|
||||
@foreach($taskCategories as $taskCategory)
|
||||
<option @if($mode == 'edit' && $taskCategory->id == $task->category_id) selected="selected" @endif value="{{ $taskCategory->id }}">{{ $taskCategory->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button id="save-task-button" type="submit" class="btn btn-success">{{ $L('Save') }}</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
66
views/tasks.blade.php
Normal file
66
views/tasks.blade.php
Normal file
@@ -0,0 +1,66 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title', $L('Tasks'))
|
||||
@section('activeNav', 'tasks')
|
||||
@section('viewJsName', 'tasks')
|
||||
|
||||
@push('pageScripts')
|
||||
<script src="{{ $U('/node_modules/jquery-ui-dist/jquery-ui.min.js?v=', true) }}{{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1>@yield('title')</h1>
|
||||
<p id="info-due-tasks" data-next-x-days="{{ $nextXDays }}" class="btn btn-lg btn-warning no-real-button responsive-button mr-2"></p>
|
||||
<p id="info-overdue-tasks" class="btn btn-lg btn-danger no-real-button responsive-button"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||
<input type="text" class="form-control" id="search">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table id="tasks-table" class="table table-sm table-striped dt-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{{ $L('Aufgabe') }}</th>
|
||||
<th>{{ $L('Due') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($tasks as $task)
|
||||
<tr id="task-{{ $task->id }}-row" class="@if($task->due < date('Y-m-d H:i:s')) table-danger @elseif($task->due < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) table-warning @endif">
|
||||
<td class="fit-content">
|
||||
<a class="btn btn-success btn-sm do-task-button" href="#" data-toggle="tooltip" title="{{ $L('Mark task "#1" as completed', $task->name) }}"
|
||||
data-task-id="{{ $task->id }}">
|
||||
<i class="fas fa-check"></i>
|
||||
</a>
|
||||
<a class="btn btn-success btn-sm start-task-button" href="#" data-toggle="tooltip" title="{{ $L('Start task "#1"', $task->name) }}"
|
||||
data-task-id="{{ $task->id }}">
|
||||
<i class="fas fa-play"></i>
|
||||
</a>
|
||||
<a class="btn btn-info btn-sm" href="{{ $U('/task/') }}{{ $task->id }}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $task->name }}
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ $task->due }}</span>
|
||||
<time class="timeago timeago-contextual" datetime="{{ $task->due }}"></time>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
Reference in New Issue
Block a user