From 7034393dced2a97fc5317e3e44b0fe59fb47d34d Mon Sep 17 00:00:00 2001 From: Jesus Guerrero Date: Fri, 15 Mar 2024 18:03:02 -0400 Subject: [PATCH] chore: Fix .env example and budget polishing --- .env.docker | 8 +- .env.example | 2 +- .../Finance/FinancePayeeController.php | 61 ++++ .../Modules/occurrence/OccurrenceCard.vue | 6 +- resources/js/Pages/Finance/Budget.vue | 4 +- resources/js/Pages/Finance/Payee.vue | 266 ++++++++++++++++++ .../components/NextPaymentItem.vue | 36 ++- 7 files changed, 361 insertions(+), 22 deletions(-) create mode 100644 app/Http/Controllers/Finance/FinancePayeeController.php create mode 100644 resources/js/Pages/Finance/Payee.vue diff --git a/.env.docker b/.env.docker index 4723c2ba..83d764c8 100644 --- a/.env.docker +++ b/.env.docker @@ -9,11 +9,11 @@ LOG_CHANNEL=stack LOG_LEVEL=debug DB_CONNECTION=mysql -DB_HOST=db -DB_PORT=3307 +DB_HOST=localhost +DB_PORT=3306 DB_DATABASE=loger DB_USERNAME=root -DB_PASSWORD=password +DB_PASSWORD=noenose BROADCAST_DRIVER=mercure CACHE_DRIVER=file @@ -56,7 +56,7 @@ VITE_GOOGLE_APP_KEY= VITE_GOOGLE_CLIENT_ID= VITE_WEATHER_ENDPOINT=https://fcc-weather-api.glitch.me/api/current? -# MERCURE_URL=https://localhost/.well-known/mercure +MERCURE_URL=https://localhost/.well-known/mercure MERCURE_SECRET="!ChangeThisMercureHubJWTSecretKey!" MERCURE_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!" MERCURE_PUBLISHER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!" diff --git a/.env.example b/.env.example index fdf61158..d95615f9 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=myhouse_crm +DB_DATABASE=loger DB_USERNAME=root DB_PASSWORD= diff --git a/app/Http/Controllers/Finance/FinancePayeeController.php b/app/Http/Controllers/Finance/FinancePayeeController.php new file mode 100644 index 00000000..f5d81f95 --- /dev/null +++ b/app/Http/Controllers/Finance/FinancePayeeController.php @@ -0,0 +1,61 @@ +reportService = $reportService; + $this->model = $payee; + $this->templates = [ + 'index' => 'Finance/Payee', + 'show' => 'Finance/Payee', + ]; + $this->searchable = ['id', 'date', 'concent']; + $this->includes = [ + 'transactions', + ]; + $this->appends = []; + } + + public function show(Payee $payee) + { + $queryParams = request()->query(); + $response = Gate::inspect('show', $payee); + $settings = Setting::getByTeam(auth()->user()->current_team_id); + $timeZone = $settings['team_timezone'] ?? config('app.timezone'); + + if (! $response->allowed()) { + return redirect(route('finance')); + } + + $filters = isset($queryParams['filter']) ? $queryParams['filter'] : []; + [$startDate, $endDate] = $this->getFilterDates($filters, $timeZone); + + return inertia($this->templates['show'], [ + 'sectionTitle' => $payee->name, + 'payeeId' => $payee->id, + 'resource' => $payee, + 'transactions' => $payee->transactionSplits(50, $startDate, $endDate, request()->only(['search', 'page', 'limit', 'direction'])), + // 'stats' => $this->reportService->getPayeeStats($payee->id, $startDate, $endDate), + 'serverSearchOptions' => [], + ]); + } +} diff --git a/resources/js/Components/Modules/occurrence/OccurrenceCard.vue b/resources/js/Components/Modules/occurrence/OccurrenceCard.vue index 4b5dad4b..729c5284 100644 --- a/resources/js/Components/Modules/occurrence/OccurrenceCard.vue +++ b/resources/js/Components/Modules/occurrence/OccurrenceCard.vue @@ -10,7 +10,11 @@ defineProps<{ checks: IOccurrenceCheck[]; }>() const getDayDiff = (lastDay: string): number => { - return differenceInCalendarDays(new Date(), parseISO(lastDay)); + try { + return differenceInCalendarDays(new Date(), parseISO(lastDay)); + } catch (e) { + return "--" + } } diff --git a/resources/js/Pages/Finance/Budget.vue b/resources/js/Pages/Finance/Budget.vue index a2d8b466..d7e8d371 100644 --- a/resources/js/Pages/Finance/Budget.vue +++ b/resources/js/Pages/Finance/Budget.vue @@ -210,9 +210,9 @@ onMounted(() => {
-

+

diff --git a/resources/js/Pages/Finance/Payee.vue b/resources/js/Pages/Finance/Payee.vue new file mode 100644 index 00000000..6be6b24d --- /dev/null +++ b/resources/js/Pages/Finance/Payee.vue @@ -0,0 +1,266 @@ + + + diff --git a/resources/js/domains/transactions/components/NextPaymentItem.vue b/resources/js/domains/transactions/components/NextPaymentItem.vue index 0d86ed92..6280248d 100644 --- a/resources/js/domains/transactions/components/NextPaymentItem.vue +++ b/resources/js/domains/transactions/components/NextPaymentItem.vue @@ -1,28 +1,36 @@