Demo project

This commit is contained in:
Lasse Hassing committed 2021-06-06 15:15:08 +02:00
1 parent 5e4f3540e8
commit a68267d0f0
146 files changed
+41587

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<title>Budget</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
</body>
</body>
</html>
@@ -0,0 +1,36 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<div class="mb-4 text-sm text-gray-600">
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
</div>
<!-- Validation Errors -->
<x-auth-validation-errors class="mb-4" :errors="$errors" />
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<!-- Password -->
<div>
<x-label for="password" :value="__('Password')" />
<x-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
</div>
<div class="flex justify-end mt-4">
<x-button>
{{ __('Confirm') }}
</x-button>
</div>
</form>
</x-auth-card>
</x-guest-layout>
@@ -0,0 +1,36 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<div class="mb-4 text-sm text-gray-600">
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
</div>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<!-- Validation Errors -->
<x-auth-validation-errors class="mb-4" :errors="$errors" />
<form method="POST" action="{{ route('password.email') }}">
@csrf
<!-- Email Address -->
<div>
<x-label for="email" :value="__('Email')" />
<x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
</div>
<div class="flex items-center justify-end mt-4">
<x-button>
{{ __('Email Password Reset Link') }}
</x-button>
</div>
</form>
</x-auth-card>
</x-guest-layout>
+56
View File
@@ -0,0 +1,56 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<!-- Validation Errors -->
<x-auth-validation-errors class="mb-4" :errors="$errors" />
<form method="POST" action="{{ route('login') }}">
@csrf
<!-- Email Address -->
<div>
<x-label for="email" :value="__('Email')" />
<x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
</div>
<!-- Password -->
<div class="mt-4">
<x-label for="password" :value="__('Password')" />
<x-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
</div>
<!-- Remember Me -->
<div class="block mt-4">
<label for="remember_me" class="inline-flex items-center">
<input id="remember_me" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50" name="remember">
<span class="ml-2 text-sm text-gray-600">{{ __('Remember me') }}</span>
</label>
</div>
<div class="flex items-center justify-end mt-4">
@if (Route::has('password.request'))
<a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('password.request') }}">
{{ __('Forgot your password?') }}
</a>
@endif
<x-button class="ml-3">
{{ __('Log in') }}
</x-button>
</div>
</form>
</x-auth-card>
</x-guest-layout>
+59
View File
@@ -0,0 +1,59 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<!-- Validation Errors -->
<x-auth-validation-errors class="mb-4" :errors="$errors" />
<form method="POST" action="{{ route('register') }}">
@csrf
<!-- Name -->
<div>
<x-label for="name" :value="__('Name')" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus />
</div>
<!-- Email Address -->
<div class="mt-4">
<x-label for="email" :value="__('Email')" />
<x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required />
</div>
<!-- Password -->
<div class="mt-4">
<x-label for="password" :value="__('Password')" />
<x-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="new-password" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-label for="password_confirmation" :value="__('Confirm Password')" />
<x-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required />
</div>
<div class="flex items-center justify-end mt-4">
<a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('login') }}">
{{ __('Already registered?') }}
</a>
<x-button class="ml-4">
{{ __('Register') }}
</x-button>
</div>
</form>
</x-auth-card>
</x-guest-layout>
@@ -0,0 +1,48 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<!-- Validation Errors -->
<x-auth-validation-errors class="mb-4" :errors="$errors" />
<form method="POST" action="{{ route('password.update') }}">
@csrf
<!-- Password Reset Token -->
<input type="hidden" name="token" value="{{ $request->route('token') }}">
<!-- Email Address -->
<div>
<x-label for="email" :value="__('Email')" />
<x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus />
</div>
<!-- Password -->
<div class="mt-4">
<x-label for="password" :value="__('Password')" />
<x-input id="password" class="block mt-1 w-full" type="password" name="password" required />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-label for="password_confirmation" :value="__('Confirm Password')" />
<x-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required />
</div>
<div class="flex items-center justify-end mt-4">
<x-button>
{{ __('Reset Password') }}
</x-button>
</div>
</form>
</x-auth-card>
</x-guest-layout>
@@ -0,0 +1,39 @@
<x-guest-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<div class="mb-4 text-sm text-gray-600">
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
</div>
@if (session('status') == 'verification-link-sent')
<div class="mb-4 font-medium text-sm text-green-600">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</div>
@endif
<div class="mt-4 flex items-center justify-between">
<form method="POST" action="{{ route('verification.send') }}">
@csrf
<div>
<x-button>
{{ __('Resend Verification Email') }}
</x-button>
</div>
</form>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900">
{{ __('Log Out') }}
</button>
</form>
</div>
</x-auth-card>
</x-guest-layout>
+15
View File
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header">
<div class="bg-white">
<h3 class="text-center"><span class="text-4xl">Categories</span></h3>
</div>
</x-slot>
<br>
<div class="p-6 bg-white">
<h3 class="text-center pb-6">Overview</h3>
<livewire:categories />
</div>
</x-app-layout>
@@ -0,0 +1 @@
<img src="/favicon.png" {{ $attributes }}>
@@ -0,0 +1,9 @@
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
<div>
{{ $logo }}
</div>
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
{{ $slot }}
</div>
</div>
@@ -0,0 +1,7 @@
@props(['status'])
@if ($status)
<div {{ $attributes->merge(['class' => 'font-medium text-sm text-green-600']) }}>
{{ $status }}
</div>
@endif
@@ -0,0 +1,15 @@
@props(['errors'])
@if ($errors->any())
<div {{ $attributes }}>
<div class="font-medium text-red-600">
{{ __('Whoops! Something went wrong.') }}
</div>
<ul class="mt-3 list-disc list-inside text-sm text-red-600">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@@ -0,0 +1,3 @@
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring ring-gray-300 disabled:opacity-25 transition ease-in-out duration-150']) }}>
{{ $slot }}
</button>
@@ -0,0 +1 @@
<a {{ $attributes->merge(['class' => 'block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out']) }}>{{ $slot }}</a>
@@ -0,0 +1,43 @@
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
@php
switch ($align) {
case 'left':
$alignmentClasses = 'origin-top-left left-0';
break;
case 'top':
$alignmentClasses = 'origin-top';
break;
case 'right':
default:
$alignmentClasses = 'origin-top-right right-0';
break;
}
switch ($width) {
case '48':
$width = 'w-48';
break;
}
@endphp
<div class="relative" x-data="{ open: false }" @click.away="open = false" @close.stop="open = false">
<div @click="open = ! open">
{{ $trigger }}
</div>
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="transform opacity-0 scale-95"
x-transition:enter-end="transform opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="transform opacity-100 scale-100"
x-transition:leave-end="transform opacity-0 scale-95"
class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}"
style="display: none;"
@click="open = false">
<div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}">
{{ $content }}
</div>
</div>
</div>
@@ -0,0 +1,3 @@
@props(['disabled' => false])
<input {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'rounded-md shadow-sm border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50']) !!}>
@@ -0,0 +1,5 @@
@props(['value'])
<label {{ $attributes->merge(['class' => 'block font-medium text-sm text-gray-700']) }}>
{{ $value ?? $slot }}
</label>
@@ -0,0 +1,11 @@
@props(['active'])
@php
$classes = ($active ?? false)
? 'inline-flex items-center px-1 pt-1 border-b-2 border-indigo-400 text-sm font-medium leading-5 text-gray-900 focus:outline-none focus:border-indigo-700 transition duration-150 ease-in-out'
: 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out';
@endphp
<a {{ $attributes->merge(['class' => $classes]) }}>
{{ $slot }}
</a>
@@ -0,0 +1,11 @@
@props(['active'])
@php
$classes = ($active ?? false)
? 'block pl-3 pr-4 py-2 border-l-4 border-indigo-400 text-base font-medium text-indigo-700 bg-indigo-50 focus:outline-none focus:text-indigo-800 focus:bg-indigo-100 focus:border-indigo-700 transition duration-150 ease-in-out'
: 'block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out';
@endphp
<a {{ $attributes->merge(['class' => $classes]) }}>
{{ $slot }}
</a>
+59
View File
@@ -0,0 +1,59 @@
<x-app-layout>
<x-slot name="header">
<div class="bg-white">
<h3 class="text-center"><a href="/year/{{$year-1}}">{{$year-1}}</a> <span class="text-4xl">{{$year}}</span> <a href="/year/{{$year+1}}">{{$year+1}}</a></h3>
</div>
</x-slot>
<br>
@if(count($categories) == 0)
<div class="p-6 bg-white text-center">
You must create at least one <a href="/categories">category</a> to continue.
</div>
@else
<div class="p-6 bg-white">
<h3 class="text-center pb-6 text-2xl">Projected</h3>
<livewire:projected :year="$year" />
</div>
<br>
<div class="p-6 bg-white mb-8">
<h3 class="text-center pb-6 text-2xl">Actual</h3>
<livewire:actual :year="$year" />
</div>
@endif
<script>
function clearHover() {
if($('table:hover').length == 0) {
$(".hovered").each(function(i) {
$(this).removeClass("hovered");
});
}
setTimeout(clearHover, 1000);
}
window.addEventListener("load", function() {
$("td").hover(function() {
$(".hovered").each(function(i) {
$(this).removeClass("hovered");
});
$(this).parent("tr").find("td").each(function(i) {
$(this).addClass("hovered");
});
var idx = $(this).index();
$(this).closest("table").find("tr").each(function(i) {
$(this).children("td").filter(":nth-child(" + (idx+1) + ")").addClass("hovered");
});
});
clearHover();
});
</script>
</x-app-layout>
+36
View File
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
@livewireStyles
</head>
<body class="font-sans antialiased bg-gray-100">
<div class="bg-gray-100">
@include('layouts.navigation')
<!-- Page Heading -->
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
{{ $header }}
</div>
</header>
</div>
<!-- Page Content -->
{{ $slot }}
</body>
@livewireScripts
</html>
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
</head>
<body>
<div class="font-sans text-gray-900 antialiased">
{{ $slot }}
</div>
</body>
</html>
@@ -0,0 +1,95 @@
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('dashboard') }}">
<x-application-logo class="block h-10 w-auto fill-current text-gray-600" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard') || request()->routeIs('year')">
{{ __('Dashboard') }}
</x-nav-link>
<x-nav-link :href="route('categories')" :active="request()->routeIs('categories')">
{{ __('Categories') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ml-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
<div>{{ Auth::user()->name }}</div>
<div class="ml-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
</div>
<!-- Hamburger -->
<div class="-mr-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
</div>
</nav>
+316
View File
@@ -0,0 +1,316 @@
<div x-data="{ modalFieldUpdate: @entangle('modalFieldUpdate'), modalColumnUpdate: @entangle('modalColumnUpdate'), modalDelete: @entangle('modalDelete') }">
@if(\Auth::user()->hasPosts($year))
<div>
<div class="text-center" >
<input wire:keydown.enter="quickinput" wire:model.defer="quickValue" name="quickValue" type="text" class="form-input px-2 py-2 rounded-md w-2/12" placeholder="Quick value ...">
<select wire:keydown.enter="quickinput" wire:model.defer="quickPostID" name="quickPostID" class="form-input px-2 rounded-md w-2/12" placeholder="Post ...">
@foreach($categories as $category)
<optgroup label="{{$category->name}}">
@foreach($category->posts->where('year', $year) as $category)
<option value="{{$category->id}}">{{$category->name}}</option>
@endforeach
</optgroup>
@endforeach
</select>
<select wire:keydown.enter="quickinput" wire:model.defer="quickMonth" name="quickMonth" class="form-input px-2 rounded-md w-1/12" placeholder="Month ...">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<button wire:click="quickinput" class="form-input px-2 py-2 rounded-md color-white bg-green-200">Add</button>
<span class="border-left pl-3 ml-2">
<a class="rounded-left color-white p-2 {{$switchValuesCSS}}" wire:click="switchMode('values')" href="javascript:;">Values</a><a class="rounded-right p-2 color-white {{$switchDifferenceCSS}}" wire:click="switchMode('difference')" href="javascript:;">Difference</a>
</span>
</div>
<table class="table border-collapse w-full mt-6">
<tr>
<td>&nbsp;</td>
<td wire:click="openColumnUpdate(1)" class="text-right border-left-weak font-bold @if(!$activeMonths[0]) col-muted @endif">Jan</td>
<td wire:click="openColumnUpdate(2)" class="text-right border-left-weak font-bold @if(!$activeMonths[1]) col-muted @endif">Feb</td>
<td wire:click="openColumnUpdate(3)" class="text-right border-left-weak font-bold @if(!$activeMonths[2]) col-muted @endif">Mar</td>
<td wire:click="openColumnUpdate(4)" class="text-right border-left-weak font-bold @if(!$activeMonths[3]) col-muted @endif">Apr</td>
<td wire:click="openColumnUpdate(5)" class="text-right border-left-weak font-bold @if(!$activeMonths[4]) col-muted @endif">May</td>
<td wire:click="openColumnUpdate(6)" class="text-right border-left-weak font-bold @if(!$activeMonths[5]) col-muted @endif">Jun</td>
<td wire:click="openColumnUpdate(7)" class="text-right border-left-weak font-bold @if(!$activeMonths[6]) col-muted @endif">Jul</td>
<td wire:click="openColumnUpdate(8)" class="text-right border-left-weak font-bold @if(!$activeMonths[7]) col-muted @endif">Aug</td>
<td wire:click="openColumnUpdate(9)" class="text-right border-left-weak font-bold @if(!$activeMonths[8]) col-muted @endif">Sep</td>
<td wire:click="openColumnUpdate(10)" class="text-right border-left-weak font-bold @if(!$activeMonths[9]) col-muted @endif">Okt</td>
<td wire:click="openColumnUpdate(11)" class="text-right border-left-weak font-bold @if(!$activeMonths[10]) col-muted @endif">Nov</td>
<td wire:click="openColumnUpdate(12)" class="text-right border-left-weak font-bold @if(!$activeMonths[11]) col-muted @endif">Dec</td>
<td class="text-right border-left font-bold italic">Avg</td>
<td class="text-right border-left-weak font-bold">Total</td>
</tr>
@foreach($categories as $category)
<tr>
<td><strong>{{$category->name}}</strong></td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
</tr>
@foreach($category->posts->where("year", $year) as $post)
<tr>
<td class="@if(!$loop->first) border-top-weak @endif">&nbsp; {{$post->name}}</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[0]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 1)">
{!! $hf->number($post->monthActualValue(1, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[1]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 2)">
{!! $hf->number($post->monthActualValue(2, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[2]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 3)">
{!! $hf->number($post->monthActualValue(3, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[3]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 4)">
{!! $hf->number($post->monthActualValue(4, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[4]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 5)">
{!! $hf->number($post->monthActualValue(5, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[5]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 6)">
{!! $hf->number($post->monthActualValue(6, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[6]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 7)">
{!! $hf->number($post->monthActualValue(7, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[7]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 8)">
{!! $hf->number($post->monthActualValue(8, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[8]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 9)">
{!! $hf->number($post->monthActualValue(9, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[9]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 10)">
{!! $hf->number($post->monthActualValue(10, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[10]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 11)">
{!! $hf->number($post->monthActualValue(11, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[11]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 12)">
{!! $hf->number($post->monthActualValue(12, ($switchMode == "difference"))) !!}
</div>
</td>
<td class="text-right border-left @if(!$loop->first) border-top-weak @endif italic">{!! $hf->number($post->avgActualValue($activeMonthCount, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif font-bold">{!! $hf->number($post->totalActualValue(($switchMode == "difference"))) !!}</td></td>
</tr>
@endforeach
<tr>
<td class="border-top">&nbsp;</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[0]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 1, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[1]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 2, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[2]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 3, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[3]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 4, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[4]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 5, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[5]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 6, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[6]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 7, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[7]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 8, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[8]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 9, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[9]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 10, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[10]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 11, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[11]) col-muted @endif">{!! $hf->number($category->monthActualValue($year, 12, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left font-bold border-top italic">{!! $hf->number($category->avgActualValue($year, $activeMonthCount, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak font-bold border-top">{!! $hf->number($category->totalActualValue($year, ($switchMode == "difference"))) !!}</td>
</tr>
@endforeach
<tr>
<td>&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
</tr>
<tr>
<td class="border-top-strong"><strong>Total</strong></td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[0]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 1, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[1]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 2, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[2]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 3, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[3]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 4, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[4]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 5, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[5]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 6, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[6]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 7, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[7]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 8, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[8]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 9, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[9]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 10, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[10]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 11, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold font-bold @if(!$activeMonths[11]) col-muted @endif">{!! $hf->number(\Auth::user()->monthActualValue($categories, $year, 12, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left border-top-strong font-bold italic">{!! $hf->number(\Auth::user()->avgActualValue($categories, $year, $activeMonthCount, ($switchMode == "difference"))) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold">{!! $hf->number(\Auth::user()->totalActualValue($categories, $year, ($switchMode == "difference"))) !!}</td>
</tr>
</table>
<script>
window.addEventListener("load", function() {
Livewire.on("focusField", inputName => {
setTimeout(function() {
$("input[name="+inputName+"]")[0].select();
$("input[name="+inputName+"]")[0].focus();
}, 100);
});
});
</script>
</div>
@else
<div>
<p class="text-center">
No posts created ...
</p>
</div>
@endif
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-1" role="dialog" aria-modal="true" x-show="modalColumnUpdate">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-1">
{{$columnName}}
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Clear all values for month?<br>
</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="updateColumn" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-yellow-600 text-base font-medium text-white hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 sm:text-sm">
Clear
</button>
<button type="button" wire:click="closeColumnUpdate" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-2" role="dialog" aria-modal="true" x-show="modalFieldUpdate">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-2">
{{$fieldName}} for ({{$fieldMonthName}})
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Added values (<span>{!!$fieldTypeHTML!!}</span>)<br>
</p>
<p>
<span>{!! $fieldHistoryHTML !!}</span>
</p>
</div>
<hr class="my-4">
<input wire:keydown.enter="addValue" wire:model.defer="fieldAddValue" name="fieldAddValue" type="text" class="form-input px-2 py-2 rounded-md w-10/12" placeholder="Add value ...">
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="addValue" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:text-sm">
Add
</button>
<button type="button" wire:click="closeFieldUpdate" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Close
</button>
</div>
</div>
</div>
</div>
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-3" role="dialog" aria-modal="true" x-show="modalDelete">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-3">
{{$fieldName}} for ({{$fieldMonthName}})
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Delete value <span>{!!$deleteValueHTML!!}</span>?<br>
</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="deleteValue" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:text-sm">
Delete
</button>
<button type="button" wire:click="closeDelete" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,51 @@
<div class="text-center" x-data="{ deleteshow: false }">
<input wire:keydown.enter="create" wire:model.defer="name" name="name" type="text" class="form-input px-2 py-1 rounded-md" placeholder="Category name ...">
<button wire:click="create" class="form-input px-2 py-1 rounded-md color-white bg-green-200">Create</button>
<ul class="pt-6 w-4/12 m-auto text-left">
@foreach($categories as $category)
<li>
<span class="text-sm text-gray-600">
[
<a href="javscript:;" class="text-blue-500" wire:click="moveUp({{$category->id}})">↑</a>
<a href="javscript:;" class="text-blue-500" wire:click="moveDown({{$category->id}})">↓</a>
<a href="javscript:;" class="text-red-500" wire:click="$set('deleteID', {{$category->id}})" @click="deleteshow=true">X</a>
]
</span>
{{$category->name}}
</li>
@endforeach
</ul>
<div class="fixed z-10 inset-0 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true" x-show="deleteshow">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Delete category?
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
All posts and data related will also be removed.
</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="delete" @click="deleteshow=false" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:text-sm">
Delete
</button>
<button type="button" @click="deleteshow=false" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,326 @@
<div x-data="{ modalRowUpdate: @entangle('modalRowUpdate'), modalFieldUpdate: @entangle('modalFieldUpdate'), modalColumnUpdate: @entangle('modalColumnUpdate'), modalDelete: @entangle('modalDelete') }">
<div class="text-center" >
<input wire:keydown.enter="createPost" wire:model.defer="createName" name="createName" type="text" class="form-input px-2 py-2 rounded-md w-4/12" placeholder="Name ...">
<select wire:keydown.enter="createPost" wire:model="createType" name="createType" class="form-input px-2 rounded-md w-2/12" placeholder="Type ...">
<option value="expense">Expense Type</option>
<option value="income">Income Type</option>
</select>
<select wire:keydown.enter="createPost" wire:model.defer="createCategoryID" name="createCategoryID" class="form-input px-2 rounded-md w-2/12" placeholder="Category ...">
@foreach($categories as $category)
<option value="{{$category->id}}">{{$category->name}}</option>
@endforeach
</select>
<button wire:click="createPost" class="form-input px-2 py-2 rounded-md color-white bg-green-200">Add</button>
</div>
@if(\Auth::user()->hasPosts($year))
<div>
<table class="table border-collapse w-full mt-6">
<tr>
<td>&nbsp;</td>
<td wire:click="openColumnUpdate(1)" class="text-right border-left-weak font-bold @if(!$activeMonths[0]) col-muted @endif">Jan</td>
<td wire:click="openColumnUpdate(2)" class="text-right border-left-weak font-bold @if(!$activeMonths[1]) col-muted @endif">Feb</td>
<td wire:click="openColumnUpdate(3)" class="text-right border-left-weak font-bold @if(!$activeMonths[2]) col-muted @endif">Mar</td>
<td wire:click="openColumnUpdate(4)" class="text-right border-left-weak font-bold @if(!$activeMonths[3]) col-muted @endif">Apr</td>
<td wire:click="openColumnUpdate(5)" class="text-right border-left-weak font-bold @if(!$activeMonths[4]) col-muted @endif">May</td>
<td wire:click="openColumnUpdate(6)" class="text-right border-left-weak font-bold @if(!$activeMonths[5]) col-muted @endif">Jun</td>
<td wire:click="openColumnUpdate(7)" class="text-right border-left-weak font-bold @if(!$activeMonths[6]) col-muted @endif">Jul</td>
<td wire:click="openColumnUpdate(8)" class="text-right border-left-weak font-bold @if(!$activeMonths[7]) col-muted @endif">Aug</td>
<td wire:click="openColumnUpdate(9)" class="text-right border-left-weak font-bold @if(!$activeMonths[8]) col-muted @endif">Sep</td>
<td wire:click="openColumnUpdate(10)" class="text-right border-left-weak font-bold @if(!$activeMonths[9]) col-muted @endif">Okt</td>
<td wire:click="openColumnUpdate(11)" class="text-right border-left-weak font-bold @if(!$activeMonths[10]) col-muted @endif">Nov</td>
<td wire:click="openColumnUpdate(12)" class="text-right border-left-weak font-bold @if(!$activeMonths[11]) col-muted @endif">Dec</td>
<td class="text-right border-left font-bold italic">Avg</td>
<td class="text-right border-left-weak font-bold">Total</td>
</tr>
@foreach($categories as $category)
<tr>
<td><strong>{{$category->name}}</strong></td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
</tr>
@foreach($category->posts as $post)
<tr>
<td class="@if(!$loop->first) border-top-weak @endif">
<div wire:click="openRowUpdate({{$post->id}})">&nbsp; {{$post->name}}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[0]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 1)">{!! $hf->number($post->monthValue(1)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[1]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 2)">{!! $hf->number($post->monthValue(2)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[2]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 3)">{!! $hf->number($post->monthValue(3)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[3]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 4)">{!! $hf->number($post->monthValue(4)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[4]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 5)">{!! $hf->number($post->monthValue(5)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[5]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 6)">{!! $hf->number($post->monthValue(6)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[6]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 7)">{!! $hf->number($post->monthValue(7)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[7]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 8)">{!! $hf->number($post->monthValue(8)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[8]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 9)">{!! $hf->number($post->monthValue(9)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[9]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 10)">{!! $hf->number($post->monthValue(10)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[10]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 11)">{!! $hf->number($post->monthValue(11)) !!}</div>
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif @if(!$activeMonths[11]) col-muted @endif">
<div wire:click="openFieldUpdate({{$post->id}}, 12)">{!! $hf->number($post->monthValue(12)) !!}</div>
</td>
<td class="text-right border-left @if(!$loop->first) border-top-weak @endif italic">
{!! $hf->number($post->avgValue($activeMonthCount)) !!}
</td>
<td class="text-right border-left-weak @if(!$loop->first) border-top-weak @endif font-bold">
{!! $hf->number($post->totalValue()) !!}</td>
</td>
</tr>
@endforeach
<tr>
<td class="border-top">&nbsp;</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[0]) col-muted @endif">{!! $hf->number($category->monthValue($year, 1)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[1]) col-muted @endif">{!! $hf->number($category->monthValue($year, 2)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[2]) col-muted @endif">{!! $hf->number($category->monthValue($year, 3)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[3]) col-muted @endif">{!! $hf->number($category->monthValue($year, 4)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[4]) col-muted @endif">{!! $hf->number($category->monthValue($year, 5)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[5]) col-muted @endif">{!! $hf->number($category->monthValue($year, 6)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[6]) col-muted @endif">{!! $hf->number($category->monthValue($year, 7)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[7]) col-muted @endif">{!! $hf->number($category->monthValue($year, 8)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[8]) col-muted @endif">{!! $hf->number($category->monthValue($year, 9)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[9]) col-muted @endif">{!! $hf->number($category->monthValue($year, 10)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[10]) col-muted @endif">{!! $hf->number($category->monthValue($year, 11)) !!}</td>
<td class="text-right border-left-weak font-bold border-top @if(!$activeMonths[11]) col-muted @endif">{!! $hf->number($category->monthValue($year, 12)) !!}</td>
<td class="text-right border-left font-bold border-top italic">{!! $hf->number($category->avgValue($year, $activeMonthCount)) !!}</td>
<td class="text-right border-left-weak font-bold border-top">{!! $hf->number($category->totalValue($year)) !!}</td>
</tr>
@endforeach
<tr>
<td>&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
<td class="border-left">&nbsp;</td>
<td class="border-left-weak">&nbsp;</td>
</tr>
<tr>
<td class="border-top-strong"><strong>Total</strong></td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[0]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 1)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[1]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 2)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[2]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 3)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[3]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 4)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[4]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 5)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[5]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 6)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[6]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 7)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[7]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 8)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[8]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 9)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[9]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 10)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold @if(!$activeMonths[10]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 11)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold font-bold @if(!$activeMonths[11]) col-muted @endif">{!! $hf->number(\Auth::user()->monthValue($categories, $year, 12)) !!}</td>
<td class="text-right border-left border-top-strong font-bold italic">{!! $hf->number(\Auth::user()->avgValue($categories, $year, $activeMonthCount)) !!}</td>
<td class="text-right border-left-weak border-top-strong font-bold">{!! $hf->number(\Auth::user()->totalValue($categories, $year)) !!}</td>
</tr>
</table>
</div>
@elseif(count($yearList) > 0)
<div>
<p class="text-center pt-6">
or copy from:
<br>
<select wire:keydown.enter="copyBudget" wire:model.defer="copyYear" name="copyYear" class="form-input px-2 rounded-md w-2/12" placeholder="Year ...">
@foreach($yearList as $y)
<option value="{{$y}}">{{$y}}</option>
@endforeach
</select>
<select wire:keydown.enter="copyBudget" wire:model.defer="copyMethod" name="copyMethod" class="form-input px-2 rounded-md w-2/12" placeholder="Method ...">
<option value="full">With values</option>
<option value="clean">Only posts</option>
</select>
<button wire:click="copyBudget" class="form-input px-2 py-2 rounded-md color-white bg-green-200">Copy</button>
</p>
</div>
@endif
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-1" role="dialog" aria-modal="true" x-show="modalFieldUpdate">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-1">
{{$fieldName}} for ({{$fieldMonthName}})
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Set value (<span>{!!$fieldTypeHTML!!}</span>)<br>
</p>
</div>
<input wire:keydown.enter="updateField" wire:model.defer="fieldValue" name="fieldValue" type="text" class="form-input px-2 py-2 rounded-md w-10/12" placeholder="Value for month ...">
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="updateField" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:text-sm">
Update
</button>
<button type="button" wire:click="closeFieldUpdate" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-2" role="dialog" aria-modal="true" x-show="modalRowUpdate">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-2">
{{$rowName}}
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Set value for all months (<span>{!!$rowTypeHTML!!}</span>)<br>
</p>
</div>
<input wire:keydown.enter="updateRow" wire:model.defer="rowValue" name="rowValue" type="text" class="form-input px-2 py-2 rounded-md w-10/12" placeholder="Value for all months ...">
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="updateRow" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:text-sm">
Update
</button>
<button type="button" wire:click="closeRowUpdate" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
<p class="pt-2 text-sm">
or <a href="javascript:;" wire:click="openDelete" class="text-red-500">delete</a><br>
</p>
</div>
</div>
</div>
</div>
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-3" role="dialog" aria-modal="true" x-show="modalColumnUpdate">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-3">
{{$columnName}}
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Clear all values for month?<br>
</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="updateColumn" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-yellow-600 text-base font-medium text-white hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 sm:text-sm">
Clear
</button>
<button type="button" wire:click="closeColumnUpdate" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<div class="fixed z-10 inset-0 overflow-y-auto" style="display:none" aria-labelledby="modal-title-4" role="dialog" aria-modal="true" x-show="modalDelete">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
<div>
<div class="mt-1 text-center sm:mt-1">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-4">
Delete {{$deleteName}}?
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
All data related will also be removed.
</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 text-center">
<button type="button" wire:click="deletePost" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:text-sm">
Delete
</button>
<button type="button" wire:click="closeDelete" class="inline-flex w-5/12 justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<script>
window.addEventListener("load", function() {
Livewire.on("focusField", inputName => {
setTimeout(function() {
$("input[name="+inputName+"]")[0].select();
$("input[name="+inputName+"]")[0].focus();
}, 100);
});
});
</script>
</div>
+32
View File
@@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>Budget</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link rel="icon" type="image/png" href="/favicon.png"/>
</head>
<body class="bg-blue-900 p-6">
<div class="p-6 max-w-sm mx-auto bg-white rounded-xl shadow-md items-center space-x-4">
<div>
<div class="text-xl pb-2 font-medium text-black">Budget App</div>
<p class="text-md">
A budget app. For budgets. And budgeting.<br>
<span class="text-gray-500 text-sm pl-2">- Lasse Hassing &lt;hello@hassing.org&gt;</span>
</p>
<ul class="pt-4">
<li><a href="/login">Login</a></li>
<li><a href="/register">Register</a></li>
<li><a href="https://github.com/hassing/livewire-buget">Source code</a></li>
</ul>
</div>
</div>
<div class="p-6 w-5/12 mx-auto bg-white rounded-xl shadow-md items-center space-x-4 mt-4">
<div class="video-container"><iframe src="https://www.youtube.com/embed/4h0Manf2Ov0?feature=embed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div>
</body>
</html>