diff --git a/app/Console/Commands/InvalidateVouchersCommand.php b/app/Console/Commands/InvalidateVouchersCommand.php new file mode 100644 index 0000000..8e58b08 --- /dev/null +++ b/app/Console/Commands/InvalidateVouchersCommand.php @@ -0,0 +1,43 @@ +date) < time()) { + Voucher::where('hash', $voucher->hash)->update(['expired' => 1]); + } + } + + fwrite($file, date('Y-m-d H:i:s') . " [CRON] Invalidated $counter vouchers\n"); + } +} diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index 891ca97..ff18bd7 100644 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -15,4 +15,9 @@ public function bill(): void { Artisan::call('app:monthly-bill'); } + + public function invalidateVouchers(): void + { + Artisan::call('app:invalidate-vouchers'); + } } diff --git a/app/Http/Controllers/VouchersController.php b/app/Http/Controllers/VouchersController.php index 1c003e9..f39f14f 100644 --- a/app/Http/Controllers/VouchersController.php +++ b/app/Http/Controllers/VouchersController.php @@ -17,7 +17,7 @@ class VouchersController extends Controller public function index(): View { return view('admin.vouchers.index', [ - 'vouchers' => Voucher::where(['accepted' => 0])->get(), + 'vouchers' => Voucher::where(['accepted' => 0, 'expired' => 0])->get(), ]); } diff --git a/database/migrations/2024_03_13_194717_alter_vouchers_table.php b/database/migrations/2024_03_13_194717_alter_vouchers_table.php new file mode 100644 index 0000000..e24fdce --- /dev/null +++ b/database/migrations/2024_03_13_194717_alter_vouchers_table.php @@ -0,0 +1,28 @@ +boolean('expired')->default(0)->after('price'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('vouchers', function (Blueprint $table) { + $table->dropColumn('expired'); + }); + } +}; diff --git a/public/css/tailwind.css b/public/css/tailwind.css index 3fa31fd..2c92ae8 100644 --- a/public/css/tailwind.css +++ b/public/css/tailwind.css @@ -1073,6 +1073,14 @@ video { position: relative; } +.end-2 { + inset-inline-end: 0.5rem; +} + +.end-2\.5 { + inset-inline-end: 0.625rem; +} + .left-0 { left: 0px; } @@ -1089,14 +1097,6 @@ video { top: 0px; } -.end-2 { - inset-inline-end: 0.5rem; -} - -.end-2\.5 { - inset-inline-end: 0.625rem; -} - .top-3 { top: 0.75rem; } @@ -1243,10 +1243,6 @@ video { margin-top: auto; } -.ms-3 { - margin-inline-start: 0.75rem; -} - .block { display: block; } @@ -1335,6 +1331,10 @@ video { width: 16.666667%; } +.w-12 { + width: 3rem; +} + .w-2\/3 { width: 66.666667%; } @@ -1367,22 +1367,14 @@ video { width: 24rem; } -.w-full { - width: 100%; -} - -.w-12 { - width: 3rem; -} - -.w-1\/4 { - width: 25%; -} - .w-\[120px\] { width: 120px; } +.w-full { + width: 100%; +} + .max-w-2xl { max-width: 42rem; } @@ -1491,11 +1483,6 @@ video { row-gap: 4rem; } -.gap-x-4 { - -moz-column-gap: 1rem; - column-gap: 1rem; -} - .space-x-2 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(0.5rem * var(--tw-space-x-reverse)); @@ -1526,12 +1513,6 @@ video { margin-bottom: calc(2rem * var(--tw-space-y-reverse)); } -.space-x-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(1rem * var(--tw-space-x-reverse)); - margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); -} - .overflow-x-auto { overflow-x: auto; } @@ -1903,6 +1884,11 @@ video { color: rgb(21 128 61 / var(--tw-text-opacity)); } +.text-indigo-600 { + --tw-text-opacity: 1; + color: rgb(79 70 229 / var(--tw-text-opacity)); +} + .text-indigo-700 { --tw-text-opacity: 1; color: rgb(67 56 202 / var(--tw-text-opacity)); @@ -1938,11 +1924,6 @@ video { color: rgb(234 179 8 / var(--tw-text-opacity)); } -.text-indigo-600 { - --tw-text-opacity: 1; - color: rgb(79 70 229 / var(--tw-text-opacity)); -} - .opacity-0 { opacity: 0; } @@ -2068,20 +2049,6 @@ video { color: rgb(255 255 255 / var(--tw-text-opacity)); } -.hover\:text-blue-700:hover { - --tw-text-opacity: 1; - color: rgb(29 78 216 / var(--tw-text-opacity)); -} - -.focus\:z-10:focus { - z-index: 10; -} - -.focus\:outline-none:focus { - outline: 2px solid transparent; - outline-offset: 2px; -} - .focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); @@ -2104,11 +2071,6 @@ video { --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)); } -.focus\:ring-gray-100:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(243 244 246 / var(--tw-ring-opacity)); -} - :is(.dark .dark\:block) { display: block; } @@ -2171,6 +2133,11 @@ video { background-color: rgb(220 38 38 / var(--tw-bg-opacity)); } +:is(.dark .dark\:text-gray-200) { + --tw-text-opacity: 1; + color: rgb(229 231 235 / var(--tw-text-opacity)); +} + :is(.dark .dark\:text-gray-400) { --tw-text-opacity: 1; color: rgb(156 163 175 / var(--tw-text-opacity)); @@ -2191,11 +2158,6 @@ video { color: rgb(255 255 255 / var(--tw-text-opacity)); } -:is(.dark .dark\:text-gray-200) { - --tw-text-opacity: 1; - color: rgb(229 231 235 / var(--tw-text-opacity)); -} - :is(.dark .odd\:dark\:bg-gray-900):nth-child(odd) { --tw-bg-opacity: 1; background-color: rgb(17 24 39 / var(--tw-bg-opacity)); @@ -2251,11 +2213,6 @@ video { --tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity)); } -:is(.dark .dark\:focus\:ring-gray-700:focus) { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity)); -} - @media (min-width: 640px) { .sm\:ml-64 { margin-left: 16rem; diff --git a/resources/views/admin/vouchers/validate.latte b/resources/views/admin/vouchers/validate.latte index 8e7d20b..cca5a4e 100644 --- a/resources/views/admin/vouchers/validate.latte +++ b/resources/views/admin/vouchers/validate.latte @@ -3,32 +3,27 @@ {block content}
{$voucher['hash']}
+{$voucher['price']|number:0,',', ' '},-
+{$voucher['dateFrom']|date:'j. n. Y'} - {$voucher['dateTo']|date:'j. n. Y'}
+