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