Subversion Repositories SmartDukaan

Rev

Rev 34814 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34814 Rev 34815
Line 25... Line 25...
25
        }
25
        }
26
    });
26
    });
27
    return isValid;
27
    return isValid;
28
}
28
}
29
 
29
 
-
 
30
function resetForm(form) {
-
 
31
    $(form).trigger('reset');
-
 
32
    $('#imgPreview').attr("src","");
-
 
33
    $('#imageId').val("");
-
 
34
}
-
 
35
 
30
$(document).on('click', ".category-list", function () {
36
$(document).on('click', ".category-list", function () {
31
 
37
 
32
    doGetAjaxRequestHandler(context + "/categories",
38
    doGetAjaxRequestHandler(context + "/categories",
33
        (response) => {
39
        (response) => {
34
            $('#main-content').html(response);
40
            $('#main-content').html(response);
Line 41... Line 47...
41
            });
47
            });
42
 
48
 
43
 
49
 
44
            $('#categories').on('click', '.view-category', function (ev) {
50
            $('#categories').on('click', '.view-category', function (ev) {
45
                ev.preventDefault();
51
                ev.preventDefault();
46
                let superCatalogId = $(this).parent().parent('tr').data('id');
52
                let categoryId = $(this).parent().parent('tr').data('id');
47
                doGetAjaxRequestHandler(context + "/categories/"+superCatalogId,(response) => {
53
                doGetAjaxRequestHandler(context + "/categories/"+categoryId,(response) => {
48
                    $('#manageCategoryBody').empty();
54
                    response = JSON.parse(response);
49
                    $('#manageCategoryBody').html(response);
55
                    $('#category_id').val(response.id);
-
 
56
                    $('#parent_id').val(response.parentCategoryId).trigger('change');
-
 
57
                    $('#label').val(response.label);
-
 
58
                    $('#display_name').val(response.displayName);
-
 
59
                    $('#description').val(response.description);
-
 
60
                    $('#imageId').val(response.imageId);
-
 
61
                    $('#featured').prop('checked', response.featured);
-
 
62
                    if(response.imageId > 0) {
-
 
63
                        const img = $('#imgPreview');
-
 
64
                        img.attr("src","http://localhost:8080/document/" + response.imageId);
-
 
65
                    }
50
                    $('#manageCategory').modal('show');
66
                    $('#manageCategory').modal('show');
51
                });
67
                });
52
            });
68
            });
53
 
69
 
54
            // Initialize DataTable
70
            // Initialize DataTable