Item add Modal
This commit is contained in:
		@@ -229,6 +229,7 @@ function Detail(){
 | 
			
		||||
                    idtoken: idtoken
 | 
			
		||||
                },
 | 
			
		||||
                success(res){
 | 
			
		||||
                    console.log(res.groups)
 | 
			
		||||
                    console.log("/myshoppinglists inside idtoken: ", idtoken)
 | 
			
		||||
                    $.ajax({
 | 
			
		||||
                        type: "GET",
 | 
			
		||||
@@ -255,31 +256,22 @@ function Detail(){
 | 
			
		||||
                                    //ITEM ADD
 | 
			
		||||
                                    // von Card Header Kopiert
 | 
			
		||||
 | 
			
		||||
                                    // <a href="" class="itemadd">
 | 
			
		||||
                                    //     <i class="fas fa-plus"></i>
 | 
			
		||||
                                    //     </a>
 | 
			
		||||
 | 
			
		||||
                                    $(".card-header").append(`
 | 
			
		||||
                                    $(".card-header").append(`<div class="shoplistid" id="${id}">
 | 
			
		||||
                                        <a href="${link}" style="left: 5px; margin-top: -50px">
 | 
			
		||||
                                            <i class="fas fa-caret-left"></i>
 | 
			
		||||
                                        </a>
 | 
			
		||||
 | 
			
		||||
                                        
 | 
			
		||||
 | 
			
		||||
                                        <button class="itemadd">
 | 
			
		||||
                                        <i class="fas fa-plus"></i>
 | 
			
		||||
                                        </button>
 | 
			
		||||
                                        <h1 class="text-center">
 | 
			
		||||
                                            ${neu[0].name}
 | 
			
		||||
                                        </h1>
 | 
			
		||||
 | 
			
		||||
                                        
 | 
			
		||||
                                        
 | 
			
		||||
                                        </h1></div>
 | 
			
		||||
                                    `);
 | 
			
		||||
                                    for (let i = 0; i < res.length; i++) {
 | 
			
		||||
                                        const el = res[i];
 | 
			
		||||
                                        $(".card-text").append(`<div class="card border-dark mb-3 items" id="${el.group_id}" style="max-width: 18rem;">
 | 
			
		||||
                                        <div class="card-body text-dark">
 | 
			
		||||
                                    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>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                    </div>`);
 | 
			
		||||
                                        `);
 | 
			
		||||
                                    }
 | 
			
		||||
                                    ItemAdden()
 | 
			
		||||
                                },
 | 
			
		||||
@@ -303,6 +295,42 @@ function Detail(){
 | 
			
		||||
 | 
			
		||||
function ItemAdden(){
 | 
			
		||||
    $(".itemadd").click(function(){
 | 
			
		||||
        alert("aleert");
 | 
			
		||||
 | 
			
		||||
        let getid = $(this).closest('.shoplistid');
 | 
			
		||||
        let id = getid.attr('id'); 
 | 
			
		||||
        console.log(id);
 | 
			
		||||
 | 
			
		||||
        $('.GroupItemAdd').modal('show');
 | 
			
		||||
 | 
			
		||||
        firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type: "GET",
 | 
			
		||||
                url: "/shoppinglist_json/" + id,
 | 
			
		||||
                data: {
 | 
			
		||||
                    idtoken: idtoken
 | 
			
		||||
                },
 | 
			
		||||
                success(result){
 | 
			
		||||
 | 
			
		||||
                    console.log(result);
 | 
			
		||||
 | 
			
		||||
                    for (let i = 0; i < result.groups.length; i++) {
 | 
			
		||||
                        const el = result.groups[i];
 | 
			
		||||
                        $(".custom-select").append(`
 | 
			
		||||
                          <option value="${i}">${el.name}</option>
 | 
			
		||||
                        `);
 | 
			
		||||
                    }
 | 
			
		||||
                    
 | 
			
		||||
                },
 | 
			
		||||
                error(err){
 | 
			
		||||
                    console.log(err);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$(".itemhinzu").click(function(){
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
@@ -48,5 +48,5 @@
 | 
			
		||||
    background: transparent;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    right:5px;
 | 
			
		||||
    margin-top: -50px;
 | 
			
		||||
    border: 0px;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user