<x-wireui:modal-card title="{{ $roleId ? __('roles.EditRole') : __('roles.CreateNew') }}" blur wire:model.defer="showCreateModal">
    <div class="space-y-4">
        <x-wireui:input label="{{__('roles.role_name')}}" wire:model.defer="name" />
        <x-wireui:select
            label="{{__('roles.permissions')}}"
            wire:model.defer="selectedPermissions"
            placeholder="{{__('roles.select_permissions')}}"
            multiselect
            option-label="label"
            option-value="value"
            :options="$permissions->map(fn($p) => ['value' => $p->id, 'label' => $p->name])->toArray()"
        />
    </div>

    <x-slot name="footer">
        <div class="flex justify-between w-full">
            <x-wireui:button flat label="{{__('roles.cancel')}}" @click="$wire.showCreateModal = false" />
            <x-wireui:button primary label="{{__('roles.submit')}}" wire:click="save" />
        </div>
    </x-slot>
</x-wireui:modal-card>