Lots of changes

This commit is contained in:
Simon Pocrnjič
2024-11-13 22:11:07 +01:00
parent 90a5858320
commit 953ff38d64
76 changed files with 2822 additions and 427 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php // routes/breadcrumbs.php
// Note: Laravel will automatically resolve `Breadcrumbs::` without
// this import. This is nice for IDE syntax and refactoring.
use App\Models\Client;
use App\Models\ClientCase;
use Diglactic\Breadcrumbs\Breadcrumbs;
// This import is also not required, and you could replace `BreadcrumbTrail $trail`
// with `$trail`. This is nice for IDE type checking and completion.
use Diglactic\Breadcrumbs\Generator as BreadcrumbTrail;
// Dashboard
Breadcrumbs::for('dashboard', function (BreadcrumbTrail $trail) {
$trail->push('Dashboard', route('dashboard'));
});
// Dashboard > Clients
Breadcrumbs::for('client', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push('Clients', route('client'));
});
// Dashboard > Clients > [Client]
Breadcrumbs::for('client.show', function (BreadcrumbTrail $trail, Client $client) {
$trail->parent('client');
$trail->push($client->person->full_name, route('client.show', $client));
});
// Dashboard > Cases
Breadcrumbs::for('clientCase', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push('Cases', route('clientCase'));
});
// Dashboard > Cases > [Case]
Breadcrumbs::for('clientCase.show', function (BreadcrumbTrail $trail, ClientCase $clientCase) {
$trail->parent('clientCase');
$trail->push($clientCase->person->full_name, route('clientCase.show', $clientCase));
});
// Dashboard > Settings
Breadcrumbs::for('settings', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push('Settings', route('settings'));
});
+23 -25
View File
@@ -1,24 +1,16 @@
<?php
use App\Charts\ExampleChart;
use App\Http\Controllers\ClientCaseContoller;
use App\Http\Controllers\ClientController;
use App\Http\Controllers\ContractController;
use App\Http\Controllers\SettingController;
use App\Models\Person\Person;
use ArielMejiaDev\LarapexCharts\LarapexChart;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
Route::get('/', function () {
return Inertia::render('Welcome', [
'canLogin' => Route::has('login'),
'canRegister' => Route::has('register'),
'laravelVersion' => Application::VERSION,
'phpVersion' => PHP_VERSION,
]);
});
//Route::get('/person', [PersonController::class, 'index'])->middleware('auth:sanctum',config('jetstream.auth_session'), 'verified');
Route::redirect('/', 'login');
Route::middleware([
'auth:sanctum',
@@ -26,34 +18,40 @@
'verified',
])->group(function () {
Route::get('/dashboard', function () {
$person = new Person();
$chart = new ExampleChart(new LarapexChart());
$clients = $person::with(['group','type'])
->whereHas('group', fn($que) => $que->where('deleted','=',0))
->whereHas('type', fn($que) => $que->where('deleted','=',0))
$people = Person::with(['group','type', 'client', 'clientCase'])
->where([
['person.active','=',1],
['person.group_id','=',1]
['active','=',1],
])
->limit(10)
->orderBy('id', 'desc')
->orderByDesc('created_at')
->get();
return Inertia::render(
'Dashboard',
[
'chart' => $chart->build(),
'clients' => $clients
'people' => $people
]
);
})->name('dashboard');
//client
Route::get('client', [ClientController::class, 'index'])->name('client');
Route::get('client/{uuid}', [ClientController::class, 'show'])->name('client.show');
Route::post('client', [ClientController::class, 'store'])->name('client.store');
Route::get('clients', [ClientController::class, 'index'])->name('client');
Route::get('clients/{client:uuid}', [ClientController::class, 'show'])->name('client.show');
Route::post('clients', [ClientController::class, 'store'])->name('client.store');
//client-case
Route::get('client-cases', [ClientCaseContoller::class, 'index'])->name('clientCase');
Route::get('client-cases/{client_case:uuid}', [ClientCaseContoller::class, 'show'])->name('clientCase.show');
Route::post('client-cases', [ClientCaseContoller::class, 'store'])->name('clientCase.store');
//client-case / contract
Route::post('client-cases/{client_case:uuid}/contract', [ClientCaseContoller::class, 'storeContract'])->name('clientCase.contract.store');
Route::put('client-cases/{client_case:uuid}/contract/{uuid}', [ClientCaseContoller::class, 'updateContract'])->name('clientCase.contract.update');
Route::delete('client-cases/{client_case:uuid}/contract/{uuid}', [ClientCaseContoller::class, 'deleteContract'])->name('clientCase.contract.delete');
//client-case / activity
Route::post('client-cases/{client_case:uuid}/activity', [ClientCaseContoller::class, 'storeActivity'])->name('clientCase.activity.store');
Route::get('settings', [SettingController::class, 'index'])->name('settings');
//contract
Route::Post('contract', [ContractController::class, 'store'])->name('contract.store');
});