Verified Commit b13cc3a0 authored by Korko's avatar Korko
Browse files

Add system to remove Draw data from organizer panel

parent 18ad4a66
......@@ -9,6 +9,7 @@ use App\Jobs\SendMail;
use App\Mail as MailModel;
use App\Mail\TargetDrawn;
use App\Participant;
use Illuminate\Http\Request;
use Metrics;
class OrganizerController extends Controller
......@@ -24,6 +25,7 @@ class OrganizerController extends Controller
{
return response()->json([
'draw' => $draw->hash,
'expires_at' => $draw->expires_at,
'participants' => $draw->participants->mapWithKeys(function ($participant) {
return [$participant->id => $participant->only([
'id', 'name', 'email', 'mail',
......@@ -79,7 +81,7 @@ class OrganizerController extends Controller
SendMail::dispatch($participant, new TargetDrawn($participant));
}
public function delete(Draw $draw)
public function delete(Request $request, Draw $draw)
{
$draw->delete();
......
......@@ -14223,6 +14223,11 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vuejs-dialog": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/vuejs-dialog/-/vuejs-dialog-1.4.1.tgz",
"integrity": "sha512-gAAiQL+KHAqYbyGxpdT8OPG7hbnB2qWzH5dkQZrntlhewe7R8N0QxsbqHcFRKAk5pUJCrc7zjbEjshlWoCSDHg=="
},
"vuelidate": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/vuelidate/-/vuelidate-0.7.5.tgz",
......
......@@ -52,6 +52,7 @@
"vuelidate": "^0.7.5"
},
"dependencies": {
"vue-i18n": "^8.16.0"
"vue-i18n": "^8.16.0",
"vuejs-dialog": "^1.4.1"
}
}
......@@ -11911,16 +11911,44 @@ footer .row {
11. Readability
========================================================================== */
.btn-success {
.btn-outline-success {
color: #2c642c;
border-color: #2c642c;
}
.btn-success,
.btn-outline-success:not([disabled]):hover {
background-color: #2c642c;
border-color: #2c642c;
}
.btn-danger {
.btn-outline-danger {
color: #a82824;
border-color: #a82824;
}
.btn-danger,
.btn-outline-danger:not([disabled]):hover {
background-color: #a82824;
border-color: #a82824;
}
.btn-primary {
.btn-outline-warning {
color: #9c5a05;
border-color: #9c5a05;
}
.btn-warning,
.btn-outline-warning:not([disabled]):hover {
background-color: #9c5a05;
border-color: #9c5a05;
color: #fff;
}
.btn-primary,
.btn-outline-primary:not([disabled]):hover {
background-color: #275c8b;
border-color: #275c8b;
}
.dark-wrapper {
......
......@@ -11911,16 +11911,44 @@ footer .row {
11. Readability
========================================================================== */
.btn-success {
.btn-outline-success {
color: #2c642c;
border-color: #2c642c;
}
.btn-success,
.btn-outline-success:not([disabled]):hover {
background-color: #2c642c;
border-color: #2c642c;
}
.btn-danger {
.btn-outline-danger {
color: #a82824;
border-color: #a82824;
}
.btn-danger,
.btn-outline-danger:not([disabled]):hover {
background-color: #a82824;
border-color: #a82824;
}
.btn-primary {
.btn-outline-warning {
color: #9c5a05;
border-color: #9c5a05;
}
.btn-warning,
.btn-outline-warning:not([disabled]):hover {
background-color: #9c5a05;
border-color: #9c5a05;
color: #fff;
}
.btn-primary,
.btn-outline-primary:not([disabled]):hover {
background-color: #275c8b;
border-color: #275c8b;
}
.dark-wrapper {
......
......@@ -11911,16 +11911,44 @@ footer .row {
11. Readability
========================================================================== */
.btn-success {
.btn-outline-success {
color: #2c642c;
border-color: #2c642c;
}
.btn-success,
.btn-outline-success:not([disabled]):hover {
background-color: #2c642c;
border-color: #2c642c;
}
.btn-danger {
.btn-outline-danger {
color: #a82824;
border-color: #a82824;
}
.btn-danger,
.btn-outline-danger:not([disabled]):hover {
background-color: #a82824;
border-color: #a82824;
}
.btn-primary {
.btn-outline-warning {
color: #9c5a05;
border-color: #9c5a05;
}
.btn-warning,
.btn-outline-warning:not([disabled]):hover {
background-color: #9c5a05;
border-color: #9c5a05;
color: #fff;
}
.btn-primary,
.btn-outline-primary:not([disabled]):hover {
background-color: #275c8b;
border-color: #275c8b;
}
.dark-wrapper {
......
......@@ -11911,16 +11911,44 @@ footer .row {
11. Readability
========================================================================== */
.btn-success {
.btn-outline-success {
color: #2c642c;
border-color: #2c642c;
}
.btn-success,
.btn-outline-success:not([disabled]):hover {
background-color: #2c642c;
border-color: #2c642c;
}
.btn-danger {
.btn-outline-danger {
color: #a82824;
border-color: #a82824;
}
.btn-danger,
.btn-outline-danger:not([disabled]):hover {
background-color: #a82824;
border-color: #a82824;
}
.btn-primary {
.btn-outline-warning {
color: #9c5a05;
border-color: #9c5a05;
}
.btn-warning,
.btn-outline-warning:not([disabled]):hover {
background-color: #9c5a05;
border-color: #9c5a05;
color: #fff;
}
.btn-primary,
.btn-outline-primary:not([disabled]):hover {
background-color: #275c8b;
border-color: #275c8b;
}
.dark-wrapper {
......
......@@ -278,11 +278,17 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _partials_store_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../partials/store.js */ "./resources/js/partials/store.js");
/* harmony import */ var vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! vuelidate/lib/validators */ "./node_modules/vuelidate/lib/validators/index.js");
/* harmony import */ var vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var _inputEdit_vue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./inputEdit.vue */ "./resources/js/components/inputEdit.vue");
/* harmony import */ var _form_vue__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./form.vue */ "./resources/js/components/form.vue");
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var vuejs_dialog__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! vuejs-dialog */ "./node_modules/vuejs-dialog/dist/vuejs-dialog.min.js");
/* harmony import */ var vuejs_dialog__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(vuejs_dialog__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var vuejs_dialog_dist_vuejs_dialog_min_css__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! vuejs-dialog/dist/vuejs-dialog.min.css */ "./node_modules/vuejs-dialog/dist/vuejs-dialog.min.css");
/* harmony import */ var vuejs_dialog_dist_vuejs_dialog_min_css__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(vuejs_dialog_dist_vuejs_dialog_min_css__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var _partials_store_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../partials/store.js */ "./resources/js/partials/store.js");
/* harmony import */ var vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! vuelidate/lib/validators */ "./node_modules/vuelidate/lib/validators/index.js");
/* harmony import */ var vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var _inputEdit_vue__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./inputEdit.vue */ "./resources/js/components/inputEdit.vue");
/* harmony import */ var _form_vue__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./form.vue */ "./resources/js/components/form.vue");
......@@ -306,12 +312,16 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
vue__WEBPACK_IMPORTED_MODULE_13___default.a.use(vuejs_dialog__WEBPACK_IMPORTED_MODULE_14___default.a);
/* harmony default export */ __webpack_exports__["default"] = ({
components: {
InputEdit: _inputEdit_vue__WEBPACK_IMPORTED_MODULE_15__["default"]
InputEdit: _inputEdit_vue__WEBPACK_IMPORTED_MODULE_18__["default"]
},
extends: _form_vue__WEBPACK_IMPORTED_MODULE_16__["default"],
extends: _form_vue__WEBPACK_IMPORTED_MODULE_19__["default"],
props: {
data: {
type: Object,
......@@ -321,11 +331,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
}
},
data: function data() {
return _objectSpread({}, _partials_store_js__WEBPACK_IMPORTED_MODULE_13__["default"], {
return _objectSpread({}, _partials_store_js__WEBPACK_IMPORTED_MODULE_16__["default"], {
validations: {
email: {
required: vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_14__["required"],
format: vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_14__["email"]
required: vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_17__["required"],
format: vuelidate_lib_validators__WEBPACK_IMPORTED_MODULE_17__["email"]
}
}
});
......@@ -369,6 +379,41 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
}
}
});
},
confirmPurge: function confirmPurge() {
var options = {
okText: this.$t('organizer.purge.confirm.ok'),
cancelText: this.$t('organizer.purge.confirm.cancel'),
verification: this.$t('organizer.purge.confirm.value'),
verificationHelp: this.$t('organizer.purge.confirm.help'),
type: 'hard'
};
var message = {
title: this.$t('organizer.purge.confirm.title', {
expiration: new Date(this.data.expires_at).toLocaleString('fr-FR', {
day: 'numeric',
month: 'long'
})
}),
body: this.$t('organizer.purge.confirm.body')
};
this.$dialog.confirm(message, options).then(this.purge);
},
purge: function purge() {
var app = this;
return jquery__WEBPACK_IMPORTED_MODULE_12___default.a.ajax({
url: "/org/".concat(this.data.draw, "/"),
type: 'DELETE',
data: {
_token: this.csrf,
key: this.key
},
success: function success(data) {
app.$dialog.alert(data.message).then(function () {
return window.location.pathname = '/';
});
}
});
}
}
});
......@@ -628,7 +673,7 @@ var render = function() {
? _c(
"button",
{
staticClass: "btn btn-primary",
staticClass: "btn btn-outline-primary",
attrs: { type: "button" },
on: {
click: function($event) {
......@@ -644,7 +689,7 @@ var render = function() {
? _c(
"button",
{
staticClass: "btn btn-success",
staticClass: "btn btn-outline-success",
attrs: {
type: "button",
disabled: _vm.isSame || !_vm.state.endsWith("Valid")
......@@ -659,7 +704,7 @@ var render = function() {
? _c(
"button",
{
staticClass: "btn btn-danger",
staticClass: "btn btn-outline-danger",
attrs: { type: "button" },
on: { click: _vm.onCancel }
},
......@@ -696,113 +741,125 @@ var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("table", { staticClass: "table table-hover" }, [
_c("thead", [
_c("tr", { staticClass: "table-active" }, [
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.name")) +
"\n "
)
]),
_vm._v(" "),
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.email")) +
"\n "
)
]),
_vm._v(" "),
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.status")) +
"\n "
)
])
])
]),
_vm._v(" "),
_c(
"tbody",
_vm._l(_vm.data.participants, function(participant, k) {
return _c("tr", { key: participant.id }, [
_c("td", [_vm._v(_vm._s(participant.name))]),
return _c("div", [
_c("table", { staticClass: "table table-hover" }, [
_c("thead", [
_c("tr", { staticClass: "table-active" }, [
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.name")) +
"\n "
)
]),
_vm._v(" "),
_c(
"td",
[
_c("input-edit", {
attrs: {
action:
"/org/" +
_vm.data.draw +
"/" +
participant.id +
"/changeEmail",
value: participant.email,
name: "email",
validation: _vm.validations.email
},
on: {
update: function($event) {
return _vm.update(k, $event)
}
},
scopedSlots: _vm._u(
[
{
key: "errors",
fn: function(ref) {
var $v = ref.$v
return [
!$v.required
? _c("div", { staticClass: "invalid-tooltip" }, [
_vm._v(
_vm._s(
_vm.$t(
"validation.custom.organizer.email.required"
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.email")) +
"\n "
)
]),
_vm._v(" "),
_c("th", { attrs: { scope: "col" } }, [
_vm._v(
"\n " +
_vm._s(_vm.$t("organizer.list.status")) +
"\n "
)
])
])
]),
_vm._v(" "),
_c(
"tbody",
_vm._l(_vm.data.participants, function(participant, k) {
return _c("tr", { key: participant.id }, [
_c("td", [_vm._v(_vm._s(participant.name))]),
_vm._v(" "),
_c(
"td",
[
_c("input-edit", {
attrs: {
action:
"/org/" +
_vm.data.draw +
"/" +
participant.id +
"/changeEmail",
value: participant.email,
name: "email",
validation: _vm.validations.email
},
on: {
update: function($event) {
return _vm.update(k, $event)
}
},
scopedSlots: _vm._u(
[
{
key: "errors",
fn: function(ref) {
var $v = ref.$v
return [
!$v.required
? _c("div", { staticClass: "invalid-tooltip" }, [
_vm._v(
_vm._s(
_vm.$t(
"validation.custom.organizer.email.required"
)
)
)
)
])
: !$v.format
? _c("div", { staticClass: "invalid-tooltip" }, [
_vm._v(
_vm._s(
_vm.$t(
"validation.custom.organizer.email.format"
])
: !$v.format
? _c("div", { staticClass: "invalid-tooltip" }, [
_vm._v(
_vm._s(
_vm.$t(
"validation.custom.organizer.email.format"
)
)
)
)
])
: _vm._e()
]
])
: _vm._e()
]
}
}
}
],
null,
true
)
})
],
1
),
_vm._v(" "),
_c("td", [
_vm._v(
_vm._s(
_vm.$t(
"common.email.status." + participant.mail.delivery_status
],
null,
true
)
})
],
1
),
_vm._v(" "),
_c("td", [
_vm._v(
_vm._s(
_vm.$t(
"common.email.status." + participant.mail.delivery_status
)
)
)
)
])
])
])
}),
0
}),
0
)
]),
_vm._v(" "),
_c(
"button",
{
staticClass: "btn btn-danger",
attrs: { type: "button" },
on: { click: _vm.confirmPurge }
},
[_vm._v(_vm._s(_vm.$t("organizer.purge.button")))]
)
])
}
......
......@@ -2203,7 +2203,7 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-danger participant-remove",
staticClass: "btn btn-outline-danger participant-remove",
attrs: { type: "button", disabled: _vm.required },
on: {
click: function($event) {
......@@ -2440,7 +2440,8 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-success participant-add",
staticClass:
"btn btn-outline-success participant-add",
attrs: { type: "button" },
on: {
click: function($event) {
......@@ -2462,7 +2463,7 @@ var render = function() {
"button",
{
staticClass:
"btn btn-warning participants-import",
"btn btn-outline-warning participants-import",
attrs: {
type: "button",
disabled: _vm.importing
......
This diff is collapsed.
......@@ -199,13 +199,18 @@
/>
<slot name="errors" :$v="$v.newValue"></slot>
<div class="input-group-append">
<button v-if="state.startsWith('view')" type="button" class="btn btn-primary" @click="send('edit')">
<button
v-if="state.startsWith('view')"
type="button"
class="btn btn-outline-primary"
@click="send('edit')"
>
<i class="fas fa-edit" />
</button>
<button
v-if="state.startsWith('edit')"
type="button"
class="btn btn-success"
class="btn btn-outline-success"
:disabled="isSame || !state.endsWith('Valid')"
@click="onSubmit"
>
......@@ -214,7 +219,7 @@