Added add_year, add_boatname
This commit is contained in:
@@ -35,6 +35,11 @@
|
||||
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-boat', 'title' => 'Boots-Details', 'height' => 200]);
|
||||
|
||||
$items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Bootsnamen ein:</p>';
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-editboatname', 'placeholder' => 'Bootsname', 'type' => 'text']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-editboatname']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-editboatname', 'height' => 240]);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||
$sp['scripts'] .= $scripts->load('boats');
|
||||
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 200]);
|
||||
|
||||
$items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Jahrgang ein:</p>';
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-edityear', 'placeholder' => 'Jahrgang', 'type' => 'number']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-edityear']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edityear', 'height' => 240]);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||
$sp['scripts'] .= $scripts->load('sailors');
|
||||
|
||||
|
||||
@@ -5,18 +5,64 @@ var page = 1;
|
||||
var pageCount = 0;
|
||||
const showCount = 25;
|
||||
|
||||
async function onEditBoatnameClick() {
|
||||
var id = $('#button-editboatname').attr('data-boat-id');
|
||||
var name = $('#input-editboatname').val();
|
||||
if (name != '') {
|
||||
showLoader();
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'add_boatname',
|
||||
method: 'POST',
|
||||
data: {
|
||||
boat: id,
|
||||
name: name
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Bootsnamen zu bearbeiten');
|
||||
} else {
|
||||
console.log('EditBoatname: unbekannter Fehler', status, error);
|
||||
console.log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
hideLoader();
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if ('status' in data) {
|
||||
if (data.status == 'added') {
|
||||
toastOk('Bootsnamen erfolgreich hinzugefügt');
|
||||
sync();
|
||||
} else {
|
||||
toastInfo('Wir prüfen Deine Anfrage und korrigieren den Bootsnamen schnellstmöglich', 5000);
|
||||
}
|
||||
} else {
|
||||
toastOk('Erfolgreich');
|
||||
}
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#menu-editboatname').hideMenu();
|
||||
}
|
||||
|
||||
async function onListClicked(id) {
|
||||
var boat = await dbGetData('boats', id);
|
||||
|
||||
$('#menu-boat').find('.menu-title').find('p').text(boat.sailnumber);
|
||||
|
||||
// Edit Boatname
|
||||
// TODO: create menu for edit boatname
|
||||
$('#button-editboatname').attr('data-boat-id', boat.id);
|
||||
$('#menu-editboatname').find('.menu-title').find('p').text(boat.sailnumber);
|
||||
if (boat['name'] == '') {
|
||||
$('#menu-item-boatname').find('span').text('Bootsnamen hinzufügen');
|
||||
$('#menu-editboatname').find('.menu-title').find('h1').text('Bootsnamen hinzufügen');
|
||||
$('#input-editboatname').val('');
|
||||
} else {
|
||||
$('#menu-item-boatname').find('span').text('Bootsnamen bearbeiten');
|
||||
$('#menu-editboatname').find('.menu-title').find('h1').text('Bootsnamen bearbeiten');
|
||||
$('#input-editboatname').val(boat.name);
|
||||
}
|
||||
$('#input-editboatname').trigger('focusin').trigger('focusout');
|
||||
|
||||
// club website
|
||||
var clubwebsite = '';
|
||||
@@ -86,6 +132,8 @@ var siteScript = async function() {
|
||||
firstCall = false;
|
||||
initPagination();
|
||||
$('#input-search').on('input', reSearch);
|
||||
$('#menu-item-boatname').click(function(){ $('#menu-boat').hideMenu(); $('#menu-editboatname').showMenu(); });
|
||||
$('#button-editboatname').click(onEditBoatnameClick);
|
||||
}
|
||||
|
||||
var results = await dbGetData('boats');
|
||||
|
||||
@@ -5,18 +5,64 @@ var page = 1;
|
||||
var pageCount = 0;
|
||||
const showCount = 25;
|
||||
|
||||
async function onEditYearClick() {
|
||||
var id = $('#button-edityear').attr('data-sailor-id');
|
||||
var year = $('#input-edityear').val();
|
||||
if (year != '') {
|
||||
showLoader();
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'add_year',
|
||||
method: 'POST',
|
||||
data: {
|
||||
sailor: id,
|
||||
year: year
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Jahrgang zu bearbeiten');
|
||||
} else {
|
||||
console.log('EditYear: unbekannter Fehler', status, error);
|
||||
console.log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
hideLoader();
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if ('status' in data) {
|
||||
if (data.status == 'added') {
|
||||
toastOk('Jahrgang erfolgreich hinzugefügt');
|
||||
sync();
|
||||
} else {
|
||||
toastInfo('Wir prüfen Deine Anfrage und korrigieren den Jahrgang schnellstmöglich', 5000);
|
||||
}
|
||||
} else {
|
||||
toastOk('Erfolgreich');
|
||||
}
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#menu-edityear').hideMenu();
|
||||
}
|
||||
|
||||
async function onListClicked(id) {
|
||||
var sailor = await dbGetData('sailors', id);
|
||||
|
||||
$('#menu-sailor').find('.menu-title').find('p').text(sailor.name);
|
||||
|
||||
// Edit Year
|
||||
// TODO: create menu for edit year
|
||||
$('#button-edityear').attr('data-sailor-id', sailor.id);
|
||||
$('#menu-edityear').find('.menu-title').find('p').text(sailor.name);
|
||||
if (sailor['year'] == null) {
|
||||
$('#menu-item-year').find('span').text('Jahrgang hinzufügen');
|
||||
$('#menu-edityear').find('.menu-title').find('h1').text('Jahrgang hinzufügen');
|
||||
$('#input-edityear').val('');
|
||||
} else {
|
||||
$('#menu-item-year').find('span').text('Jahrgang bearbeiten');
|
||||
$('#menu-edityear').find('.menu-title').find('h1').text('Jahrgang bearbeiten');
|
||||
$('#input-edityear').val(sailor.year);
|
||||
}
|
||||
$('#input-edityear').trigger('focusin').trigger('focusout');
|
||||
|
||||
// club website
|
||||
var clubwebsite = '';
|
||||
@@ -86,6 +132,8 @@ var siteScript = async function() {
|
||||
firstCall = false;
|
||||
initPagination();
|
||||
$('#input-search').on('input', reSearch);
|
||||
$('#menu-item-year').click(function(){ $('#menu-sailor').hideMenu(); $('#menu-edityear').showMenu(); });
|
||||
$('#button-edityear').click(onEditYearClick);
|
||||
}
|
||||
|
||||
var results = await dbGetData('sailors');
|
||||
|
||||
Reference in New Issue
Block a user