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

View File

@ -15,13 +15,26 @@ public function __construct(LarapexChart $chart)
public function build($options = null) public function build($options = null)
{ {
$data = \App\Models\ClientCase::query()
->selectRaw('EXTRACT(MONTH from created_at) as month, COUNT(id) as count')
->limit(6)
->whereRaw('EXTRACT(MONTH from created_at) > EXTRACT(MONTH from (NOW() - INTERVAL \'6 month\')) ')
->groupByRaw('EXTRACT(MONTH from created_at)')
->orderByRaw('EXTRACT(MONTH from created_at)')
->get();
$months = $data->pluck('month')->map(
fn($nu)
=> \DateTime::createFromFormat('!m', $nu)->format('F'))->toArray();
$newCases = $data->pluck('count')->toArray();
return $this->chart->areaChart() return $this->chart->areaChart()
->setTitle('Contracts during last six months.') ->setTitle('Cases during last six months.')
->setSubtitle('New and Completed.') ->addData('New cases', $newCases)
->addData('New', [4, 9, 5, 2, 1, 8]) //->addData('Completed', [7, 2, 7, 2, 5, 4])
->addData('Completed', [7, 2, 7, 2, 5, 4])
->setColors(['#1A56DB', '#ff6384']) ->setColors(['#1A56DB', '#ff6384'])
->setXAxis(['January', 'February', 'March', 'April', 'May', 'June']) ->setXAxis($months)
->setToolbar(true) ->setToolbar(true)
->toVue(); ->toVue();
} }

View File

@ -0,0 +1,190 @@
<?php
namespace App\Http\Controllers;
use App\Models\ClientCase;
use App\Models\Contract;
use Illuminate\Http\Request;
use Inertia\Inertia;
class ClientCaseContoller extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(ClientCase $clientCase, Request $request)
{
return Inertia::render('Cases/Index', [
'client_cases' => $clientCase::with(['person'])
->when($request->input('search'), fn($que, $search) =>
$que->whereHas(
'person',
fn($q) => $q->where('full_name', 'like', '%' . $search . '%')
)
)
->where('active', 1)
->orderByDesc('created_at')
->paginate(15)
->withQueryString(),
'filters' => $request->only(['search'])
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
$cuuid = $request->input('client_uuid');
$client = \App\Models\Client::where('uuid', $cuuid)->firstOrFail();
if( isset($client->id) ){
\DB::transaction(function() use ($request, $client){
$pq = $request->input('person');
$person = $client->person()->create([
'nu' => rand(100000,200000),
'first_name' => $pq['first_name'],
'last_name' => $pq['last_name'],
'full_name' => $pq['full_name'],
'gender' => null,
'birthday' => null,
'tax_number' => null,
'social_security_number' => null,
'description' => 'sdwwf',
'group_id' => 2,
'type_id' => 1
]);
$person->addresses()->create([
'address' => $pq['address']['address'],
'country' => $pq['address']['country'],
'type_id' => $pq['address']['type_id']
]);
$person->clientCase()->create([
'client_id' => $client->id
]);
});
}
return to_route('client.show', $client);
}
public function storeContract(ClientCase $clientCase, Request $request)
{
\DB::transaction(function() use ($request, $clientCase){
//Create contract
$clientCase->contracts()->create([
'reference' => $request->input('reference'),
'start_date' => date('Y-m-d', strtotime($request->input('start_date'))),
'type_id' => $request->input('type_id')
]);
});
return to_route('clientCase.show', $clientCase);
}
public function updateContract(ClientCase $clientCase, String $uuid, Request $request)
{
$contract = Contract::where('uuid', $uuid)->firstOrFail();
\DB::transaction(function() use ($request, $contract){
$contract->update([
'reference' => $request->input('reference'),
'type_id' => $request->input('type_id')
]);
});
return to_route('clientCase.show', $clientCase);
}
public function storeActivity(ClientCase $clientCase, Request $request) {
$attributes = $request->validate([
'due_date' => 'nullable|date',
'amount' => 'nullable|decimal:0,4',
'note' => 'string',
'action_id' => 'exists:\App\Models\Action,id',
'decision_id' => 'exists:\App\Models\Decision,id'
]);
//Create activity
$clientCase->activities()->create($attributes);
return to_route('clientCase.show', $clientCase);
}
public function deleteContract(ClientCase $clientCase, String $uuid, Request $request) {
$contract = Contract::where('uuid', $uuid)->firstOrFail();
\DB::transaction(function() use ($request, $contract){
$contract->delete();
});
return to_route('clientCase.show', $clientCase);
}
/**
* Display the specified resource.
*/
public function show(ClientCase $clientCase)
{
$case = $clientCase::with([
'person' => fn($que) => $que->with('addresses')
])->where('active', 1)->findOrFail($clientCase->id);
return Inertia::render('Cases/Show', [
'client' => $case->client()->with('person', fn($q) => $q->with(['addresses']))->firstOrFail(),
'client_case' => $case,
'contracts' => $case->contracts()
->with(['type'])
->orderByDesc('created_at')->get(),
'activities' => $case->activities()->with(['action', 'decision'])
->orderByDesc('created_at')
->paginate(15),
'contract_types' => \App\Models\ContractType::whereNull('deleted_at')->get(),
'actions' => \App\Models\Action::with('decisions')->get()
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -2,66 +2,84 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Person\Person; use App\Models\Client;
use Auth; use DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Inertia; use Inertia\Inertia;
class ClientController extends Controller class ClientController extends Controller
{ {
public function index(Person $person){ public function index(Client $client, Request $request){
return Inertia::render('Client/Index',[ return Inertia::render('Client/Index',[
'persons' => $person::with(['group','type']) 'clients' => $client::query()
->selectRaw('person.*,(select count(id) from contracts where client_id=person.id) as contracts') ->with('person')
->whereHas('group', fn($que) => $que->where('deleted','=',0)) ->when($request->input('search'), fn($que, $search) =>
->whereHas('type', fn($que) => $que->where('deleted','=',0)) $que->whereHas(
->where([ 'person',
['person.active','=',1], fn($q) => $q->where('full_name', 'like', '%' . $search . '%')
['person.group_id','=',1] )
])->get(), )
'create_url' => route('client.store'), ->where('active', 1)
'person_types' => \App\Models\Person\PersonType::all(['id','name','description']) ->orderByDesc('created_at')
->where('deleted','=',0) ->paginate(15)
->withQueryString(),
'filters' => $request->only(['search'])
]); ]);
} }
public function show($uuid) { public function show(Client $client, Request $request) {
$data = $client::query()
->with(['person' => fn($que) => $que->with('addresses')])
->findOrFail($client->id);
return Inertia::render('Client/Show', [ return Inertia::render('Client/Show', [
'client' => Person::with(['group','type','addresses','contracts'])->where('uuid', $uuid)->firstOrFail() 'client' => $data,
'client_cases' => $data->clientCases()
->with('person')
->when($request->input('search'), fn($que, $search) =>
$que->whereHas(
'person',
fn($q) => $q->where('full_name', 'like', '%' . $search . '%')
)
)
->where('active', 1)
->orderByDesc('created_at')
->paginate(15)
->withQueryString(),
'filters' => $request->only(['search'])
]); ]);
} }
public function store(Request $request) public function store(Request $request)
{ {
$reqAddress = $request->input('address');
$userId = Auth::user()->id;
$address = [ DB::transaction(function() use ($request){
'address' => $reqAddress['address'], $address = $request->input('address');
'country' => $reqAddress['country'], $person = \App\Models\Person\Person::create([
'type_id' => $reqAddress['type_id'], 'nu' => rand(100000,200000),
'person_id' => 0, 'first_name' => $request->input('first_name'),
'user_id' => $userId 'last_name' => $request->input('last_name'),
]; 'full_name' => $request->input('full_name'),
'gender' => null,
'birthday' => null,
'tax_number' => null,
'social_security_number' => null,
'description' => 'sdwwf',
'group_id' => 1,
'type_id' => 2
]);
$pid = Person::create([ $person->addresses()->create([
'nu' => rand(100000,200000), 'address' => $address['address'],
'first_name' => $request->input('first_name'), 'country' => $address['country'],
'last_name' => $request->input('last_name'), 'type_id' => $address['type_id']
'full_name' => $request->input('full_name'), ]);
'gender' => null,
'birthday' => null,
'tax_number' => null,
'social_security_number' => null,
'description' => 'sdwwf',
'group_id' => 1,
'type_id' => 2,
'user_id' => $userId
])->id;
$address['person_id'] = $pid; $person->client()->create();
});
\App\Models\Person\PersonAddress::create($address); //\App\Models\Person\PersonAddress::create($address);
return to_route('client'); return to_route('client');

View File

@ -2,60 +2,60 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Contract;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Inertia;
class ContractController extends Controller class ContractController extends Controller
{ {
public function index(Contract $contract) {
return Inertia::render('Contract/Index', [
'contracts' => $contract::with(['type', 'debtor'])
->where('active', 1)
->orderByDesc('created_at')
->paginate(10),
'person_types' => \App\Models\Person\PersonType::all(['id', 'name', 'description'])
->where('deleted', 0)
]);
}
public function show(Contract $contract){
return inertia('Contract/Show', [
'contract' => $contract::with(['type', 'client', 'debtor'])->findOrFail($contract->id)
]);
}
public function store(Request $request) public function store(Request $request)
{ {
$cuuid = $request->input('client_uuid'); $uuid = $request->input('client_case_uuid');
$userId = \Auth::user()->id;
$pReqPer = $request->input('person');
$pReqCont = $request->input('contract');
$cid = \DB::table('person')->where('uuid', $cuuid)->firstOrFail('id')->id; $clientCase = \App\Models\ClientCase::where('uuid', $uuid)->firstOrFail();
if( isset($clientCase->id) ){
\DB::transaction(function() use ($request, $clientCase){
if(!empty($cid)){ //Create contract
$clientCase->contracts()->create([
'reference' => $request->input('reference'),
'start_date' => date('Y-m-d', strtotime($request->input('start_date'))),
'type_id' => $request->input('type_id')
]);
$pid = \App\Models\Person\Person::create([ });
'nu' => rand(100000,200000),
'first_name' => $pReqPer['first_name'],
'last_name' => $pReqPer['last_name'],
'full_name' => $pReqPer['full_name'],
'gender' => null,
'birthday' => null,
'tax_number' => null,
'social_security_number' => null,
'description' => 'sdwwf',
'group_id' => 2,
'type_id' => 1,
'user_id' => $userId
])->id;
$address = [
'address' => $pReqPer['address']['address'],
'country' => $pReqPer['address']['country'],
'type_id' => $pReqPer['address']['type_id'],
'person_id' => $pid,
'user_id' => $userId
];
$contract = [
'reference' => $pReqCont['reference'],
'start_date' => date('Y-m-d', strtotime($pReqCont['start_date'])),
'client_id' => $cid,
'debtor_id' => $pid,
'type_id' => $pReqCont['type_id']
];
\App\Models\Person\PersonAddress::create($address);
\App\Models\Contract::create($contract);
} }
return to_route('client.show', ['uuid' => $cuuid]); return to_route('clientCase.show', $clientCase);
}
public function update(Contract $contract, Request $request){
$contract->update([
'referenca' => $request->input('referenca'),
'type_id' => $request->input('type_id')
]);
} }
} }

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Inertia\Inertia;
class SettingController extends Controller
{
//
public function index(Request $request){
return Inertia::render('Settings/Index', [
'actions' => \App\Models\Action::query()
->with('decisions', fn($q) => $q->get(['decisions.id']))
->get(),
'decisions' => \App\Models\Decision::query()
->with('actions', fn($q) => $q->get(['actions.id']))
->get()
]
);
}
}

25
app/Models/Action.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Action extends Model
{
/** @use HasFactory<\Database\Factories\ActionFactory> */
use HasFactory;
public function decisions(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Decision::class);
}
public function segment(): BelongsTo
{
return $this->belongsTo(\App\Models\Segment::class);
}
}

50
app/Models/Activity.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Activity extends Model
{
/** @use HasFactory<\Database\Factories\ActivityFactory> */
use HasFactory;
use SoftDeletes;
protected $fillable = [
'due_date',
'amount',
'note',
'action_id',
'decision_id'
];
protected $hidden = [
'action_id',
'decision_id',
'client_case_id',
'contract_id'
];
public function action(): BelongsTo
{
return $this->belongsTo(\App\Models\Action::class);
}
public function decision(): BelongsTo
{
return $this->belongsTo(\App\Models\Decision::class);
}
public function clientCase(): BelongsTo
{
return $this->belongsTo(\App\Models\ClientCase::class);
}
public function contract(): BelongsTo|null
{
return $this->belongsTo(\App\Models\Contract::class);
}
}

35
app/Models/Client.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use App\Traits\Uuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Client extends Model
{
/** @use HasFactory<\Database\Factories\ClientFactory> */
use HasFactory;
use Uuid;
protected $fillable = [
'person_id'
];
protected $hidden = [
'id',
'person_id',
];
public function person(): BelongsTo
{
return $this->belongsTo(\App\Models\Person\Person::class);
}
public function clientCases(): HasMany
{
return $this->hasMany(\App\Models\ClientCase::class);
}
}

46
app/Models/ClientCase.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use App\Traits\Uuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ClientCase extends Model
{
/** @use HasFactory<\Database\Factories\ClientCaseFactory> */
use HasFactory;
use Uuid;
protected $fillable = [
'client_id'
];
protected $hidden = [
'id',
'client_id',
'person_id'
];
public function client(): BelongsTo
{
return $this->belongsTo(\App\Models\Client::class);
}
public function person(): BelongsTo
{
return $this->belongsTo(\App\Models\Person\Person::class);
}
public function contracts(): HasMany
{
return $this->hasMany(\App\Models\Contract::class);
}
public function activities(): HasMany
{
return $this->hasMany(\App\Models\Activity::class);
}
}

View File

@ -7,26 +7,27 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Contract extends Model class Contract extends Model
{ {
/** @use HasFactory<\Database\Factories\ContractFactory> */ /** @use HasFactory<\Database\Factories\ContractFactory> */
use HasFactory; use HasFactory;
use Uuid; use Uuid;
use SoftDeletes;
protected $fillable = [ protected $fillable = [
'reference', 'reference',
'start_date', 'start_date',
'end_date', 'end_date',
'client_id', 'client_case_id',
'debtor_id',
'type_id', 'type_id',
'description' 'description'
]; ];
protected $hidden = [ protected $hidden = [
'client_id', 'id',
'debtor_id', 'client_case_id',
'type_id' 'type_id'
]; ];
@ -35,6 +36,11 @@ public function type(): BelongsTo
return $this->belongsTo(\App\Models\ContractType::class, 'type_id'); return $this->belongsTo(\App\Models\ContractType::class, 'type_id');
} }
public function client(): BelongsTo
{
return $this->belongsTo(\App\Models\Person\Person::class, 'client_id');
}
public function debtor(): BelongsTo public function debtor(): BelongsTo
{ {
return $this->belongsTo(\App\Models\Person\Person::class, 'debtor_id'); return $this->belongsTo(\App\Models\Person\Person::class, 'debtor_id');

25
app/Models/Decision.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Decision extends Model
{
/** @use HasFactory<\Database\Factories\DecisionFactory> */
use HasFactory;
public function actions(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Action::class);
}
public function events(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Event::class);
}
}

12
app/Models/Event.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Event extends Model
{
/** @use HasFactory<\Database\Factories\EventFactory> */
use HasFactory;
}

View File

@ -7,6 +7,7 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\HasApiTokens;
class Person extends Model class Person extends Model
@ -43,6 +44,14 @@ class Person extends Model
'user_id' 'user_id'
]; ];
protected static function booted(){
static::creating(function (Person $person) {
if(!isset($person->user_id)){
$person->user_id = auth()->id();
}
});
}
public function phones(): HasMany public function phones(): HasMany
{ {
@ -68,16 +77,14 @@ public function type(): BelongsTo
return $this->belongsTo(\App\Models\Person\PersonType::class, 'type_id'); return $this->belongsTo(\App\Models\Person\PersonType::class, 'type_id');
} }
public function contracts(): HasMany public function client(): HasOne
{ {
return $this->hasMany(\App\Models\Contract::class, 'client_id') return $this->hasOne(\App\Models\Client::class);
->with('debtor', fn($que) => }
$que->with(['type', 'group'])
->whereHas('type', fn($tque) => $tque->where('deleted','=',0)) public function clientCase(): HasOne
->whereHas('group', fn($tque) => $tque->where('deleted','=',0)) {
->where('active','=',1)) return $this->hasOne(\App\Models\ClientCase::class);
->with('type', fn($que) => $que->where('deleted','=',0))
->where('active', '=', 1);
} }
} }

View File

@ -26,6 +26,12 @@ class PersonAddress extends Model
'deleted' 'deleted'
]; ];
protected static function booted(){
static::creating(function (PersonAddress $address) {
$address->user_id = auth()->id();
});
}
public function person(): BelongsTo public function person(): BelongsTo
{ {
return $this->belongsTo(\App\Models\Person\Person::class); return $this->belongsTo(\App\Models\Person\Person::class);

View File

@ -3,6 +3,8 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\Application;
use Inertia\Inertia;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -12,6 +14,10 @@ class AppServiceProvider extends ServiceProvider
public function register(): void public function register(): void
{ {
// //
Inertia::share([
'laravelVersion' => Application::VERSION,
'phpVersion' => PHP_VERSION
]);
} }
/** /**

View File

@ -7,11 +7,13 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"arielmejiadev/larapex-charts": "^2.1", "arielmejiadev/larapex-charts": "^2.1",
"diglactic/laravel-breadcrumbs": "^9.0",
"inertiajs/inertia-laravel": "^1.0", "inertiajs/inertia-laravel": "^1.0",
"laravel/framework": "^11.9", "laravel/framework": "^11.9",
"laravel/jetstream": "^5.2", "laravel/jetstream": "^5.2",
"laravel/sanctum": "^4.0", "laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9", "laravel/tinker": "^2.9",
"robertboes/inertia-breadcrumbs": "^0.6.0",
"tightenco/ziggy": "^2.0" "tightenco/ziggy": "^2.0"
}, },
"require-dev": { "require-dev": {

275
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0a7997fbdd574a14b9c8fdb5ac33c48a", "content-hash": "32566a0ee8267e886985b5451f39d450",
"packages": [ "packages": [
{ {
"name": "arielmejiadev/larapex-charts", "name": "arielmejiadev/larapex-charts",
@ -367,6 +367,77 @@
}, },
"time": "2024-07-08T12:26:09+00:00" "time": "2024-07-08T12:26:09+00:00"
}, },
{
"name": "diglactic/laravel-breadcrumbs",
"version": "v9.0.0",
"source": {
"type": "git",
"url": "https://github.com/diglactic/laravel-breadcrumbs.git",
"reference": "88e8f01e013e811215770e27b40a74014c28f2c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/diglactic/laravel-breadcrumbs/zipball/88e8f01e013e811215770e27b40a74014c28f2c4",
"reference": "88e8f01e013e811215770e27b40a74014c28f2c4",
"shasum": ""
},
"require": {
"facade/ignition-contracts": "^1.0",
"laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0",
"php": "^7.3 || ^8.0"
},
"conflict": {
"davejamesmiller/laravel-breadcrumbs": "*"
},
"require-dev": {
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"php-coveralls/php-coveralls": "^2.7",
"phpunit/phpunit": "^9.5 || ^10.5",
"spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Diglactic\\Breadcrumbs\\ServiceProvider"
],
"aliases": {
"Breadcrumbs": "Diglactic\\Breadcrumbs\\Breadcrumbs"
}
}
},
"autoload": {
"psr-4": {
"Diglactic\\Breadcrumbs\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sheng Slogar",
"email": "sheng@diglactic.com",
"role": "Maintainer"
},
{
"name": "Dave James Miller",
"email": "dave@davejamesmiller.com",
"role": "Original Creator"
}
],
"description": "A simple Laravel-style way to create breadcrumbs.",
"homepage": "https://github.com/diglactic/laravel-breadcrumbs",
"keywords": [
"laravel"
],
"support": {
"issues": "https://github.com/diglactic/laravel-breadcrumbs/issues",
"source": "https://github.com/diglactic/laravel-breadcrumbs/tree/v9.0.0"
},
"time": "2024-03-12T00:42:39+00:00"
},
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
"version": "2.0.10", "version": "2.0.10",
@ -667,6 +738,59 @@
], ],
"time": "2023-10-06T06:47:41+00:00" "time": "2023-10-06T06:47:41+00:00"
}, },
{
"name": "facade/ignition-contracts",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/facade/ignition-contracts.git",
"reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267",
"reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267",
"shasum": ""
},
"require": {
"php": "^7.3|^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v2.15.8",
"phpunit/phpunit": "^9.3.11",
"vimeo/psalm": "^3.17.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Facade\\IgnitionContracts\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://flareapp.io",
"role": "Developer"
}
],
"description": "Solution contracts for Ignition",
"homepage": "https://github.com/facade/ignition-contracts",
"keywords": [
"contracts",
"flare",
"ignition"
],
"support": {
"issues": "https://github.com/facade/ignition-contracts/issues",
"source": "https://github.com/facade/ignition-contracts/tree/1.0.2"
},
"time": "2020-10-16T08:27:54+00:00"
},
{ {
"name": "fruitcake/php-cors", "name": "fruitcake/php-cors",
"version": "v1.3.0", "version": "v1.3.0",
@ -3728,6 +3852,155 @@
], ],
"time": "2024-04-27T21:32:50+00:00" "time": "2024-04-27T21:32:50+00:00"
}, },
{
"name": "robertboes/inertia-breadcrumbs",
"version": "0.6.0",
"source": {
"type": "git",
"url": "https://github.com/RobertBoes/inertia-breadcrumbs.git",
"reference": "4954e56e735d6143f195d8e5f1d57ec9b82f35a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobertBoes/inertia-breadcrumbs/zipball/4954e56e735d6143f195d8e5f1d57ec9b82f35a6",
"reference": "4954e56e735d6143f195d8e5f1d57ec9b82f35a6",
"shasum": ""
},
"require": {
"illuminate/contracts": "^10.0|^11.0",
"inertiajs/inertia-laravel": "^1.0",
"php": "^8.1",
"spatie/laravel-package-tools": "^1.11.0"
},
"conflict": {
"orchestra/testbench-core": ">=9,<9.0.14"
},
"require-dev": {
"composer/composer": "^2.1",
"diglactic/laravel-breadcrumbs": "^8.0|^9.0",
"glhd/gretel": "^1.7",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.14",
"nunomaduro/collision": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^10.0|^11",
"spatie/laravel-ray": "^1.28",
"spatie/ray": "^1.33",
"tabuna/breadcrumbs": "^4.0"
},
"suggest": {
"diglactic/laravel-breadcrumbs": "Manage and configure breadcrumbs with diglactic/laravel-breadcrumbs",
"glhd/gretel": "Manage and configure breadcrumbs with glhd/gretel",
"tabuna/breadcrumbs": "Manage and configure breadcrumbs with tabuna/breadcrumbs"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"RobertBoes\\InertiaBreadcrumbs\\InertiaBreadcrumbsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"RobertBoes\\InertiaBreadcrumbs\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Robert Boes",
"email": "github@robertboes.nl",
"role": "Developer"
}
],
"description": "Laravel package to automatically share breadcrumbs to Inertia",
"homepage": "https://github.com/robertboes/inertia-breadcrumbs",
"keywords": [
"breadcrumbs",
"inertia-breadcrumbs",
"inertiajs",
"laravel",
"robertboes"
],
"support": {
"issues": "https://github.com/RobertBoes/inertia-breadcrumbs/issues",
"source": "https://github.com/RobertBoes/inertia-breadcrumbs/tree/0.6.0"
},
"funding": [
{
"url": "https://github.com/RobertBoes",
"type": "github"
}
],
"time": "2024-04-26T21:05:12+00:00"
},
{
"name": "spatie/laravel-package-tools",
"version": "1.16.5",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-package-tools.git",
"reference": "c7413972cf22ffdff97b68499c22baa04eddb6a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/c7413972cf22ffdff97b68499c22baa04eddb6a2",
"reference": "c7413972cf22ffdff97b68499c22baa04eddb6a2",
"shasum": ""
},
"require": {
"illuminate/contracts": "^9.28|^10.0|^11.0",
"php": "^8.0"
},
"require-dev": {
"mockery/mockery": "^1.5",
"orchestra/testbench": "^7.7|^8.0",
"pestphp/pest": "^1.22",
"phpunit/phpunit": "^9.5.24",
"spatie/pest-plugin-test-time": "^1.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\LaravelPackageTools\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "Tools for creating Laravel packages",
"homepage": "https://github.com/spatie/laravel-package-tools",
"keywords": [
"laravel-package-tools",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-package-tools/issues",
"source": "https://github.com/spatie/laravel-package-tools/tree/1.16.5"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2024-08-27T18:56:10+00:00"
},
{ {
"name": "symfony/clock", "name": "symfony/clock",
"version": "v7.1.1", "version": "v7.1.1",

75
config/breadcrumbs.php Normal file
View File

@ -0,0 +1,75 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Name
|--------------------------------------------------------------------------
|
| Choose a view to display when Breadcrumbs::render() is called.
| Built in templates are:
|
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
| - 'breadcrumbs::bulma' - Bulma
| - 'breadcrumbs::foundation6' - Foundation 6
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
| - 'breadcrumbs::materialize' - Materialize
| - 'breadcrumbs::tailwind' - Tailwind CSS
| - 'breadcrumbs::uikit' - UIkit
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
*/
'view' => 'breadcrumbs::tailwind',
/*
|--------------------------------------------------------------------------
| Breadcrumbs File(s)
|--------------------------------------------------------------------------
|
| The file(s) where breadcrumbs are defined. e.g.
|
| - base_path('routes/breadcrumbs.php')
| - glob(base_path('breadcrumbs/*.php'))
|
*/
'files' => base_path('routes/breadcrumbs.php'),
/*
|--------------------------------------------------------------------------
| Exceptions
|--------------------------------------------------------------------------
|
| Determine when to throw an exception.
|
*/
// When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
'unnamed-route-exception' => true,
// When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException)
'missing-route-bound-breadcrumb-exception' => true,
// When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException)
'invalid-named-breadcrumb-exception' => true,
/*
|--------------------------------------------------------------------------
| Classes
|--------------------------------------------------------------------------
|
| Subclass the default classes for more advanced customisations.
|
*/
// Manager
'manager-class' => Diglactic\Breadcrumbs\Manager::class,
// Generator
'generator-class' => Diglactic\Breadcrumbs\Generator::class,
];

View File

@ -0,0 +1,46 @@
<?php
use RobertBoes\InertiaBreadcrumbs\Classifier\AppendAllBreadcrumbs;
use RobertBoes\InertiaBreadcrumbs\Classifier\IgnoreSingleBreadcrumbs;
use RobertBoes\InertiaBreadcrumbs\Collectors\DiglacticBreadcrumbsCollector;
use RobertBoes\InertiaBreadcrumbs\Collectors\GretelBreadcrumbsCollector;
use RobertBoes\InertiaBreadcrumbs\Collectors\TabunaBreadcrumbsCollector;
return [
'middleware' => [
/**
* Determines if the middleware should automatically be registered by this package
* If you would like to register it yourself you should set this to false
*/
'enabled' => true,
/**
* The middleware is added to the 'web' group by default
*/
'group' => 'web',
/**
* The key of shared breadcrumbs
*/
'key' => 'breadcrumbs',
],
/**
* By default a collector for diglactic/laravel-breadcrumbs is used
* If you're using tabuna/breadcrumbs you can use TabunaBreadcrumbsCollector::class
* If you're using glhd/gretel you can use GretelBreadcrumbsCollector::class (see notes in the readme about using this package)
*/
'collector' => DiglacticBreadcrumbsCollector::class,
/**
* A classifier to determine if the breadcrumbs should be added to the Inertia response
* This can be useful if you have defined a breadcrumb route which other routes can extend, but you don't want to show single breadcrumbs
*/
'classifier' => AppendAllBreadcrumbs::class,
// 'classifier' => IgnoreSingleBreadcrumbs::class,
/**
* Whether the query string should be ignored when determining the current route
*/
'ignore_query' => true,
];

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Action>
*/
class ActionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Activity>
*/
class ActivityFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ClientCase>
*/
class ClientCaseFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Client>
*/
class ClientFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Decision>
*/
class DecisionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
*/
class EventFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -15,7 +15,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -24,7 +24,8 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->string('color_tag', 50)->nullable();
$table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -33,7 +34,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -42,7 +43,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -62,7 +63,7 @@ public function up(): void
$table->foreignId('group_id')->references('id')->on('person_groups'); $table->foreignId('group_id')->references('id')->on('person_groups');
$table->foreignId('type_id')->references('id')->on('person_types'); $table->foreignId('type_id')->references('id')->on('person_types');
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->foreignIdFor(\App\Models\User::class); $table->foreignIdFor(\App\Models\User::class);
$table->timestamps(); $table->timestamps();
}); });
@ -75,7 +76,7 @@ public function up(): void
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class); $table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->foreignIdFor(\App\Models\User::class); $table->foreignIdFor(\App\Models\User::class);
$table->timestamps(); $table->timestamps();
@ -89,7 +90,7 @@ public function up(): void
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class); $table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->foreignIdFor(\App\Models\User::class); $table->foreignIdFor(\App\Models\User::class);
$table->timestamps(); $table->timestamps();

View File

@ -15,7 +15,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -27,7 +27,7 @@ public function up(): void
$table->foreignIdFor(\App\Models\Contract::class); $table->foreignIdFor(\App\Models\Contract::class);
$table->foreignId('type_id')->references('id')->on('account_types'); $table->foreignId('type_id')->references('id')->on('account_types');
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -15,7 +15,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50)->unique(); $table->string('name',50)->unique();
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -34,7 +34,7 @@ public function up(): void
$table->foreignId('account_id')->references('id')->on('accounts'); $table->foreignId('account_id')->references('id')->on('accounts');
$table->foreignId('type_id')->references('id')->on('debt_types'); $table->foreignId('type_id')->references('id')->on('debt_types');
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -16,7 +16,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -30,7 +30,7 @@ public function up(): void
$table->foreignId('debt_id')->references('id')->on('debts'); $table->foreignId('debt_id')->references('id')->on('debts');
$table->foreignId('type_id')->references('id')->on('payment_types'); $table->foreignId('type_id')->references('id')->on('payment_types');
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->foreignIdFor(\App\Models\User::class); $table->foreignIdFor(\App\Models\User::class);
$table->timestamps(); $table->timestamps();
}); });

View File

@ -15,7 +15,7 @@ public function up(): void
$table->id(); $table->id();
$table->string('name',50); $table->string('name',50);
$table->string('description',125)->nullable(); $table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
@ -27,11 +27,10 @@ public function up(): void
$table->date('start_date'); $table->date('start_date');
$table->date('end_date')->nullable(); $table->date('end_date')->nullable();
$table->string('description', 255)->nullable(); $table->string('description', 255)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class, 'client_id'); $table->foreignIdFor(\App\Models\ClientCase::class);
$table->foreignIdFor(\App\Models\Person\Person::class, 'debtor_id');
$table->foreignId('type_id')->references('id')->on('contract_types'); $table->foreignId('type_id')->references('id')->on('contract_types');
$table->unsignedTinyInteger('active')->default(1); $table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0); $table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('clients', function (Blueprint $table) {
$table->id();
$table->uuid()->unique();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('clients');
}
};

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('client_cases', function (Blueprint $table) {
$table->id();
$table->uuid()->unique();
$table->foreignIdFor(\App\Models\Client::class);
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('client_cases');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('activities', function (Blueprint $table) {
$table->id();
$table->date('due_date')->nullable();
$table->decimal('amount', 4)->nullable();
$table->text('note')->default('');
$table->foreignIdFor(\App\Models\Action::class);
$table->foreignIdFor(\App\Models\Decision::class);
$table->foreignIdFor(\App\Models\ClientCase::class);
$table->foreignIdFor(\App\Models\Contract::class)->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('activities');
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('actions', function (Blueprint $table) {
$table->id();
$table->string('name', 125);
$table->string('color_tag', 55)->nullable();
$table->foreignIdFor(\App\Models\Segment::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('actions');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('decisions', function (Blueprint $table) {
$table->id();
$table->string('name', 125);
$table->string('color_tag', 55)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('decisions');
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('events', function (Blueprint $table) {
$table->id();
$table->string('name', 55);
$table->string('description', 125)->nullable();
$table->jsonb('options');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('events');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('decision_events', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Decision::class);
$table->foreignIdFor(\App\Models\Event::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('decision_events');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('action_decision', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Action::class);
$table->foreignIdFor(\App\Models\Decision::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActivitySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientCaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DecisionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class EventSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -2,14 +2,12 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Models\Contract;
use App\Models\ContractType; use App\Models\ContractType;
use App\Models\Person\AddressType; use App\Models\Person\AddressType;
use App\Models\Person\Person; use App\Models\Person\Person;
use App\Models\Person\PersonGroup; use App\Models\Person\PersonGroup;
use App\Models\Person\PersonType; use App\Models\Person\PersonType;
use App\Models\Person\PhoneType; use App\Models\Person\PhoneType;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
class PersonSeeder extends Seeder class PersonSeeder extends Seeder
@ -26,8 +24,8 @@ public function run(): void
]; ];
$personGroups = [ $personGroups = [
[ 'name' => 'client', 'description' => ''], [ 'name' => 'client', 'description' => '', 'color_tag' => 'blue-400'],
[ 'name' => 'debtor', 'description' => ''] [ 'name' => 'client case', 'description' => '', 'color_tag' => 'red-400']
]; ];
$phoneTypes = [ $phoneTypes = [
@ -80,7 +78,7 @@ public function run(): void
'group_id' => 1, 'group_id' => 1,
'type_id' => 1, 'type_id' => 1,
'user_id' => 1 'user_id' => 1
]); ])->client()->create();
//debtors //debtors
Person::create([ Person::create([
@ -96,6 +94,8 @@ public function run(): void
'group_id' => 2, 'group_id' => 2,
'type_id' => 2, 'type_id' => 2,
'user_id' => 1 'user_id' => 1
])->clientCase()->create([
'client_id' => 1
]); ]);
Person::create([ Person::create([
@ -111,6 +111,8 @@ public function run(): void
'group_id' => 2, 'group_id' => 2,
'type_id' => 2, 'type_id' => 2,
'user_id' => 1 'user_id' => 1
])->clientCase()->create([
'client_id' => 1
]); ]);
//client //client
@ -127,7 +129,7 @@ public function run(): void
'group_id' => 1, 'group_id' => 1,
'type_id' => 1, 'type_id' => 1,
'user_id' => 1 'user_id' => 1
]); ])->client()->create();
//debtors //debtors
Person::create([ Person::create([
@ -143,7 +145,11 @@ public function run(): void
'group_id' => 2, 'group_id' => 2,
'type_id' => 2, 'type_id' => 2,
'user_id' => 1 'user_id' => 1
]); ])->clientCase()->create(
[
'client_id' => 4
]
);
Person::create([ Person::create([
'nu' => rand(100000,200000), 'nu' => rand(100000,200000),
@ -158,41 +164,11 @@ public function run(): void
'group_id' => 2, 'group_id' => 2,
'type_id' => 1, 'type_id' => 1,
'user_id' => 1 'user_id' => 1
]); ])->clientCase()->create(
[
'client_id' => 4
//contract ]
Contract::create([ );
'reference' => '111111222',
'start_date' => date('Y-m-d'),
'client_id' => 1,
'debtor_id' => 2,
'type_id' => 1
]);
Contract::create([
'reference' => '111111224',
'start_date' => date('Y-m-d'),
'client_id' => 1,
'debtor_id' => 3,
'type_id' => 1
]);
Contract::create([
'reference' => '211111222',
'start_date' => date('Y-m-d'),
'client_id' => 4,
'debtor_id' => 5,
'type_id' => 1
]);
Contract::create([
'reference' => '211111224',
'start_date' => date('Y-m-d'),
'client_id' => 4,
'debtor_id' => 6,
'type_id' => 1
]);
} }
} }

21
package-lock.json generated
View File

@ -11,6 +11,8 @@
"apexcharts": "^3.54.1", "apexcharts": "^3.54.1",
"flowbite": "^2.5.2", "flowbite": "^2.5.2",
"flowbite-vue": "^0.1.6", "flowbite-vue": "^0.1.6",
"lodash": "^4.17.21",
"tailwindcss-inner-border": "^0.2.0",
"vue3-apexcharts": "^1.7.0" "vue3-apexcharts": "^1.7.0"
}, },
"devDependencies": { "devDependencies": {
@ -2271,6 +2273,12 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT"
},
"node_modules/lodash-es": { "node_modules/lodash-es": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
@ -3246,6 +3254,19 @@
"node": ">=14.0.0" "node": ">=14.0.0"
} }
}, },
"node_modules/tailwindcss-inner-border": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/tailwindcss-inner-border/-/tailwindcss-inner-border-0.2.0.tgz",
"integrity": "sha512-IrKWoSHMisGY1FGfwD3+5nzPu1N9gWqUopqma72rS/5wp+DGxUltXhMm84TLpUeaUJyW6NDSHUO/qWh/+puZvg==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/kripod"
},
"peerDependencies": {
"tailwindcss": ">=3"
}
},
"node_modules/tailwindcss/node_modules/postcss-selector-parser": { "node_modules/tailwindcss/node_modules/postcss-selector-parser": {
"version": "6.1.2", "version": "6.1.2",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",

View File

@ -25,6 +25,8 @@
"apexcharts": "^3.54.1", "apexcharts": "^3.54.1",
"flowbite": "^2.5.2", "flowbite": "^2.5.2",
"flowbite-vue": "^0.1.6", "flowbite-vue": "^0.1.6",
"lodash": "^4.17.21",
"tailwindcss-inner-border": "^0.2.0",
"vue3-apexcharts": "^1.7.0" "vue3-apexcharts": "^1.7.0"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,7 +1,9 @@
@import '/node_modules/floating-vue/dist/style.css';
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
[x-cloak] { [x-cloak] {
display: none; display: none;
} }

View File

@ -1,7 +1,3 @@
<template> <template>
<svg viewBox="0 0 317 48" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" class="w-20 h-20" viewBox="0 -960 960 960" fill="#5985E1"><path d="M480-80q-140-35-230-162.5T160-522v-238l320-120 320 120v238q0 78-21.5 154.5T703-225L563-359q-19 11-40.16 18-21.16 7-42.84 7-62 0-105.5-43T331-482.5q0-62.5 43.5-106T480-632q62 0 105.5 43.5T629-482q0 21-6 42t-19 38l88 84q24-43 36-96.5T740-522v-198.48L480-815l-260 94.52V-522q0 131 72.5 236.5T480.2-142q28.8-8 70.3-33t65.5-48l42 43q-35 32-83.5 60.5T480-80Zm.2-314q36.8 0 62.8-25.5t26-63q0-37.5-26.2-63.5-26.21-26-63-26-36.8 0-62.8 26t-26 63.5q0 37.5 26.2 63 26.21 25.5 63 25.5Zm-1.2-90Z"/></svg>
<path d="M74.09 30.04V13h-4.14v21H82.1v-3.96h-8.01zM95.379 19v1.77c-1.08-1.35-2.7-2.19-4.89-2.19-3.99 0-7.29 3.45-7.29 7.92s3.3 7.92 7.29 7.92c2.19 0 3.81-.84 4.89-2.19V34h3.87V19h-3.87zm-4.17 11.73c-2.37 0-4.14-1.71-4.14-4.23 0-2.52 1.77-4.23 4.14-4.23 2.4 0 4.17 1.71 4.17 4.23 0 2.52-1.77 4.23-4.17 4.23zM106.628 21.58V19h-3.87v15h3.87v-7.17c0-3.15 2.55-4.05 4.56-3.81V18.7c-1.89 0-3.78.84-4.56 2.88zM124.295 19v1.77c-1.08-1.35-2.7-2.19-4.89-2.19-3.99 0-7.29 3.45-7.29 7.92s3.3 7.92 7.29 7.92c2.19 0 3.81-.84 4.89-2.19V34h3.87V19h-3.87zm-4.17 11.73c-2.37 0-4.14-1.71-4.14-4.23 0-2.52 1.77-4.23 4.14-4.23 2.4 0 4.17 1.71 4.17 4.23 0 2.52-1.77 4.23-4.17 4.23zM141.544 19l-3.66 10.5-3.63-10.5h-4.26l5.7 15h4.41l5.7-15h-4.26zM150.354 28.09h11.31c.09-.51.15-1.02.15-1.59 0-4.41-3.15-7.92-7.59-7.92-4.71 0-7.92 3.45-7.92 7.92s3.18 7.92 8.22 7.92c2.88 0 5.13-1.17 6.54-3.21l-3.12-1.8c-.66.87-1.86 1.5-3.36 1.5-2.04 0-3.69-.84-4.23-2.82zm-.06-3c.45-1.92 1.86-3.03 3.93-3.03 1.62 0 3.24.87 3.72 3.03h-7.65zM164.516 34h3.87V12.1h-3.87V34zM185.248 34.36c3.69 0 6.9-2.01 6.9-6.3V13h-2.1v15.06c0 3.03-2.07 4.26-4.8 4.26-2.19 0-3.93-.78-4.62-2.61l-1.77 1.05c1.05 2.43 3.57 3.6 6.39 3.6zM203.124 18.64c-4.65 0-7.83 3.45-7.83 7.86 0 4.53 3.24 7.86 7.98 7.86 3.03 0 5.34-1.41 6.6-3.45l-1.74-1.02c-.81 1.44-2.46 2.55-4.83 2.55-3.18 0-5.55-1.89-5.97-4.95h13.17c.03-.3.06-.63.06-.93 0-4.11-2.85-7.92-7.44-7.92zm0 1.92c2.58 0 4.98 1.71 5.4 5.01h-11.19c.39-2.94 2.64-5.01 5.79-5.01zM221.224 20.92V19h-4.32v-4.2l-1.98.6V19h-3.15v1.92h3.15v9.09c0 3.6 2.25 4.59 6.3 3.99v-1.74c-2.91.12-4.32.33-4.32-2.25v-9.09h4.32zM225.176 22.93c0-1.62 1.59-2.37 3.15-2.37 1.44 0 2.97.57 3.6 2.1l1.65-.96c-.87-1.86-2.79-3.06-5.25-3.06-3 0-5.13 1.89-5.13 4.29 0 5.52 8.76 3.39 8.76 7.11 0 1.77-1.68 2.4-3.45 2.4-2.01 0-3.57-.99-4.11-2.52l-1.68.99c.75 1.92 2.79 3.45 5.79 3.45 3.21 0 5.43-1.77 5.43-4.32 0-5.52-8.76-3.39-8.76-7.11zM244.603 20.92V19h-4.32v-4.2l-1.98.6V19h-3.15v1.92h3.15v9.09c0 3.6 2.25 4.59 6.3 3.99v-1.74c-2.91.12-4.32.33-4.32-2.25v-9.09h4.32zM249.883 21.49V19h-1.98v15h1.98v-8.34c0-3.72 2.34-4.98 4.74-4.98v-1.92c-1.92 0-3.69.63-4.74 2.73zM263.358 18.64c-4.65 0-7.83 3.45-7.83 7.86 0 4.53 3.24 7.86 7.98 7.86 3.03 0 5.34-1.41 6.6-3.45l-1.74-1.02c-.81 1.44-2.46 2.55-4.83 2.55-3.18 0-5.55-1.89-5.97-4.95h13.17c.03-.3.06-.63.06-.93 0-4.11-2.85-7.92-7.44-7.92zm0 1.92c2.58 0 4.98 1.71 5.4 5.01h-11.19c.39-2.94 2.64-5.01 5.79-5.01zM286.848 19v2.94c-1.26-2.01-3.39-3.3-6.06-3.3-4.23 0-7.74 3.42-7.74 7.86s3.51 7.86 7.74 7.86c2.67 0 4.8-1.29 6.06-3.3V34h1.98V19h-1.98zm-5.91 13.44c-3.33 0-5.91-2.61-5.91-5.94 0-3.33 2.58-5.94 5.91-5.94s5.91 2.61 5.91 5.94c0 3.33-2.58 5.94-5.91 5.94zM309.01 18.64c-1.92 0-3.75.87-4.86 2.73-.84-1.74-2.46-2.73-4.56-2.73-1.8 0-3.42.72-4.59 2.55V19h-1.98v15H295v-8.31c0-3.72 2.16-5.13 4.32-5.13 2.13 0 3.51 1.41 3.51 4.08V34h1.98v-8.31c0-3.72 1.86-5.13 4.17-5.13 2.13 0 3.66 1.41 3.66 4.08V34h1.98v-9.36c0-3.75-2.31-6-5.61-6z" class="fill-black" />
<path d="M11.395 44.428C4.557 40.198 0 32.632 0 24 0 10.745 10.745 0 24 0a23.891 23.891 0 0113.997 4.502c-.2 17.907-11.097 33.245-26.602 39.926z" fill="#6875F5" />
<path d="M14.134 45.885A23.914 23.914 0 0024 48c13.255 0 24-10.745 24-24 0-3.516-.756-6.856-2.115-9.866-4.659 15.143-16.608 27.092-31.75 31.751z" fill="#6875F5" />
</svg>
</template> </template>

View File

@ -1,6 +1,3 @@
<template> <template>
<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" class="w-20 h-20" viewBox="0 -960 960 960" fill="#5985E1"><path d="M480-80q-140-35-230-162.5T160-522v-238l320-120 320 120v238q0 78-21.5 154.5T703-225L563-359q-19 11-40.16 18-21.16 7-42.84 7-62 0-105.5-43T331-482.5q0-62.5 43.5-106T480-632q62 0 105.5 43.5T629-482q0 21-6 42t-19 38l88 84q24-43 36-96.5T740-522v-198.48L480-815l-260 94.52V-522q0 131 72.5 236.5T480.2-142q28.8-8 70.3-33t65.5-48l42 43q-35 32-83.5 60.5T480-80Zm.2-314q36.8 0 62.8-25.5t26-63q0-37.5-26.2-63.5-26.21-26-63-26-36.8 0-62.8 26t-26 63.5q0 37.5 26.2 63 26.21 25.5 63 25.5Zm-1.2-90Z"/></svg>
<path d="M11.395 44.428C4.557 40.198 0 32.632 0 24 0 10.745 10.745 0 24 0a23.891 23.891 0 0113.997 4.502c-.2 17.907-11.097 33.245-26.602 39.926z" fill="#6875F5" />
<path d="M14.134 45.885A23.914 23.914 0 0024 48c13.255 0 24-10.745 24-24 0-3.516-.756-6.856-2.115-9.866-4.659 15.143-16.608 27.092-31.75 31.751z" fill="#6875F5" />
</svg>
</template> </template>

View File

@ -4,14 +4,6 @@ import { Link } from '@inertiajs/vue3';
<template> <template>
<Link :href="'/'"> <Link :href="'/'">
<svg <svg xmlns="http://www.w3.org/2000/svg" class="w-32 h-32" viewBox="0 -960 960 960" fill="#5985E1"><path d="M480-80q-140-35-230-162.5T160-522v-238l320-120 320 120v238q0 78-21.5 154.5T703-225L563-359q-19 11-40.16 18-21.16 7-42.84 7-62 0-105.5-43T331-482.5q0-62.5 43.5-106T480-632q62 0 105.5 43.5T629-482q0 21-6 42t-19 38l88 84q24-43 36-96.5T740-522v-198.48L480-815l-260 94.52V-522q0 131 72.5 236.5T480.2-142q28.8-8 70.3-33t65.5-48l42 43q-35 32-83.5 60.5T480-80Zm.2-314q36.8 0 62.8-25.5t26-63q0-37.5-26.2-63.5-26.21-26-63-26-36.8 0-62.8 26t-26 63.5q0 37.5 26.2 63 26.21 25.5 63 25.5Zm-1.2-90Z"/></svg>
class="w-16 h-16"
viewBox="0 0 48 48"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M11.395 44.428C4.557 40.198 0 32.632 0 24 0 10.745 10.745 0 24 0a23.891 23.891 0 0113.997 4.502c-.2 17.907-11.097 33.245-26.602 39.926z" fill="#6875F5" />
<path d="M14.134 45.885A23.914 23.914 0 0024 48c13.255 0 24-10.745 24-24 0-3.516-.756-6.856-2.115-9.866-4.659 15.143-16.608 27.092-31.75 31.751z" fill="#6875F5" />
</svg>
</Link> </Link>
</template> </template>

View File

@ -1,27 +1,192 @@
<script setup> <script setup>
import { FwbButton, FwbModal, FwbTable, FwbTableBody, FwbTableCell, FwbTableHead, FwbTableHeadCell, FwbTableRow } from 'flowbite-vue';
import Drawer from './Drawer.vue';
import { useForm } from '@inertiajs/vue3';
import { ref } from 'vue';
import TextInput from './TextInput.vue';
import InputLabel from './InputLabel.vue';
import ActionMessage from './ActionMessage.vue';
import PrimaryButton from './PrimaryButton.vue';
import Modal from './Modal.vue';
import SecondaryButton from './SecondaryButton.vue';
defineProps({
const props = defineProps({
title: String, title: String,
description: String, description: String,
tableHead: Array, header: Array,
tableBody: Array body: Array,
editor: {
type: Boolean,
default: false
},
options: {
type: Object,
default: {}
}
}); });
const drawerUpdateForm = ref(false);
const modalRemove = ref(false);
const formUpdate = (props.editor) ? useForm(props.options.editor_data.form.values) : false;
const formRemove = (props.editor) ? useForm({type: 'soft', key: null}) : false;
const openEditor = (ref, data) => {
formUpdate[ref.key] = ref.val;
for(const [key, value] of Object.entries(data)) {
formUpdate[key] = value;
}
drawerUpdateForm.value = true;
}
const closeEditor = () => {
drawerUpdateForm.value = false;
}
const setUpdateRoute = (name, params = false, index) => {
if(!params){
return route(name, index)
}
return route(name, [params, index]);
}
const update = () => {
const putRoute = setUpdateRoute(
props.options.editor_data.form.route.name,
props.options.editor_data.form.route.params,
formUpdate[props.options.editor_data.form.key]
)
formUpdate.put(putRoute, {
onSuccess: () => {
closeEditor();
formUpdate.reset();
console.log('ssss')
},
preserveScroll: true
});
}
const modalRemoveTitle = ref('');
const closeModal = () => {
modalRemove.value = false;
}
const showModal = (key, title) => {
modalRemoveTitle.value = title;
formRemove.key = key;
modalRemove.value = true;
}
const remove = () => {
const removeRoute = setUpdateRoute(
props.options.editor_data.form.route_remove.name,
props.options.editor_data.form.route_remove.params,
formRemove.key
)
formRemove.delete(removeRoute, {
onSuccess: () => {
closeModal();
formRemove.reset();
},
preserveScroll: true
});
}
</script> </script>
<template> <template>
<div class="relative overflow-x-auto"> <div class="relative overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"> <FwbTable hoverable>
<thead class="text-xs text-gray-700 uppercase bg-gray-200 dark:bg-gray-700 dark:text-gray-400"> <FwbTableHead>
<th scope="col" class="px-6 py-3 font-bold" v-for="h in tableHead">{{ h.data }}</th> <FwbTableHeadCell v-for="h in header">{{ h.data }}</FwbTableHeadCell>
</thead> <FwbTableHeadCell v-if="editor"></FwbTableHeadCell>
<tbody> <FwbTableHeadCell v-else />
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-100 hover:bg-gray-100 even:dark:bg-gray-800 border-b dark:border-gray-700" v-for="row in tableBody"> </FwbTableHead>
<th scope="row" class="px-6 py-4 font-light text-gray-900 whitespace-nowrap dark:text-white" v-for="col in row.cols"> <FwbTableBody>
<a v-if="col.link !== undefined" :href="route(col.link.route, col.link.options)">{{ col.data }}</a> <FwbTableRow v-for="(row, key, parent_index) in body" :class="row.options.class" >
<FwbTableCell v-for="col in row.cols">
<a v-if="col.link !== undefined" :class="col.link.css" :href="route(col.link.route, col.link.options)">{{ col.data }}</a>
<span v-else>{{ col.data }}</span> <span v-else>{{ col.data }}</span>
</th> </FwbTableCell>
</tr> <FwbTableCell v-if="editor">
</tbody> <fwb-button class="mr-1" size="sm" color="default" @click="openEditor(row.options.ref, row.options.editable)" outline>Edit</fwb-button>
</table> <fwb-button size="sm" color="red" @click="showModal(row.options.ref.val, row.options.title)" outline>Remove</fwb-button>
</FwbTableCell>
<FwbTableCell v-else />
</FwbTableRow>
</FwbTableBody>
</FwbTable>
</div> </div>
<Drawer
v-if="editor"
:show="drawerUpdateForm"
@close="drawerUpdateForm = false"
>
<template #title>Update {{ options.editor_data.title }}</template>
<template #content>
<form @submit.prevent="update">
<div v-for="e in options.editor_data.form.el" class="col-span-6 sm:col-span-4 mb-4">
<InputLabel :for="e.id" :value="e.label"/>
<TextInput
v-if="e.type === 'text'"
:id="e.id"
:ref="e.ref"
type="text"
:autocomplete="e.autocomplete"
class="mt-1 block w-full"
v-model="formUpdate[e.bind]"
/>
<select
v-else-if="e.type === 'select'"
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
:id="e.id"
:ref="e.ref"
v-model="formUpdate[e.bind]"
>
<option v-for="op in e.selectOptions" :value="op.val">{{ op.desc }}</option>
</select>
</div>
<div class="flex justify-end mt-4">
<ActionMessage :on="formUpdate.recentlySuccessful" class="me-3">
Saved.
</ActionMessage>
<PrimaryButton :class="{ 'opacity-25': formUpdate.processing }" :disabled="formUpdate.processing">
Save
</PrimaryButton>
</div>
</form>
</template>
</Drawer>
<Modal
v-if="editor"
:show="modalRemove"
@close="closeModal"
maxWidth="sm"
>
<form @submit.prevent="remove">
<div class="p-3">
<div class="text-lg text-center py-2 mb-4">
Remove {{ options.editor_data.title }} <b>{{ modalRemoveTitle }}</b>?
</div>
<div class="flex justify-between">
<SecondaryButton type="button" @click="closeModal">
Cancel
</SecondaryButton>
<ActionMessage :on="formRemove.recentlySuccessful" class="me-3">
Deleted.
</ActionMessage>
<PrimaryButton class="bg-red-700" :class="{ 'opacity-25': formRemove.processing }" :disabled="formRemove.processing">
Delete
</PrimaryButton>
</div>
</div>
</form>
</Modal>
</template> </template>

View File

@ -0,0 +1,21 @@
<script setup>
defineProps({
breadcrumbs: Array
});
</script>
<template>
<nav v-if="breadcrumbs" class="flex" aria-label="Breadcrumb">
<ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
<li v-for="(page, index) in breadcrumbs" class="flex items-center">
<svg v-if="index !== 0" class="rtl:rotate-180 w-3 h-3 text-gray-400 mx-1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/>
</svg>
<a v-if="page.current === undefined" :href="page.url" class="ms-1 text-sm font-medium text-gray-700 hover:text-blue-600 md:ms-2 dark:text-gray-400 dark:hover:text-white">{{ page.title }}</a>
<span v-else class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400">{{ page.title }}</span>
</li>
</ol>
</nav>
</template>

View File

@ -9,7 +9,7 @@ const props = defineProps({
<template> <template>
<div class="grid grid-rows-* grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2"> <div class="grid grid-rows-* grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2">
<div class=" rounded p-2 shadow" v-for="item in items"> <div class="rounded p-2 shadow" v-for="item in items">
<p class="text-sm leading-5 md text-gray-500">{{ item.title }}</p> <p class="text-sm leading-5 md text-gray-500">{{ item.title }}</p>
<p class="text-lg leading-7 text-gray-900">{{ item.val }}</p> <p class="text-lg leading-7 text-gray-900">{{ item.val }}</p>
</div> </div>

View File

@ -0,0 +1,76 @@
<script setup>
import { Link } from '@inertiajs/vue3';
const props = defineProps({
links: Array,
from: Number,
to: Number,
total: Number
});
const num = props.links.length;
</script>
<template>
<div class="flex items-center justify-between bg-white px-4 py-3 sm:px-6">
<div class="flex flex-1 justify-between sm:hidden">
<a href="#" class="relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">Previous</a>
<a href="#" class="relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">Next</a>
</div>
<div class="hidden sm:flex sm:flex-1 sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700">
Showing
<span class="font-medium">{{ from }}</span>
to
<span class="font-medium">{{ to }}</span>
of
<span class="font-medium">{{ total }}</span>
results
</p>
</div>
<div>
<nav class="isolate inline-flex -space-x-px rounded-md shadow-sm" aria-label="Pagination">
<template v-for="(link, index) in links">
<component
:is="link.url ? Link : 'span'"
v-if="index === 0 || index === (num - 1)"
:href="link.url"
class="relative inline-flex items-center px-2 py-2 ring-1 ring-inset ring-gray-300 focus:z-20 focus:outline-offset-0"
:class="{
'rounded-l-md': index === 0,
'rounded-r-md': index === (num - 1),
'text-gray-900 hover:bg-gray-50': link.url,
'text-gray-400 bg-gray-100': ! link.url}"
>
<span class="sr-only">
{{ index === 0 ? 'Previous' : 'Next' }}
</span>
<svg v-if="index === 0" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd" d="M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd" />
</svg>
<svg v-else class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />
</svg>
</component>
<component
v-else
:is="link.url ? Link : 'span'"
:href="link.url"
v-html="link.label"
class="relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:outline-offset-0"
:class="{
'text-gray-700 ring-1 ring-inset ring-gray-300': ! link.url,
'text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20': link.url && ! link.active,
'z-10 bg-blue-600 text-white focus:z-20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600': link.url && link.active
}"
>
</component>
</template>
</nav>
</div>
</div>
</div>
</template>

View File

@ -0,0 +1,36 @@
<script setup>
const props = defineProps({
person: Object
})
</script>
<template>
<div class="grid grid-rows-* grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2">
<div class="rounded p-2 shadow">
<p class="text-xs leading-5 md:text-sm text-gray-500">Nu.</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.nu }}</p>
</div>
<div class="rounded p-2 shadow">
<p class="text-sm leading-5 md:text-sm text-gray-500">Name.</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.full_name }}</p>
</div>
<div class="rounded p-2 shadow">
<p class="text-sm leading-5 md:text-sm text-gray-500">Tax NU.</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.tax_number }}</p>
</div>
<div class="rounded p-2 shadow">
<p class="text-sm leading-5 md:text-sm text-gray-500">Social security NU.</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.social_security_number }}</p>
</div>
<div class="md:col-span-full lg:col-span-2 rounded p-2 shadow">
<p class="text-sm leading-5 md:text-sm text-gray-500">Address</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.address }}</p>
</div>
<div class="md:col-span-full lg:col-span-2 rounded p-2 shadow">
<p class="text-sm leading-5 md:text-sm text-gray-500">Description</p>
<p class="text-sm md:text-base leading-7 text-gray-900">{{ person.description }}</p>
</div>
</div>
</template>

View File

@ -0,0 +1,25 @@
<script setup>
import { debounce } from 'lodash';
import { ref, watch } from 'vue';
import TextInput from '@/Components/TextInput.vue';
import { router } from '@inertiajs/vue3';
const props = defineProps({
options: Object
});
const search = ref(props.options.search)
watch(search, debounce((value) => {
const routeOptions = props.options.route.options ?? null;
router.get(
route(props.options.route.link, routeOptions),
{ search: value },
{ preserveState: true, replace: true }
);
}, 300));
</script>
<template>
<TextInput v-model="search" title="Search" placeholder="Search..." />
</template>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="md:col-span-1 flex justify-between"> <div class="md:col-span-1 flex justify-between">
<div class="px-4 sm:px-0"> <div class="px-4 sm:px-0">
<h3 class="text-lg font-medium text-gray-900"> <h3 class="text-base lg:text-lg font-medium text-gray-900">
<slot name="title" /> <slot name="title" />
</h3> </h3>

View File

@ -1,27 +1,20 @@
<script setup> <script setup>
import { ref } from 'vue'; import { computed, ref } from 'vue';
import { Head, Link, router } from '@inertiajs/vue3'; import { Head, Link, router, usePage } from '@inertiajs/vue3';
import ApplicationMark from '@/Components/ApplicationMark.vue'; import ApplicationMark from '@/Components/ApplicationMark.vue';
import Banner from '@/Components/Banner.vue'; import Banner from '@/Components/Banner.vue';
import Dropdown from '@/Components/Dropdown.vue'; import Dropdown from '@/Components/Dropdown.vue';
import DropdownLink from '@/Components/DropdownLink.vue'; import DropdownLink from '@/Components/DropdownLink.vue';
import NavLink from '@/Components/NavLink.vue'; import NavLink from '@/Components/NavLink.vue';
import ResponsiveNavLink from '@/Components/ResponsiveNavLink.vue'; import ResponsiveNavLink from '@/Components/ResponsiveNavLink.vue';
import Breadcrumbs from '@/Components/Breadcrumbs.vue';
defineProps({ const props = defineProps({
title: String, title: String,
}); });
const showingNavigationDropdown = ref(false); const showingNavigationDropdown = ref(false);
const switchToTeam = (team) => {
router.put(route('current-team.update'), {
team_id: team.id,
}, {
preserveState: false,
});
};
const logout = () => { const logout = () => {
router.post(route('logout')); router.post(route('logout'));
}; };
@ -55,70 +48,22 @@ const logout = () => {
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex"> <div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<NavLink :href="route('client')" :active="route().current('client') || route().current('client.*')"> <NavLink :href="route('client')" :active="route().current('client') || route().current('client.*')">
Client Clients
</NavLink>
</div>
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<NavLink :href="route('clientCase')" :active="route().current('clientCase') || route().current('clientCase.*')">
Cases
</NavLink>
</div>
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<NavLink :href="route('settings')" :active="route().current('settings') || route().current('settings.*')">
Settings
</NavLink> </NavLink>
</div> </div>
</div> </div>
<div class="hidden sm:flex sm:items-center sm:ms-6"> <div class="hidden sm:flex sm:items-center sm:ms-6">
<div class="ms-3 relative">
<!-- Teams Dropdown -->
<Dropdown v-if="$page.props.jetstream.hasTeamFeatures" align="right" width="60">
<template #trigger>
<span class="inline-flex rounded-md">
<button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150">
{{ $page.props.auth.user.current_team.name }}
<svg class="ms-2 -me-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
</svg>
</button>
</span>
</template>
<template #content>
<div class="w-60">
<!-- Team Management -->
<div class="block px-4 py-2 text-xs text-gray-400">
Manage Team
</div>
<!-- Team Settings -->
<DropdownLink :href="route('teams.show', $page.props.auth.user.current_team)">
Team Settings
</DropdownLink>
<DropdownLink v-if="$page.props.jetstream.canCreateTeams" :href="route('teams.create')">
Create New Team
</DropdownLink>
<!-- Team Switcher -->
<template v-if="$page.props.auth.user.all_teams.length > 1">
<div class="border-t border-gray-200" />
<div class="block px-4 py-2 text-xs text-gray-400">
Switch Teams
</div>
<template v-for="team in $page.props.auth.user.all_teams" :key="team.id">
<form @submit.prevent="switchToTeam(team)">
<DropdownLink as="button">
<div class="flex items-center">
<svg v-if="team.id == $page.props.auth.user.current_team_id" class="me-2 h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>{{ team.name }}</div>
</div>
</DropdownLink>
</form>
</template>
</template>
</div>
</template>
</Dropdown>
</div>
<!-- Settings Dropdown --> <!-- Settings Dropdown -->
<div class="ms-3 relative"> <div class="ms-3 relative">
<Dropdown align="right" width="48"> <Dropdown align="right" width="48">
@ -130,7 +75,6 @@ const logout = () => {
<span v-else class="inline-flex rounded-md"> <span v-else class="inline-flex rounded-md">
<button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150"> <button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150">
{{ $page.props.auth.user.name }} {{ $page.props.auth.user.name }}
<svg class="ms-2 -me-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <svg class="ms-2 -me-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" /> <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
</svg> </svg>
@ -203,6 +147,12 @@ const logout = () => {
<ResponsiveNavLink :href="route('client')" :active="route().current('client')"> <ResponsiveNavLink :href="route('client')" :active="route().current('client')">
Clients Clients
</ResponsiveNavLink> </ResponsiveNavLink>
<ResponsiveNavLink :href="route('clientCase')" :active="route().current('clientCase')">
Cases
</ResponsiveNavLink>
<ResponsiveNavLink :href="route('settings')" :active="route().current('settings')">
Settings
</ResponsiveNavLink>
</div> </div>
<!-- Responsive Settings Options --> <!-- Responsive Settings Options -->
@ -285,7 +235,8 @@ const logout = () => {
<!-- Page Heading --> <!-- Page Heading -->
<header v-if="$slots.header" class="bg-white shadow"> <header v-if="$slots.header" class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<slot name="header" /> <Breadcrumbs :breadcrumbs="$page.props.breadcrumbs"></Breadcrumbs>
</div> </div>
</header> </header>

View File

@ -0,0 +1,59 @@
<script setup>
import AppLayout from '@/Layouts/AppLayout.vue';
import List from '@/Components/List.vue';
import ListItem from '@/Components/ListItem.vue';
import Pagination from '@/Components/Pagination.vue';
import SearchInput from '@/Components/SearchInput.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
const props = defineProps({
client_cases: Object,
filters: Object
});
const search = {
search: props.filters.search,
route: {
link: 'clientCase'
}
}
</script>
<template>
<AppLayout title="Client cases">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Contracts
</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg">
<div class="mx-auto max-w-4x1 py-3">
<div class="flex justify-end">
<SearchInput :options="search" />
</div>
<List>
<ListItem v-for="clientCase in client_cases.data">
<div class="flex justify-between shadow rounded border-solid border-l-4 border-red-400 p-3">
<div class="flex min-w-0 gap-x-4">
<div class="min-w-0 flex-auto">
<p class="text-sm font-semibold leading-6 text-gray-900"><a :href="route('clientCase.show', {uuid: clientCase.uuid})">{{ clientCase.person.full_name }}</a></p>
<p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ clientCase.person.nu }}</p>
</div>
</div>
<div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end">
<p class="text-sm leading-6 text-gray-900">{{ clientCase.person.tax_number }}</p>
<div class="mt-1 flex items-center gap-x-1.5">
<p class="text-xs leading-5 text-gray-500">{{ clientCase.person.name }}</p>
</div>
</div>
</div>
</ListItem>
</List>
</div>
<Pagination :links="client_cases.links" :from="client_cases.from" :to="client_cases.to" :total="client_cases.total" />
</div>
</div>
</div>
</AppLayout>
</template>

View File

@ -0,0 +1,149 @@
<script setup>
import ActionMessage from '@/Components/ActionMessage.vue';
import Drawer from '@/Components/Drawer.vue';
import InputLabel from '@/Components/InputLabel.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
import TextInput from '@/Components/TextInput.vue';
import { useForm } from '@inertiajs/vue3';
import { FwbTextarea } from 'flowbite-vue';
import { ref, watch } from 'vue';
const props = defineProps({
show: {
type: Boolean,
default: false
},
client_case: Object,
actions: Array
});
const decisions = ref(props.actions[0].decisions);
console.log(props.actions);
const emit = defineEmits(['close']);
const close = () => {
emit('close');
}
const form = useForm({
due_date: null,
amount: null,
note: '',
action_id: props.actions[0].id,
decision_id: props.actions[0].decisions[0].id
});
watch(
() => form.action_id,
(action_id) => {
decisions.value = props.actions.filter((el) => el.id === action_id)[0].decisions;
form.decision_id = decisions.value[0].id;
}
);
const store = () => {
console.table({
due_date: form.due_date,
action_id: form.action_id,
decision_id: form.decision_id,
amount: form.amount,
note: form.note
});
form.post(route('clientCase.activity.store', props.client_case), {
onBefore: () => {
if(form.due_date !== null || form.due_date !== '') {
form.due_date = new Date(form.due_date).toISOString();
}
},
onSuccess: () => {
close();
form.reset();
}
});
}
</script>
<template>
<Drawer
:show="show"
@close="close"
>
<template #title>Add activity</template>
<template #content>
<form @submit.prevent="store">
<SectionTitle class="mt-4 border-b mb-4">
<template #title>
Activity
</template>
</SectionTitle>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityDueDate" value="Due date"/>
<vue-date-picker
id="activityDueDate"
:enable-time-picker="false"
format="dd.MM.yyyy"
class="mt-1 block w-full"
v-model="form.due_date"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityAmount" value="Amount"/>
<TextInput
id="activityAmount"
ref="activityAmountinput"
v-model="form.amount"
type="number"
class="mt-1 block w-full"
autocomplete="0.00"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityAction" value="Action"/>
<select
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
id="activityAction"
ref="activityActionSelect"
v-model="form.action_id"
>
<option v-for="a in actions" :value="a.id">{{ a.name }}</option>
<!-- ... -->
</select>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityDecision" value="Decision"/>
<select
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
id="activityDecision"
ref="activityDecisionSelect"
v-model="form.decision_id"
>
<option v-for="d in decisions" :value="d.id">{{ d.name }}</option>
<!-- ... -->
</select>
</div>
<div class="col-span-6 sm:col-span-4">
<FwbTextarea
label="Note"
id="activityNote"
ref="activityNoteTextarea"
v-model="form.note"
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
/>
</div>
<div class="flex justify-end mt-4">
<ActionMessage :on="form.recentlySuccessful" class="me-3">
Saved.
</ActionMessage>
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
Save
</PrimaryButton>
</div>
</form>
</template>
</Drawer>
</template>

View File

@ -0,0 +1,48 @@
<script setup>
import BasicTable from '@/Components/BasicTable.vue';
import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/Shared/AppObjects';
const props = defineProps({
client_case: Object,
activities: Object
});
let header = [
C_TD.make('Date', 'header'),
C_TD.make('Action', 'header'),
C_TD.make('Decision', 'header'),
C_TD.make('Note', 'header'),
C_TD.make('Due date', 'header'),
C_TD.make('Amount', 'header')
];
const createBody = (data) => {
let body = [];
data.forEach((p) => {
const createdDate = new Date(p.created_at).toLocaleDateString('de');
const dueDate = (p.due_date === null) ? new Date().toLocaleDateString('de') : null;
const cols = [
C_TD.make(createdDate, 'body' ),
C_TD.make(p.action.name, 'body'),
C_TD.make(p.decision.name, 'body'),
C_TD.make(p.note, 'body' ),
C_TD.make(dueDate, 'body' ),
C_TD.make(Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(p.amount), 'body' )
];
body.push(
C_TR.make(cols)
)
});
return body;
}
</script>
<template>
<BasicTable :header="header" :body="createBody(activities.data)" />
</template>

View File

@ -0,0 +1,102 @@
<script setup>
import ActionMessage from '@/Components/ActionMessage.vue';
import Drawer from '@/Components/Drawer.vue';
import InputLabel from '@/Components/InputLabel.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
import TextInput from '@/Components/TextInput.vue';
import { useForm } from '@inertiajs/vue3';
const props = defineProps({
client_case: Object,
show: {
type: Boolean,
default: false
},
types: Array
});
console.log(props.types);
const emit = defineEmits(['close']);
const close = () => {
emit('close');
}
//store contract
const formContract = useForm({
client_case_uuid: props.client_case.uuid,
reference: '',
start_date: new Date().toISOString(),
type_id: props.types[0].id
});
const storeContract = () => {
formContract.post(route('clientCase.contract.store', props.client_case), {
onBefore: () => {
formContract.start_date = formContract.start_date;
},
onSuccess: () => {
close();
formContract.reset();
},
preserveScroll: true
});
}
</script>
<template>
<Drawer
:show="show"
@close="close"
>
<template #title>Add contract</template>
<template #content>
<form @submit.prevent="storeContract">
<SectionTitle class="mt-4 border-b mb-4">
<template #title>
Contract
</template>
</SectionTitle>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractRef" value="Reference"/>
<TextInput
id="contractRef"
ref="contractRefInput"
v-model="formContract.reference"
type="text"
class="mt-1 block w-full"
autocomplete="contract-reference"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractStartDate" value="Start date"/>
<vue-date-picker id="contractStartDate" :enable-time-picker="false" format="dd.MM.yyyy" class="mt-1 block w-full" v-model="formContract.start_date"></vue-date-picker>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractTypeSelect" value="Contract type"/>
<select
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
id="contractTypeSelect"
v-model="formContract.type_id"
>
<option v-for="t in types" :value="t.id">{{ t.name }}</option>
<!-- ... -->
</select>
</div>
<div class="flex justify-end mt-4">
<ActionMessage :on="formContract.recentlySuccessful" class="me-3">
Saved.
</ActionMessage>
<PrimaryButton :class="{ 'opacity-25': formContract.processing }" :disabled="formContract.processing">
Save
</PrimaryButton>
</div>
</form>
</template>
</Drawer>
</template>

View File

@ -0,0 +1,87 @@
<script setup>
import BasicTable from '@/Components/BasicTable.vue';
import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/Shared/AppObjects';
const props = defineProps({
client_case: Object,
contract_types: Array,
contracts: Array
});
//Contract table
let tableContractHeader = [
C_TD.make('Ref.', 'header'),
C_TD.make('Start date', 'header'),
C_TD.make('Type', 'header')
];
const tableOptions = {
editor_data: {
form: {
route: {name: 'clientCase.contract.update', params: {uuid: props.client_case.uuid}},
route_remove: {name: 'clientCase.contract.delete', params: {uuid: props.client_case.uuid}},
values: {
uuid: null,
reference: '',
type_id: 1
},
key: 'uuid',
index: {uuid: null},
el: [
{
id: 'contractRefU',
ref: 'contractRefUInput',
bind: 'reference',
type: 'text',
label: 'Reference',
autocomplete: 'contract-reference'
},
{
id: 'contractTypeU',
ref: 'contractTypeSelectU',
bind: 'type_id',
type: 'select',
label: 'Type',
selectOptions: props.contract_types.map(item => new Object({val: item.id, desc: item.name}))
}
]
},
title: 'contract'
}
}
const createContractTableBody = (data) => {
let tableContractBody = [];
data.forEach((p) => {
let startDate = new Date(p.start_date).toLocaleDateString('de');
const cols = [
C_TD.make(p.reference, 'body' ),
C_TD.make(startDate, 'body' ),
C_TD.make(p.type.name, 'body' ),
];
tableContractBody.push(
C_TR.make(
cols,
{
class: '',
title: p.reference,
edit: true,
ref: {key: 'uuid', val: p.uuid},
editable: {
reference: p.reference,
type_id: p.type.id
}
}
)
)
});
return tableContractBody;
}
</script>
<template>
<BasicTable :options="tableOptions" :header="tableContractHeader" :editor="true" :body="createContractTableBody(contracts)" />
</template>

View File

@ -0,0 +1,175 @@
<script setup>
import PersonInfoGrid from '@/Components/PersonInfoGrid.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
import AppLayout from '@/Layouts/AppLayout.vue';
import { Link, useForm } from '@inertiajs/vue3';
import { FwbA, FwbButton } from 'flowbite-vue';
import { ref } from 'vue';
import ContractDrawer from './Partials/ContractDrawer.vue';
import ContractTable from './Partials/ContractTable.vue';
import ActivityDrawer from './Partials/ActivityDrawer.vue';
import ActivityTable from './Partials/ActivityTable.vue';
const props = defineProps({
client: Object,
client_case: Object,
contracts: Array,
activities: Object,
contract_types: Array,
actions: Array
});
console.log(props.actions);
//Client and case person info card
const clientMainAddress = props.client.person.addresses.filter( a => a.type.id === 1 )[0] ?? '';
const personMainAddress = props.client_case.person.addresses.filter( a => a.type.id === 1 )[0] ?? '';
const clientInfo = new Object({
nu: props.client.person.nu,
full_name: props.client.person.full_name,
main_address: (clientMainAddress.country !== '') ? `${clientMainAddress.address} - ${clientMainAddress.country}` : clientMainAddress.address,
tax_number: props.client.person.tax_number,
social_security_number: props.client.person.social_security_number,
description: props.client.person.description
});
const casePersonInfo = new Object({
nu: props.client_case.person.nu,
full_name: props.client_case.person.full_name,
main_address: (personMainAddress.country !== '') ? `${personMainAddress.address} - ${personMainAddress.country}` : personMainAddress.address,
tax_number: props.client_case.person.tax_number,
social_security_number: props.client_case.person.social_security_number,
description: props.client_case.person.description
});
//Drawer add new contract
const drawerCreateContract = ref(false);
const openDrawerCreateContract = () => {
drawerCreateContract.value = true;
}
//Drawer add new activity
const drawerAddActivity = ref(false);
const openDrawerAddActivity = () => {
drawerAddActivity.value = true;
}
//Close drawer (all)
const closeDrawer = () => {
drawerCreateContract.value = false;
drawerAddActivity.value = false;
}
</script>
<template>
<AppLayout title="Client case">
<template #header></template>
<div class="pt-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400">
<div class="mx-auto max-w-4x1 p-3">
<SectionTitle>
<template #title>
<FwbA class= "hover:text-blue-500" :href="route('client.show', client)">
Client
</FwbA>
</template>
</SectionTitle>
</div>
</div>
</div>
</div>
<div class="pt-1">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400">
<div class="mx-auto max-w-4x1 p-3">
<PersonInfoGrid :person="clientInfo" />
</div>
</div>
</div>
</div>
<div class="pt-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-red-400">
<div class="mx-auto max-w-4x1 p-3">
<SectionTitle>
<template #title>
Case
</template>
</SectionTitle>
</div>
</div>
</div>
</div>
<div class="pt-1">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-red-400">
<div class="mx-auto max-w-4x1 p-3">
<PersonInfoGrid :person="casePersonInfo" />
</div>
</div>
</div>
</div>
<div class="pt-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4">
<div class="mx-auto max-w-4x1">
<div class="flex justify-between p-3">
<SectionTitle>
<template #title>
Contracts
</template>
</SectionTitle>
<FwbButton @click="openDrawerCreateContract">Add new</FwbButton>
</div>
<ContractTable
:client_case="client_case"
:contracts="contracts"
:contract_types="contract_types"
/>
</div>
</div>
</div>
</div>
<div class="pt-12 pb-6">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4">
<div class="mx-auto max-w-4x1">
<div class="flex justify-between p-3">
<SectionTitle>
<template #title>
Activities
</template>
</SectionTitle>
<FwbButton @click="openDrawerAddActivity">Add new</FwbButton>
</div>
<ActivityTable
:client_case="client_case"
:activities="activities"
/>
</div>
</div>
</div>
</div>
</AppLayout>
<ContractDrawer
:show="drawerCreateContract"
@close="closeDrawer"
:types="contract_types"
:client_case="client_case"
/>
<ActivityDrawer
:show="drawerAddActivity"
@close="closeDrawer"
:client_case="client_case"
:actions="actions"
/>
</template>

View File

@ -1,23 +1,22 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, watch } from 'vue';
import AppLayout from '@/Layouts/AppLayout.vue'; import AppLayout from '@/Layouts/AppLayout.vue';
import List from '@/Components/List.vue'; import List from '@/Components/List.vue';
import ListItem from '@/Components/ListItem.vue'; import ListItem from '@/Components/ListItem.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue'; import PrimaryButton from '@/Components/PrimaryButton.vue';
import InputLabel from '@/Components/InputLabel.vue'; import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue'; import TextInput from '@/Components/TextInput.vue';
import { useForm } from '@inertiajs/vue3'; import { Link, useForm } from '@inertiajs/vue3';
import ActionMessage from '@/Components/ActionMessage.vue'; import ActionMessage from '@/Components/ActionMessage.vue';
import Drawer from '@/Components/Drawer.vue'; import Drawer from '@/Components/Drawer.vue';
import Pagination from '@/Components/Pagination.vue';
import SearchInput from '@/Components/SearchInput.vue';
const props = defineProps({ const props = defineProps({
persons: Array, clients: Object,
create_url: String, filters: Object
person_types: Array
}); });
const drawerCreateClient = ref(false);
const Address = { const Address = {
address: '', address: '',
country: '', country: '',
@ -31,14 +30,29 @@ const formClient = useForm({
address: Address address: Address
}); });
//Create client drawer
const drawerCreateClient = ref(false);
//Search input
const search = {
search: props.filters.search,
route: {
link: 'client'
}
}
//Open drawer create client
const openDrawerCreateClient = () => { const openDrawerCreateClient = () => {
drawerCreateClient.value = true drawerCreateClient.value = true
} }
//Close any drawer on page
const closeDrawer = () => { const closeDrawer = () => {
drawerCreateClient.value = false drawerCreateClient.value = false
} }
//Ajax call post to store new client
const storeClient = () => { const storeClient = () => {
formClient.post(route('client.store'), { formClient.post(route('client.store'), {
onBefore: () => { onBefore: () => {
@ -50,10 +64,8 @@ const storeClient = () => {
} }
}); });
}; };
</script> </script>
<template> <template>
@ -67,26 +79,30 @@ const storeClient = () => {
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg"> <div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg">
<div class="mx-auto max-w-4x1 py-3"> <div class="mx-auto max-w-4x1 py-3">
<PrimaryButton @click="openDrawerCreateClient" class="bg-blue-400">Add client</PrimaryButton> <div class="flex justify-between">
<PrimaryButton @click="openDrawerCreateClient" class="bg-blue-400">Add client</PrimaryButton>
<SearchInput :options="search" />
</div>
<List class="mt-2"> <List class="mt-2">
<ListItem v-for="person in persons"> <ListItem v-for="client in clients.data">
<div class="flex justify-between shadow rounded border-solid border-l-4 border-blue-400 p-3"> <div class="flex justify-between shadow rounded border-solid border-l-4 border-blue-400 p-3">
<div class="flex min-w-0 gap-x-4"> <div class="flex min-w-0 gap-x-4">
<div class="min-w-0 flex-auto"> <div class="min-w-0 flex-auto">
<p class="text-sm font-semibold leading-6 text-gray-900"><a :href="route('client.show', { uuid: person.uuid })">{{ person.full_name }}</a></p> <p class="text-sm font-semibold leading-6 text-gray-900"><Link :href="route('client.show', {uuid: client.uuid})">{{ client.person.full_name }}</Link></p>
<p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ person.nu }}</p> <p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ client.person.nu }}</p>
</div> </div>
</div> </div>
<div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end"> <div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end">
<p class="text-sm leading-6 text-gray-900">{{ person.tax_number }}</p> <p class="text-sm leading-6 text-gray-900">{{ client.person.tax_number }}</p>
<div class="mt-1 flex items-center gap-x-1.5"> <div class="mt-1 flex items-center gap-x-1.5">
<p class="text-xs leading-5 text-gray-500">{{ person.group.name }}</p> <p class="text-xs leading-5 text-gray-500">Client</p>
</div> </div>
</div> </div>
</div> </div>
</ListItem> </ListItem>
</List> </List>
</div> </div>
<Pagination :links="clients.links" :from="clients.from" :to="clients.to" :total="clients.total" />
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,21 +3,26 @@ import AppLayout from '@/Layouts/AppLayout.vue';
import List from '@/Components/List.vue'; import List from '@/Components/List.vue';
import ListItem from '@/Components/ListItem.vue'; import ListItem from '@/Components/ListItem.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue'; import PrimaryButton from '@/Components/PrimaryButton.vue';
import ItemGrid from '@/Components/ItemGrid.vue';
import { Item } from '@/Shared/AppObjects';
import Drawer from '@/Components/Drawer.vue'; import Drawer from '@/Components/Drawer.vue';
import InputLabel from '@/Components/InputLabel.vue'; import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue'; import TextInput from '@/Components/TextInput.vue';
import { ref } from 'vue'; import { ref } from 'vue';
import { useForm } from '@inertiajs/vue3'; import { Link, useForm } from '@inertiajs/vue3';
import ActionMessage from '@/Components/ActionMessage.vue'; import ActionMessage from '@/Components/ActionMessage.vue';
import SectionTitle from '@/Components/SectionTitle.vue'; import SectionTitle from '@/Components/SectionTitle.vue';
import { de } from 'date-fns/locale' import PersonInfoGrid from '@/Components/PersonInfoGrid.vue';
import Pagination from '@/Components/Pagination.vue';
import SearchInput from '@/Components/SearchInput.vue';
const props = defineProps({ const props = defineProps({
client: Object client: Object,
client_cases: Object,
urlPrev: String,
filters: Object
}); });
console.log(props.client_cases)
const Address = { const Address = {
address: '', address: '',
country: '', country: '',
@ -31,47 +36,46 @@ const Person = {
address: Address address: Address
} }
const Contract = { const formCreateCase = useForm({
reference: '',
start_date: new Date(),
type_id: 3
}
const formCreateContract = useForm({
client_uuid: props.client.uuid, client_uuid: props.client.uuid,
person: Person, person: Person
contract: Contract
}); });
const drawerCreateContract = ref(false); const search = {
search: props.filters.search,
route: {
link: 'client.show',
options: {uuid: props.client.uuid}
}
}
const openDrawerCreateContract = () => { const drawerCreateCase = ref(false);
drawerCreateContract.value = true;
const openDrawerCreateCase = () => {
drawerCreateCase.value = true;
} }
const closeDrawer = () => { const closeDrawer = () => {
drawerCreateContract.value = false drawerCreateCase.value = false
} }
const mainAddress = props.client.addresses.filter( a => a.type.id === 1 )[0] ?? ''; const mainAddress = props.client.person.addresses.filter( a => a.type.id === 1 )[0] ?? '';
const clientInfo = [ const clientInfo = new Object({
Item.make('nu', 'Nu.', 'number', props.client.nu), nu: props.client.person.nu,
Item.make('full_name', 'Name', 'string', props.client.full_name), full_name: props.client.person.full_name,
Item.make('main_address', 'Address', 'string', mainAddress.address), main_address: (mainAddress.country !== '') ? `${mainAddress.address} - ${mainAddress.country}` : mainAddress.address,
Item.make('tax_number', 'Tax NU.', 'string', props.client.tax_number), tax_number: props.client.person.tax_number,
Item.make('social_security_number', 'Social security NU.', 'string', props.client.social_security_number), social_security_number: props.client.person.social_security_number,
Item.make('description', 'Description', 'string', props.client.description) description: props.client.person.description
] });
const storeContract = () => { const storeCase = () => {
formCreateContract.post(route('contract.store'), { formCreateCase.post(route('clientCase.store'), {
onBefore: () => {
formCreateContract.contract.start_date = formCreateContract.contract.start_date.toISOString();
},
onSuccess: () => { onSuccess: () => {
closeDrawer(); closeDrawer();
formCreateContract.reset(); formCreateCase.reset();
console.log(props.client_cases)
} }
}); });
}; };
@ -81,17 +85,26 @@ const storeContract = () => {
<template> <template>
<AppLayout title="Client"> <AppLayout title="Client">
<template #header> <template #header></template>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ client.full_name.toUpperCase() }}
</h2>
</template>
<div class="pt-12"> <div class="pt-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400">
<div class="mx-auto max-w-4x1 p-3"> <div class="mx-auto max-w-4x1 p-3">
<ItemGrid :items="clientInfo"></ItemGrid> <SectionTitle>
<template #title>
{{ client.person.full_name }} - client
</template>
</SectionTitle>
</div>
</div>
</div>
</div>
<div class="pt-1">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400">
<div class="mx-auto max-w-4x1 p-3">
<PersonInfoGrid :person="clientInfo"></PersonInfoGrid>
</div> </div>
</div> </div>
</div> </div>
@ -101,37 +114,41 @@ const storeContract = () => {
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg"> <div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg">
<div class="mx-auto max-w-4x1 py-3"> <div class="mx-auto max-w-4x1 py-3">
<PrimaryButton @click="openDrawerCreateContract" class="bg-blue-400">Add contract</PrimaryButton> <div class="flex justify-between">
<PrimaryButton @click="openDrawerCreateCase" class="bg-blue-400">Add Case</PrimaryButton>
<SearchInput :options="search" />
</div>
<List class="mt-2"> <List class="mt-2">
<ListItem v-for="contract in client.contracts"> <ListItem v-for="clientCase in client_cases.data">
<div class="flex justify-between shadow rounded border-solid border-l-4 border-red-400 p-2"> <div class="flex justify-between shadow rounded border-solid border-l-4 border-red-400 p-2">
<div class="flex min-w-0 gap-x-4"> <div class="flex min-w-0 gap-x-4">
<div class="min-w-0 flex-auto"> <div class="min-w-0 flex-auto">
<p class="text-sm font-semibold leading-6 text-gray-900">{{ contract.debtor.full_name }}</p> <p class="text-sm font-semibold leading-6 text-gray-900"><Link :href="route('clientCase.show', {uuid: clientCase.uuid})">{{ clientCase.person.full_name }}</Link></p>
<p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ contract.reference }}</p> <p class="mt-1 truncate text-xs leading-5 text-gray-500"></p>
</div> </div>
</div> </div>
<div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end"> <div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end">
<p class="text-sm leading-6 text-gray-900">{{ contract.debtor.nu }}</p> <p class="text-sm leading-6 text-gray-900">{{ clientCase.person.nu }}</p>
<div class="mt-1 flex items-center gap-x-1.5"> <div class="mt-1 flex items-center gap-x-1.5">
<p class="text-xs leading-5 text-gray-500">{{ contract.debtor.group.name }}</p> <p class="text-xs leading-5 text-gray-500">Client case</p>
</div> </div>
</div> </div>
</div> </div>
</ListItem> </ListItem>
</List> </List>
</div> </div>
<Pagination :links="client_cases.links" :from="client_cases.from" :to="client_cases.to" :total="client_cases.total" />
</div> </div>
</div> </div>
</div> </div>
</AppLayout> </AppLayout>
<Drawer <Drawer
:show="drawerCreateContract" :show="drawerCreateCase"
@close="drawerCreateContract = false"> @close="drawerCreateCase = false">
<template #title>Add contract</template> <template #title>Add case</template>
<template #content> <template #content>
<form @submit.prevent="storeContract"> <form @submit.prevent="storeCase">
<SectionTitle class="border-b mb-4"> <SectionTitle class="border-b mb-4">
<template #title> <template #title>
Person Person
@ -142,7 +159,7 @@ const storeContract = () => {
<TextInput <TextInput
id="firstname" id="firstname"
ref="firstnameInput" ref="firstnameInput"
v-model="formCreateContract.person.first_name" v-model="formCreateCase.person.first_name"
type="text" type="text"
class="mt-1 block w-full" class="mt-1 block w-full"
autocomplete="first-name" autocomplete="first-name"
@ -154,7 +171,7 @@ const storeContract = () => {
<TextInput <TextInput
id="lastname" id="lastname"
ref="lastnameInput" ref="lastnameInput"
v-model="formCreateContract.person.last_name" v-model="formCreateCase.person.last_name"
type="text" type="text"
class="mt-1 block w-full" class="mt-1 block w-full"
autocomplete="last-name" autocomplete="last-name"
@ -166,7 +183,7 @@ const storeContract = () => {
<TextInput <TextInput
id="fullname" id="fullname"
ref="fullnameInput" ref="fullnameInput"
v-model="formCreateContract.person.full_name" v-model="formCreateCase.person.full_name"
type="text" type="text"
class="mt-1 block w-full" class="mt-1 block w-full"
autocomplete="full-name" autocomplete="full-name"
@ -178,7 +195,7 @@ const storeContract = () => {
<TextInput <TextInput
id="address" id="address"
ref="addressInput" ref="addressInput"
v-model="formCreateContract.person.address.address" v-model="formCreateCase.person.address.address"
type="text" type="text"
class="mt-1 block w-full" class="mt-1 block w-full"
autocomplete="address" autocomplete="address"
@ -190,7 +207,7 @@ const storeContract = () => {
<TextInput <TextInput
id="addressCountry" id="addressCountry"
ref="addressCountryInput" ref="addressCountryInput"
v-model="formCreateContract.person.address.country" v-model="formCreateCase.person.address.country"
type="text" type="text"
class="mt-1 block w-full" class="mt-1 block w-full"
autocomplete="address-country" autocomplete="address-country"
@ -202,53 +219,19 @@ const storeContract = () => {
<select <select
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm" class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
id="addressType" id="addressType"
v-model="formCreateContract.person.address.type_id" v-model="formCreateCase.person.address.type_id"
> >
<option value="1">Permanent</option> <option value="1">Permanent</option>
<option value="2">Temporary</option> <option value="2">Temporary</option>
<!-- ... --> <!-- ... -->
</select> </select>
</div> </div>
<SectionTitle class="mt-4 border-b mb-4">
<template #title>
Contract
</template>
</SectionTitle>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractRef" value="Reference"/>
<TextInput
id="contractRef"
ref="contractRefInput"
v-model="formCreateContract.contract.reference"
type="text"
class="mt-1 block w-full"
autocomplete="contract-reference"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractStartDate" value="Start date"/>
<vue-date-picker id="contractStartDate" :format-locale="de" :enable-time-picker="false" format="dd.MM.yyyy" class="mt-1 block w-full" v-model="formCreateContract.contract.start_date"></vue-date-picker>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="contractTypeSelect" value="Contract type"/>
<select
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
id="contractTypeSelect"
v-model="formCreateContract.person.address.type_id"
>
<option value="1">Early</option>
<option value="2">Hard</option>
<option value="3">Delivery</option>
<option value="4">Leasing</option>
<!-- ... -->
</select>
</div>
<div class="flex justify-end mt-4"> <div class="flex justify-end mt-4">
<ActionMessage :on="formCreateContract.recentlySuccessful" class="me-3"> <ActionMessage :on="formCreateCase.recentlySuccessful" class="me-3">
Saved. Saved.
</ActionMessage> </ActionMessage>
<PrimaryButton :class="{ 'opacity-25': formCreateContract.processing }" :disabled="formCreateContract.processing"> <PrimaryButton :class="{ 'opacity-25': formCreateCase.processing }" :disabled="formCreateCase.processing">
Save Save
</PrimaryButton> </PrimaryButton>
</div> </div>

View File

@ -6,23 +6,38 @@ import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/S
const props = defineProps({ const props = defineProps({
chart: Object, chart: Object,
clients: Array people: Array
}); });
const tableClientHeader = [ console.log(props.people)
const tablePersonHeader = [
C_TD.make('Nu.', 'header'), C_TD.make('Nu.', 'header'),
C_TD.make('Name', 'header') C_TD.make('Name', 'header'),
C_TD.make('Group', 'header')
]; ];
let tableClientBody = []; let tablePersonBody = [];
const getRoute = (person) => {
if( person.client ){
return {route: 'client.show', options: person.client};
}
return {route: 'clientCase.show', options: person.client_case};
}
props.people.forEach((p) => {
const forLink = getRoute(p);
props.clients.forEach((p) => {
const cols = [ const cols = [
C_TD.make(Number(p.nu), 'body', {}, C_LINK.make('client.show', {'uuid': p.uuid})), C_TD.make(Number(p.nu), 'body', {}, C_LINK.make(forLink.route, forLink.options, `font-bold hover:text-${p.group.color_tag}`)),
C_TD.make(p.full_name, 'body') C_TD.make(p.full_name, 'body'),
C_TD.make(p.group.name)
]; ];
tableClientBody.push(C_TR.make(cols)) tablePersonBody.push(C_TR.make(cols, {class: `border-l-4 border-${p.group.color_tag}`}))
}); });
</script> </script>
@ -34,7 +49,7 @@ props.clients.forEach((p) => {
Dashboard Dashboard
</h2> </h2>
</template> </template>
<div class="pt-12"> <div class="pt-12 hidden md:block">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-2"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-2">
<apexchart :width="chart.width" :height="chart.height" :type="chart.type" :options="chart.options" :series="chart.series"></apexchart> <apexchart :width="chart.width" :height="chart.height" :type="chart.type" :options="chart.options" :series="chart.series"></apexchart>
@ -42,7 +57,7 @@ props.clients.forEach((p) => {
</div> </div>
</div> </div>
<div class="py-12"> <div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid grid-cols-2 gap-6"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid md:grid-cols-2 gap-6">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<SectionTitle class="p-4"> <SectionTitle class="p-4">
<template #title> <template #title>
@ -52,18 +67,18 @@ props.clients.forEach((p) => {
List of new contracts for terrain work List of new contracts for terrain work
</template> </template>
</SectionTitle> </SectionTitle>
<BasicTable :table-head="tableClientHeader" :table-body="tableClientBody"></BasicTable> <BasicTable :header="tablePersonHeader" :body="tablePersonBody"></BasicTable>
</div> </div>
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<SectionTitle class="p-4"> <SectionTitle class="p-4">
<template #title> <template #title>
Persons Last added
</template> </template>
<template #description> <template #description>
List of new persons List of new people
</template> </template>
</SectionTitle> </SectionTitle>
<BasicTable :table-head="tableClientHeader" :table-body="tableClientBody"></BasicTable> <BasicTable :header="tablePersonHeader" :body="tablePersonBody"></BasicTable>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,36 @@
<script setup>
import AppLayout from '@/Layouts/AppLayout.vue';
import { ref } from 'vue';
import { FwbTab, FwbTabs } from 'flowbite-vue'
import ActionTable from './Partials/ActionTable.vue';
import DecisionTable from './Partials/DecisionTable.vue';
const props = defineProps({
actions: Array,
decisions: Array
});
const activeTab = ref('actions')
</script>
<template>
<AppLayout title="Settings">
<template #header></template>
<div class="pt-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<fwb-tabs v-model="activeTab" variant="underline" >
<fwb-tab name="actions" title="Actions">
<ActionTable :actions="actions" />
</fwb-tab>
<fwb-tab name="decisions" title="Decisions">
<DecisionTable :decisions="decisions" />
</fwb-tab>
</fwb-tabs>
</div>
</div>
</div>
</AppLayout>
</template>

View File

@ -0,0 +1,36 @@
<script setup>
import BasicTable from '@/Components/BasicTable.vue';
import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/Shared/AppObjects';
const props = defineProps({
actions: Array
});
const header = [
C_TD.make('#', 'header'),
C_TD.make('Name', 'header'),
C_TD.make('Color tag', 'header'),
C_TD.make('Decisions', 'header')
];
const createBody = (data) => {
let content = [];
data.forEach((a) => {
const cols = [
C_TD.make(a.id, 'body'),
C_TD.make(a.name, 'body'),
C_TD.make(a.color_tag, 'body'),
C_TD.make(a.decisions.length, 'body')
];
content.push(C_TR.make(cols));
});
return content;
}
</script>
<template>
<BasicTable :header="header" :body="createBody(actions)" />
</template>

View File

@ -0,0 +1,36 @@
<script setup>
import BasicTable from '@/Components/BasicTable.vue';
import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/Shared/AppObjects';
const props = defineProps({
decisions: Array
});
const header = [
C_TD.make('#', 'header'),
C_TD.make('Name', 'header'),
C_TD.make('Color tag', 'header'),
C_TD.make('Belongs to actions', 'header')
];
const createBody = (data) => {
let content = [];
data.forEach((a) => {
const cols = [
C_TD.make(a.id, 'body'),
C_TD.make(a.name, 'body'),
C_TD.make(a.color_tag, 'body'),
C_TD.make(a.actions.length, 'body')
];
content.push(C_TR.make(cols));
});
return content;
}
</script>
<template>
<BasicTable :header="header" :body="createBody(decisions)" />
</template>

View File

@ -9,42 +9,46 @@ export class TableColumn{
} }
} }
link = undefined; link = undefined;
constructor(data, type, option = undefined, link = undefined) { constructor(data, type, options = {}, link = undefined) {
this.data = data; this.data = data;
this.type = type; this.type = type;
this.options = option; this.options = options;
this.link = link; this.link = link;
}; };
static make(data, type, option = undefined, link = undefined){ static make(data, type, options = {}, link = undefined){
return new this(data, type, option, link); return new this(data, type, options, link);
} }
} }
export class LinkOptions{ export class LinkOptions{
route = ''; route = '';
options = undefined; options = undefined;
constructor(route, options = undefined){ css = undefined;
constructor(route, options = undefined, css = undefined){
this.route = route; this.route = route;
this.options = options this.options = options;
this.css = css
}; };
static make(route, option = undefined){ static make(route, option = {}, css = undefined){
return new this(route, option); return new this(route, option, css);
} }
} }
export class TableRow{ export class TableRow{
cols = []; cols = [];
options = {};
edit = false; edit = false;
constructor(cols, edit = false){ constructor(cols, options = {}, edit = false){
this.cols = cols, this.cols = cols;
this.edit = edit this.options = options;
this.edit = edit;
}; };
static make(cols, edit = false){ static make(cols, options, edit = false){
return new this(cols, edit); return new this(cols, options, edit);
} }
} }

48
routes/breadcrumbs.php Normal file
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'));
});

View File

@ -1,24 +1,16 @@
<?php <?php
use App\Charts\ExampleChart; use App\Charts\ExampleChart;
use App\Http\Controllers\ClientCaseContoller;
use App\Http\Controllers\ClientController; use App\Http\Controllers\ClientController;
use App\Http\Controllers\ContractController; use App\Http\Controllers\ContractController;
use App\Http\Controllers\SettingController;
use App\Models\Person\Person; use App\Models\Person\Person;
use ArielMejiaDev\LarapexCharts\LarapexChart; use ArielMejiaDev\LarapexCharts\LarapexChart;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Inertia\Inertia; use Inertia\Inertia;
Route::get('/', function () { Route::redirect('/', 'login');
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::middleware([ Route::middleware([
'auth:sanctum', 'auth:sanctum',
@ -26,34 +18,40 @@
'verified', 'verified',
])->group(function () { ])->group(function () {
Route::get('/dashboard', function () { Route::get('/dashboard', function () {
$person = new Person();
$chart = new ExampleChart(new LarapexChart()); $chart = new ExampleChart(new LarapexChart());
$clients = $person::with(['group','type']) $people = Person::with(['group','type', 'client', 'clientCase'])
->whereHas('group', fn($que) => $que->where('deleted','=',0))
->whereHas('type', fn($que) => $que->where('deleted','=',0))
->where([ ->where([
['person.active','=',1], ['active','=',1],
['person.group_id','=',1]
]) ])
->limit(10) ->limit(10)
->orderBy('id', 'desc') ->orderByDesc('created_at')
->get(); ->get();
return Inertia::render( return Inertia::render(
'Dashboard', 'Dashboard',
[ [
'chart' => $chart->build(), 'chart' => $chart->build(),
'clients' => $clients 'people' => $people
] ]
); );
})->name('dashboard'); })->name('dashboard');
//client //client
Route::get('client', [ClientController::class, 'index'])->name('client'); Route::get('clients', [ClientController::class, 'index'])->name('client');
Route::get('client/{uuid}', [ClientController::class, 'show'])->name('client.show'); Route::get('clients/{client:uuid}', [ClientController::class, 'show'])->name('client.show');
Route::post('client', [ClientController::class, 'store'])->name('client.store'); Route::post('clients', [ClientController::class, 'store'])->name('client.store');
//contract //client-case
Route::Post('contract', [ContractController::class, 'store'])->name('contract.store'); 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');
}); });

View File

@ -27,6 +27,7 @@ export default {
typography, typography,
require('flowbite/plugin')({ require('flowbite/plugin')({
charts: true charts: true
}) }),
require('tailwindcss-inner-border')
], ],
}; };