Skip to content

Commit

Permalink
Merge pull request #347 from mkocansey/development
Browse files Browse the repository at this point in the history
Fix: select component 500 error
  • Loading branch information
mkocansey authored Sep 16, 2024
2 parents 1d27f9c + 0470c2c commit 24d14e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
3 changes: 2 additions & 1 deletion resources/views/components/input.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
$suffix_is_icon = true;
$suffix_icon_css = 'hidden cursor-pointer dark:!bg-dark-900/60 dark:hover:!bg-dark-900 !p-0.5 !rounded-full bg-gray-400 !stroke-2 hover:bg-gray-600 text-white';
}
if($attributes->has('readonly', 'disabled')){
if($attributes->has('readonly') || $attributes->has('disabled')) {
if($attributes->get('readonly') == 'false') $attributes = $attributes->except('readonly');
if($attributes->get('disabled') == 'false') $attributes = $attributes->except('disabled');
}
Expand Down
17 changes: 3 additions & 14 deletions resources/views/components/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,14 @@
$filter = preg_replace('/[\s-]/', '_', $filter);
$selected_value = ($selected_value != '') ? explode(',', str_replace(', ', ',', $selected_value)) : [];
if ($data !== 'manual' && count($data)) {
if ($data !== 'manual') {
$data = (!is_array($data)) ? json_decode(str_replace('"', '"', $data), true) : $data;
if(! isset($data[0][$label_key]) ) {
die('<p style="color:red">
&lt;x-bladewind.select /&gt;: ensure the value you set as label_key
exists in your array data</p>');
}
if( !empty($flag_key) && !isset($data[0][$flag_key]) ) {
die('<p style="color:red">
&lt;x-bladewind.select /&gt;: ensure the value you set as flag_key exists in your array</p>');
}
}
$size = (!in_array($size, ['small','medium', 'regular', 'big'])) ? 'medium' : $size;
$sizes = [ 'small' => 'py-[6px]', 'medium' => 'py-[10px]', 'regular' => 'py-[6.5px]', 'big' => 'py-[18.5px]' ];
@endphp
<style>
<style xmlns:x-bladewind="http://www.w3.org/1999/html">
.display-area::-webkit-scrollbar {
display: none;
width: 0 !important;
Expand Down Expand Up @@ -218,7 +207,7 @@ class="!border-0 !border-b !rounded-none focus:!border-slate-300 dark:focus:!bor
onselect="{{ $onselect }}"
flag="{{ $item[$flag_key] ?? '' }}"
image="{{ $item[$image_key] ?? '' }}"
selected="{{ (in_array($item[$value_key], $selected_value)) ? 'true' : 'false' }}" />
selected="{{ (in_array($item[$value_key], $selected_value)) ? 'true' : 'false' }}"/>
@empty
<x-bladewind::select-item
:selectable="false"
Expand Down

0 comments on commit 24d14e4

Please sign in to comment.