Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
48845df200 |
|
@ -0,0 +1,67 @@
|
||||||
|
var toastedOptions = {
|
||||||
|
position: "bottom-right",
|
||||||
|
duration: 3000,
|
||||||
|
fitToScreen: false,
|
||||||
|
fullWidth: false,
|
||||||
|
theme: "material",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function (toasted) {
|
||||||
|
var toasted = new toasted(toastedOptions);
|
||||||
|
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
data: {
|
||||||
|
firstname: "",
|
||||||
|
lastname: "",
|
||||||
|
username: "",
|
||||||
|
email: "",
|
||||||
|
group: null,
|
||||||
|
function: '',
|
||||||
|
oc_groups: [],
|
||||||
|
},
|
||||||
|
oc_groups: [],
|
||||||
|
finished: false,
|
||||||
|
submitRequest: null,
|
||||||
|
errorFields: [],
|
||||||
|
groups: [
|
||||||
|
{ id: "Gallier", name: "Gallier (Wuppertal)" },
|
||||||
|
{ id: "Gandalf", name: "Gandalf (SG-Mangenberg)" },
|
||||||
|
{ id: "Gravenrode", name: "Gravenrode (SG-Gräfrath)" },
|
||||||
|
{ id: "Lennep", name: "Lennep (RS-Lennep)" },
|
||||||
|
{ id: "Silva", name: "Silva (SG-Wald)" },
|
||||||
|
{ id: "Sugambrer", name: "Sugambrer (SG-Höhscheid)" },
|
||||||
|
{ id: "Tenkterer", name: "Tenkterer (SG-Löhdorf)" },
|
||||||
|
{ id: "von Berg", name: "von Berg (SG-Ohligs)" },
|
||||||
|
],
|
||||||
|
submit() {
|
||||||
|
var _self = this;
|
||||||
|
this.loading = true;
|
||||||
|
var promise = fetch(window.location.href, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"X-WINTER-REQUEST-HANDLER": this.submitRequest,
|
||||||
|
"X-WINTER-REQUEST-PARTIALS": [],
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(this.data),
|
||||||
|
});
|
||||||
|
|
||||||
|
promise.then(function (response) {
|
||||||
|
_self.loading = false;
|
||||||
|
if (response.status === 422) {
|
||||||
|
response.json().then((errors) => {
|
||||||
|
Object.keys(errors).forEach((field) => {
|
||||||
|
toasted.error(errors[field].join("<br>"));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (response.status === 201) {
|
||||||
|
_self.finished = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,6 +10,9 @@ use Illuminate\Validation\Rule;
|
||||||
use Input;
|
use Input;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Winter\Storm\Support\Facades\Validator;
|
use Winter\Storm\Support\Facades\Validator;
|
||||||
|
use Zoomyboy\Event\Classes\Spreadsheet;
|
||||||
|
use Zoomyboy\Event\Classes\SpreadsheetHeader;
|
||||||
|
use Zoomyboy\Owncloud\Classes\Filesystem;
|
||||||
use Zoomyboy\Owncloud\Models\Settings;
|
use Zoomyboy\Owncloud\Models\Settings;
|
||||||
|
|
||||||
class Form extends ComponentBase
|
class Form extends ComponentBase
|
||||||
|
@ -37,6 +40,31 @@ class Form extends ComponentBase
|
||||||
|
|
||||||
public function onRun(): void
|
public function onRun(): void
|
||||||
{
|
{
|
||||||
|
// $filesystem = app(Filesystem::class)->client();
|
||||||
|
|
||||||
|
// $filesystem->write('lorem/gandalf.txt', 'AAAABBBB');
|
||||||
|
(new Spreadsheet('Anmeldezahlen BeLa'))
|
||||||
|
->headers([
|
||||||
|
new SpreadsheetHeader('Vorname'),
|
||||||
|
new SpreadsheetHeader('Nachname'),
|
||||||
|
new SpreadsheetHeader('Straße'),
|
||||||
|
new SpreadsheetHeader('PLZ'),
|
||||||
|
new SpreadsheetHeader('Ort'),
|
||||||
|
])
|
||||||
|
->sheet('Gandalf', [
|
||||||
|
['Philipp', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Philipp', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Philipp', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Philipp', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
])
|
||||||
|
->sheet('Gravenrose', [
|
||||||
|
['Jane', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Jane', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Jane', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
['Jane2', 'Lang', 'Itterstr 3', '42719', 'solingen'],
|
||||||
|
])
|
||||||
|
->generate();
|
||||||
|
|
||||||
$groups = Cache::remember('oc_groupsa', 1, function () {
|
$groups = Cache::remember('oc_groupsa', 1, function () {
|
||||||
return $this->getGroups();
|
return $this->getGroups();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue