Andrew Wallo 6 kuukautta sitten
vanhempi
commit
2584ab58e3

+ 22
- 4
app/Filament/Company/Resources/Purchases/BillResource.php Näytä tiedosto

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace App\Filament\Company\Resources\Purchases;
4 4
 
5
+use App\Enums\Accounting\AdjustmentStatus;
5 6
 use App\Enums\Accounting\BillStatus;
6 7
 use App\Enums\Accounting\DocumentDiscountMethod;
7 8
 use App\Enums\Accounting\DocumentType;
@@ -117,17 +118,17 @@ class BillResource extends Resource
117 118
                                     Header::make($settings->resolveColumnLabel('item_name', 'Items'))
118 119
                                         ->width($hasDiscounts ? '15%' : '20%'),
119 120
                                     Header::make('Description')
120
-                                        ->width($hasDiscounts ? '25%' : '30%'),
121
+                                        ->width($hasDiscounts ? '15%' : '20%'), // Reduced from 25%/30%
121 122
                                     Header::make($settings->resolveColumnLabel('unit_name', 'Quantity'))
122 123
                                         ->width('10%'),
123 124
                                     Header::make($settings->resolveColumnLabel('price_name', 'Price'))
124 125
                                         ->width('10%'),
125 126
                                     Header::make('Taxes')
126
-                                        ->width($hasDiscounts ? '15%' : '20%'),
127
+                                        ->width($hasDiscounts ? '20%' : '30%'), // Increased from 15%/20%
127 128
                                 ];
128 129
 
129 130
                                 if ($hasDiscounts) {
130
-                                    $headers[] = Header::make('Discounts')->width('15%');
131
+                                    $headers[] = Header::make('Discounts')->width('20%'); // Increased from 15%
131 132
                                 }
132 133
 
133 134
                                 $headers[] = Header::make($settings->resolveColumnLabel('amount_name', 'Amount'))
@@ -146,7 +147,14 @@ class BillResource extends Resource
146 147
                                     ->live()
147 148
                                     ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
148 149
                                         $offeringId = $state;
149
-                                        $offeringRecord = Offering::with(['purchaseTaxes', 'purchaseDiscounts'])->find($offeringId);
150
+                                        $offeringRecord = Offering::with([
151
+                                            'purchaseTaxes' => function ($query) {
152
+                                                $query->where('status', AdjustmentStatus::Active);
153
+                                            },
154
+                                            'purchaseDiscounts' => function ($query) {
155
+                                                $query->where('status', AdjustmentStatus::Active);
156
+                                            },
157
+                                        ])->find($offeringId);
150 158
 
151 159
                                         if (! $offeringRecord) {
152 160
                                             return;
@@ -180,6 +188,11 @@ class BillResource extends Resource
180 188
                                 Forms\Components\Select::make('purchaseTaxes')
181 189
                                     ->label('Taxes')
182 190
                                     ->relationship('purchaseTaxes', 'name')
191
+                                    ->disableOptionWhen(function (string $value) {
192
+                                        $adjustment = Adjustment::find($value);
193
+
194
+                                        return $adjustment?->status !== AdjustmentStatus::Active;
195
+                                    })
183 196
                                     ->saveRelationshipsUsing(null)
184 197
                                     ->dehydrated(true)
185 198
                                     ->preload()
@@ -189,6 +202,11 @@ class BillResource extends Resource
189 202
                                 Forms\Components\Select::make('purchaseDiscounts')
190 203
                                     ->label('Discounts')
191 204
                                     ->relationship('purchaseDiscounts', 'name')
205
+                                    ->disableOptionWhen(function (string $value) {
206
+                                        $adjustment = Adjustment::find($value);
207
+
208
+                                        return $adjustment?->status !== AdjustmentStatus::Active;
209
+                                    })
192 210
                                     ->saveRelationshipsUsing(null)
193 211
                                     ->dehydrated(true)
194 212
                                     ->preload()

+ 35
- 58
resources/css/filament/company/form-fields.css Näytä tiedosto

@@ -29,10 +29,6 @@
29 29
 }
30 30
 
31 31
 /* Choices.js select field overrides */
32
-.choices__list.choices__list--single {
33
-    @apply w-full;
34
-}
35
-
36 32
 .choices:focus-visible {
37 33
     outline: none;
38 34
 }
@@ -41,85 +37,66 @@
41 37
     @apply text-gray-900 dark:text-white font-semibold;
42 38
 }
43 39
 
44
-.choices[data-type="select-one"] .choices__inner {
45
-    line-height: 1.5;
46
-    display: flex;
47
-    align-items: center;
48
-    min-height: 2.25rem;
49
-    box-sizing: border-box;
50
-}
51
-
52 40
 .choices:not(.is-disabled) .choices__item {
53 41
     cursor: pointer;
54 42
 }
55 43
 
56
-/* Base horizontal scrolling */
57
-.table-repeater-container {
58
-    overflow-x: auto;
59
-    max-width: 100%;
60
-    -webkit-overflow-scrolling: touch;
61
-}
62
-
63
-.table-repeater-container:has(.choices.is-open) {
64
-    overflow: visible;
65
-}
66
-
67
-.table-repeater-container table {
68
-    min-width: 100%;
69
-    width: max-content;
70
-}
71
-
72
-.fi-ta-table:has(.budget-items-relation-manager) {
73
-    .fi-ta-row {
74
-        @apply divide-x divide-gray-200 dark:divide-gray-700;
44
+/* Table Repeater Styles */
45
+:not(.is-spreadsheet) {
46
+    .table-repeater-container {
47
+        @apply rounded-none ring-0;
75 48
     }
76 49
 
77
-    .fi-ta-summary-row-heading {
78
-        @apply px-3 py-3 !important;
50
+    .table-repeater-component {
51
+        @apply space-y-10;
79 52
     }
80 53
 
81
-    .fi-ta-text-summary {
82
-        @apply px-3 py-3 !important;
83
-
84
-        > span {
85
-            @apply font-medium text-gray-950 dark:text-white;
86
-        }
54
+    .table-repeater-component ul {
55
+        @apply justify-start;
87 56
     }
88 57
 
89
-    .fi-ta-text {
90
-        @apply px-3 py-0 !important;
58
+    .table-repeater-row {
59
+        @apply divide-x-0 !important;
91 60
     }
92 61
 
93
-    .fi-ta-text-input {
94
-        @apply px-0 py-0 !important;
62
+    .table-repeater-column {
63
+        @apply py-2 !important;
95 64
     }
96 65
 
97
-    .fi-ta-icon {
98
-        @apply px-3 py-0 !important;
66
+    .table-repeater-header {
67
+        @apply rounded-t-none !important;
99 68
     }
100 69
 
101
-    .fi-ta-text-input {
102
-        .fi-input-wrp,
103
-        .fi-input {
104
-            @apply ring-0 bg-transparent shadow-none rounded-none !important;
105
-        }
70
+    .table-repeater-rows-wrapper {
71
+        @apply divide-gray-300 last:border-b last:border-gray-300 dark:divide-white/20 dark:last:border-white/20;
106 72
     }
107 73
 
108
-    .fi-ta-cell:focus-within {
109
-        outline: 2px solid #2563eb;
110
-        outline-offset: -2px;
111
-        z-index: 1;
74
+    .table-repeater-header tr {
75
+        @apply divide-x-0 text-base sm:text-sm sm:leading-6 !important;
112 76
     }
113 77
 
114
-    .fi-ta-col-wrp button:focus {
115
-        outline: none !important;
116
-        box-shadow: none !important;
78
+    .table-repeater-header-column {
79
+        @apply ps-3 pe-3 font-semibold bg-gray-200 dark:bg-gray-800 rounded-none !important;
117 80
     }
118 81
 }
119 82
 
120
-
121 83
 /* Excel/Spreadsheet styling */
122 84
 .is-spreadsheet {
85
+    .table-repeater-container {
86
+        overflow-x: auto;
87
+        max-width: 100%;
88
+        -webkit-overflow-scrolling: touch;
89
+    }
90
+
91
+    .table-repeater-container:has(.choices.is-open) {
92
+        overflow: visible;
93
+    }
94
+
95
+    .table-repeater-container table {
96
+        min-width: 100%;
97
+        width: max-content;
98
+    }
99
+
123 100
     .table-repeater-container {
124 101
         border: 1px solid #e5e7eb !important;
125 102
         border-radius: 0 !important;

+ 48
- 0
resources/css/filament/company/theme.css Näytä tiedosto

@@ -53,3 +53,51 @@
53 53
     pointer-events: none;
54 54
     z-index: -1;
55 55
 }
56
+
57
+.fi-ta-table:has(.budget-items-relation-manager) {
58
+    .fi-ta-row {
59
+        @apply divide-x divide-gray-200 dark:divide-gray-700;
60
+    }
61
+
62
+    .fi-ta-summary-row-heading {
63
+        @apply px-3 py-3 !important;
64
+    }
65
+
66
+    .fi-ta-text-summary {
67
+        @apply px-3 py-3 !important;
68
+
69
+        > span {
70
+            @apply font-medium text-gray-950 dark:text-white;
71
+        }
72
+    }
73
+
74
+    .fi-ta-text {
75
+        @apply px-3 py-0 !important;
76
+    }
77
+
78
+    .fi-ta-text-input {
79
+        @apply px-0 py-0 !important;
80
+    }
81
+
82
+    .fi-ta-icon {
83
+        @apply px-3 py-0 !important;
84
+    }
85
+
86
+    .fi-ta-text-input {
87
+        .fi-input-wrp,
88
+        .fi-input {
89
+            @apply ring-0 bg-transparent shadow-none rounded-none !important;
90
+        }
91
+    }
92
+
93
+    .fi-ta-cell:focus-within {
94
+        outline: 2px solid #2563eb;
95
+        outline-offset: -2px;
96
+        z-index: 1;
97
+    }
98
+
99
+    .fi-ta-col-wrp button:focus {
100
+        outline: none !important;
101
+        box-shadow: none !important;
102
+    }
103
+}

Loading…
Peruuta
Tallenna