Commit a78597e2abd036c2d2b97f9d06c5554d995591d9
1 parent
cd3eed5412
Exists in
master
Perbaikan maxvalue pada modal
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
lib/control-panel/views/main.njk
1 | {% extends "template.sbadmin2.njk" %} | 1 | {% extends "template.sbadmin2.njk" %} |
2 | 2 | ||
3 | {% block content %} | 3 | {% block content %} |
4 | 4 | ||
5 | <table class="table"> | 5 | <table class="table"> |
6 | <thead> | 6 | <thead> |
7 | <tr> | 7 | <tr> |
8 | <th style="white-space: nowrap; width: 1%;">Produk</th> | 8 | <th style="white-space: nowrap; width: 1%;">Produk</th> |
9 | <th class="text-right">Sisa</th> | 9 | <th class="text-right">Sisa</th> |
10 | <th style="white-space: nowrap; width: 1%;"> </th> | 10 | <th style="white-space: nowrap; width: 1%;"> </th> |
11 | </tr> | 11 | </tr> |
12 | </thead> | 12 | </thead> |
13 | <tbody> | 13 | <tbody> |
14 | {% for item in limitedList %} | 14 | {% for item in limitedList %} |
15 | <tr> | 15 | <tr> |
16 | <td style="white-space: nowrap; width: 1%;"> | 16 | <td style="white-space: nowrap; width: 1%;"> |
17 | <strong>{{ item.product }}</strong> | 17 | <strong>{{ item.product }}</strong> |
18 | </td> | 18 | </td> |
19 | 19 | ||
20 | <td class="text-right"> | 20 | <td class="text-right"> |
21 | {% set maxValue = maxValues[item.product] %} | 21 | {% set maxValue = maxValues[item.product] %} |
22 | {% if maxValue %} | 22 | {% if maxValue %} |
23 | <div class="progress"> | 23 | <div class="progress"> |
24 | <div class="progress-bar" role="progressbar" style="width: {{ 100 * item.value / (maxValue or item.value) }}%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="{{ maxValue }}"></div> | 24 | <div class="progress-bar" role="progressbar" style="width: {{ 100 * item.value / (maxValue or item.value) }}%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="{{ maxValue }}"></div> |
25 | </div> | 25 | </div> |
26 | <br> | 26 | <br> |
27 | {% endif %} | 27 | {% endif %} |
28 | 28 | ||
29 | <a href="#" title="klik untuk edit nilai maksimal pada grafik indikator" data-toggle="modal" data-target="#editMaxValueModal" data-product="{{ item.product }}" data-maxvalue="{{ item.value }}"> | 29 | <a href="#" title="klik untuk edit nilai maksimal pada grafik indikator" data-toggle="modal" data-target="#editMaxValueModal" data-product="{{ item.product }}" data-maxvalue="{{ maxValue or item.value }}"> |
30 | {{ item.value }} | 30 | {{ item.value }} |
31 | {% if maxValue %} dari {{ maxValue }} {% endif %} | 31 | {% if maxValue %} dari {{ maxValue }} {% endif %} |
32 | </a> | 32 | </a> |
33 | </td> | 33 | </td> |
34 | 34 | ||
35 | <td style="white-space: nowrap; width: 1%;"> | 35 | <td style="white-space: nowrap; width: 1%;"> |
36 | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#editQuotaModal" data-product="{{ item.product }}"> | 36 | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#editQuotaModal" data-product="{{ item.product }}"> |
37 | Edit | 37 | Edit |
38 | </button> | 38 | </button> |
39 | 39 | ||
40 | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#addQuotaModal" data-product="{{ item.product }}"> | 40 | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#addQuotaModal" data-product="{{ item.product }}"> |
41 | Tambah | 41 | Tambah |
42 | </button> | 42 | </button> |
43 | 43 | ||
44 | <a href="{{ baseUrl }}/delete/{{ item.supplier | urlencode }}/{{ item.product | urlencode }}" | 44 | <a href="{{ baseUrl }}/delete/{{ item.supplier | urlencode }}/{{ item.product | urlencode }}" |
45 | class="btn btn-danger btn-sm" | 45 | class="btn btn-danger btn-sm" |
46 | onclick="return confirm('Apakah anda yakin ingin menghapus kuota “{{ item.product }}“ pada supplier “{{ item.supplier }}“?');" | 46 | onclick="return confirm('Apakah anda yakin ingin menghapus kuota “{{ item.product }}“ pada supplier “{{ item.supplier }}“?');" |
47 | > | 47 | > |
48 | Hapus | 48 | Hapus |
49 | </a> | 49 | </a> |
50 | </td> | 50 | </td> |
51 | </tr> | 51 | </tr> |
52 | {% endfor %} | 52 | {% endfor %} |
53 | </tbody> | 53 | </tbody> |
54 | </table> | 54 | </table> |
55 | 55 | ||
56 | <div class="card border-left-primary"> | 56 | <div class="card border-left-primary"> |
57 | <div class="card-header align-items-center"> | 57 | <div class="card-header align-items-center"> |
58 | <h5 class="m0 font-weight-bold text-primary">Penambahan Produk Terlimit</h5> | 58 | <h5 class="m0 font-weight-bold text-primary">Penambahan Produk Terlimit</h5> |
59 | </div> | 59 | </div> |
60 | 60 | ||
61 | <div class="card-body"> | 61 | <div class="card-body"> |
62 | <form method="POST" action="{{ baseUrl }}/add-product"> | 62 | <form method="POST" action="{{ baseUrl }}/add-product"> |
63 | <div class="form-group"> | 63 | <div class="form-group"> |
64 | <label for="inputProduct">Kode Produk di Supplier</label> | 64 | <label for="inputProduct">Kode Produk di Supplier</label> |
65 | <input name="product" type="text" class="form-control" id="inputProduct" aria-describedby="inputProductHelp"> | 65 | <input name="product" type="text" class="form-control" id="inputProduct" aria-describedby="inputProductHelp"> |
66 | <small id="inputProductHelp" class="form-text text-muted">Masukkan kode produk di supplier.</small> | 66 | <small id="inputProductHelp" class="form-text text-muted">Masukkan kode produk di supplier.</small> |
67 | </div> | 67 | </div> |
68 | 68 | ||
69 | <div class="form-group"> | 69 | <div class="form-group"> |
70 | <label for="inputLimit">Batas limit</label> | 70 | <label for="inputLimit">Batas limit</label> |
71 | <input name="newLimit" type="text" class="form-control" id="inputLimit" aria-describedby="inputLimitHelp"> | 71 | <input name="newLimit" type="text" class="form-control" id="inputLimit" aria-describedby="inputLimitHelp"> |
72 | <small id="inputLimitHelp" class="form-text text-muted">Masukkan batas limit.</small> | 72 | <small id="inputLimitHelp" class="form-text text-muted">Masukkan batas limit.</small> |
73 | </div> | 73 | </div> |
74 | 74 | ||
75 | <button type="submit" class="btn btn-primary">Submit</button> | 75 | <button type="submit" class="btn btn-primary">Submit</button> |
76 | </form> | 76 | </form> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <form method="POST" action="{{ baseUrl }}/edit-product"> | 80 | <form method="POST" action="{{ baseUrl }}/edit-product"> |
81 | <div class="modal fade" id="editQuotaModal" tabindex="-1" role="dialog" aria-labelledby="editQuotaModalLabel" aria-hidden="true"> | 81 | <div class="modal fade" id="editQuotaModal" tabindex="-1" role="dialog" aria-labelledby="editQuotaModalLabel" aria-hidden="true"> |
82 | <div class="modal-dialog"> | 82 | <div class="modal-dialog"> |
83 | <div class="modal-content"> | 83 | <div class="modal-content"> |
84 | <div class="modal-header"> | 84 | <div class="modal-header"> |
85 | <h5 class="modal-title" id="editQuotaModalLabel">Edit Kuota</h5> | 85 | <h5 class="modal-title" id="editQuotaModalLabel">Edit Kuota</h5> |
86 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 86 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
87 | <span aria-hidden="true">×</span> | 87 | <span aria-hidden="true">×</span> |
88 | </button> | 88 | </button> |
89 | </div> | 89 | </div> |
90 | <div class="modal-body"> | 90 | <div class="modal-body"> |
91 | <input type="hidden" name="product" id="inputProduct" value="-999"> | 91 | <input type="hidden" name="product" id="inputProduct" value="-999"> |
92 | <div class="form-group"> | 92 | <div class="form-group"> |
93 | <label for="inputLimit">Batas limit</label> | 93 | <label for="inputLimit">Batas limit</label> |
94 | <input name="newLimit" type="number" class="form-control" id="inputLimit" aria-describedby="inputLimitHelp" required> | 94 | <input name="newLimit" type="number" class="form-control" id="inputLimit" aria-describedby="inputLimitHelp" required> |
95 | <small id="inputLimitHelp" class="form-text text-muted">Masukkan batas limit baru.</small> | 95 | <small id="inputLimitHelp" class="form-text text-muted">Masukkan batas limit baru.</small> |
96 | </div> | 96 | </div> |
97 | </div> | 97 | </div> |
98 | 98 | ||
99 | <div class="modal-footer"> | 99 | <div class="modal-footer"> |
100 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | 100 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
101 | <input type="submit" class="btn btn-primary" value="Simpan"> | 101 | <input type="submit" class="btn btn-primary" value="Simpan"> |
102 | </div> | 102 | </div> |
103 | </div> | 103 | </div> |
104 | </div> | 104 | </div> |
105 | </div> | 105 | </div> |
106 | </form> | 106 | </form> |
107 | 107 | ||
108 | <form method="POST" action="{{ baseUrl }}/add-quota"> | 108 | <form method="POST" action="{{ baseUrl }}/add-quota"> |
109 | <div class="modal fade" id="addQuotaModal" tabindex="-1" role="dialog" aria-labelledby="addQuotaModalLabel" aria-hidden="true"> | 109 | <div class="modal fade" id="addQuotaModal" tabindex="-1" role="dialog" aria-labelledby="addQuotaModalLabel" aria-hidden="true"> |
110 | <div class="modal-dialog"> | 110 | <div class="modal-dialog"> |
111 | <div class="modal-content"> | 111 | <div class="modal-content"> |
112 | <div class="modal-header"> | 112 | <div class="modal-header"> |
113 | <h5 class="modal-title" id="editQuotaModalLabel">Tambah Kuota</h5> | 113 | <h5 class="modal-title" id="editQuotaModalLabel">Tambah Kuota</h5> |
114 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 114 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
115 | <span aria-hidden="true">×</span> | 115 | <span aria-hidden="true">×</span> |
116 | </button> | 116 | </button> |
117 | </div> | 117 | </div> |
118 | <div class="modal-body"> | 118 | <div class="modal-body"> |
119 | <input type="hidden" name="product" id="inputProduct"> | 119 | <input type="hidden" name="product" id="inputProduct"> |
120 | <div class="form-group"> | 120 | <div class="form-group"> |
121 | <label for="raiseValue">Kuota yang ingin ditambahkan</label> | 121 | <label for="raiseValue">Kuota yang ingin ditambahkan</label> |
122 | <input name="raiseValue" type="number" class="form-control" id="raiseValue" aria-describedby="raiseValueHelp" required> | 122 | <input name="raiseValue" type="number" class="form-control" id="raiseValue" aria-describedby="raiseValueHelp" required> |
123 | <small id="raiseValue" class="form-text text-muted">Masukkan tambahan kuota.</small> | 123 | <small id="raiseValue" class="form-text text-muted">Masukkan tambahan kuota.</small> |
124 | </div> | 124 | </div> |
125 | </div> | 125 | </div> |
126 | 126 | ||
127 | <div class="modal-footer"> | 127 | <div class="modal-footer"> |
128 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | 128 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
129 | <input type="submit" class="btn btn-primary" value="Simpan"> | 129 | <input type="submit" class="btn btn-primary" value="Simpan"> |
130 | </div> | 130 | </div> |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | </div> | 133 | </div> |
134 | </form> | 134 | </form> |
135 | 135 | ||
136 | <form method="POST" action="{{ baseUrl }}/edit-max-value-for-indicator"> | 136 | <form method="POST" action="{{ baseUrl }}/edit-max-value-for-indicator"> |
137 | <div class="modal fade" id="editMaxValueModal" tabindex="-1" role="dialog" aria-labelledby="editMaxValueModalLabel" aria-hidden="true"> | 137 | <div class="modal fade" id="editMaxValueModal" tabindex="-1" role="dialog" aria-labelledby="editMaxValueModalLabel" aria-hidden="true"> |
138 | <div class="modal-dialog"> | 138 | <div class="modal-dialog"> |
139 | <div class="modal-content"> | 139 | <div class="modal-content"> |
140 | <div class="modal-header"> | 140 | <div class="modal-header"> |
141 | <h5 class="modal-title" id="editMaxValueModalLabel">Edit nilai maksimal pada indikator</h5> | 141 | <h5 class="modal-title" id="editMaxValueModalLabel">Edit nilai maksimal pada indikator</h5> |
142 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 142 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
143 | <span aria-hidden="true">×</span> | 143 | <span aria-hidden="true">×</span> |
144 | </button> | 144 | </button> |
145 | </div> | 145 | </div> |
146 | <div class="modal-body"> | 146 | <div class="modal-body"> |
147 | <input type="hidden" name="product" id="inputProduct"> | 147 | <input type="hidden" name="product" id="inputProduct"> |
148 | <div class="form-group"> | 148 | <div class="form-group"> |
149 | <label for="raiseValue">Nilai maksimal</label> | 149 | <label for="raiseValue">Nilai maksimal</label> |
150 | <input name="maxValue" type="number" class="form-control" id="maxValue" aria-describedby="maxValueHelp" required> | 150 | <input name="maxValue" type="number" class="form-control" id="maxValue" aria-describedby="maxValueHelp" required> |
151 | <small id="maxValueHelp" class="form-text text-muted">Masukkan nilai maksimal (untuk tampilan grafik).</small> | 151 | <small id="maxValueHelp" class="form-text text-muted">Masukkan nilai maksimal (untuk tampilan grafik).</small> |
152 | </div> | 152 | </div> |
153 | </div> | 153 | </div> |
154 | 154 | ||
155 | <div class="modal-footer"> | 155 | <div class="modal-footer"> |
156 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | 156 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
157 | <input type="submit" class="btn btn-primary" value="Simpan"> | 157 | <input type="submit" class="btn btn-primary" value="Simpan"> |
158 | </div> | 158 | </div> |
159 | </div> | 159 | </div> |
160 | </div> | 160 | </div> |
161 | </div> | 161 | </div> |
162 | </form> | 162 | </form> |
163 | 163 | ||
164 | {% endblock %} | 164 | {% endblock %} |
165 | 165 | ||
166 | {% block postScriptOnBody %} | 166 | {% block postScriptOnBody %} |
167 | 167 | ||
168 | <script> | 168 | <script> |
169 | $('#editQuotaModal').on('show.bs.modal', function (event) { | 169 | $('#editQuotaModal').on('show.bs.modal', function (event) { |
170 | var button = $(event.relatedTarget); | 170 | var button = $(event.relatedTarget); |
171 | var product = button.data('product'); | 171 | var product = button.data('product'); |
172 | 172 | ||
173 | var modal = $(this) | 173 | var modal = $(this) |
174 | modal.find('.modal-title').text(`Edit Kuota ${product}`); | 174 | modal.find('.modal-title').text(`Edit Kuota ${product}`); |
175 | modal.find('.modal-body #inputProduct').val(product); | 175 | modal.find('.modal-body #inputProduct').val(product); |
176 | }); | 176 | }); |
177 | 177 | ||
178 | $('#addQuotaModal').on('show.bs.modal', function (event) { | 178 | $('#addQuotaModal').on('show.bs.modal', function (event) { |
179 | var button = $(event.relatedTarget); | 179 | var button = $(event.relatedTarget); |
180 | var product = button.data('product'); | 180 | var product = button.data('product'); |
181 | 181 | ||
182 | var modal = $(this) | 182 | var modal = $(this) |
183 | modal.find('.modal-title').text(`Tambah Kuota ${product}`); | 183 | modal.find('.modal-title').text(`Tambah Kuota ${product}`); |
184 | modal.find('.modal-body #inputProduct').val(product); | 184 | modal.find('.modal-body #inputProduct').val(product); |
185 | }); | 185 | }); |
186 | 186 | ||
187 | $('#editMaxValueModal').on('show.bs.modal', function (event) { | 187 | $('#editMaxValueModal').on('show.bs.modal', function (event) { |
188 | var button = $(event.relatedTarget); | 188 | var button = $(event.relatedTarget); |
189 | var product = button.data('product'); | 189 | var product = button.data('product'); |
190 | var maxvalue = button.data('maxvalue'); | 190 | var maxvalue = button.data('maxvalue'); |
191 | 191 | ||
192 | var modal = $(this) | 192 | var modal = $(this) |
193 | modal.find('.modal-title').text(`Edit nilai maksimal ${product}`); | 193 | modal.find('.modal-title').text(`Edit nilai maksimal ${product}`); |
194 | modal.find('.modal-body #inputProduct').val(product); | 194 | modal.find('.modal-body #inputProduct').val(product); |
195 | modal.find('.modal-body #maxValue').val(maxvalue); | 195 | modal.find('.modal-body #maxValue').val(maxvalue); |
196 | }); | 196 | }); |
197 | </script> | 197 | </script> |
198 | 198 | ||
199 | {% endblock %} | 199 | {% endblock %} |