.
This commit is contained in:
parent
b5f1a94039
commit
650e0bbd9e
@ -78,37 +78,10 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".gruppenadd").click(function () {
|
||||
|
||||
// let name = $("#groupname").val();
|
||||
// let color = $("#groupfarbe").val();
|
||||
$("#ListenDetailAdd").modal("hide");
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/group",
|
||||
data: {
|
||||
sl_id: globaleAddZwischenID,
|
||||
name: $("#groupname").val(),
|
||||
color: $("input:checked").val()
|
||||
},
|
||||
success(res) {
|
||||
console.log("groupadd funktioniert");
|
||||
|
||||
},
|
||||
error(err) {
|
||||
console.log("error");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".sl_add").click(function () {
|
||||
$('#EigeneListeAdd').modal('show');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
var globaleAddZwischenID = "";
|
||||
@ -151,7 +124,6 @@ function eigeneEinkaufslisten() {
|
||||
${userinfo}</span>
|
||||
<button class="btn edit"><i class="fas fa-pencil-alt "></i></button>
|
||||
<button class="btn trash"><i class="far fa-trash-alt"></i></button>
|
||||
<button class="btn groupadd" data-toggle="modal" data-target=".ListenDetailAdd"><i class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@ -162,7 +134,6 @@ function eigeneEinkaufslisten() {
|
||||
}
|
||||
console.log("Eigene Einkaufslisten");
|
||||
loeschen();
|
||||
lala();
|
||||
Detail();
|
||||
// groupHinzufügen()
|
||||
},
|
||||
@ -240,10 +211,58 @@ function loeschen() {
|
||||
|
||||
function lala() {
|
||||
$(".groupadd").click(function () {
|
||||
let card = $(this).closest(".card");
|
||||
let id = card.attr("id");
|
||||
let getid = $(this).closest('.shoplistid');
|
||||
let id = getid.attr('id');
|
||||
console.log(id);
|
||||
globaleAddZwischenID = id;
|
||||
$("#groupname").val("");
|
||||
});
|
||||
}
|
||||
|
||||
function gruppenhinzu() {
|
||||
$(".gruppenadd").click(function () {
|
||||
|
||||
let name = $("#groupname").val();
|
||||
let color = $("input:checked").val();
|
||||
$("#ListenDetailAdd").modal("hide");
|
||||
console.log(globaleAddZwischenID);
|
||||
|
||||
firebase.auth().onAuthStateChanged(async function (user) {
|
||||
if (user) {
|
||||
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/group",
|
||||
data: {
|
||||
idtoken:idtoken,
|
||||
sl_id: globaleAddZwischenID,
|
||||
name: $("#groupname").val(),
|
||||
color: $("input:checked").val(),
|
||||
hidden: false
|
||||
},
|
||||
success(res) {
|
||||
$(".gruppeninhalt").append(`<div class="col-md-6 col-lg-4 shoplisteid" id="${globaleAddZwischenID}">
|
||||
<div class="card mb-3 groupid" id="" style="max-width: 18rem;background-color:#${color};">
|
||||
|
||||
<div class="card-header"><h5 class="card-title">${name}</h5><button class="btn trashgroup"><i class="far fa-trash-alt"></i></button><button class="btn seemore" type="button" data-toggle="collapse" data-target="#${name}" aria-expanded="false" aria-controls="${name}"><i class="fas fa-caret-down"></i></button>
|
||||
<div class="${name}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></div>
|
||||
`);
|
||||
|
||||
},
|
||||
error(err) {
|
||||
console.log("error");
|
||||
}
|
||||
});
|
||||
|
||||
}).catch((error) => console.error("Get id token client error: ", error));
|
||||
} else {
|
||||
console.log("Check Auth error", user)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -297,9 +316,7 @@ function Detail() {
|
||||
<a href="${link}" style="left: 5px; margin-top: -50px;color: black;">
|
||||
<i class="fas fa-caret-left"></i>
|
||||
</a>
|
||||
<button class="itemadd">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
<button class="btn groupadd" data-toggle="modal" data-target=".ListenDetailAdd"><i class="fas fa-plus"></i></button>
|
||||
<h1 class="text-center">
|
||||
${neu[0].name}
|
||||
</h1></div>
|
||||
@ -321,6 +338,8 @@ function Detail() {
|
||||
$(`.${el.name}`).append(`<div class="collapse" id="${el.name}"><ul><li>${el2.count}x ${el2.name}</li></ul></div>`);
|
||||
}
|
||||
}
|
||||
lala();
|
||||
gruppenhinzu();
|
||||
ItemAdden();
|
||||
groupdelete();
|
||||
},
|
||||
@ -351,6 +370,7 @@ function ItemAdden() {
|
||||
|
||||
let getid = $(this).closest('.shoplistid');
|
||||
let id = getid.attr('id');
|
||||
console.log(id);
|
||||
globaleAddZwischenID = id;
|
||||
console.log(id);
|
||||
$('.select').remove();
|
||||
@ -399,6 +419,10 @@ $(".itemhinzu").click(function () {
|
||||
console.log(zahl);
|
||||
console.log(gruppe);
|
||||
|
||||
|
||||
firebase.auth().onAuthStateChanged(async function (user) {
|
||||
if (user) {
|
||||
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/item",
|
||||
@ -415,6 +439,11 @@ $(".itemhinzu").click(function () {
|
||||
|
||||
}
|
||||
});
|
||||
}).catch((error) => console.error("Get id token client error: ", error));
|
||||
} else {
|
||||
console.log("Check Auth error", user)
|
||||
}
|
||||
});
|
||||
|
||||
Detail();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user