( async function(){
    

    let app = new Vue({
        el : '#finishedItemApp',
        data : {
            card : {},
            items : [],
        },
        methods : {
            onJobCardSelect : function( id, card ){
                this.card = card;
                $.ajax({
                    url: `/ctp/rest/job-cards/${id}`,
                    method: 'GET',
                    contentType: 'application/json',
                    dataType: 'json',
                    success:  ( data ) =>{
                        this.items = data;
                    },
                    error: function (err) {
                        console.log(err)
                    }
                });

            },
            onBundleSelects : function( id, card ){
                 this.card = card;
                     console.log(id);
                     console.log(card);
                     $.ajax({
                         url: `/ctp/rest/bundles/find-bundle-by-id/${id}`,
                         method: 'GET',
                         contentType: 'application/json',
                         dataType: 'json',
                         success:  ( data ) =>{
                         console.log(data)
                             this.items.push(data);
                           },
                             error: function (err) {
                             console.log(err)
                          }
                     });
            }
        },
        mounted : function () {
        }
    })
    
})(jQuery);