Fix: array is not correctly serialized, causing mary-choices to break
This commit is contained in:
parent
feaa8b6c93
commit
1ef7957a05
@ -88,6 +88,14 @@ public function boot(TicketService $ticketService, UserAppAccessService $appAcce
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
// Auto-open drawer if requested from URL
|
||||
if ($this->raise) {
|
||||
$this->drawerOpen = true;
|
||||
if ($this->appId) {
|
||||
$this->form->connectedAppId = $this->appId;
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-populate dynamic choice lists
|
||||
$this->searchApps();
|
||||
$this->searchRoles();
|
||||
@ -100,18 +108,11 @@ public function mount(): void
|
||||
$this->form->notifiedRoleIds = [$defaultRole->id];
|
||||
}
|
||||
|
||||
// Auto-open drawer if requested from URL
|
||||
if ($this->raise) {
|
||||
$this->drawerOpen = true;
|
||||
if ($this->appId) {
|
||||
$this->form->connectedAppId = $this->appId;
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-open ticket if requested from URL
|
||||
if ($this->ticketParam && (int) $this->ticketParam > 0) {
|
||||
$this->showTicket((int) $this->ticketParam);
|
||||
}
|
||||
ds($this->appId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,14 +194,14 @@ public function searchApps(string $value = ''): void
|
||||
}
|
||||
}
|
||||
|
||||
$this->appsSearchable = $apps
|
||||
$this->appsSearchable = array_values($apps
|
||||
->when('' !== $value,
|
||||
fn($col) => $col->filter(fn($app) => str_contains(strtolower($app->name), strtolower($value))))
|
||||
->map(fn($app) => [
|
||||
'id' => $app->id,
|
||||
'name' => $app->name.(isset($app->days_remaining) ? ' ('.$app->days_remaining.' days left)' : ''),
|
||||
])
|
||||
->toArray();
|
||||
->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +211,7 @@ public function searchRoles(string $value = ''): void
|
||||
{
|
||||
$selectedIds = $this->form->notifiedRoleIds;
|
||||
|
||||
$this->rolesSearchable = Role::query()
|
||||
$this->rolesSearchable = array_values(Role::query()
|
||||
->where(function ($query) use ($value, $selectedIds): void {
|
||||
if ('' !== $value) {
|
||||
$query->where('name', 'like', "%{$value}%");
|
||||
@ -221,7 +222,7 @@ public function searchRoles(string $value = ''): void
|
||||
})
|
||||
->select('id', 'name')
|
||||
->get()
|
||||
->toArray();
|
||||
->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -231,7 +232,7 @@ public function searchUsers(string $value = ''): void
|
||||
{
|
||||
$selectedIds = $this->form->notifiedUserIds;
|
||||
|
||||
$this->usersSearchable = User::query()
|
||||
$this->usersSearchable = array_values(User::query()
|
||||
->where('id', '!=', auth()->id())
|
||||
->where(function ($query) use ($value, $selectedIds): void {
|
||||
if ('' !== $value) {
|
||||
@ -244,7 +245,7 @@ public function searchUsers(string $value = ''): void
|
||||
})
|
||||
->select('id', 'name')
|
||||
->get()
|
||||
->toArray();
|
||||
->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -672,13 +673,15 @@ class="w-11/12 md:w-5/12 p-6 bg-white"
|
||||
<!-- Connected App Selection (Nullable & Searchable) -->
|
||||
<x-mary-choices
|
||||
wire:model="form.connectedAppId"
|
||||
:label="__('Select Service (Expiring Soon)')"
|
||||
placeholder="Search/Select service..."
|
||||
:label="__('Select Apps')"
|
||||
placeholder="Search/Select apps..."
|
||||
:options="$appsSearchable"
|
||||
:single="true"
|
||||
search-function="searchApps"
|
||||
searchable
|
||||
option-value="id"
|
||||
/>
|
||||
@ds($appsSearchable)
|
||||
|
||||
<!-- Issue Category -->
|
||||
<x-mary-select
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user