Implemented some person target functionality.
This commit is contained in:
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\PersonTarget;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PersonTargetsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$personTargets['receivables'] = PersonTarget::receivable();
|
||||||
|
$personTargets['debts'] = PersonTarget::debt();
|
||||||
|
|
||||||
|
foreach ($personTargets as $personTargetsList) {
|
||||||
|
$personTargetsList->load('person:id,name_or_company,surname',
|
||||||
|
'ioType:id,factor',
|
||||||
|
'actuals:id,person_target_id,account_type_id,amount',
|
||||||
|
'actuals.accountType:id,account_class_id',
|
||||||
|
'actuals.accountType.accountClass:id,io_type_id',
|
||||||
|
'actuals.accountType.accountClass.ioType:id,factor');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('personTargets.index', compact('personTargets'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\PersonTarget $personTarget
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(PersonTarget $personTarget)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\PersonTarget $personTarget
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(PersonTarget $personTarget)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\PersonTarget $personTarget
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, PersonTarget $personTarget)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the dialog for deleting the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\PersonTarget $personTarget
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function delete(PersonTarget $personTarget)
|
||||||
|
{
|
||||||
|
return view('personTargets.delete', compact('personTarget'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\PersonTarget $personTarget
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(PersonTarget $personTarget)
|
||||||
|
{
|
||||||
|
$personTarget->delete();
|
||||||
|
|
||||||
|
return redirect('/targets');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
<li><a href='/bookings/year-{{ date('Y') }}'>Kassenbuch</a></li>
|
<li><a href='/bookings/year-{{ date('Y') }}'>Kassenbuch</a></li>
|
||||||
<li><a href='/people'>Personen</a></li>
|
<li><a href='/people'>Personen</a></li>
|
||||||
<li><a href='/projects/'>Projekte</a></li>
|
<li><a href='/projects/'>Projekte</a></li>
|
||||||
|
<li><a href='/targets/'>F / V</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
@extends('layout.master')
|
||||||
|
|
||||||
|
@section('title', 'Zahlungsverflichtung löschen')
|
||||||
|
|
||||||
|
@section('subnav')
|
||||||
|
<a href='{{ url()->previous() }}'>Zurück</a>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h2>@yield('title')</h2>
|
||||||
|
<form action='/targets/{{ $personTarget->id }}' method='post'>
|
||||||
|
{{ method_field('delete') }}
|
||||||
|
{{ csrf_field() }}
|
||||||
|
<p>Soll folgende Zahlungsverpflichtung wirklich gelöscht werden?</p>
|
||||||
|
|
||||||
|
<table border='1'>
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Position</th>
|
||||||
|
<th>Person / Firma</th>
|
||||||
|
<th>Betrag</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ formatDate($personTarget->date) }}</td>
|
||||||
|
<td>{{ $personTarget->reference }}</td>
|
||||||
|
<td>{{ $personTarget->person->fullName() }}</td>
|
||||||
|
<td>{{ $personTarget->signedAmount() }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<button type="submit" id="submit">Ja</button>
|
||||||
|
</form>
|
||||||
|
@endsection
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
@extends('layout.master')
|
||||||
|
|
||||||
|
@section('title', 'Forderungen und Verbindlichkeiten')
|
||||||
|
|
||||||
|
@section('subnav')
|
||||||
|
<a href='/targets/create'>Neue Forderung / Verbindlichkeit</a>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h2>@yield('title')</h2>
|
||||||
|
<h3>Offene Verbindlichkeiten</h3>
|
||||||
|
<table border='1'>
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Position</th>
|
||||||
|
<th>Person / Firma</th>
|
||||||
|
<th>Soll</th>
|
||||||
|
<th>Ist</th>
|
||||||
|
<th>Differenz</th>
|
||||||
|
<th>Aktion</th>
|
||||||
|
</tr>
|
||||||
|
@foreach ($personTargets['debts'] as $personTarget)
|
||||||
|
<tr>
|
||||||
|
<td>{{ formatDate($personTarget->date) }}</td>
|
||||||
|
<td>{{ $personTarget->reference }}</td>
|
||||||
|
<td>{{ $personTarget->person->fullName() }}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->signedAmount()) !!}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->actualsSum()) !!}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->difference()) !!}</td>
|
||||||
|
<td>
|
||||||
|
<a href='/targets/{{ $personTarget->id }}'>Anzeigen</a><br />
|
||||||
|
<a href='/targets/{{ $personTarget->id }}/edit'>Bearbeiten</a><br />
|
||||||
|
<a href='/targets/{{ $personTarget->id }}/delete'>Löschen</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
<h3>Offene Forderungen</h3>
|
||||||
|
<table border='1'>
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Position</th>
|
||||||
|
<th>Person / Firma</th>
|
||||||
|
<th>Betrag</th>
|
||||||
|
<th>Aktion</th>
|
||||||
|
</tr>
|
||||||
|
@foreach ($personTargets['receivables'] as $personTarget)
|
||||||
|
<tr>
|
||||||
|
<td>{{ formatDate($personTarget->date) }}</td>
|
||||||
|
<td>{{ $personTarget->reference }}</td>
|
||||||
|
<td>{{ $personTarget->person->fullName() }}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->signedAmount()) !!}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->actualsSum()) !!}</td>
|
||||||
|
<td>{!! formatAmount($personTarget->difference()) !!}</td>
|
||||||
|
<td>
|
||||||
|
<a href='/targets/{{ $personTarget->id }}'>Anzeigen</a><br />
|
||||||
|
<a href='/targets/{{ $personTarget->id }}/edit'>Bearbeiten</a><br />
|
||||||
|
<a href='/targets/{{ $personTarget->id }}/delete'>Löschen</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@endsection
|
||||||
@@ -50,3 +50,16 @@ Route::delete('/projects/{project}', 'ProjectsController@destroy');
|
|||||||
|
|
||||||
Route::get('/projects/{project}/edit', 'ProjectsController@edit');
|
Route::get('/projects/{project}/edit', 'ProjectsController@edit');
|
||||||
Route::get('/projects/{project}/delete', 'ProjectsController@delete');
|
Route::get('/projects/{project}/delete', 'ProjectsController@delete');
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* PERSON TARGETS *
|
||||||
|
******************************************************************************/
|
||||||
|
Route::get('/targets', 'PersonTargetsController@index');
|
||||||
|
Route::post('/targets', 'PersonTargetsController@store');
|
||||||
|
|
||||||
|
Route::get('/targets/create', 'PersonTargetsController@create');
|
||||||
|
Route::patch('/targets/{personTarget}', 'PersonTargetsController@update');
|
||||||
|
Route::delete('/targets/{personTarget}', 'PersonTargetsController@destroy');
|
||||||
|
|
||||||
|
Route::get('/targets/{personTarget}/edit', 'PersonTargetsController@edit');
|
||||||
|
Route::get('/targets/{personTarget}/delete', 'PersonTargetsController@delete');
|
||||||
|
|||||||
Reference in New Issue
Block a user