{"size": 1789, "ext": "js", "max_stars_repo_path": "public/js/coupon-grid.js", "max_stars_repo_name": "abdel-malek/Dukkangi", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/js/coupon-grid.js", "max_issues_repo_name": "abdel-malek/Dukkangi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/js/coupon-grid.js", "max_forks_repo_name": "abdel-malek/Dukkangi", "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": 35.0784313725, "max_line_length": 107, "alphanum_fraction": 0.4443823365}
(function ($){
  loadUsers();
})(jQuery);

function loadUsers(){
    $("#coupon-grid").jsGrid({
        filtering: true,
        width: '100%',
        height: 'auto',
        autoload: true,
        paging: true,
        pageSize: 1000,
        pageIndex: 1,
        pageLoading: true,
        editing: false,
        inserting: false,
        subGrid: false,
        controller: {
            updateItem: $.noop,
            loadData: function (filter) {
                var data = $.Deferred();
                $.ajax({
                    type: "POST",
                    url: ``,
                    dataType: "json",
                    data: {filter},
                    headers: {
                        "x-csrf-token": $("[name=_token]").val()
                    },
                }).done((response) => data.resolve({ data: response.data, itemsCount: [response.total] }));
                return data.promise();
            },
        },
        fields: [
            {name: "id"                 , title: 'User ID'    , type: "text", width: 5},
            {name: "email"              , title: 'Email', type: "text", width: 5},
            {name: "order_item.0.points", title: 'Gain Points', type: "text", width: 5},
            {
              type: "control", width: 10, editButton: false, modeSwitchButton: false, deleteButton: false,
              itemTemplate: function (value, item) {
                var $result = jsGrid.fields.control.prototype.itemTemplate.apply(this, arguments);
                var $orderItems = $('<a class="btn btn-block btn-success btn-xs">Send Coupon</a>');
                $orderItems.attr('onclick',`viewModal( ${item.id} )`);
                return $result.add($orderItems);
              },
            },
            
        ]
    });
}
