2024-04-25 05:27:45 +00:00
<!-- $o = User :: class -->
2021-06-18 15:09:34 +00:00
@ extends ( 'layouts.app' )
@ section ( 'htmlheader_title' )
@ if ( $o -> exists ) Update @ else Add @ endif User
@ endsection
@ section ( 'content' )
2024-12-06 00:16:38 +00:00
< form class = " needs-validation " method = " post " autocomplete = " off " novalidate >
2021-06-18 15:09:34 +00:00
@ csrf
< div class = " row " >
< div class = " col-12 " >
2024-04-25 05:44:06 +00:00
@ includeWhen ( session () -> has ( 'success' ), 'widgets.success-row' ,[ 'msg' => session () -> get ( 'success' )])
2021-06-18 15:09:34 +00:00
< div class = " greyframe titledbox shadow0xb0 " >
2024-04-22 04:27:48 +00:00
< h2 class = " cap " >@ if ( $o -> exists ) Update @ else Add @ endif User </ h2 >
2023-12-19 00:16:08 +00:00
2024-04-22 04:27:48 +00:00
< div class = " row " >
< div class = " col-4 " >
< label for = " name " class = " form-label " > Name </ label >
< div class = " input-group has-validation " >
< span class = " input-group-text " >< i class = " bi bi-tag-fill " ></ i ></ span >
2024-04-25 05:27:45 +00:00
< input type = " text " class = " form-control @error('name') is-invalid @enderror " id = " name " placeholder = " Name " name = " name " value = " { { old('name', $o->name ) }} " autocomplete = " name " required @ cannot ( 'admin' , $o ) disabled @ endcannot autofocus >
2024-04-22 04:27:48 +00:00
< span class = " invalid-feedback " role = " alert " >
@ error ( 'name' )
{{ $message }}
@ else
A name is required .
@ enderror
</ span >
</ div >
</ div >
2021-06-18 15:09:34 +00:00
2024-04-22 04:27:48 +00:00
< div class = " col-3 " >
< label for = " alias " class = " form-label " > BBS Alias </ label >
< div class = " input-group has-validation " >
< span class = " input-group-text " >< i class = " bi bi-tag-fill " ></ i ></ span >
2024-04-25 05:27:45 +00:00
< input type = " text " class = " form-control @error('alias') is-invalid @enderror " id = " alias " placeholder = " alias " name = " alias " value = " { { old('alias', $o->alias ) }} " @ cannot ( 'update' , $o ) disabled @ endcannot >
2024-04-22 04:27:48 +00:00
< span class = " invalid-feedback " role = " alert " >
@ error ( 'alias' )
{{ $message }}
@ enderror
</ span >
</ div >
</ div >
2023-08-02 12:42:59 +00:00
2024-04-22 04:27:48 +00:00
<!-- Forward Netmail -->
2024-04-25 05:27:45 +00:00
@ can ( 'admin' , $o )
< div class = " col-4 " >
< label for = " system_id " class = " form-label " > Forward Netmails </ label >
< div class = " input-group has-validation " >
< span class = " input-group-text " >< i class = " bi bi-envelope-at-fill " ></ i ></ span >
2024-06-03 11:11:02 +00:00
< select style = " width: 80%; " class = " form-select @error('system_id') is-invalid @enderror " id = " system_id " name = " system_id " >
2024-04-25 05:27:45 +00:00
< option value = " " >& nbsp ; </ option >
@ foreach ( $o -> systems as $oo )
< option value = " { { $oo->id }} " @ if ( old ( 'system_id' , $o -> system_id ) == $oo -> id ) selected @ endif > {{ $oo -> name }} </ option >
@ endforeach
</ select >
< span class = " invalid-feedback " role = " alert " >
@ error ( 'system_id' )
{{ $message }}
@ enderror
</ span >
</ div >
</ div >
@ endcan
</ div >
< div class = " row " >
2024-04-22 04:27:48 +00:00
< div class = " col-4 " >
2024-04-25 05:27:45 +00:00
< label for = " email " class = " form-label " > Email </ label >
2024-04-22 04:27:48 +00:00
< div class = " input-group has-validation " >
2024-04-25 05:27:45 +00:00
< span class = " input-group-text " >< i class = " bi bi-person-badge " ></ i ></ span >
< input type = " text " class = " form-control @error('email') is-invalid @enderror " id = " email " placeholder = " Email " name = " email " value = " { { old('email', $o->email ) }} " autocomplete = " email " required @ cannot ( 'update' , $o ) disabled @ endcannot >
2024-04-22 04:27:48 +00:00
< span class = " invalid-feedback " role = " alert " >
2024-04-25 05:27:45 +00:00
@ error ( 'email' )
2024-04-22 04:27:48 +00:00
{{ $message }}
2024-04-25 05:27:45 +00:00
@ else
Email required for login .
2024-04-22 04:27:48 +00:00
@ enderror
</ span >
2023-08-02 12:42:59 +00:00
</ div >
2024-04-22 04:27:48 +00:00
</ div >
2021-06-18 15:09:34 +00:00
2024-04-22 04:27:48 +00:00
< div class = " col-4 " >
2024-04-25 05:27:45 +00:00
< label for = " password " class = " form-label " > Password </ label >
2024-04-22 04:27:48 +00:00
< div class = " input-group has-validation " >
< span class = " input-group-text " >< i class = " bi bi-person-badge " ></ i ></ span >
2024-04-25 05:27:45 +00:00
< input type = " password " class = " form-control @error('password') is-invalid @enderror " id = " password " placeholder = " { { old('password', $o->password ) ? 'Password Unchanged' : 'Password' }} " name = " password " value = " " @ cannot ( 'update' , $o ) disabled @ endcannot >
2024-04-22 04:27:48 +00:00
< span class = " invalid-feedback " role = " alert " >
2024-04-25 05:27:45 +00:00
@ error ( 'password' )
2024-04-22 04:27:48 +00:00
{{ $message }}
@ else
2024-04-25 05:27:45 +00:00
Password required for login .
2024-04-22 04:27:48 +00:00
@ enderror
</ span >
</ div >
</ div >
2021-06-18 15:09:34 +00:00
2024-04-22 04:27:48 +00:00
< div class = " col-1 " >
2024-04-25 05:27:45 +00:00
@ can ( 'ownes' , $o )
< label for = " passkey " class = " form-label " > Passkey </ label >
< div class = " input-group has-validation " >
< button class = " btn { { $o->passkey ? 'btn-primary' : 'btn-outline-primary' }} " id = " passkey " >< i class = " bi bi-key " ></ i ></ button >
< span class = " invalid-feedback " role = " alert " >
@ error ( 'passkey' )
{{ $message }}
@ enderror
</ span >
2023-12-19 00:16:08 +00:00
</ div >
2024-04-25 05:27:45 +00:00
@ endcan
2024-04-22 04:27:48 +00:00
</ div >
2021-10-19 11:21:32 +00:00
2024-04-25 05:27:45 +00:00
@ can ( 'admin' , $o )
< div class = " col-3 " >
< div class = " row p-0 " >
< div class = " col-xl-6 col-12 " >
< span class = " form-label " style = " font-size: 75%; margin-bottom: 1px; " > Active </ span >
< div class = " input-group " >
< div class = " btn-group " role = " group " >
< input type = " radio " class = " btn-check " name = " active " id = " active_yes " value = " 1 " required @ if ( old ( 'active' , $o -> active )) checked @ endif >
< label class = " btn btn-outline-success " for = " active_yes " > Yes </ label >
< input type = " radio " class = " btn-check btn-danger " name = " active " id = " active_no " value = " 0 " required @ if ( ! old ( 'active' , $o -> active )) checked @ endif >
< label class = " btn btn-outline-danger " for = " active_no " > No </ label >
</ div >
</ div >
</ div >
< div class = " col-xl-6 col-12 " >
< span class = " form-label " style = " font-size: 75%; margin-bottom: 1px; " > Site Admin </ span >
< div class = " input-group " >
< div class = " btn-group " role = " group " @ if ( $user -> id === $o -> id ) data - bs - toggle = " tooltip " title = " You cannot demote yourself " @ endif >
< input type = " radio " class = " btn-check " name = " admin " id = " admin_yes " value = " 1 " required @ if ( old ( 'admin' , $o -> admin )) checked @ endif >
< label class = " btn btn-outline-success " for = " admin_yes " > Yes </ label >
2023-12-19 00:16:08 +00:00
2024-04-25 05:27:45 +00:00
< input type = " radio " class = " btn-check btn-danger " name = " admin " id = " admin_no " value = " 0 " required @ if (( $user -> id === $o -> id ) || $user -> cannot ( 'admin' , $o )) disabled @ endif @ if ( ! old ( 'admin' , $o -> admin )) checked @ endif >
< label class = " btn btn-outline-danger " for = " admin_no " > No </ label >
</ div >
</ div >
</ div >
2021-10-19 11:21:32 +00:00
</ div >
</ div >
2024-04-25 05:27:45 +00:00
@ endcan
2024-04-22 04:27:48 +00:00
</ div >
2021-10-19 11:21:32 +00:00
2024-04-22 04:27:48 +00:00
< div class = " row " >
< div class = " col-12 " >
< label for = " pgp_pubkey " class = " form-label " > PGP Public Key </ label >
2024-04-25 05:27:45 +00:00
< textarea class = " form-control @error('pgp_pubkey')is-invalid @enderror " rows = 3 id = " pgp_pubkey " name = " pgp_pubkey " placeholder = " PGP Public Key... " @ cannot ( 'update' , $o ) disabled @ endcannot > {{ old ( 'pgp_pubkey' , $o -> pgp_pubkey ) }} </ textarea >
2024-04-22 04:27:48 +00:00
< span class = " invalid-feedback " role = " alert " >
@ error ( 'pgp_pubkey' )
{{ $message }}
@ enderror
</ span >
</ div >
</ div >
2021-06-18 15:09:34 +00:00
2024-04-22 04:27:48 +00:00
< div class = " row " >
< div class = " col-12 " >
2024-04-25 05:27:45 +00:00
< a href = " { { back()->getTargetUrl() }} " class = " btn btn-danger " > Cancel </ a >
@ canany ([ 'admin' , 'update' ], $o )
2024-04-22 04:27:48 +00:00
< button type = " submit " name = " submit " class = " btn btn-success float-end " >@ if ( $o -> exists ) Save @ else Add @ endif </ button >
@ endcan
2021-06-18 15:09:34 +00:00
</ div >
</ div >
</ div >
</ div >
</ div >
2023-12-19 00:16:08 +00:00
2024-04-22 04:27:48 +00:00
< div class = " row " >
2023-12-19 00:16:08 +00:00
< div class = " col-12 " >
< h3 > Systems </ h3 >
< table class = " table monotable " >
< thead >
< tr >
< th > System </ th >
</ tr >
</ thead >
< tbody >
@ foreach ( $o -> systems as $o )
< tr >
< th >< a href = " { { url('system/addedit',[ $o->id ]) }} " > {{ $o -> name }} </ a ></ th >
< th class = " text-end " > { !! $o -> akas -> pluck ( 'ftn' ) -> join ( '<br>' ) !! } </ th >
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
</ div >
2021-06-18 15:09:34 +00:00
</ form >
@ endsection
2023-08-02 12:42:59 +00:00
@ section ( 'page-css' )
@ css ( 'select2' )
< style >
#content h3 {
margin - bottom : 5 px ;
}
#content ul li:last-child {
margin - bottom : inherit ;
}
</ style >
@ append
2021-06-18 15:09:34 +00:00
@ section ( 'page-scripts' )
2023-08-02 12:42:59 +00:00
@ js ( 'select2' )
2024-04-25 05:27:45 +00:00
<!-- Passkeys -->
< script type = 'text/javascript' src = '{{ asset(' / passkey / passkey . js ') }}' ></ script >
2023-06-27 07:39:11 +00:00
@ if ( $user -> id === $o -> id )
2024-04-25 05:27:45 +00:00
< script type = " text/javascript " >
2023-08-02 12:42:59 +00:00
var tooltipTriggerList = [] . slice . call ( document . querySelectorAll ( '[data-bs-toggle="tooltip"]' ))
var tooltipList = tooltipTriggerList . map ( function ( tooltipTriggerEl ) {
return new bootstrap . Tooltip ( tooltipTriggerEl )
})
</ script >
2021-06-18 15:09:34 +00:00
@ endif
2023-08-02 12:42:59 +00:00
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
$ ( '#system_id' ) . select2 ();
2024-04-25 05:27:45 +00:00
$ ( '#passkey' ) . on ( 'click' , function ( item ) {
if ( passkey_debug )
console . log ( 'Passkey: Create Click' );
// Availability of `window.PublicKeyCredential` means WebAuthn is usable.
// `isUserVerifyingPlatformAuthenticatorAvailable` means the feature detection is usable.
// `sConditionalMediationAvailable` means the feature detection is usable.
if ( window . PublicKeyCredential &&
PublicKeyCredential . isUserVerifyingPlatformAuthenticatorAvailable &&
PublicKeyCredential . isConditionalMediationAvailable ) {
// Check if user verifying platform authenticator is available.
Promise . all ([
PublicKeyCredential . isUserVerifyingPlatformAuthenticatorAvailable (),
PublicKeyCredential . isConditionalMediationAvailable (),
]) . then ( results => {
if ( passkey_debug )
console . log ( 'Passkey: Browser Supported' );
if ( results . every ( r => r === true )) {
passkey_register ( '{{ csrf_token() }}' , $ ( this ), 'bi-key' , 'btn-primary' , '{{ $o->passkey ? ' btn - primary ' : ' btn - outline - primary ' }}' );
} else {
alert ( 'It seems that passkey is NOT supported by your browse (B)' );
}
});
} else {
alert ( 'It seems that passkey is NOT supported by your browser (A)' );
}
return false ;
});
2023-08-02 12:42:59 +00:00
});
</ script >
2021-06-18 15:09:34 +00:00
@ append