Item add und ausgeben
This commit is contained in:
parent
bad52f9284
commit
35d36f6de1
@ -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){
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
});
|
@ -85,22 +85,22 @@
|
||||
<center><p class="layout ueberschrift">Item hinzufügen</p></center>
|
||||
<div class="form-group layout">
|
||||
<label for="exampleInputEmail1">Gegenstand</label>
|
||||
<input type="text" class="form-control" id="intemname" placeholder="zB: Coca Cola">
|
||||
<input type="text" class="form-control" id="itemname" placeholder="zB: Coca Cola">
|
||||
</div>
|
||||
|
||||
<div class="form-group layout">
|
||||
<label for="Anzahl-example">Anzahl</label>
|
||||
<select class="custom-select" id="inputGroupSelect01">
|
||||
<option selected>1</option>
|
||||
<option value="1">2</option>
|
||||
<option value="2">3</option>
|
||||
<option value="3">4</option>
|
||||
<option value="4">5</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group layout">
|
||||
<label for="Group-select">Group</label>
|
||||
<select class="custom-select" id="inputGroupSelect02">
|
||||
<select class="custom-select custom-select-groups" id="inputGroupSelect02">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user