Item add und ausgeben
This commit is contained in:
@ -229,7 +229,7 @@ function Detail(){
|
||||
idtoken: idtoken
|
||||
},
|
||||
success(res){
|
||||
console.log(res.groups)
|
||||
console.log(res)
|
||||
console.log("/myshoppinglists inside idtoken: ", idtoken)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@ -270,7 +270,7 @@ function Detail(){
|
||||
for (let i = 0; i < res.groups.length; i++) {
|
||||
const el = res.groups[i];
|
||||
$(".card-body").append(`
|
||||
<h5 class="card-title text-center">${el.name}</h5>
|
||||
<h5 class="card-title text-center">${el.name}: ${el.content[0].name}</h5>
|
||||
`);
|
||||
}
|
||||
ItemAdden()
|
||||
@ -298,7 +298,9 @@ function ItemAdden(){
|
||||
|
||||
let getid = $(this).closest('.shoplistid');
|
||||
let id = getid.attr('id');
|
||||
globaleAddZwischenID = id;
|
||||
console.log(id);
|
||||
$('.custom-select-groups').remove('#select-group');
|
||||
|
||||
$('.GroupItemAdd').modal('show');
|
||||
|
||||
@ -311,12 +313,12 @@ function ItemAdden(){
|
||||
},
|
||||
success(result){
|
||||
|
||||
console.log(result);
|
||||
console.log(result.groups);
|
||||
|
||||
for (let i = 0; i < result.groups.length; i++) {
|
||||
const el = result.groups[i];
|
||||
$(".custom-select").append(`
|
||||
<option value="${i}">${el.name}</option>
|
||||
$(".custom-select-groups").append(`
|
||||
<option class="select" value="${el.group_id}">${el.name}</option>
|
||||
`);
|
||||
}
|
||||
|
||||
@ -331,6 +333,27 @@ function ItemAdden(){
|
||||
|
||||
$(".itemhinzu").click(function(){
|
||||
|
||||
|
||||
var name = $('#itemname').val();
|
||||
var zahl = $('#inputGroupSelect01').val();
|
||||
var gruppe = $('#inputGroupSelect02').val();
|
||||
console.log(name);
|
||||
console.log(zahl);
|
||||
console.log(gruppe);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/item",
|
||||
data: {
|
||||
group_id: $('#inputGroupSelect02').val(),
|
||||
sl_id: globaleAddZwischenID,
|
||||
name: $('#itemname').val(),
|
||||
count: $('#inputGroupSelect01').val()
|
||||
},
|
||||
success(result){
|
||||
console.log("post item");
|
||||
},error(err){
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
});
|
Reference in New Issue
Block a user