aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/templates/edit_tiers_categ.mako
blob: 34795a056a82545418c614ac437f48310286048f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<%inherit file="jm2l:templates/layout.mako"/>
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<%def name="jsAddOn()"> 
    <script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script>
<script type="text/javascript">
jQuery(function() {
	jQuery('.repeat').each(function() {
		jQuery(this).repeatable_fields({
			wrapper: 'table',
			container: 'tbody',
			row: 'tr',
			cell: 'td',
		});
	});
});
</script>

</%def>
<h2>Gestion des catégories pour les entités</h2>

<form method="post" action="#">
<div class="repeat">
  <table class="table table-striped table-bordered">
	<tbody data-rf-row-count="${len(TiersOpt.get_entity_type())}" class="container ui-sortable">
	<tr style="display: none;" class="template row">
		##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
		<td class="cell">
			<strong>Catégorie</strong>
			<input style="width:80%" disabled="" name="collection[{{row-count-placeholder}}][title]" 
				class="form-control" type="text">
			<table class="table table-striped table-bordered">
			  <caption><strong>Sous Catégories</strong></caption>			
			  <tbody data-rf-row-count="0" style="" class="container ui-sortable">
				<tr style="display: none;" class="template row">
					##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
					<td class="cell">
						<input style="margin-bottom:0" 
							name="collection[{{row-count-placeholder}}][{{row-count-placeholder}}][id]" 
							class="form-control" type="text">
					</td>
					<td><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
				</tr>
			  </tbody>
			  <tfoot>
				<tr>
					<td colspan="3" style="text-align:center;"><span class="add btn btn-mini btn-success">Ajouter une sous-catégorie</span></td>
				</tr>
			  </tfoot>
			</table>
		</td>
		
		<td style="width:60px"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
	</tr>
% for num, (opt, optcounter) in enumerate(TiersOpt.get_entity_type()):	
	<tr class="row">
		##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
		<td class="cell">
			<strong>Catégorie</strong>
			<input style="width:70%" name="collection[${opt.slug_entity_type}][title]" 
				class="form-control" type="text" value="${opt.entity_type}"> ( ${optcounter} entité${["","s"][optcounter>1]} )
			<table class="table table-striped table-bordered">
			  <caption><strong>Sous Catégories</strong></caption>
			  <tbody data-rf-row-count="${len(TiersOpt.get_entity_sub_type(opt.entity_type))}" style="" class="container ui-sortable">
				<tr style="display: none;" class="template row">
					##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
					<td class="cell">		
						<input style="margin-bottom:0;width:95%;" 
							name="collection[${opt.slug_entity_type}][{{row-count-placeholder}}][id]"
							class="form-control" type="text">
					</td>
					<td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
				</tr>				
		% for nums, (sopt, soptcounter) in enumerate(TiersOpt.get_entity_sub_type(opt.entity_type)):				
				<tr class="row" display: table-row;>
					##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
					<td class="cell">
						<input style="margin-bottom:0;width:80%;"
							name="collection[${opt.slug_entity_type}][${nums}][${sopt.uid}]" 
							class="form-control" type="text" value="${sopt.entity_subtype}">
						( ${soptcounter} entité${["","s"][soptcounter>1]} )
					</td>
					% if soptcounter:
						<td style="width:70px;"></td>
					% else:
						<td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
					% endif
				</tr>
		% endfor
			  </tbody>
			  <tfoot>
				<tr>
					<td colspan="3" style="text-align:center;">
						<span class="add btn btn-mini btn-success">Ajouter une sous-catégorie à ${opt.entity_type}</span>
					</td>
				</tr>
			  </tfoot>				
			</table>
		</td>
	% if optcounter:					
		<td style="width:70px;"></td>
	% else:
		<td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
	% endif
	</tr>
% endfor
	</tbody>
	<tfoot>
		<tr>
			<td colspan="2" style="text-align:center;"><span class="add btn btn-mini btn-success">Ajouter une catégorie</span></td>
		</tr>
	</tfoot>	
  </table>
</div>

	<input type="submit" class="btn btn-primary" value="Enregistrer les modifications" />
</form>