69 lines
2.1 KiB
PHP
69 lines
2.1 KiB
PHP
<?php
|
|
|
|
use App\Livewire\Forms\StoreConnectedAppFrom;
|
|
use App\Models\ConnectionProtocol;
|
|
use App\Models\ConnectionProvider;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Component;
|
|
use Livewire\Attributes\Title;
|
|
|
|
new
|
|
#[Title('Create a service')]
|
|
class extends Component {
|
|
public StoreConnectedAppFrom $form;
|
|
|
|
#[Computed]
|
|
public function providers()
|
|
{
|
|
return ConnectionProvider::query()->get();
|
|
}
|
|
|
|
#[Computed]
|
|
public function protocols()
|
|
{
|
|
return ConnectionProtocol::query()->get()->map(function (ConnectionProtocol $protocol) {
|
|
$protocol->name = ucfirst($protocol->name);
|
|
return $protocol;
|
|
});
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$this->form->save();
|
|
}
|
|
};
|
|
?>
|
|
|
|
<div>
|
|
<x-shared.card :title="__('Create a service')" class="">
|
|
<form wire:submit="save" class="p-4 grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
<x-input wire:model.live.blur="form.name" required :label="__('Name')"/>
|
|
<x-input wire:model.live.blur="form.logoUrl" :label="__('Logo Link')"/>
|
|
<x-choices
|
|
required
|
|
wire:model.live="form.protocolId"
|
|
:label="__('Protocol')"
|
|
:single="true"
|
|
:options="$this->protocols"
|
|
placeholder="Select"
|
|
/>
|
|
<x-choices required
|
|
wire:model.live="form.providerId"
|
|
:label="__('Provider')"
|
|
placeholder="Search ..."
|
|
:single="true"
|
|
:options="$this->providers"
|
|
searchable
|
|
/>
|
|
<div class="md:col-span-2 flex gap-x-4 font-medium justify-end">
|
|
<x-shared.button>Cancel</x-shared.button>
|
|
<x-shared.button type="submit">Save & Add Another</x-shared.button>
|
|
<x-shared.button type="submit"
|
|
class="bg-blue-600 text-blue-50 hover:bg-blue-700 border-blue-600 min-w-20 flex justify-center items-center">
|
|
Save
|
|
</x-shared.button>
|
|
</div>
|
|
</form>
|
|
</x-shared.card>
|
|
</div>
|