<commit_before>new Vue({

    el: "#cart",
    data: {
        cart: {},
        token: null,
        len: 0,
        total: 0,
        stockProducts: null
    },

    ready: function(){
        var vue = this;
        vue.getContent();
//                setInterval(function(){
//                    vue.getContent();
//                }, 2000);

        $(this.$$.cartContent).show();
    },

    methods: {
        getContent: function(){
            var vue = this;
            $(this.$$.cartContent).css('opacity', '.4');
            $.post("/cart/get_content", {_token: this.token }).done(function(cart){
                vue.stockProducts = cart.stockProducts;
                vue.cart = cart.content;
                vue.len = cart.len;
                vue.total = cart.total;

                var cart = $("#_cart");
                cart.find('.qty').html(vue.len);
                cart.find('.qty-items').html(vue.len);
                cart.find('._sum').html(vue.total);

                $(vue.$$.cartContent).css('opacity', '1');
            });
        },
        deleteItem: function(id) {
            var vue = this;
            $.post('/cart/delete_item', { _token: this.token, rowid: id})
                .done(function(){
                    vue.getContent()
                })
        },

        updateItem: function(product, _qty){

            var vue = this,
                qty = $(_qty.$el).find('.item-quantity');

                    console.log(product.options.instance);

            qty.css('border-color', '#7cb342');
            if(qty.val().match(/^[0-9]{1,3}$/) && qty.val() > 0){
                $.post('/cart/update_item', {
                    _token: this.token,
                    product: product,
                    qty: qty.val(),
                    instance: product.options.instance
                }).done(function(){
                    vue.getContent();
                })
            } else if(qty.val().match(/^\d{0}$/)){
                qty.css('border-color', 'red');
            } else {
                $(_qty.$el).find('.item-quantity').val(product.qty);
            }
        }
    }
})<commit_msg>слияние<commit_after>new Vue({

    el: "#cart",
    data: {
        cart: {},
        token: null,
        len: 0,
        total: 0,
        stockProducts: null
    },

    ready: function(){
        var vue = this;
        vue.getContent();
//                setInterval(function(){
//                    vue.getContent();
//                }, 2000);

        $(this.$$.cartContent).show();
    },

    methods: {
        getContent: function(){
            var vue = this;
            $(this.$$.cartContent).css('opacity', '.4');
            $.post("/cart/get_content", {_token: this.token }).done(function(cart){
                vue.stockProducts = cart.stockProducts;
                vue.cart = cart.content;
                vue.len = cart.len;
                vue.total = cart.total;

                var cart = $("#_cart");
                cart.find('.qty').html(vue.len);
                cart.find('.qty-items').html(vue.len);
                cart.find('._sum').html(vue.total);

                $(vue.$$.cartContent).css('opacity', '1');
            });
        },
        deleteItem: function(id) {
            var vue = this;
            $.post('/cart/delete_item', { _token: this.token, rowid: id})
                .done(function(){
                    vue.getContent()
                })
        },

        updateItem: function(product, _qty){

            var vue = this,
                qty = $(_qty.$el).find('.item-quantity');

                    //console.log(product.options.instance);

            qty.css('border-color', '#7cb342');
            if(qty.val().match(/^[0-9]{1,3}$/) && qty.val() > 0){
                $.post('/cart/update_item', {
                    _token: this.token,
                    product: product,
                    qty: qty.val(),
                    instance: product.options.instance
                }).done(function(){
                    vue.getContent();
                })
            } else if(qty.val().match(/^\d{0}$/)){
                qty.css('border-color', 'red');
            } else {
                $(_qty.$el).find('.item-quantity').val(product.qty);
            }
        }
    }
})
{'fraction_non_alphanumeric': 0.1723176962378077, 'fraction_numerical': 0.008360427310729215, 'mean_word_length': 1.2121212121212122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3073008', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1181, 'n_words': 190}