{"size": 1204, "ext": "js", "max_stars_repo_path": "resources/js/admin/product-group/Form.js", "max_stars_repo_name": "SamuelT-ST/laracom", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/js/admin/product-group/Form.js", "max_issues_repo_name": "SamuelT-ST/laracom", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/js/admin/product-group/Form.js", "max_forks_repo_name": "SamuelT-ST/laracom", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.0833333333, "max_line_length": 57, "alphanum_fraction": 0.4244186047}
import AppForm from '../app-components/Form/AppForm';

Vue.component('product-group-form', {
    mixins: [AppForm],
    props: ['availableProducts'],
    data: function() {
        return {
            form: {
                name: '',
                description: '',
                discount: '',
                status: false,
                products: [],
                categories: []
            },
            newProduct: '',
            fromDimensions: '',
            toDimensions: '',
            position: '',
            mediaCollections: ['cover', 'images']
        }
    },
    methods: {
        addProduct(){

            let data = {
                product: this.newProduct,
                pivot: {
                    from_dimensions: this.fromDimensions,
                    to_dimensions: this.toDimensions,
                    position: this.position,
                }
            };

            this.form.products.push(data);

            this.newProduct = '';
            this.fromDimensions = '';
            this.toDimensions = '';
            this.position = ''
        },

        deleteProduct(index){
            this.form.products.splice(index,1);
        },
    }

});