Andrew Wallo 5 months ago
parent
commit
7ab0036a23

+ 3
- 0
app/Filament/Forms/Components/CustomTableRepeater.php View File

5
 use Awcodes\TableRepeater\Components\TableRepeater;
5
 use Awcodes\TableRepeater\Components\TableRepeater;
6
 use Closure;
6
 use Closure;
7
 use Filament\Forms\Components\Actions\Action;
7
 use Filament\Forms\Components\Actions\Action;
8
+use Filament\Support\Enums\MaxWidth;
8
 use Illuminate\Contracts\Support\Htmlable;
9
 use Illuminate\Contracts\Support\Htmlable;
9
 use Illuminate\Contracts\View\View;
10
 use Illuminate\Contracts\View\View;
10
 
11
 
93
 
94
 
94
         $this->minItems(1);
95
         $this->minItems(1);
95
 
96
 
97
+        $this->stackAt(MaxWidth::Large);
98
+
96
         $this->extraAttributes(function (): array {
99
         $this->extraAttributes(function (): array {
97
             $attributes = [];
100
             $attributes = [];
98
 
101
 

+ 0
- 8
app/Filament/Forms/Components/DocumentHeaderSection.php View File

2
 
2
 
3
 namespace App\Filament\Forms\Components;
3
 namespace App\Filament\Forms\Components;
4
 
4
 
5
-use App\DTO\CompanyDTO;
6
 use Closure;
5
 use Closure;
7
 use Filament\Forms\Components\FileUpload;
6
 use Filament\Forms\Components\FileUpload;
8
 use Filament\Forms\Components\Group;
7
 use Filament\Forms\Components\Group;
9
 use Filament\Forms\Components\Section;
8
 use Filament\Forms\Components\Section;
10
 use Filament\Forms\Components\Split;
9
 use Filament\Forms\Components\Split;
11
 use Filament\Forms\Components\TextInput;
10
 use Filament\Forms\Components\TextInput;
12
-use Filament\Forms\Components\View;
13
 use Filament\Support\Enums\MaxWidth;
11
 use Filament\Support\Enums\MaxWidth;
14
 use Illuminate\Support\Facades\Auth;
12
 use Illuminate\Support\Facades\Auth;
15
 use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
13
 use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
41
         $this->collapsible();
39
         $this->collapsible();
42
         $this->collapsed();
40
         $this->collapsed();
43
 
41
 
44
-        $company = Auth::user()->currentCompany;
45
-
46
         $this->schema([
42
         $this->schema([
47
             Split::make([
43
             Split::make([
48
                 Group::make([
44
                 Group::make([
72
                         ->default(fn () => $this->getDefaultHeader()),
68
                         ->default(fn () => $this->getDefaultHeader()),
73
                     TextInput::make('subheader')
69
                     TextInput::make('subheader')
74
                         ->default(fn () => $this->getDefaultSubheader()),
70
                         ->default(fn () => $this->getDefaultSubheader()),
75
-                    View::make('filament.forms.components.company-info')
76
-                        ->viewData([
77
-                            'companyDTO' => CompanyDTO::fromModel($company),
78
-                        ]),
79
                 ])->grow(true),
71
                 ])->grow(true),
80
             ])->from('md'),
72
             ])->from('md'),
81
         ]);
73
         ]);

+ 5
- 0
app/View/Models/DocumentTotalViewModel.php View File

32
 
32
 
33
         $grandTotalInCents = $subtotalInCents + ($taxTotalInCents - $discountTotalInCents);
33
         $grandTotalInCents = $subtotalInCents + ($taxTotalInCents - $discountTotalInCents);
34
 
34
 
35
+        // Amount Due is the same as Grand Total for now, but can be modified later to account for payments
36
+        $amountDueInCents = $grandTotalInCents;
37
+
35
         $conversionMessage = $this->buildConversionMessage($grandTotalInCents, $currencyCode, $defaultCurrencyCode);
38
         $conversionMessage = $this->buildConversionMessage($grandTotalInCents, $currencyCode, $defaultCurrencyCode);
36
 
39
 
37
         return [
40
         return [
39
             'taxTotal' => CurrencyConverter::formatCentsToMoney($taxTotalInCents, $currencyCode),
42
             'taxTotal' => CurrencyConverter::formatCentsToMoney($taxTotalInCents, $currencyCode),
40
             'discountTotal' => CurrencyConverter::formatCentsToMoney($discountTotalInCents, $currencyCode),
43
             'discountTotal' => CurrencyConverter::formatCentsToMoney($discountTotalInCents, $currencyCode),
41
             'grandTotal' => CurrencyConverter::formatCentsToMoney($grandTotalInCents, $currencyCode),
44
             'grandTotal' => CurrencyConverter::formatCentsToMoney($grandTotalInCents, $currencyCode),
45
+            'amountDue' => CurrencyConverter::formatCentsToMoney($amountDueInCents, $currencyCode),
46
+            'currencyCode' => $currencyCode,
42
             'conversionMessage' => $conversionMessage,
47
             'conversionMessage' => $conversionMessage,
43
         ];
48
         ];
44
     }
49
     }

+ 38
- 29
resources/views/filament/forms/components/document-totals.blade.php View File

12
     $isPerDocumentDiscount = $discountMethod->isPerDocument();
12
     $isPerDocumentDiscount = $discountMethod->isPerDocument();
13
 @endphp
13
 @endphp
14
 
14
 
15
-<div class="totals-summary w-full sm:pr-14">
16
-    <table class="w-full text-right table-fixed hidden sm:table">
15
+<div class="totals-summary w-full lg:pl-[4rem] lg:pr-[6rem] py-8 lg:py-0">
16
+    <table class="w-full text-right table-fixed hidden lg:table">
17
         <colgroup>
17
         <colgroup>
18
-            <col class="w-[20%]"> {{-- Items --}}
19
-            <col class="w-[30%]"> {{-- Description --}}
18
+            <col class="w-[30%]"> {{-- Items --}}
20
             <col class="w-[10%]"> {{-- Quantity --}}
19
             <col class="w-[10%]"> {{-- Quantity --}}
21
             <col class="w-[10%]"> {{-- Price --}}
20
             <col class="w-[10%]"> {{-- Price --}}
22
-            <col class="w-[20%]"> {{-- Taxes --}}
21
+            <col class="w-[15%]">
22
+            <col class="w-[15%]"> {{-- Adjustments --}}
23
             <col class="w-[10%]"> {{-- Amount --}}
23
             <col class="w-[10%]"> {{-- Amount --}}
24
         </colgroup>
24
         </colgroup>
25
         <tbody>
25
         <tbody>
26
             <tr>
26
             <tr>
27
                 <td colspan="4"></td>
27
                 <td colspan="4"></td>
28
-                <td class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white">Subtotal:</td>
29
-                <td class="text-sm pl-4 py-2 leading-6">{{ $subtotal }}</td>
28
+                <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white">Subtotal:</td>
29
+                <td class="text-sm p-2">{{ $subtotal }}</td>
30
             </tr>
30
             </tr>
31
             <tr>
31
             <tr>
32
                 <td colspan="4"></td>
32
                 <td colspan="4"></td>
33
-                <td class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white">Taxes:</td>
34
-                <td class="text-sm pl-4 py-2 leading-6">{{ $taxTotal }}</td>
33
+                <td class="text-sm p-2">Tax:</td>
34
+                <td class="text-sm p-2">{{ $taxTotal }}</td>
35
             </tr>
35
             </tr>
36
             @if($isPerDocumentDiscount)
36
             @if($isPerDocumentDiscount)
37
                 <tr>
37
                 <tr>
38
-                    <td colspan="3" class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white text-right">Discount:</td>
39
-                    <td colspan="2" class="text-sm px-4 py-2">
38
+                    <td colspan="3" class="text-sm p-2">Discount:</td>
39
+                    <td colspan="2" class="text-sm p-2">
40
                         <div class="flex justify-between space-x-2">
40
                         <div class="flex justify-between space-x-2">
41
                             @foreach($getChildComponentContainer()->getComponents() as $component)
41
                             @foreach($getChildComponentContainer()->getComponents() as $component)
42
                                 <div class="flex-1 text-left">{{ $component }}</div>
42
                                 <div class="flex-1 text-left">{{ $component }}</div>
43
                             @endforeach
43
                             @endforeach
44
                         </div>
44
                         </div>
45
                     </td>
45
                     </td>
46
-                    <td class="text-sm pl-4 py-2 leading-6">({{ $discountTotal }})</td>
46
+                    <td class="text-sm p-2">({{ $discountTotal }})</td>
47
                 </tr>
47
                 </tr>
48
             @else
48
             @else
49
                 <tr>
49
                 <tr>
50
                     <td colspan="4"></td>
50
                     <td colspan="4"></td>
51
-                    <td class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white">Discounts:</td>
52
-                    <td class="text-sm pl-4 py-2 leading-6">({{ $discountTotal }})</td>
51
+                    <td class="text-sm p-2">Discount:</td>
52
+                    <td class="text-sm p-2">({{ $discountTotal }})</td>
53
                 </tr>
53
                 </tr>
54
             @endif
54
             @endif
55
-            <tr class="font-semibold">
55
+            <tr>
56
+                <td colspan="4"></td>
57
+                <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white">Total:</td>
58
+                <td class="text-sm p-2">{{ $grandTotal }}</td>
59
+            </tr>
60
+            <tr>
56
                 <td colspan="4"></td>
61
                 <td colspan="4"></td>
57
-                <td class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white">Total:</td>
58
-                <td class="text-sm pl-4 py-2 leading-6">{{ $grandTotal }}</td>
62
+                <td class="text-sm p-2 font-semibold text-gray-950 dark:text-white border-t-4 border-double">Amount Due ({{ $currencyCode }}):</td>
63
+                <td class="text-sm p-2 border-t-4 border-double">{{ $amountDue }}</td>
59
             </tr>
64
             </tr>
60
             @if($conversionMessage)
65
             @if($conversionMessage)
61
                 <tr>
66
                 <tr>
62
-                    <td colspan="6" class="text-sm pl-4 py-2 leading-6 text-gray-600">
67
+                    <td colspan="6" class="text-sm p-2 text-gray-600">
63
                         {{ $conversionMessage }}
68
                         {{ $conversionMessage }}
64
                     </td>
69
                     </td>
65
                 </tr>
70
                 </tr>
68
     </table>
73
     </table>
69
 
74
 
70
     <!-- Mobile View -->
75
     <!-- Mobile View -->
71
-    <div class="block sm:hidden p-5">
76
+    <div class="block lg:hidden">
72
         <div class="flex flex-col space-y-6">
77
         <div class="flex flex-col space-y-6">
73
             <div class="flex justify-between items-center">
78
             <div class="flex justify-between items-center">
74
-                <span class="text-sm font-medium text-gray-950 dark:text-white">Subtotal:</span>
75
-                <span class="text-sm text-gray-950 dark:text-white">{{ $subtotal }}</span>
79
+                <span class="text-sm font-semibold text-gray-950 dark:text-white">Subtotal:</span>
80
+                <span class="text-sm">{{ $subtotal }}</span>
76
             </div>
81
             </div>
77
             <div class="flex justify-between items-center">
82
             <div class="flex justify-between items-center">
78
-                <span class="text-sm font-medium text-gray-950 dark:text-white">Taxes:</span>
79
-                <span class="text-sm text-gray-950 dark:text-white">{{ $taxTotal }}</span>
83
+                <span class="text-sm">Tax:</span>
84
+                <span class="text-sm">{{ $taxTotal }}</span>
80
             </div>
85
             </div>
81
             @if($isPerDocumentDiscount)
86
             @if($isPerDocumentDiscount)
82
                 <div class="flex flex-col space-y-2">
87
                 <div class="flex flex-col space-y-2">
83
-                    <span class="text-sm font-medium text-gray-950 dark:text-white">Discount:</span>
88
+                    <span class="text-sm">Discount:</span>
84
                     <div class="flex justify-between space-x-2">
89
                     <div class="flex justify-between space-x-2">
85
                         @foreach($getChildComponentContainer()->getComponents() as $component)
90
                         @foreach($getChildComponentContainer()->getComponents() as $component)
86
                             <div class="w-1/2">{{ $component }}</div>
91
                             <div class="w-1/2">{{ $component }}</div>
89
                 </div>
94
                 </div>
90
             @else
95
             @else
91
                 <div class="flex justify-between items-center">
96
                 <div class="flex justify-between items-center">
92
-                    <span class="text-sm font-medium text-gray-950 dark:text-white">Discounts:</span>
93
-                    <span class="text-sm text-gray-950 dark:text-white">({{ $discountTotal }})</span>
97
+                    <span class="text-sm">Discount:</span>
98
+                    <span class="text-sm">({{ $discountTotal }})</span>
94
                 </div>
99
                 </div>
95
             @endif
100
             @endif
96
-            <div class="flex justify-between items-center font-semibold">
97
-                <span class="text-sm font-medium text-gray-950 dark:text-white">Total:</span>
98
-                <span class="text-sm text-gray-950 dark:text-white">{{ $grandTotal }}</span>
101
+            <div class="flex justify-between items-center">
102
+                <span class="text-sm font-semibold text-gray-950 dark:text-white">Total:</span>
103
+                <span class="text-sm">{{ $grandTotal }}</span>
104
+            </div>
105
+            <div class="flex justify-between items-center">
106
+                <span class="text-sm font-semibold text-gray-950 dark:text-white">Amount Due ({{ $currencyCode }}):</span>
107
+                <span class="text-sm">{{ $amountDue }}</span>
99
             </div>
108
             </div>
100
             @if($conversionMessage)
109
             @if($conversionMessage)
101
                 <div class="text-sm text-gray-600">
110
                 <div class="text-sm text-gray-600">

Loading…
Cancel
Save