From 691c7e3765009bfb70335ffb8c54b5855bc49cab Mon Sep 17 00:00:00 2001 From: pbao9 Date: Sat, 14 Feb 2026 22:10:30 +0700 Subject: [PATCH] feat: Enhance Select2 functionality with clearable options and custom placeholders, and apply new card styling to the order add page. --- .../administrator/layout/master.blade.php | 14 ++--- .../administrator/pages/order/add.blade.php | 54 +++++++++---------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/resources/views/administrator/layout/master.blade.php b/resources/views/administrator/layout/master.blade.php index 8db0230..97b435f 100644 --- a/resources/views/administrator/layout/master.blade.php +++ b/resources/views/administrator/layout/master.blade.php @@ -78,17 +78,19 @@ window.initSelect2 = function() { $(".select2").each(function () { if (!$(this).hasClass('select2-hidden-accessible')) { + var placeholder = $(this).data('placeholder') || 'Select an option'; $(this).select2({ - allowClear: false, + allowClear: true, width: "100%", + placeholder: placeholder, }); } }); }; - $(document).ready(function () { - window.initSelect2(); - }); + $(document).ready(function () { + window.initSelect2(); + }); // Global ModalManager initialization document.addEventListener('DOMContentLoaded', function() { @@ -107,8 +109,8 @@ @stack('custom-scripts') diff --git a/resources/views/administrator/pages/order/add.blade.php b/resources/views/administrator/pages/order/add.blade.php index 76bed80..69cdde0 100644 --- a/resources/views/administrator/pages/order/add.blade.php +++ b/resources/views/administrator/pages/order/add.blade.php @@ -3,11 +3,11 @@ @section('breadcrumb') @php - $breadcrumbItems = [ - ['label' => 'Order'], - ['label' => 'Order Management', 'url' => route('administrator.pages.order.index')], - ['label' => 'Add New Order', 'active' => true], - ]; +$breadcrumbItems = [ + ['label' => 'Order'], + ['label' => 'Order Management', 'url' => route('administrator.pages.order.index')], + ['label' => 'Add New Order', 'active' => true], +]; @endphp @endsection @@ -18,12 +18,12 @@ @csrf