Skip to content
Snippets Groups Projects
Verified Commit 97df5315 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Podpora spravy pozvanek

parent 07439364
No related branches found
No related tags found
No related merge requests found
Pipeline #14596 passed
0.12.1
0.13.0
......@@ -54,7 +54,7 @@ sub meet($c) {
my $invite = $c->schema->resultset('Invite')->search({
token => uc($c->stash->{token}),
expire => {'>' => \'now()'},
# expire => {'>' => \'now()'}, # zatim nebudeme limitovat casove
})->first;
if ( ! $invite ) {
......
......@@ -48,7 +48,8 @@ sub get($c) {
my $meet = $c->_get($c->stash->{id}, 0) // return;
my $users = { 0 => [], 1 => [] };
my $users = { 0 => [], 1 => [] };
my @invites = ();
USER:
foreach my $user ( $meet->users ) {
......@@ -58,11 +59,21 @@ sub get($c) {
}
}
INVITE:
foreach my $invite ( $meet->invites ) {
push @invites, {
id => $invite->id,
token => $invite->token,
displayname => $invite->displayname,
}
}
$c->render(openapi => $c->spec_filter({
$meet->get_columns,
groups => $meet->cached_groups, #TODO: direct
moderators => $users->{1},
participants => $users->{0},
invites => \@invites,
}, 'Meet'));
}
......@@ -94,6 +105,7 @@ sub list($c) {
groups => $meet->cached_groups,
moderators => $meet->cached_moderators,
participants => [],
invites => [],
}, 'Meet')
}
......@@ -171,6 +183,18 @@ sub delete_user($c) {
$c->render( status => 204, text => '' );
}
sub delete_invite($c) {
$c->openapi->valid_input or return;
my $meet = $c->_get($c->stash->{id}, 2) // return;
$meet->delete_related('invites',
{ id => $c->stash->{invite_id} }
);
$c->render( status => 204, text => '' );
}
sub delete($c) {
$c->openapi->valid_input or return;
......
......@@ -65,6 +65,11 @@ __PACKAGE__->has_many(
{ 'foreign.meet_id' => 'self.id', },
);
__PACKAGE__->has_many(
invites => 'SeMeet::Schema::Result::Invite',
{ 'foreign.meet_id' => 'self.id', },
);
__PACKAGE__->inflate_column('properties', {
inflate => sub { from_json(shift); },
deflate => sub { to_json(shift); },
......
......@@ -52,6 +52,10 @@ components:
type: array
items:
$ref: '#/components/schemas/UserInList'
invites:
type: array
items:
$ref: '#/components/schemas/InviteInList'
GroupInList:
type: object
properties:
......@@ -101,6 +105,19 @@ components:
email:
type: string
description: E-mail
InviteInList:
type: object
properties:
id:
type: integer
readOnly: true
token:
type: string
description: Access token
readOnly: true
displayname:
type: string
description: Jmeno, Prijmeni
paths:
/meets:
......@@ -423,6 +440,33 @@ paths:
responses:
204:
description: User deleted
/meets/{id}/invites/{invite_id}:
delete:
x-mojo-to: meets#delete_invite
security:
- Bearer: []
tags:
- meets
summary: "Smazat pozvanku"
operationId: deleteInviteFromMeet
parameters:
- name: id
in: path
required: true
example: 100345
description: "Identifikator mistnosti"
schema:
type: integer
- name: invite_id
in: path
required: true
example: 100345
description: "Identifikator pozvanky"
schema:
type: integer
responses:
204:
description: Invite deleted
/invites:
post:
x-mojo-to: invites#create
......
% if ( $roles->{owner} || $roles->{moderator} ) {
% if ( $roles->{owner} || $roles->{moderator} ) {
<div class="mb-4">
<span v-for="invite in meet.invites" class="chip chip--violet-400 mr-1 mb-1 rounded">
{{ invite.displayname }}
% if ( $roles->{owner} || $roles->{moderator} ) {
<span class="icon" title="Zobrazit pozvánku">
<i class="ico--link ml-3 cursor-pointer" @click="showInvite(invite)"></i>
</span>
<span class="icon" title="Smazat pozvánku">
<i class="ico--cross ml-3 cursor-pointer" @click="removeInvite(invite.id)"></i>
</span>
% }
</span>
</div>
<div class="grid grid-cols-5">
<div class="mr-2 col-span-2">
......@@ -8,16 +22,29 @@
<div class="mr-2 col-span-3">
<label class="form-field__label"><%=l 'E-mail' %></label>
<div class="flex flex-row">
<input type="text" class="w-full text-input mr-2" value="" v-model.lazy="newInvite.email" placeholder="<%=l 'INPUT_INVITE_EMAIL_PLACEHOLDER' %>"/>
<button class="btn btn--violet-400 btn--hoveractive text-sm ml-2" @click="addInvite()">
<div class="btn__body" style="white-space: nowrap;"><%=l 'Create invite' %></div>
</button>
</div>
</div>
% if (0) {
<div class="mr-2 col-span-2">
<label class="form-field__label"><%=l 'Platnost do' %></label>
<div class="flex flex-row">
<input type="text" class="w-full text-input mr-2" value="" v-model.lazy="newInvite.email" placeholder="<%=l 'INPUT_INVITE_EMAIL_PLACEHOLDER' %>"/>
<button class="btn btn--violet-400 btn--hoveractive text-sm" @click="addInvite()">
<date-picker format="DD.MM.YYYY" v-model.lazy="newInvite.expire"></date-picker>
<button class="btn btn--violet-400 btn--hoveractive text-sm ml-2" @click="addInvite()">
<div class="btn__body" style="white-space: nowrap;"><%=l 'Create invite' %></div>
</button>
</div>
</div>
% }
</div>
% }
......@@ -28,6 +28,13 @@
% }
<script src="https://cdn-unpkg.pirati.cz/vue@2.7.8/dist/vue.min.js"></script>
<script src="<%= config->{styleguide} %>js/main.bundle.js"></script>
<script src="https://cdn-unpkg.pirati.cz/vue2-datepicker@3.11.1/index.min.js"></script>
<script src="https://cdn-unpkg.pirati.cz/vue2-datepicker@3.11.1/locale/cs.js"></script>
<link href="https://cdn-unpkg.pirati.cz/vue2-datepicker@3.11.1/index.css" rel="stylesheet">
<style>
.mx-input { height: 48px; border-color: #adadad; border-radius: 0; }
</style>
</head>
<body>
......
......@@ -4,11 +4,11 @@
%= include 'includes/meet'
<div class="grid grid-cols-4 border border-b-0 divide-x text-center">
<div class="grid grid-cols-5 border border-b-0 divide-x text-center">
<div @click="active_tab='groups'" class="p-4 bg-grey-125" :class="tabClass('groups')"><%=l 'Authorized groups' %></div>
<div @click="active_tab='participants'" class="p-4 bg-grey-125" :class="tabClass('participants')"><%=l 'Authorized persons' %></div>
<div @click="active_tab='moderators'" class="p-4 bg-grey-125" :class="tabClass('moderators')"><%=l 'Moderators' %></div>
%#<div @click="active_tab='invites'" class="p-4 bg-grey-125" :class="tabClass('invites')"><%=l 'Invites' %></div>
<div @click="active_tab='invites'" class="p-4 bg-grey-125" :class="tabClass('invites')"><%=l 'Invites' %></div>
<div @click="active_tab='form'" class="p-4 bg-grey-125" :class="tabClass('form')"><%=l $roles->{owner} ? 'Configuration':'About meet' %></div>
</div>
......@@ -22,9 +22,9 @@
<div v-if="active_tab == 'moderators'">
%= include 'includes/meet_moderators'
</div>
%# <div v-if="active_tab == 'invites'">
%#= include 'includes/meet_invites'
%# </div>
<div v-if="active_tab == 'invites'">
%= include 'includes/meet_invites'
</div>
<div v-if="active_tab == 'form'">
% if ( $roles->{owner} ) {
%= include 'includes/meet_form'
......@@ -34,6 +34,22 @@
</div>
</div>
<div class="modal__overlay" v-if="inviteInfoVisible" v-cloak>
<div class="modal__content" role="dialog">
<div class="modal__container" role="dialog">
<div class="modal__container-body elevation-10">
<button class="modal__close" title="Zavřít" @click="inviteInfoVisible = false"><i class="ico--cross"></i></button>
<div class="card">
<div class="card__body w-120 text-center">
<p class="card-body-text">Adresa pozvánky byla zkopírovana do schránky</p>
<b><a v-bind:href="selectedInvite.full_url">{{ selectedInvite.full_url }}</a></b>
</div>
</div>
</div>
</div>
</div>
</div>
</div><%# APP %>
......@@ -57,6 +73,8 @@
meet: {},
newInvite: {},
selectedInvite: {},
inviteInfoVisible: false,
active_tab: 'groups',
delete_confirm_visible: false,
......@@ -225,8 +243,8 @@
},
addInvite: function() {
console.log(this.newInvite);
if ( this.newInvite.displayname == '' || this.newInvite.email == '' ) {
console.log('XXX');
return true;
}
......@@ -245,8 +263,14 @@
})
},
showInvite: function(invite) {
this.selectedInvite.full_url = 'https://<%= config->{domain} %>/guest/'+ invite.token ;
this.inviteInfoVisible = true;
navigator.clipboard.writeText(this.selectedInvite.full_url);
},
removeInvite: function(id) {
fetch(INVITES_URL + id, {
fetch(MEET_URL + '/invites/' + id, {
method: "DELETE",
headers: API_HEADERS,
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment