| 33973 |
tejus.loha |
1 |
<div class="form-group">
|
|
|
2 |
<label for="brand_id">Select brand</label>
|
|
|
3 |
<select id="brand_id" class="form-control">
|
|
|
4 |
<option value="">-- Select --</option>
|
|
|
5 |
#foreach($brand in $brands)
|
|
|
6 |
<option value="$brand.getId()" #if($brand.getId() == $superCatalogModel.getBrandId()) selected="selected" #end>$brand.getName()</option>
|
|
|
7 |
#end
|
|
|
8 |
</select>
|
|
|
9 |
</div>
|
|
|
10 |
<div class="form-group">
|
|
|
11 |
<label for="super_catalog_name">Super catalog name</label>
|
|
|
12 |
<select id="super_catalog_name" class="form-control selectOrCreate">
|
|
|
13 |
<option value="">-- Select --</option>
|
|
|
14 |
#foreach($row in $superCatalogs)
|
|
|
15 |
<option value="$row.getId()" #if($row.getId() == $superCatalogModel.getSuperCatalogId()) selected="selected" #end>$row.getSuperCatalogName()</option>
|
|
|
16 |
#end
|
|
|
17 |
</select>
|
|
|
18 |
</div>
|
|
|
19 |
<table class="table" id="catalogMappingTable">
|
|
|
20 |
<thead>
|
|
|
21 |
<tr>
|
|
|
22 |
<th width="70%">Catalog</th>
|
|
|
23 |
<th width="20%">Variant</th>
|
|
|
24 |
<th width="10%"><button class="btn btn-primary addNew"><i class="fa fa-plus"></i></button></th>
|
|
|
25 |
</tr>
|
|
|
26 |
</thead>
|
|
|
27 |
<tbody id="catalogMapping">
|
| 34010 |
vikas.jang |
28 |
#if($superCatalogMapping.size() > 0)
|
| 33973 |
tejus.loha |
29 |
#foreach($mapping in $superCatalogMapping)
|
|
|
30 |
<tr data-mapping-id="$mapping.getId()">
|
|
|
31 |
<td>
|
|
|
32 |
<div class="form-group">
|
|
|
33 |
<select class="form-control catalog_id" id="catalog_id">
|
|
|
34 |
<option value="">-- Select Catalog --</option>
|
|
|
35 |
#foreach($row in $catalogs)
|
| 34023 |
vikas.jang |
36 |
<option value="$row.getId()" #if($row.getId() == $mapping.getCatalogId()) selected="selected" #end>$row.getDescription()</option>
|
| 33973 |
tejus.loha |
37 |
#end
|
|
|
38 |
</select>
|
|
|
39 |
</div>
|
|
|
40 |
</td>
|
|
|
41 |
<td>
|
|
|
42 |
<div class="form-group">
|
|
|
43 |
<input id="variant_name" class="form-control variant_name" placeholder="Variant name" #if($mapping.getVariantName()) value="$mapping.getVariantName()" #end>
|
|
|
44 |
<input type="hidden" id="mapping_id" value="$mapping.getId()">
|
|
|
45 |
</div>
|
|
|
46 |
</td>
|
|
|
47 |
<td>
|
|
|
48 |
<button class="btn btn-danger removeExisting"><i class="fa fa-times"></i></button>
|
|
|
49 |
</td>
|
|
|
50 |
</tr>
|
|
|
51 |
#end
|
| 34010 |
vikas.jang |
52 |
#else
|
| 33973 |
tejus.loha |
53 |
<tr>
|
|
|
54 |
<td>
|
|
|
55 |
<div class="form-group">
|
|
|
56 |
<select class="form-control select2 catalog_id" id="catalog_id">
|
|
|
57 |
<option value="">-- Select Catalog --</option>
|
|
|
58 |
#foreach($row in $catalogs)
|
| 34023 |
vikas.jang |
59 |
<option value="$row.getId()">$row.getDescription()</option>
|
| 33973 |
tejus.loha |
60 |
#end
|
|
|
61 |
</select>
|
|
|
62 |
</div>
|
|
|
63 |
</td>
|
|
|
64 |
<td>
|
|
|
65 |
<div class="form-group">
|
|
|
66 |
<input id="variant_name" class="form-control variant_name" placeholder="Variant name">
|
|
|
67 |
<input type="hidden" id="mapping_id" value="0">
|
|
|
68 |
</div>
|
|
|
69 |
</td>
|
|
|
70 |
<td>
|
|
|
71 |
<button class="btn btn-primary removeExisting"><i class="fa fa-minus"></i></button>
|
|
|
72 |
</td>
|
|
|
73 |
</tr>
|
| 34010 |
vikas.jang |
74 |
#end
|
| 33973 |
tejus.loha |
75 |
</tbody>
|
|
|
76 |
</table>
|
|
|
77 |
|
|
|
78 |
<script>
|
|
|
79 |
$(document).ready(function (){
|
|
|
80 |
$('.selectOrCreate').select2({
|
|
|
81 |
placeholder: "Select or add new",
|
|
|
82 |
tags: true,
|
|
|
83 |
createTag: function(params) {
|
|
|
84 |
return {
|
|
|
85 |
id: params.term,
|
|
|
86 |
text: params.term,
|
|
|
87 |
newOption: true
|
|
|
88 |
};
|
|
|
89 |
},
|
|
|
90 |
templateResult: function(data) {
|
|
|
91 |
return data.newOption ? $('<span class="new-option">Add: ' + data.text + '</span>') : data.text;
|
|
|
92 |
},
|
|
|
93 |
});
|
|
|
94 |
});
|
|
|
95 |
</script>
|