add.pt
6.01 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<html metal:use-macro="load: ../base.pt">
<!-- <div metal:fill-slot="content"> -->
<div metal:fill-slot="scripts">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${request.title}</h3>
</div>
<div class="panel-body">
<form id="deform" method="POST" enctype="multipart/form-data" accept-charset="utf-8"
class="form-horizontal">
<div class="alert alert-danger" tal:condition="form and form.error and True or False">
<div class="error-msg-lbl">Kesalahan Pengisian Form</div>
<p class="error-msg">${form.errormsg}</p>
</div>
<div class="form-group" tal:repeat="f form" id="group-${f.oid}">
<div id="item-${f.oid}" style="${f.widget.hidden and 'display:none;' or 'display:block;'}">
<label for="${f.oid}" class="control-label col-md-2 ${f.required and 'required' or ''} " id="req-${f.oid}">
${f.title}</label>
<div class="col-md-3">
${structure:f.serialize()}
<p id="error-${f.oid}" class="help-block" tal:condition="f.error"
tal:repeat="error f.error.messages()">
${error}</p>
</div>
</div>
</div>
<<<<<<< HEAD
<div class="col-md-4">
<label class="control-label col-md-3"></label>
<button type="submit" class="btn btn-primary" id="simpan" name="simpan">Simpan</button>
<button type="submit" class="btn btn-warning" id="batal" name="batal">Tutup</button>
</div>
</form>
</div>
</div>
<style>
.red-border {
border-color: rgba(255, 0, 0, 0.2);
box-shadow: 0 1px 1px rgba(255, 0, 0, 0.2); inset, 0 0 8px rgba(255, 0, 0, 0.2);
outline: 0 none;
}
</style>
<!-- </div> -->
=======
<div class="col-md-3">
<div class="form-group" tal:define="field form['aktif']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-6" id="req-${field.oid}">
${field.title}</label>
<div class="col-md-6">
${structure:field.serialize()}
<p id="error-${field.oid}" class="help-block" tal:condition="field.error"
tal:repeat="error field.error.messages()">
${error}</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" tal:define="field form['status']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-4" id="req-${field.oid}">
${field.title}</label>
<div class="col-md-8">
${structure:field.serialize()}
<p id="error-${field.oid}" class="help-block" tal:condition="field.error"
tal:repeat="error field.error.messages()">
${error}</p>
</div>
</div>
</div>
</div>
>>>>>>> 2c4a01303afe7752c4288ff2440e57196df69a0c
<script>
$(document).ready(function(){
show_type();
function show_type(){
type_id = $('#source_type').val();
if (type_id == 'grid'){
//$('#grid_nm').prop('readonly', false);
//$('#grid_nm').prop('enabled', true);
$('#grid_nm').typeahead({"minLength": 1,
"remote": "/eis/carousel/hon/act?term=%QUERY",
"limit": 8});
$('#group-grid_nm').css("display","block");
}
else{
$('#grid_nm').typeahead('destroy');
//$('#grid_nm').prop('readonly', true);
//$('#grid_nm').prop('enabled', false);
$('#grid_nm').val("");
$('#group-grid_nm').css("display","none");
}
if (type_id == 'chart-pie'){
$('#pie_nm').typeahead('destroy');
//$('#pie_nm').prop('readonly', false);
//$('#pie_nm').prop('enabled', true);
$('#pie_nm').typeahead({"minLength": 1,
"remote": "/eis/chart/hon/act?term=%QUERY&chart_type=pie",
"limit": 8});
$('#group-pie_nm').css("display","block");
}
else{
$('#pie_nm').typeahead('destroy');
//$('#pie_nm').prop('readonly', true);
//$('#pie_nm').prop('enabled', false);
$('#pie_nm').val("");
$('#group-pie_nm').css("display","none");
}
if (type_id == 'chart-bar'){
//$('#bar_nm').prop('readonly', false);
//$('#bar_nm').prop('enabled', true);
$('#bar_nm').typeahead({"minLength": 1,
"remote": "/eis/chart/hon/act?term=%QUERY&chart_type=bar",
"limit": 8});
$('#group-bar_nm').css("display","block");
}
else{
$('#bar_nm').typeahead('destroy');
//$('#bar_nm').prop('readonly', true);
//$('#bar_nm').prop('enabled', false);
$('#bar_nm').val("");
$('#group-bar_nm').css("display","none");
}
if (type_id == 'chart-line'){
//$('#line_nm').prop('readonly', false);
//$('#line_nm').prop('enabled', true);
$('#line_nm').typeahead({"minLength": 1,
"remote": "/eis/chart/hon/act?term=%QUERY&chart_type=line",
"limit": 8});
$('#group-line_nm').css("display","block");
}
else{
$('#line_nm').typeahead('destroy');
//$('#line_nm').prop('readonly', true);
//$('#line_nm').prop('enabled', false);
$('#line_nm').val("");
$('#group-line_nm').css("display","none");
}
if (type_id == 'image'){
$('#source_id').prop('readonly', false);
$('#source_id').prop('enabled', true);
$('#group-upload').css("display","block");
}
else{
$('#source_id').prop('readonly', true);
$('#source_id').prop('enabled', false);
$('#group-upload').css("display","none");
}
}
$('#source_type').change( function(){
$('#source_id').val("");
show_type();
});
$('#grid_nm, #line_nm, #bar_nm, #pie_nm').on(
'typeahead:selected',
function(obj, datum, name) {
$('#source_id').val(datum.id);
}
);
$('#upload').change( function(){
$('#source_id').val($('#upload').val());
});
});
</script>
</div>
</html>