Item add und ausgeben
This commit is contained in:
parent
bad52f9284
commit
35d36f6de1
@ -229,7 +229,7 @@ function Detail(){
|
|||||||
idtoken: idtoken
|
idtoken: idtoken
|
||||||
},
|
},
|
||||||
success(res){
|
success(res){
|
||||||
console.log(res.groups)
|
console.log(res)
|
||||||
console.log("/myshoppinglists inside idtoken: ", idtoken)
|
console.log("/myshoppinglists inside idtoken: ", idtoken)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -270,7 +270,7 @@ function Detail(){
|
|||||||
for (let i = 0; i < res.groups.length; i++) {
|
for (let i = 0; i < res.groups.length; i++) {
|
||||||
const el = res.groups[i];
|
const el = res.groups[i];
|
||||||
$(".card-body").append(`
|
$(".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()
|
ItemAdden()
|
||||||
@ -298,7 +298,9 @@ function ItemAdden(){
|
|||||||
|
|
||||||
let getid = $(this).closest('.shoplistid');
|
let getid = $(this).closest('.shoplistid');
|
||||||
let id = getid.attr('id');
|
let id = getid.attr('id');
|
||||||
|
globaleAddZwischenID = id;
|
||||||
console.log(id);
|
console.log(id);
|
||||||
|
$('.custom-select-groups').remove('#select-group');
|
||||||
|
|
||||||
$('.GroupItemAdd').modal('show');
|
$('.GroupItemAdd').modal('show');
|
||||||
|
|
||||||
@ -311,12 +313,12 @@ function ItemAdden(){
|
|||||||
},
|
},
|
||||||
success(result){
|
success(result){
|
||||||
|
|
||||||
console.log(result);
|
console.log(result.groups);
|
||||||
|
|
||||||
for (let i = 0; i < result.groups.length; i++) {
|
for (let i = 0; i < result.groups.length; i++) {
|
||||||
const el = result.groups[i];
|
const el = result.groups[i];
|
||||||
$(".custom-select").append(`
|
$(".custom-select-groups").append(`
|
||||||
<option value="${i}">${el.name}</option>
|
<option class="select" value="${el.group_id}">${el.name}</option>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,6 +333,27 @@ function ItemAdden(){
|
|||||||
|
|
||||||
$(".itemhinzu").click(function(){
|
$(".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>
|
<center><p class="layout ueberschrift">Item hinzufügen</p></center>
|
||||||
<div class="form-group layout">
|
<div class="form-group layout">
|
||||||
<label for="exampleInputEmail1">Gegenstand</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group layout">
|
<div class="form-group layout">
|
||||||
<label for="Anzahl-example">Anzahl</label>
|
<label for="Anzahl-example">Anzahl</label>
|
||||||
<select class="custom-select" id="inputGroupSelect01">
|
<select class="custom-select" id="inputGroupSelect01">
|
||||||
<option selected>1</option>
|
<option value="1">1</option>
|
||||||
<option value="1">2</option>
|
<option value="2">2</option>
|
||||||
<option value="2">3</option>
|
<option value="3">3</option>
|
||||||
<option value="3">4</option>
|
<option value="4">4</option>
|
||||||
<option value="4">5</option>
|
<option value="5">5</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group layout">
|
<div class="form-group layout">
|
||||||
<label for="Group-select">Group</label>
|
<label for="Group-select">Group</label>
|
||||||
<select class="custom-select" id="inputGroupSelect02">
|
<select class="custom-select custom-select-groups" id="inputGroupSelect02">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user