Stock-Journal: API, Summary, Done By (#989)

* Stockjournal: Add "Done by"

* Add API for Stock-Journal

* Add "Journal-Summary"

* Use ALTER TABLE

* Moved the "Jounral summary" button to the stock journal page

* Changed icon & context menu position for new stock journal summary page

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
fipwmaqzufheoxq92ebc
2020-09-06 13:18:51 +02:00
committed by GitHub
parent 7498d8f13d
commit 0454c128f0
10 changed files with 183 additions and 23 deletions

View File

@@ -5,12 +5,15 @@
@section('viewJsName', 'stockjournal')
@section('content')
<div class="row">
<div class="col">
<h2 class="title">@yield('title')</h2>
<div class="title-related-links">
<h2 class="title">@yield('title')</h2>
<div class="related-links">
<a class="btn btn-outline-dark responsive-button"
href="{{ $U('/stockjournal/summary') }}">
{{ $__t('Journal summary') }}
</a>
</div>
</div>
<hr>
<div class="row my-3">
<div class="col-xs-12 col-md-6 col-xl-3">
@@ -52,6 +55,7 @@
<th>{{ $__t('Booking time') }}</th>
<th>{{ $__t('Booking type') }}</th>
<th class="@if(!GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) d-none @endif">{{ $__t('Location') }}</th>
<th>{{ $__t('Done by') }}</th>
</tr>
</thead>
<tbody class="d-none">
@@ -70,7 +74,7 @@
</a>
</td>
<td>
<span class="name-anchor @if($stockLogEntry->undone == 1) text-strike-through @endif">{{ FindObjectInArrayByPropertyValue($products, 'id', $stockLogEntry->product_id)->name }}</span>
<span class="name-anchor @if($stockLogEntry->undone == 1) text-strike-through @endif">{{ $stockLogEntry->product_name }}</span>
@if($stockLogEntry->undone == 1)
<br>
{{ $__t('Undone on') . ' ' . $stockLogEntry->undone_timestamp }}
@@ -79,7 +83,7 @@
@endif
</td>
<td>
<span class="locale-number locale-number-quantity-amount">{{ $stockLogEntry->amount }}</span> {{ $__n($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) }}
<span class="locale-number locale-number-quantity-amount">{{ $stockLogEntry->amount }}</span> {{ $__n($stockLogEntry->amount, $stockLogEntry->qu_name, $stockLogEntry->qu_name_plural) }}
</td>
<td>
{{ $stockLogEntry->row_created_timestamp }}
@@ -93,7 +97,10 @@
@endif
</td>
<td class="@if(!GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) d-none @endif">
{{ FindObjectInArrayByPropertyValue($locations, 'id', $stockLogEntry->location_id)->name }}
{{ $stockLogEntry->location_name }}
</td>
<td>
{{ $stockLogEntry->user_display_name }}
</td>
</tr>
@endforeach

View File

@@ -0,0 +1,47 @@
@extends('layout.default')
@section('title', $__t('Stock journal summary'))
@section('activeNav', '')
@section('viewJsName', 'stockjournalsummary')
@section('content')
<div class="row">
<div class="col">
<h2 class="title">@yield('title')</h2>
</div>
</div>
<hr>
<div class="row">
<div class="col">
<table id="journal-summary-table"
class="table table-sm table-striped dt-responsive">
<thead>
<tr>
<th>{{ $__t('Product') }}</th>
<th>{{ $__t('Booking type') }}</th>
<th>{{ $__t('User') }}</th>
<th>{{ $__t('Amount') }}</th>
</tr>
</thead>
<tbody class="d-none">
@foreach($entries as $journalEntry)
<tr>
<td>
{{ $journalEntry->product_name }}
</td>
<td>
{{ $__t($journalEntry->transaction_type) }}
</td>
<td>
{{ $journalEntry->user_display_name }}
</td>
<td>
<span class="locale-number locale-number-quantity-amount">{{ $journalEntry->amount }}</span> {{ $__n($journalEntry->amount, $journalEntry->qu_name, $journalEntry->qu_name_plural) }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@@ -142,7 +142,9 @@
<tbody class="d-none">
@foreach($currentStock as $currentStockEntry)
<tr id="product-{{ $currentStockEntry->product_id }}-row"
class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days"))
class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("
+$nextXDays
days"))
&&
$currentStockEntry->amount > 0) table-warning @elseif ($currentStockEntry->product_missing) table-info @endif">
<td class="fit-content border-right">
@@ -246,6 +248,11 @@
href="{{ $U('/stockjournal?product=') }}{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Stock journal for this product') }}</span>
</a>
<a class="dropdown-item"
type="button"
href="{{ $U('/stockjournal/summary?product_id=') }}{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-icon"><i class="fas fa-file-archive"></i></span> <span class="dropdown-item-text">{{ $__t('Journal summary for this product') }}</span>
</a>
<a class="dropdown-item permission-MASTER_DATA_EDIT"
type="button"
href="{{ $U('/product/') }}{{ $currentStockEntry->product_id . '?returnto=%2Fstockoverview' }}">
@@ -322,7 +329,8 @@
&&
$currentStockEntry->amount > 0) expired @elseif($currentStockEntry->best_before_date < date('Y-m-d
23:59:59',
strtotime("+$nextXDays days"))
strtotime("+$nextXDays
days"))
&&
$currentStockEntry->amount > 0) expiring @endif @if($currentStockEntry->product_missing) belowminstockamount @endif
</td>