buttons work now after style tags removed

This commit is contained in:
spencerrlongg 2023-12-05 16:41:25 -06:00
parent d3967b37cd
commit 080d196138
3 changed files with 179 additions and 192 deletions

View file

@ -2,7 +2,7 @@
namespace App\Http\Livewire; namespace App\Http\Livewire;
use Illuminate\Support\Facades\Auth; use Laravel\Passport\Client;
use Laravel\Passport\ClientRepository; use Laravel\Passport\ClientRepository;
use Livewire\Component; use Livewire\Component;
@ -29,11 +29,12 @@ class OauthClients extends Component
//$newClient = ; //$newClient = ;
$this->dispatchBrowserEvent('clientCreated', $newClient->accessToken); //$this->dispatchBrowserEvent('clientCreated', $newClient->accessToken);
} }
public function deleteClient($clientId): void public function deleteClient(Client $clientId): void
{ {
Auth::user()->clients()->find($clientId)->delete(); //->delete must be of type Client - thus the model binding
app(ClientRepository::class)->delete($clientId);
} }
} }

View file

@ -1,43 +1,30 @@
<style scoped> <div>
.action-link { <div class="panel panel-default">
cursor: pointer; <div class="panel-heading">
} <div style="display: flex; justify-content: space-between; align-items: center;">
<h2>
(Livewire) OAuth Clients
</h2>
.m-b-none { <a class="action-link"
margin-bottom: 0;
}
</style>
<template>
<div>
<div class="panel panel-default">
<div class="panel-heading">
<div style="display: flex; justify-content: space-between; align-items: center;">
<h2>
(Livewire) OAuth Clients
</h2>
<a class="action-link"
{{-- @click="showCreateClientForm"--}} {{-- @click="showCreateClientForm"--}}
> >
Create New Client Create New Client
</a> </a>
</div>
</div> </div>
</div>
<div class="panel-body"> <div class="panel-body">
<!-- Current Clients --> <!-- Current Clients -->
@if($clients->count() === 0) @if($clients->count() === 0)
<p class="m-b-none"> <p class="m-b-none">
You have not created any OAuth clients. You have not created any OAuth clients.
</p> </p>
@endif @endif
@if($clients->count() > 0) @if($clients->count() > 0)
<table class="table table-borderless m-b-none" <table class="table table-borderless m-b-none">
{{-- v-if="clients.length > 0"--}} <thead>
>
<thead>
<tr> <tr>
<th>Client ID</th> <th>Client ID</th>
<th>Name</th> <th>Name</th>
@ -45,12 +32,11 @@
<th><span class="sr-only">Edit</span></th> <th><span class="sr-only">Edit</span></th>
<th><span class="sr-only">Delete</span></th> <th><span class="sr-only">Delete</span></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($clients as $client) @foreach($clients as $client)
<tr <tr>
>
<!-- ID --> <!-- ID -->
<td style="vertical-align: middle;"> <td style="vertical-align: middle;">
{{ $client->id }} {{ $client->id }}
@ -76,175 +62,175 @@
</td> </td>
<!-- Delete Button --> <!-- Delete Button -->
<td style="vertical-align: middle;"> <td style="vertical-align: middle;" class="text-right">
<a class="action-link btn btn-danger btn-sm" <a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')">
wire:click="deleteClient('{{ $client->id }}')" <i class="fas fa-trash"></i>
>
Delete
</a> </a>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
@endif @endif
</div>
</div> </div>
</div>
<!-- Create Client Modal --> <!-- Create Client Modal -->
<div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog"> <div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2 class="modal-title"> <h2 class="modal-title">
Create Client Create Client
</h2> </h2>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger"
{{-- v-if="createForm.errors.length > 0"--}}
>
<p><strong>Whoops!</strong> Something went wrong!</p>
<br>
<ul>
<li
{{-- v-for="error in createForm.errors"--}}
>
{{-- {{ error }}--}}
</li>
</ul>
</div> </div>
<div class="modal-body"> <!-- Create Client Form -->
<!-- Form Errors --> <form class="form-horizontal" role="form">
<div class="alert alert-danger" <!-- Name -->
{{-- v-if="createForm.errors.length > 0"--}} <div class="form-group">
> <label class="col-md-3 control-label" for="create-client-name">Name</label>
<p><strong>Whoops!</strong> Something went wrong!</p>
<br>
<ul>
<li
{{-- v-for="error in createForm.errors"--}}
>
{{-- {{ error }}--}}
</li>
</ul>
</div>
<!-- Create Client Form --> <div class="col-md-7">
<form class="form-horizontal" role="form"> <input id="create-client-name" type="text" aria-label="create-client-name" class="form-control"
<!-- Name -->
<div class="form-group">
<label class="col-md-3 control-label" for="create-client-name">Name</label>
<div class="col-md-7">
<input id="create-client-name" type="text" aria-label="create-client-name" class="form-control"
{{-- @keyup.enter="store" --}} {{-- @keyup.enter="store" --}}
{{-- v-model="createForm.name"--}} {{-- v-model="createForm.name"--}}
>
<span class="help-block">
Something your users will recognize and trust.
</span>
</div>
</div>
<!-- Redirect URL -->
<div class="form-group">
<label class="col-md-3 control-label" for="redirect">Redirect URL</label>
<div class="col-md-7">
<input type="text" class="form-control" aria-label="redirect" name="redirect"
{{-- @keyup.enter="store" --}}
{{-- v-model="createForm.redirect"--}}
>
<span class="help-block">
Your application's authorization callback URL.
</span>
</div>
</div>
</form>
</div>
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary"
{{-- @click="store"--}}
>
Create
</button>
</div>
</div>
</div>
</div>
<!-- Edit Client Modal -->
<div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button " class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Edit Client
</h4>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger"
{{-- v-if="editForm.errors.length > 0"--}}
>
<p><strong>Whoops!</strong> Something went wrong!</p>
<br>
<ul>
<li
{{-- v-for="error in editForm.errors"--}}
> >
{{-- {{ error }}--}}
</li> <span class="help-block">
</ul> Something your users will recognize and trust.
</span>
</div>
</div> </div>
<!-- Edit Client Form --> <!-- Redirect URL -->
<form class="form-horizontal" role="form"> <div class="form-group">
<!-- Name --> <label class="col-md-3 control-label" for="redirect">Redirect URL</label>
<div class="form-group">
<label class="col-md-3 control-label" for="edit-client-name">Name</label>
<div class="col-md-7"> <div class="col-md-7">
<input id="edit-client-name" type="text" aria-label="edit-client-name" class="form-control" <input type="text" class="form-control" aria-label="redirect" name="redirect"
{{-- @keyup.enter="update" --}} {{-- @keyup.enter="store" --}}
{{-- v-model="editForm.name"--}} {{-- v-model="createForm.redirect"--}}
> >
<span class="help-block"> <span class="help-block">
Something your users will recognize and trust. Your application's authorization callback URL.
</span> </span>
</div>
</div> </div>
</div>
</form>
</div>
<!-- Redirect URL --> <!-- Modal Actions -->
<div class="form-group"> <div class="modal-footer">
<label class="col-md-3 control-label" for="redirect">Redirect URL</label> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<div class="col-md-7"> <button type="button" class="btn btn-primary"
<input type="text" class="form-control" name="redirect" aria-label="redirect" {{-- @click="store"--}}
{{-- @keyup.enter="update" --}} >
{{-- v-model="editForm.redirect"--}} Create
> </button>
<span class="help-block">
Your application's authorization callback URL.
</span>
</div>
</div>
</form>
</div>
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary"
{{-- @click="update"--}}
>
Save Changes
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template>
<!-- Edit Client Modal -->
<div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Edit Client
</h4>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger"
{{-- v-if="editForm.errors.length > 0"--}}
>
<p><strong>Whoops!</strong> Something went wrong!</p>
<br>
<ul>
<li
{{-- v-for="error in editForm.errors"--}}
>
{{-- {{ error }}--}}
</li>
</ul>
</div>
<!-- Edit Client Form -->
<form class="form-horizontal" role="form">
<!-- Name -->
<div class="form-group">
<label class="col-md-3 control-label" for="edit-client-name">Name</label>
<div class="col-md-7">
<input id="edit-client-name" type="text" aria-label="edit-client-name" class="form-control"
{{-- @keyup.enter="update" --}}
{{-- v-model="editForm.name"--}}
>
<span class="help-block">
Something your users will recognize and trust.
</span>
</div>
</div>
<!-- Redirect URL -->
<div class="form-group">
<label class="col-md-3 control-label" for="redirect">Redirect URL</label>
<div class="col-md-7">
<input type="text" class="form-control" name="redirect" aria-label="redirect"
{{-- @keyup.enter="update" --}}
{{-- v-model="editForm.redirect"--}}
>
<span class="help-block">
Your application's authorization callback URL.
</span>
</div>
</div>
</form>
</div>
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary"
{{-- @click="update"--}}
>
Save Changes
</button>
</div>
</div>
</div>
</div>
<script>
</script>
</div>

View file

@ -15,7 +15,7 @@
@if (!config('app.lock_passwords')) @if (!config('app.lock_passwords'))
<div id="app"> <div id="app">
<livewire:oauth-clients /> <livewire:oauth-clients />
<passport-clients clients-url="{{ url('oauth/clients') }}"></passport-clients> {{-- <passport-clients clients-url="{{ url('oauth/clients') }}"></passport-clients>--}}
<passport-authorized-clients clients-url="{{ url('oauth/clients') }}" tokens-url="{{ url('oauth/tokens') }}"></passport-authorized-clients> <passport-authorized-clients clients-url="{{ url('oauth/clients') }}" tokens-url="{{ url('oauth/tokens') }}"></passport-authorized-clients>
</div> </div>
@else @else