Merge pull request #442 from 1day2die/development
click to copy Ref URL // Badge Color on Profile
This commit is contained in:
commit
4af88ade8c
2 changed files with 46 additions and 4 deletions
|
@ -16,11 +16,26 @@ class ProfileController extends Controller
|
|||
/** Display a listing of the resource. */
|
||||
public function index()
|
||||
{
|
||||
switch (Auth::user()->role) {
|
||||
case 'admin':
|
||||
$badgeColor = 'badge-danger';
|
||||
break;
|
||||
case 'mod':
|
||||
$badgeColor = 'badge-info';
|
||||
break;
|
||||
case 'client':
|
||||
$badgeColor = 'badge-success';
|
||||
break;
|
||||
default:
|
||||
$badgeColor = 'badge-secondary';
|
||||
break;
|
||||
}
|
||||
return view('profile.index')->with([
|
||||
'user' => Auth::user(),
|
||||
'credits_reward_after_verify_discord' => config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'),
|
||||
'force_email_verification' => config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION'),
|
||||
'force_discord_verification' => config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION'),
|
||||
'badgeColor' => $badgeColor,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,10 @@
|
|||
<div class="mt-1">
|
||||
<span class="badge badge-success"><i
|
||||
class="fa fa-user-check mr-2"></i>
|
||||
{{_("Referral URL")}} : {{route("register")}}?ref={{$user->referral_code}}</span>
|
||||
{{_("Referral URL")}} :
|
||||
<span onclick="onClickCopy()" id="RefLink" style="cursor: pointer;">
|
||||
{{route("register")}}?ref={{$user->referral_code}}</span>
|
||||
</span>
|
||||
@else
|
||||
<span class="badge badge-warning"><i
|
||||
class="fa fa-user-check mr-2"></i>
|
||||
|
@ -115,9 +118,8 @@
|
|||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center text-sm-right"><span
|
||||
class="badge badge-secondary">{{ $user->role }}</span>
|
||||
class="badge {{$badgeColor}}">{{ $user->role }}</span>
|
||||
<div class="text-muted">
|
||||
<small>{{ $user->created_at->isoFormat('LL') }}</small>
|
||||
</div>
|
||||
|
@ -304,5 +306,30 @@
|
|||
</div>
|
||||
</section>
|
||||
<!-- END CONTENT -->
|
||||
|
||||
<script>
|
||||
function onClickCopy() {
|
||||
let textToCopy = document.getElementById('RefLink').innerText;
|
||||
if(navigator.clipboard) {
|
||||
navigator.clipboard.writeText(textToCopy).then(() => {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: '{{ __("URL copied to clipboard")}}',
|
||||
position: 'top-middle',
|
||||
showConfirmButton: false,
|
||||
background: '#343a40',
|
||||
toast: false,
|
||||
timer: 1000,
|
||||
timerProgressBar: true,
|
||||
didOpen: (toast) => {
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log('Browser Not compatible')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue