Subversion Repositories SmartDukaan

Rev

Rev 34023 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<style>
    .select2-container .select2-selection--single {
        box-sizing: border-box;
        cursor: pointer;
        display: block;
        height: 35px;
        padding: 3px;
        user-select: none;
        -webkit-user-select: none;
    }

    .modal-body {
        overflow-y: auto;
        max-height: calc(100vh - 200px);
    }
</style>
<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>Super Catalog</h3>
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Dashboard</a></li>
                <li><i class="icon_document_alt"></i>Super Catalog</li>
                <li class="pull-right">
                    <button class="btn btn-primary map-catalog" type="button" data-toggle="modal" data-target="#manageSuperCatalogModal">
                        <i class="icon_document_alt"></i>Create New</button>
                </li>
            </ol>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered" id="super-catalog">
            <thead>
            <tr>
                <th>#</th>
                <th>Name</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
                #if($allSuperCatalogs.size() > 0)
                    #foreach($superCatalog in $allSuperCatalogs)
                    <tr data-id="$superCatalog.getId()" data-catalog_name="$superCatalog.getSuperCatalogName()" data-brand_name="$superCatalog.getBrandId()">
                        <td>$superCatalog.getId()</td>
                        <td>$superCatalog.getSuperCatalogName()</td>
                        <td data-id="$superCatalog.getId()">
                            <button class="btn btn-primary view-super-catalog"><i class="fa fa-eye" title="View"></i></button>
                            <button class="btn btn-danger delete-super-catalog-mapping"><i class="fa fa-trash" title="Delete"></i></button>
                        </td>
                    </tr>
                    #end
                #else
                    <tr>
                        <td colspan="7">No super catalogs mapping available.</td>
                    </tr>
                #end
            </tbody>
        </table>
    </div>
</section>

<div id="manageSuperCatalogModal" class="modal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Manage super catalog</h4>
            </div>
            <div class="modal-body" id="manageSuperCatalogModalBody">
                <div class="form-group">
                    <label for="brand_id">Select brand</label>
                    <select id="brand_id" class="form-control">
                        <option value="">-- Select --</option>
                        #foreach($brand in $brands)
                            <option value="$brand.getId()">$brand.getName()</option>
                        #end
                    </select>
                </div>
                <div class="form-group">
                    <label for="super_catalog_name">Super catalog name</label>
                    <select id="super_catalog_name" class="form-control selectOrCreate"></select>
                </div>
                <table class="table" id="catalogMappingTable">
                    <thead>
                        <tr>
                            <th>Catalog</th>
                            <th>Variant</th>
                            <th><button class="btn btn-primary addNew"><i class="fa fa-plus"></i></button></th>
                        </tr>
                    </thead>
                    <tbody id="catalogMapping"></tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary save_super_model">Save</button>
            </div>
        </div>
    </div>
</div>

<script>
    $('.map-catalog').click(function () {
        $('#manageSuperCatalogModal').on('show.bs.modal', function () {
            console.log("shown bs model")
            $('tbody#catalogMapping').empty();
        });
    })
</script>