Add ability to invite users

This commit is contained in:
James Cole
2022-10-01 12:21:42 +02:00
parent 9bfa52f3ce
commit ee9b651f0f
22 changed files with 656 additions and 115 deletions

View File

@@ -4,6 +4,31 @@
{{ Breadcrumbs.render }}
{% endblock %}
{% block content %}
{% if allowInvites %}
<div class="row">
<div class="col-lg-6">
<form action="{{ route('admin.users.invite') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">{{ 'invite_new_user_title'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ 'invite_new_user_text'|_ }}
</p>
{{ ExpandedForm.text('invited_user',null, {'type': 'email', 'label' : 'invited_user_mail'|_}) }}
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('invite_user')|_ }}
</button>
</div>
</div>
</form>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box box-primary">
@@ -29,8 +54,10 @@
<tr>
<td class="hidden-xs" data-value="{{ user.id }}">
<div class="btn-group btn-group-xs">
<a class="btn btn-default" href="{{ route('admin.users.edit',user.id) }}"><span class="fa fa-pencil"></span></a>
<a class="btn btn-danger" href="{{ route('admin.users.delete',user.id) }}"><span class="fa fa-trash"></span></a>
<a class="btn btn-default" href="{{ route('admin.users.edit',user.id) }}"><span
class="fa fa-pencil"></span></a>
<a class="btn btn-danger" href="{{ route('admin.users.delete',user.id) }}"><span
class="fa fa-trash"></span></a>
</div>
</td>
<td class="hidden-xs" data-value="{{ user.id }}">#{{ user.id }}</td>
@@ -60,9 +87,11 @@
</td>
<td data-value="{% if user.blocked %}1{% else %}0{% endif %}">
{% if user.blocked == 1 %}
<small class="text-danger"><span class="fa fa-fw fa-check" title="{{ 'yes'|_ }}"></span></small>
<small class="text-danger"><span class="fa fa-fw fa-check"
title="{{ 'yes'|_ }}"></span></small>
{% else %}
<small class="text-success"><span class="fa fa-fw fa-times" title="{{ 'no'|_ }}"></span></small>
<small class="text-success"><span class="fa fa-fw fa-times"
title="{{ 'no'|_ }}"></span></small>
{% endif %}
</td>
<td class="hidden-xs">
@@ -84,10 +113,71 @@
</div>
</div>
</div>
{% if invitedUsers.count > 0 %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'all_invited_users'|_ }}</h3>
</div>
<div class="box-body no-padding">
<table class="table table-responsive table-condensed sortable">
<thead>
<tr>
<th data-defaultsign="_19" class="hidden-xs" colspan="1">&nbsp;</th>
<th data-defaultsign="az">{{ trans('list.email') }}</th>
<th data-defaultsign="month" class="hidden-xs">{{ trans('list.invited_at') }}</th>
<th data-defaultsign="month" class="hidden-xs">{{ trans('list.expires') }}</th>
<th class="hidden-xs">{{ trans('list.invited_by') }}</th>
<th>{{ trans('list.invite_link') }}</th>
</tr>
</thead>
<tbody>
{% for invitee in invitedUsers %}
<tr>
<td class="hidden-xs" data-value="{{ user.id }}">
<div class="btn-group btn-group-xs">
<a class="btn btn-danger" href="{{ route('admin.users.delete-invite', invitee.id) }}"><span
class="fa fa-trash"></span></a>
</div>
</td>
<td>
{{ invitee.email }}
</td>
<td class="hidden-xs">
{{ invitee.created_at.isoFormat(monthAndDayFormat) }}
{{ invitee.created_at.format('H:i') }}
</td>
<td>
{{ invitee.expires.isoFormat(monthAndDayFormat) }}
{{ invitee.expires.format('H:i') }}
</td>
<td>
{{ invitee.user.email }}
</td>
<td>
{% if invitee.redeemed %}
<em><s>{{ 'code_already_used'|_ }}</s></em>
{% else %}
<input type="text" class="form-control" readonly value="{{ route('invite', [invitee.invite_code]) }}">
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="v1/css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all" nonce="{{ JS_NONCE }}">
<link rel="stylesheet" href="v1/css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all"
nonce="{{ JS_NONCE }}">
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"
nonce="{{ JS_NONCE }}"></script>
{% endblock %}

View File

@@ -23,6 +23,7 @@
<form action="{{ route('register') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="invite_code" value="{{ inviteCode }}">
<div class="input-group mb-3">
<input type="email" name="email" value="{{ email }}" class="form-control"
placeholder="{{ trans('form.email') }}"/>

View File

@@ -0,0 +1,3 @@
@component('mail::message')
{{ trans('email.invitation_created_body', ['email' => $email,'invitee' => $invitee]) }}
@endcomponent