From 953ff38d64feea8174c9afb03d2c092322ada7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pocrnji=C4=8D?= Date: Wed, 13 Nov 2024 22:11:07 +0100 Subject: [PATCH] Lots of changes --- app/Charts/ExampleChart.php | 23 +- app/Http/Controllers/ClientCaseContoller.php | 190 ++++++++++++ app/Http/Controllers/ClientController.php | 100 ++++--- app/Http/Controllers/ContractController.php | 82 +++--- app/Http/Controllers/SettingController.php | 24 ++ app/Models/Action.php | 25 ++ app/Models/Activity.php | 50 ++++ app/Models/Client.php | 35 +++ app/Models/ClientCase.php | 46 +++ app/Models/Contract.php | 14 +- app/Models/Decision.php | 25 ++ app/Models/Event.php | 12 + app/Models/Person/Person.php | 25 +- app/Models/Person/PersonAddress.php | 6 + app/Providers/AppServiceProvider.php | 6 + composer.json | 2 + composer.lock | 275 +++++++++++++++++- config/breadcrumbs.php | 75 +++++ config/inertia-breadcrumbs.php | 46 +++ database/factories/ActionFactory.php | 23 ++ database/factories/ActivityFactory.php | 23 ++ database/factories/ClientCaseFactory.php | 23 ++ database/factories/ClientFactory.php | 23 ++ database/factories/DecisionFactory.php | 23 ++ database/factories/EventFactory.php | 23 ++ .../2024_10_14_185613_create_person_table.php | 15 +- ...024_10_19_090817_create_accounts_table.php | 4 +- .../2024_10_19_100530_create_debts_table.php | 4 +- ...024_10_19_100706_create_payments_table.php | 4 +- ...24_10_20_113420_create_contracts_table.php | 7 +- ...2024_11_02_190342_create_clients_table.php | 30 ++ ...11_02_190558_create_client_cases_table.php | 31 ++ ...4_11_09_213443_create_activities_table.php | 35 +++ ...2024_11_09_213511_create_actions_table.php | 30 ++ ...24_11_09_213534_create_decisions_table.php | 29 ++ .../2024_11_10_141407_create_events_table.php | 30 ++ ...10_142707_create_decision_events_table.php | 29 ++ ...024_11_10_182416_action_decision_table.php | 29 ++ database/seeders/ActionSeeder.php | 17 ++ database/seeders/ActivitySeeder.php | 17 ++ database/seeders/ClientCaseSeeder.php | 17 ++ database/seeders/ClientSeeder.php | 17 ++ database/seeders/DecisionSeeder.php | 17 ++ database/seeders/EventSeeder.php | 17 ++ database/seeders/PersonSeeder.php | 60 ++-- package-lock.json | 21 ++ package.json | 2 + public/favicon.ico | Bin 0 -> 15406 bytes resources/css/app.css | 2 + resources/js/Components/ApplicationLogo.vue | 6 +- resources/js/Components/ApplicationMark.vue | 5 +- .../js/Components/AuthenticationCardLogo.vue | 10 +- resources/js/Components/BasicTable.vue | 195 ++++++++++++- resources/js/Components/Breadcrumbs.vue | 21 ++ resources/js/Components/ItemGrid.vue | 2 +- resources/js/Components/Pagination.vue | 76 +++++ resources/js/Components/PersonInfoGrid.vue | 36 +++ resources/js/Components/SearchInput.vue | 25 ++ resources/js/Components/SectionTitle.vue | 2 +- resources/js/Layouts/AppLayout.vue | 95 ++---- resources/js/Pages/Cases/Index.vue | 59 ++++ .../Pages/Cases/Partials/ActivityDrawer.vue | 149 ++++++++++ .../js/Pages/Cases/Partials/ActivityTable.vue | 48 +++ .../Pages/Cases/Partials/ContractDrawer.vue | 102 +++++++ .../js/Pages/Cases/Partials/ContractTable.vue | 87 ++++++ resources/js/Pages/Cases/Show.vue | 175 +++++++++++ resources/js/Pages/Client/Index.vue | 46 ++- resources/js/Pages/Client/Show.vue | 167 +++++------ resources/js/Pages/Dashboard.vue | 43 ++- resources/js/Pages/Settings/Index.vue | 36 +++ .../Pages/Settings/Partials/ActionTable.vue | 36 +++ .../Pages/Settings/Partials/DecisionTable.vue | 36 +++ resources/js/Shared/AppObjects.js | 30 +- routes/breadcrumbs.php | 48 +++ routes/web.php | 48 ++- tailwind.config.js | 3 +- 76 files changed, 2822 insertions(+), 427 deletions(-) create mode 100644 app/Http/Controllers/ClientCaseContoller.php create mode 100644 app/Http/Controllers/SettingController.php create mode 100644 app/Models/Action.php create mode 100644 app/Models/Activity.php create mode 100644 app/Models/Client.php create mode 100644 app/Models/ClientCase.php create mode 100644 app/Models/Decision.php create mode 100644 app/Models/Event.php create mode 100644 config/breadcrumbs.php create mode 100644 config/inertia-breadcrumbs.php create mode 100644 database/factories/ActionFactory.php create mode 100644 database/factories/ActivityFactory.php create mode 100644 database/factories/ClientCaseFactory.php create mode 100644 database/factories/ClientFactory.php create mode 100644 database/factories/DecisionFactory.php create mode 100644 database/factories/EventFactory.php create mode 100644 database/migrations/2024_11_02_190342_create_clients_table.php create mode 100644 database/migrations/2024_11_02_190558_create_client_cases_table.php create mode 100644 database/migrations/2024_11_09_213443_create_activities_table.php create mode 100644 database/migrations/2024_11_09_213511_create_actions_table.php create mode 100644 database/migrations/2024_11_09_213534_create_decisions_table.php create mode 100644 database/migrations/2024_11_10_141407_create_events_table.php create mode 100644 database/migrations/2024_11_10_142707_create_decision_events_table.php create mode 100644 database/migrations/2024_11_10_182416_action_decision_table.php create mode 100644 database/seeders/ActionSeeder.php create mode 100644 database/seeders/ActivitySeeder.php create mode 100644 database/seeders/ClientCaseSeeder.php create mode 100644 database/seeders/ClientSeeder.php create mode 100644 database/seeders/DecisionSeeder.php create mode 100644 database/seeders/EventSeeder.php create mode 100644 resources/js/Components/Breadcrumbs.vue create mode 100644 resources/js/Components/Pagination.vue create mode 100644 resources/js/Components/PersonInfoGrid.vue create mode 100644 resources/js/Components/SearchInput.vue create mode 100644 resources/js/Pages/Cases/Index.vue create mode 100644 resources/js/Pages/Cases/Partials/ActivityDrawer.vue create mode 100644 resources/js/Pages/Cases/Partials/ActivityTable.vue create mode 100644 resources/js/Pages/Cases/Partials/ContractDrawer.vue create mode 100644 resources/js/Pages/Cases/Partials/ContractTable.vue create mode 100644 resources/js/Pages/Cases/Show.vue create mode 100644 resources/js/Pages/Settings/Index.vue create mode 100644 resources/js/Pages/Settings/Partials/ActionTable.vue create mode 100644 resources/js/Pages/Settings/Partials/DecisionTable.vue create mode 100644 routes/breadcrumbs.php diff --git a/app/Charts/ExampleChart.php b/app/Charts/ExampleChart.php index 7999c28..0db5cf2 100644 --- a/app/Charts/ExampleChart.php +++ b/app/Charts/ExampleChart.php @@ -15,13 +15,26 @@ public function __construct(LarapexChart $chart) 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() - ->setTitle('Contracts during last six months.') - ->setSubtitle('New and Completed.') - ->addData('New', [4, 9, 5, 2, 1, 8]) - ->addData('Completed', [7, 2, 7, 2, 5, 4]) + ->setTitle('Cases during last six months.') + ->addData('New cases', $newCases) + //->addData('Completed', [7, 2, 7, 2, 5, 4]) ->setColors(['#1A56DB', '#ff6384']) - ->setXAxis(['January', 'February', 'March', 'April', 'May', 'June']) + ->setXAxis($months) ->setToolbar(true) ->toVue(); } diff --git a/app/Http/Controllers/ClientCaseContoller.php b/app/Http/Controllers/ClientCaseContoller.php new file mode 100644 index 0000000..33bf166 --- /dev/null +++ b/app/Http/Controllers/ClientCaseContoller.php @@ -0,0 +1,190 @@ + $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) + { + // + } +} diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 51d471c..9e6cb2c 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -2,66 +2,84 @@ namespace App\Http\Controllers; -use App\Models\Person\Person; -use Auth; +use App\Models\Client; +use DB; use Illuminate\Http\Request; use Inertia\Inertia; class ClientController extends Controller { - public function index(Person $person){ + public function index(Client $client, Request $request){ return Inertia::render('Client/Index',[ - 'persons' => $person::with(['group','type']) - ->selectRaw('person.*,(select count(id) from contracts where client_id=person.id) as contracts') - ->whereHas('group', fn($que) => $que->where('deleted','=',0)) - ->whereHas('type', fn($que) => $que->where('deleted','=',0)) - ->where([ - ['person.active','=',1], - ['person.group_id','=',1] - ])->get(), - 'create_url' => route('client.store'), - 'person_types' => \App\Models\Person\PersonType::all(['id','name','description']) - ->where('deleted','=',0) + 'clients' => $client::query() + ->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 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', [ - '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) { - $reqAddress = $request->input('address'); - $userId = Auth::user()->id; - $address = [ - 'address' => $reqAddress['address'], - 'country' => $reqAddress['country'], - 'type_id' => $reqAddress['type_id'], - 'person_id' => 0, - 'user_id' => $userId - ]; + DB::transaction(function() use ($request){ + $address = $request->input('address'); + $person = \App\Models\Person\Person::create([ + 'nu' => rand(100000,200000), + 'first_name' => $request->input('first_name'), + '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([ - 'nu' => rand(100000,200000), - 'first_name' => $request->input('first_name'), - '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, - 'user_id' => $userId - ])->id; + $person->addresses()->create([ + 'address' => $address['address'], + 'country' => $address['country'], + 'type_id' => $address['type_id'] + ]); - $address['person_id'] = $pid; + $person->client()->create(); + }); - \App\Models\Person\PersonAddress::create($address); + //\App\Models\Person\PersonAddress::create($address); return to_route('client'); diff --git a/app/Http/Controllers/ContractController.php b/app/Http/Controllers/ContractController.php index b370e34..dcd64e0 100644 --- a/app/Http/Controllers/ContractController.php +++ b/app/Http/Controllers/ContractController.php @@ -2,60 +2,60 @@ namespace App\Http\Controllers; +use App\Models\Contract; use Illuminate\Http\Request; +use Inertia\Inertia; + 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) { - $cuuid = $request->input('client_uuid'); - $userId = \Auth::user()->id; - $pReqPer = $request->input('person'); - $pReqCont = $request->input('contract'); - - $cid = \DB::table('person')->where('uuid', $cuuid)->firstOrFail('id')->id; + $uuid = $request->input('client_case_uuid'); + $clientCase = \App\Models\ClientCase::where('uuid', $uuid)->firstOrFail(); - - if(!empty($cid)){ + if( isset($clientCase->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; + \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') + ]); - $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') + ]); + } } diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php new file mode 100644 index 0000000..cd6a189 --- /dev/null +++ b/app/Http/Controllers/SettingController.php @@ -0,0 +1,24 @@ + \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() + ] + ); + } +} diff --git a/app/Models/Action.php b/app/Models/Action.php new file mode 100644 index 0000000..473d9a6 --- /dev/null +++ b/app/Models/Action.php @@ -0,0 +1,25 @@ + */ + use HasFactory; + + public function decisions(): BelongsToMany + { + return $this->belongsToMany(\App\Models\Decision::class); + } + + public function segment(): BelongsTo + { + return $this->belongsTo(\App\Models\Segment::class); + } + +} diff --git a/app/Models/Activity.php b/app/Models/Activity.php new file mode 100644 index 0000000..0ea1e5a --- /dev/null +++ b/app/Models/Activity.php @@ -0,0 +1,50 @@ + */ + 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); + } +} diff --git a/app/Models/Client.php b/app/Models/Client.php new file mode 100644 index 0000000..079dd24 --- /dev/null +++ b/app/Models/Client.php @@ -0,0 +1,35 @@ + */ + 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); + } +} diff --git a/app/Models/ClientCase.php b/app/Models/ClientCase.php new file mode 100644 index 0000000..fb23573 --- /dev/null +++ b/app/Models/ClientCase.php @@ -0,0 +1,46 @@ + */ + 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); + } +} diff --git a/app/Models/Contract.php b/app/Models/Contract.php index 95a797e..1bfd8c1 100644 --- a/app/Models/Contract.php +++ b/app/Models/Contract.php @@ -7,26 +7,27 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; +use Illuminate\Database\Eloquent\SoftDeletes; class Contract extends Model { /** @use HasFactory<\Database\Factories\ContractFactory> */ use HasFactory; use Uuid; + use SoftDeletes; protected $fillable = [ 'reference', 'start_date', 'end_date', - 'client_id', - 'debtor_id', + 'client_case_id', 'type_id', 'description' ]; protected $hidden = [ - 'client_id', - 'debtor_id', + 'id', + 'client_case_id', 'type_id' ]; @@ -35,6 +36,11 @@ public function type(): BelongsTo 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 { return $this->belongsTo(\App\Models\Person\Person::class, 'debtor_id'); diff --git a/app/Models/Decision.php b/app/Models/Decision.php new file mode 100644 index 0000000..6cb7d59 --- /dev/null +++ b/app/Models/Decision.php @@ -0,0 +1,25 @@ + */ + use HasFactory; + + public function actions(): BelongsToMany + { + return $this->belongsToMany(\App\Models\Action::class); + } + + public function events(): BelongsToMany + { + return $this->belongsToMany(\App\Models\Event::class); + } +} diff --git a/app/Models/Event.php b/app/Models/Event.php new file mode 100644 index 0000000..9dce7e8 --- /dev/null +++ b/app/Models/Event.php @@ -0,0 +1,12 @@ + */ + use HasFactory; +} diff --git a/app/Models/Person/Person.php b/app/Models/Person/Person.php index e65f4a8..95bec5d 100644 --- a/app/Models/Person/Person.php +++ b/app/Models/Person/Person.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; use Laravel\Sanctum\HasApiTokens; class Person extends Model @@ -43,6 +44,14 @@ class Person extends Model '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 { @@ -68,16 +77,14 @@ public function type(): BelongsTo 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') - ->with('debtor', fn($que) => - $que->with(['type', 'group']) - ->whereHas('type', fn($tque) => $tque->where('deleted','=',0)) - ->whereHas('group', fn($tque) => $tque->where('deleted','=',0)) - ->where('active','=',1)) - ->with('type', fn($que) => $que->where('deleted','=',0)) - ->where('active', '=', 1); + return $this->hasOne(\App\Models\Client::class); + } + + public function clientCase(): HasOne + { + return $this->hasOne(\App\Models\ClientCase::class); } } diff --git a/app/Models/Person/PersonAddress.php b/app/Models/Person/PersonAddress.php index 05b2d5f..8bba135 100644 --- a/app/Models/Person/PersonAddress.php +++ b/app/Models/Person/PersonAddress.php @@ -26,6 +26,12 @@ class PersonAddress extends Model 'deleted' ]; + protected static function booted(){ + static::creating(function (PersonAddress $address) { + $address->user_id = auth()->id(); + }); + } + public function person(): BelongsTo { return $this->belongsTo(\App\Models\Person\Person::class); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 452e6b6..b6ec3eb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,6 +3,8 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use Illuminate\Foundation\Application; +use Inertia\Inertia; class AppServiceProvider extends ServiceProvider { @@ -12,6 +14,10 @@ class AppServiceProvider extends ServiceProvider public function register(): void { // + Inertia::share([ + 'laravelVersion' => Application::VERSION, + 'phpVersion' => PHP_VERSION + ]); } /** diff --git a/composer.json b/composer.json index 52dc8ba..b64cfcd 100644 --- a/composer.json +++ b/composer.json @@ -7,11 +7,13 @@ "require": { "php": "^8.2", "arielmejiadev/larapex-charts": "^2.1", + "diglactic/laravel-breadcrumbs": "^9.0", "inertiajs/inertia-laravel": "^1.0", "laravel/framework": "^11.9", "laravel/jetstream": "^5.2", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", + "robertboes/inertia-breadcrumbs": "^0.6.0", "tightenco/ziggy": "^2.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index a32bf3d..9385b44 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0a7997fbdd574a14b9c8fdb5ac33c48a", + "content-hash": "32566a0ee8267e886985b5451f39d450", "packages": [ { "name": "arielmejiadev/larapex-charts", @@ -367,6 +367,77 @@ }, "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", "version": "2.0.10", @@ -667,6 +738,59 @@ ], "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", "version": "v1.3.0", @@ -3728,6 +3852,155 @@ ], "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", "version": "v7.1.1", diff --git a/config/breadcrumbs.php b/config/breadcrumbs.php new file mode 100644 index 0000000..3f2837c --- /dev/null +++ b/config/breadcrumbs.php @@ -0,0 +1,75 @@ + '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, + +]; diff --git a/config/inertia-breadcrumbs.php b/config/inertia-breadcrumbs.php new file mode 100644 index 0000000..e6ec888 --- /dev/null +++ b/config/inertia-breadcrumbs.php @@ -0,0 +1,46 @@ + [ + /** + * 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, +]; diff --git a/database/factories/ActionFactory.php b/database/factories/ActionFactory.php new file mode 100644 index 0000000..8e72255 --- /dev/null +++ b/database/factories/ActionFactory.php @@ -0,0 +1,23 @@ + + */ +class ActionFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ActivityFactory.php b/database/factories/ActivityFactory.php new file mode 100644 index 0000000..512ffac --- /dev/null +++ b/database/factories/ActivityFactory.php @@ -0,0 +1,23 @@ + + */ +class ActivityFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ClientCaseFactory.php b/database/factories/ClientCaseFactory.php new file mode 100644 index 0000000..d5b18bf --- /dev/null +++ b/database/factories/ClientCaseFactory.php @@ -0,0 +1,23 @@ + + */ +class ClientCaseFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ClientFactory.php b/database/factories/ClientFactory.php new file mode 100644 index 0000000..8d211a1 --- /dev/null +++ b/database/factories/ClientFactory.php @@ -0,0 +1,23 @@ + + */ +class ClientFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/DecisionFactory.php b/database/factories/DecisionFactory.php new file mode 100644 index 0000000..e9e0ade --- /dev/null +++ b/database/factories/DecisionFactory.php @@ -0,0 +1,23 @@ + + */ +class DecisionFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php new file mode 100644 index 0000000..41c6c10 --- /dev/null +++ b/database/factories/EventFactory.php @@ -0,0 +1,23 @@ + + */ +class EventFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/2024_10_14_185613_create_person_table.php b/database/migrations/2024_10_14_185613_create_person_table.php index 50bcab9..45028e7 100644 --- a/database/migrations/2024_10_14_185613_create_person_table.php +++ b/database/migrations/2024_10_14_185613_create_person_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -24,7 +24,8 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->string('color_tag', 50)->nullable(); + $table->softDeletes(); $table->timestamps(); }); @@ -33,7 +34,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -42,7 +43,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -62,7 +63,7 @@ public function up(): void $table->foreignId('group_id')->references('id')->on('person_groups'); $table->foreignId('type_id')->references('id')->on('person_types'); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->foreignIdFor(\App\Models\User::class); $table->timestamps(); }); @@ -75,7 +76,7 @@ public function up(): void $table->string('description',125)->nullable(); $table->foreignIdFor(\App\Models\Person\Person::class); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->foreignIdFor(\App\Models\User::class); $table->timestamps(); @@ -89,7 +90,7 @@ public function up(): void $table->string('description',125)->nullable(); $table->foreignIdFor(\App\Models\Person\Person::class); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->foreignIdFor(\App\Models\User::class); $table->timestamps(); diff --git a/database/migrations/2024_10_19_090817_create_accounts_table.php b/database/migrations/2024_10_19_090817_create_accounts_table.php index a817c30..c188002 100644 --- a/database/migrations/2024_10_19_090817_create_accounts_table.php +++ b/database/migrations/2024_10_19_090817_create_accounts_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -27,7 +27,7 @@ public function up(): void $table->foreignIdFor(\App\Models\Contract::class); $table->foreignId('type_id')->references('id')->on('account_types'); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); } diff --git a/database/migrations/2024_10_19_100530_create_debts_table.php b/database/migrations/2024_10_19_100530_create_debts_table.php index 8d65e0f..cf29831 100644 --- a/database/migrations/2024_10_19_100530_create_debts_table.php +++ b/database/migrations/2024_10_19_100530_create_debts_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->string('name',50)->unique(); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -34,7 +34,7 @@ public function up(): void $table->foreignId('account_id')->references('id')->on('accounts'); $table->foreignId('type_id')->references('id')->on('debt_types'); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); } diff --git a/database/migrations/2024_10_19_100706_create_payments_table.php b/database/migrations/2024_10_19_100706_create_payments_table.php index 3174382..60a8af2 100644 --- a/database/migrations/2024_10_19_100706_create_payments_table.php +++ b/database/migrations/2024_10_19_100706_create_payments_table.php @@ -16,7 +16,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -30,7 +30,7 @@ public function up(): void $table->foreignId('debt_id')->references('id')->on('debts'); $table->foreignId('type_id')->references('id')->on('payment_types'); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->foreignIdFor(\App\Models\User::class); $table->timestamps(); }); diff --git a/database/migrations/2024_10_20_113420_create_contracts_table.php b/database/migrations/2024_10_20_113420_create_contracts_table.php index 144c9df..c72cd4e 100644 --- a/database/migrations/2024_10_20_113420_create_contracts_table.php +++ b/database/migrations/2024_10_20_113420_create_contracts_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->string('name',50); $table->string('description',125)->nullable(); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); @@ -27,11 +27,10 @@ public function up(): void $table->date('start_date'); $table->date('end_date')->nullable(); $table->string('description', 255)->nullable(); - $table->foreignIdFor(\App\Models\Person\Person::class, 'client_id'); - $table->foreignIdFor(\App\Models\Person\Person::class, 'debtor_id'); + $table->foreignIdFor(\App\Models\ClientCase::class); $table->foreignId('type_id')->references('id')->on('contract_types'); $table->unsignedTinyInteger('active')->default(1); - $table->unsignedTinyInteger('deleted')->default(0); + $table->softDeletes(); $table->timestamps(); }); } diff --git a/database/migrations/2024_11_02_190342_create_clients_table.php b/database/migrations/2024_11_02_190342_create_clients_table.php new file mode 100644 index 0000000..3204462 --- /dev/null +++ b/database/migrations/2024_11_02_190342_create_clients_table.php @@ -0,0 +1,30 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_02_190558_create_client_cases_table.php b/database/migrations/2024_11_02_190558_create_client_cases_table.php new file mode 100644 index 0000000..82b0be6 --- /dev/null +++ b/database/migrations/2024_11_02_190558_create_client_cases_table.php @@ -0,0 +1,31 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_09_213443_create_activities_table.php b/database/migrations/2024_11_09_213443_create_activities_table.php new file mode 100644 index 0000000..c87c301 --- /dev/null +++ b/database/migrations/2024_11_09_213443_create_activities_table.php @@ -0,0 +1,35 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_09_213511_create_actions_table.php b/database/migrations/2024_11_09_213511_create_actions_table.php new file mode 100644 index 0000000..86f7d14 --- /dev/null +++ b/database/migrations/2024_11_09_213511_create_actions_table.php @@ -0,0 +1,30 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_09_213534_create_decisions_table.php b/database/migrations/2024_11_09_213534_create_decisions_table.php new file mode 100644 index 0000000..3aeb05a --- /dev/null +++ b/database/migrations/2024_11_09_213534_create_decisions_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('name', 125); + $table->string('color_tag', 55)->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('decisions'); + } +}; diff --git a/database/migrations/2024_11_10_141407_create_events_table.php b/database/migrations/2024_11_10_141407_create_events_table.php new file mode 100644 index 0000000..f304a8c --- /dev/null +++ b/database/migrations/2024_11_10_141407_create_events_table.php @@ -0,0 +1,30 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_10_142707_create_decision_events_table.php b/database/migrations/2024_11_10_142707_create_decision_events_table.php new file mode 100644 index 0000000..39c3ef3 --- /dev/null +++ b/database/migrations/2024_11_10_142707_create_decision_events_table.php @@ -0,0 +1,29 @@ +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'); + } +}; diff --git a/database/migrations/2024_11_10_182416_action_decision_table.php b/database/migrations/2024_11_10_182416_action_decision_table.php new file mode 100644 index 0000000..82377de --- /dev/null +++ b/database/migrations/2024_11_10_182416_action_decision_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignIdFor(\App\Models\Action::class); + $table->foreignIdFor(\App\Models\Decision::class); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +}; diff --git a/database/seeders/ActionSeeder.php b/database/seeders/ActionSeeder.php new file mode 100644 index 0000000..f41858f --- /dev/null +++ b/database/seeders/ActionSeeder.php @@ -0,0 +1,17 @@ + 'client', 'description' => ''], - [ 'name' => 'debtor', 'description' => ''] + [ 'name' => 'client', 'description' => '', 'color_tag' => 'blue-400'], + [ 'name' => 'client case', 'description' => '', 'color_tag' => 'red-400'] ]; $phoneTypes = [ @@ -80,7 +78,7 @@ public function run(): void 'group_id' => 1, 'type_id' => 1, 'user_id' => 1 - ]); + ])->client()->create(); //debtors Person::create([ @@ -96,6 +94,8 @@ public function run(): void 'group_id' => 2, 'type_id' => 2, 'user_id' => 1 + ])->clientCase()->create([ + 'client_id' => 1 ]); Person::create([ @@ -111,6 +111,8 @@ public function run(): void 'group_id' => 2, 'type_id' => 2, 'user_id' => 1 + ])->clientCase()->create([ + 'client_id' => 1 ]); //client @@ -127,7 +129,7 @@ public function run(): void 'group_id' => 1, 'type_id' => 1, 'user_id' => 1 - ]); + ])->client()->create(); //debtors Person::create([ @@ -143,7 +145,11 @@ public function run(): void 'group_id' => 2, 'type_id' => 2, 'user_id' => 1 - ]); + ])->clientCase()->create( + [ + 'client_id' => 4 + ] + ); Person::create([ 'nu' => rand(100000,200000), @@ -158,41 +164,11 @@ public function run(): void 'group_id' => 2, 'type_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 - ]); - } } diff --git a/package-lock.json b/package-lock.json index 28c87ce..dab8d7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,8 @@ "apexcharts": "^3.54.1", "flowbite": "^2.5.2", "flowbite-vue": "^0.1.6", + "lodash": "^4.17.21", + "tailwindcss-inner-border": "^0.2.0", "vue3-apexcharts": "^1.7.0" }, "devDependencies": { @@ -2271,6 +2273,12 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "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": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", @@ -3246,6 +3254,19 @@ "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": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", diff --git a/package.json b/package.json index 5d92fad..430171c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "apexcharts": "^3.54.1", "flowbite": "^2.5.2", "flowbite-vue": "^0.1.6", + "lodash": "^4.17.21", + "tailwindcss-inner-border": "^0.2.0", "vue3-apexcharts": "^1.7.0" } } diff --git a/public/favicon.ico b/public/favicon.ico index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..eac1ced7667a733813eb24e1246e29d4e4307d24 100644 GIT binary patch literal 15406 zcmeHOYmih&6&@2~67!H~QpPGZD^?PSk3?fI7M5ThC}kxTiFfZ~vjPz}5F|tcNUSn- zv-hze8Z3;W`4I?41WHAMMuTD!9??q0A{bt>?A&{2W`{QtK*Dp!@9TRT?%tZ6$IdLP z-g1>S@&7bW_xR zT`Kj;RjJevz@Q6yg!RbI=`UwCy+5$^#{)+*(~kb$YKUhYeL}|3_xXxYd|Th0 zbB*Roa0Is6f<7HVtNsxQAGpd5o~2IOJNy32WL>e`bM+ya0MnBWc??(PpCiL4AxW)@?BaFmbD(|$l4`8g{ z$sn;@3bsGnXlELbMk3KZ4gBgW0n<#KmuppT%*|47EEFK(bM&MBL-!_P{ceW-o{rK+ zuT|AvG)H2`>APRf)jyMQ^-Wki1(9rRC+(;F#=2M^x9|1jBxC90LFcWAmXCEjcH^{B zm$c6teIe}GIMn-WgFFtyo@;fb?F!nbfWHg2?rSQ>9?bwFPa)6|jvS<%)67Ee9{#sfXwT z8>=0~KJiIeUu}*#o-1fO`kGCq@{UUSzxK113$T|giux76|9Z-zlD=^m&(s=#gZg&7 z(lKP8P%Z}i(uno}%-cbh(SLLtcO_-WyG`J+^@U0Jpw+k;>+or`Zvc&r8CUyJXPfp3 z$oqE@?Om8Vz-UhN{ag}9sqccKoR5B-_pYF|ad;dSYi%-Uo`~>;5F^`<6OJ!qYB8 zj{jgi`^x%qIeeAH)Rtg%nX2t7S_HDz8`YeyPVH^uskG>DZ>r0ifZs&+T zt~yh~QHOy8_EtZYw#Qr}>t&v{jceG3v@5Rf(1B?ouFBUh;GbcitgC%p;t%P=$AX-F z=e{$3pKNCxbmJuCy}LVoVLLhgMH04Lo^g#Og6G!8#yBi+zs!30d=JL!SE-$sF}0v}ZN1Fy^2C;fPLe>kwTuLxX@aVT)L=Il3>i#N_`z65-YMg0+^F8b>d z4|C!Wed<7;`V3uvGUP$5xqm~ykXY8c*p~D~>PesD;r;{PU$~TIS)a`7J^m#Aa^E%4Pw0O+TE*IH(SPVvj(ad|Y_Yj5Mvrxz zk4&3-OUBlJ5ZNrQe{lxwsZYEf>*+4&)jH6pJ)>@)#+u&*otvJAor}Z9%e0H&cP9GN z=AVxG0*AH^cJS^vY$avJ9bivv(5AmB_c!h{s}Q#s&zL~gRNn2;|FrehfC=}-5Y`93 zcIWK-uCIhvDVPHMskEhz!Wv_o;!rd$%H_={u`GOF@cJzF{yXRgmBQKEwtvkXH;DU! zoFB2j+xl9JbpmD4TfDvLm$sDaDc@4-zc+XX`uzV$fN>IpXj9{m2I3?T!ocr;N&-9= z=S}^}{P*=M3w>ns`$8a$mt-ydi-?)u_)2G&a^^%eiL&UnAzxi*ylZHSPI-V&AR@ z&v6{MqyIQ~-cCBSA<*GzmFRmMN4(6wyiWnXPRVPq~`+ z+t|YxS8Qago%;dD#k&Nop~;W~{Ry#-Adj_pw=h%garnmhU%S1W94c-1ohAdcaMvXG z-@x|*#ro2wK+mQ_hu;9~E~JAP@0;LtCwTiC@&}M+pnku=CG3E<262hOyAUr0>~hwJ zNt<7cMzwXqKG@nH1WvK%sE-xfFSpYNvbEm=PR5oZJ|sWLLwhTIp;M6aYR;|XiT63M z5wg9r)Ltn2l*_#~t${id$z^}OSd1UO81`P?K?vG_KY{(}b@-f&S1(1p4RP4+cQcre z=Xoa^mxYHI4&cSTt?)B!{j=rxE7uO0jg906-8cSRNZeEM8@78c=n1(af6K?+M1Gd? z!TmT3@I1gf4Ax)U z3m2yun8sk(!W|K=eDa-Iq^}Q?7w7}luJOb6c~g2k;a1g%gOxF;y~E(^A07+|Cib0F8I-_{d;wgL7)#D6Ex@<~|I z0RKW~F;5xtkc6r9n|%ciu3uX#%6|dA5%^ge@kE=qBXFCB^ZtwHbJ`DaeuRIYbqq0= zSi`WN`eOD?@)EscJ7@fpKG!wIx8=+j;4ffJFTi^EHf$m8ZL~$u1^N>lAAP8;7-Lbn z_6Pr5gM5!8^)})YHU|ExNW$KbZ^1i#yX3l+^UxpslQ#FPpiQ|Mc7?tY?H~6G`V&kn z@5T65iTD-9EBQ_4{l&lJgL;oU#!=WuzXhF|1DP%ypHlQ*XfxJ3;{QU>{zv#3 z#(^l-QVCzx!te~@g|YlcFqYqA9D6`NE>ZR`~G=NmuK2^9ey$WAD#!IGc5I5oM$_6cku$&l1g3dD?Vz)>*2pI9j)pu(5va8 s-te9RF*&@udZmW5c&&U@+h49*uHF8+qpOzZ0r&w43`k%=0@X<1KmS6bkN^Mx literal 0 HcmV?d00001 diff --git a/resources/css/app.css b/resources/css/app.css index 0de2120..631f7ef 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,7 +1,9 @@ +@import '/node_modules/floating-vue/dist/style.css'; @tailwind base; @tailwind components; @tailwind utilities; + [x-cloak] { display: none; } diff --git a/resources/js/Components/ApplicationLogo.vue b/resources/js/Components/ApplicationLogo.vue index e92ee4c..3933bd0 100644 --- a/resources/js/Components/ApplicationLogo.vue +++ b/resources/js/Components/ApplicationLogo.vue @@ -1,7 +1,3 @@ diff --git a/resources/js/Components/ApplicationMark.vue b/resources/js/Components/ApplicationMark.vue index e150674..3933bd0 100644 --- a/resources/js/Components/ApplicationMark.vue +++ b/resources/js/Components/ApplicationMark.vue @@ -1,6 +1,3 @@ diff --git a/resources/js/Components/AuthenticationCardLogo.vue b/resources/js/Components/AuthenticationCardLogo.vue index c5027ec..7c3ff1d 100644 --- a/resources/js/Components/AuthenticationCardLogo.vue +++ b/resources/js/Components/AuthenticationCardLogo.vue @@ -4,14 +4,6 @@ import { Link } from '@inertiajs/vue3'; diff --git a/resources/js/Components/BasicTable.vue b/resources/js/Components/BasicTable.vue index 6c48ad3..d6ed138 100644 --- a/resources/js/Components/BasicTable.vue +++ b/resources/js/Components/BasicTable.vue @@ -1,27 +1,192 @@ \ No newline at end of file diff --git a/resources/js/Components/Breadcrumbs.vue b/resources/js/Components/Breadcrumbs.vue new file mode 100644 index 0000000..59d6507 --- /dev/null +++ b/resources/js/Components/Breadcrumbs.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/resources/js/Components/ItemGrid.vue b/resources/js/Components/ItemGrid.vue index d737c95..e75e83d 100644 --- a/resources/js/Components/ItemGrid.vue +++ b/resources/js/Components/ItemGrid.vue @@ -9,7 +9,7 @@ const props = defineProps({