Add journal and undo UI for stock bookings, chore executions and battery charge cycles (closes #63, closes #97)

This commit is contained in:
Bernd Bestel
2018-10-27 17:26:00 +02:00
parent fe83e2fa6f
commit 364f6b2051
28 changed files with 541 additions and 92 deletions

View File

@@ -0,0 +1,66 @@
@extends('layout.default')
@section('title', $L('Batteries journal'))
@section('activeNav', 'batteriesjournal')
@section('viewJsName', 'batteriesjournal')
@section('content')
<div class="row">
<div class="col">
<h1>@yield('title')</h1>
</div>
</div>
<div class="row my-3">
<div class="col-xs-12 col-md-6 col-xl-3">
<label for="battery-filter">{{ $L('Filter by battery') }}</label> <i class="fas fa-filter"></i>
<select class="form-control" id="battery-filter">
<option value="all">{{ $L('All') }}</option>
@foreach($batteries as $battery)
<option value="{{ $battery->id }}">{{ $battery->name }}</option>
@endforeach
</select>
</div>
<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="batteries-journal-table" class="table table-sm table-striped dt-responsive">
<thead>
<tr>
<th>#</th>
<th>{{ $L('Battery') }}</th>
<th>{{ $L('Tracked time') }}</th>
</tr>
</thead>
<tbody>
@foreach($chargeCycles as $chargeCycleEntry)
<tr class="@if($chargeCycleEntry->undone == 1) text-muted @endif">
<td class="fit-content">
<a class="btn btn-secondary btn-sm undo-battery-execution-button @if($chargeCycleEntry->undone == 1) disabled @endif" href="#" data-charge-cycle-id="{{ $chargeCycleEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $L('Undo charge cycle') }}">
<i class="fas fa-undo"></i>
</a>
</td>
<td>
<span class="@if($chargeCycleEntry->undone == 1) text-strike-through @endif">{{ FindObjectInArrayByPropertyValue($batteries, 'id', $chargeCycleEntry->battery_id)->name }}</span>
@if($chargeCycleEntry->undone == 1)
<br>
{{ $L('Undone on') . ' ' . $chargeCycleEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $chargeCycleEntry->undone_timestamp }}"></time>
@endif
</td>
<td>
{{ $chargeCycleEntry->tracked_time }}
<time class="timeago timeago-contextual" datetime="{{ $chargeCycleEntry->tracked_time }}"></time>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@@ -11,7 +11,11 @@
@section('content')
<div class="row">
<div class="col">
<h1>@yield('title')</h1>
<h1>@yield('title')
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/batteriesjournal') }}">
<i class="fas fa-file-alt"></i> {{ $L('Journal') }}
</a>
</h1>
<p id="info-due-batteries" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="btn btn-lg btn-warning status-filter-button responsive-button mr-2"></p>
<p id="info-overdue-batteries" data-status-filter="overdue" class="btn btn-lg btn-danger status-filter-button responsive-button"></p>
</div>
@@ -53,6 +57,9 @@
data-battery-name="{{ FindObjectInArrayByPropertyValue($batteries, 'id', $curentBatteryEntry->battery_id)->name }}">
<i class="fas fa-fire"></i>
</a>
<a class="btn btn-info btn-sm" href="{{ $U('/batteriesjournal?battery=') }}{{ $curentBatteryEntry->battery_id }}">
<i class="fas fa-file-alt"></i>
</a>
</td>
<td>
{{ FindObjectInArrayByPropertyValue($batteries, 'id', $curentBatteryEntry->battery_id)->name }}

View File

@@ -1,8 +1,8 @@
@extends('layout.default')
@section('title', $L('Chores analysis'))
@section('activeNav', 'choresanalysis')
@section('viewJsName', 'choresanalysis')
@section('title', $L('Chores journal'))
@section('activeNav', 'choresjournal')
@section('viewJsName', 'choresjournal')
@section('content')
<div class="row">
@@ -11,7 +11,7 @@
</div>
</div>
<div class="row mt-3">
<div class="row my-3">
<div class="col-xs-12 col-md-6 col-xl-3">
<label for="chore-filter">{{ $L('Filter by chore') }}</label> <i class="fas fa-filter"></i>
<select class="form-control" id="chore-filter">
@@ -29,9 +29,10 @@
<div class="row">
<div class="col">
<table id="chores-analysis-table" class="table table-sm table-striped dt-responsive">
<table id="chores-journal-table" class="table table-sm table-striped dt-responsive">
<thead>
<tr>
<th>#</th>
<th>{{ $L('Chore') }}</th>
<th>{{ $L('Tracked time') }}</th>
<th>{{ $L('Done by') }}</th>
@@ -39,13 +40,23 @@
</thead>
<tbody>
@foreach($choresLog as $choreLogEntry)
<tr>
<tr class="@if($choreLogEntry->undone == 1) text-muted @endif">
<td class="fit-content">
<a class="btn btn-secondary btn-sm undo-chore-execution-button @if($choreLogEntry->undone == 1) disabled @endif" href="#" data-execution-id="{{ $choreLogEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $L('Undo chore execution') }}">
<i class="fas fa-undo"></i>
</a>
</td>
<td>
{{ FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->name }}
<span class="@if($choreLogEntry->undone == 1) text-strike-through @endif">{{ FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->name }}</span>
@if($choreLogEntry->undone == 1)
<br>
{{ $L('Undone on') . ' ' . $choreLogEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $choreLogEntry->undone_timestamp }}"></time>
@endif
</td>
<td>
{{ $choreLogEntry->tracked_time }}
<time class="timeago timeago-contextual" datetime="{{ $choreLogEntry->tracked_time }}"></time>
<time class="timeago timeago-contextual" datetime="{{ $choreLogEntry->tracked_time }}"></time>
</td>
<td>
@if ($choreLogEntry->done_by_user_id !== null && !empty($choreLogEntry->done_by_user_id))

View File

@@ -11,7 +11,11 @@
@section('content')
<div class="row">
<div class="col">
<h1>@yield('title')</h1>
<h1>@yield('title')
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/choresjournal') }}">
<i class="fas fa-file-alt"></i> {{ $L('Journal') }}
</a>
</h1>
<p id="info-due-chores" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="btn btn-lg btn-warning status-filter-button responsive-button mr-2"></p>
<p id="info-overdue-chores" data-status-filter="overdue" class="btn btn-lg btn-danger status-filter-button responsive-button"></p>
</div>
@@ -53,8 +57,8 @@
data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}">
<i class="fas fa-play"></i>
</a>
<a class="btn btn-info btn-sm" href="{{ $U('/choresanalysis?chore=') }}{{ $curentChoreEntry->chore_id }}">
<i class="fas fa-chart-line"></i>
<a class="btn btn-info btn-sm" href="{{ $U('/choresjournal?chore=') }}{{ $curentChoreEntry->chore_id }}">
<i class="fas fa-file-alt"></i>
</a>
</td>
<td>

View File

@@ -0,0 +1,74 @@
@extends('layout.default')
@section('title', $L('Stock journal'))
@section('activeNav', 'stockjournal')
@section('viewJsName', 'stockjournal')
@section('content')
<div class="row">
<div class="col">
<h1>@yield('title')</h1>
</div>
</div>
<div class="row my-3">
<div class="col-xs-12 col-md-6 col-xl-3">
<label for="product-filter">{{ $L('Filter by product') }}</label> <i class="fas fa-filter"></i>
<select class="form-control" id="product-filter">
<option value="all">{{ $L('All') }}</option>
@foreach($products as $product)
<option value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach
</select>
</div>
<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="stock-journal-table" class="table table-sm table-striped dt-responsive">
<thead>
<tr>
<th>#</th>
<th>{{ $L('Product') }}</th>
<th>{{ $L('Amount') }}</th>
<th>{{ $L('Booking time') }}</th>
<th>{{ $L('Booking type') }}</th>
</tr>
</thead>
<tbody>
@foreach($stockLog as $stockLogEntry)
<tr class="@if($stockLogEntry->undone == 1) text-muted @endif">
<td class="fit-content">
<a class="btn btn-secondary btn-sm undo-stock-booking-button @if($stockLogEntry->undone == 1) disabled @endif" href="#" data-booking-id="{{ $stockLogEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $L('Undo booking') }}">
<i class="fas fa-undo"></i>
</a>
</td>
<td>
<span class="@if($stockLogEntry->undone == 1) text-strike-through @endif">{{ FindObjectInArrayByPropertyValue($products, 'id', $stockLogEntry->product_id)->name }}</span>
@if($stockLogEntry->undone == 1)
<br>
{{ $L('Undone on') . ' ' . $stockLogEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $stockLogEntry->undone_timestamp }}"></time>
@endif
</td>
<td>
{{ $stockLogEntry->amount }} {{ Pluralize($stockLogEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockLogEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockLogEntry->product_id)->qu_id_stock)->name_plural) }}
</td>
<td>
{{ $stockLogEntry->row_created_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $stockLogEntry->row_created_timestamp }}"></time>
</td>
<td>
{{ $L($stockLogEntry->transaction_type) }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@@ -19,7 +19,12 @@
@section('content')
<div class="row">
<div class="col">
<h1>@yield('title') <small id="info-current-stock" class="text-muted"></small></h1>
<h1>@yield('title')
<small id="info-current-stock" class="text-muted"></small>
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockjournal') }}">
<i class="fas fa-file-alt"></i> {{ $L('Journal') }}
</a>
</h1>
<p id="info-expiring-products" data-next-x-days="{{ $nextXDays }}" data-status-filter="expiring" class="btn btn-lg btn-warning status-filter-button responsive-button mr-2"></p>
<p id="info-expired-products" data-status-filter="expired" class="btn btn-lg btn-danger status-filter-button responsive-button mr-2"></p>
<p id="info-missing-products" data-status-filter="belowminstockamount" class="btn btn-lg btn-info status-filter-button responsive-button"></p>
@@ -92,6 +97,9 @@
data-consume-amount="{{ $currentStockEntry->amount }}">
<i class="fas fa-utensils"></i> {{ $L('All') }}
</a>
<a class="btn btn-info btn-sm" href="{{ $U('/stockjournal?product=') }}{{ $currentStockEntry->product_id }}">
<i class="fas fa-file-alt"></i>
</a>
</td>
<td class="product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}">
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} <i class="fas fa-info text-muted"></i>