|
19 | 19 | <td>{{ user.email }}</td> |
20 | 20 | <td> |
21 | 21 | <div class="btn-group"> |
22 | | - <button type="button" class="btn btn-success btn-filter" onclick="printLabelPopup('{{ user.name }}', {{ user.id }},'{{ user.top_size }}')">발권</button> |
23 | | - <a class="btn btn-default btn-filter" |
24 | | - href='/admin/registration/registration/{{user.id}}' |
25 | | - target='_blank' role="button">관리</a> |
| 22 | + <a class="btn btn-success btn-filter" |
| 23 | + target='_blank' role="button" |
| 24 | + href='{% url "registration_issue_print" user.id %}'>발권</a> |
| 25 | + <a class="btn btn-default btn-filter" |
| 26 | + href='/admin/registration/registration/{{user.id}}' |
| 27 | + target='_blank' role="button">관리</a> |
26 | 28 | </div> |
27 | 29 | </td> |
28 | 30 | </tr> |
|
41 | 43 | <script src="{% static "components/datatables.net/js/jquery.dataTables.min.js" %}" charset="utf-8"></script> |
42 | 44 | <script src="{% static "components/datatables.net-bs/js/dataTables.bootstrap.min.js" %}" charset="utf-8"></script> |
43 | 45 |
|
44 | | -{% verbatim %} |
45 | | -<script id="print_template" type="text/x-handlebars-template"> |
46 | | -<div class="ui brother-label"> |
47 | | - <p class="ui name">{{name}}</p> |
48 | | -</div> |
49 | | -<div class="ui brother-label"> |
50 | | - <p class="ui name">{{topSize}}</p> |
51 | | -</div> |
52 | | -<style> |
53 | | -.brother-label { |
54 | | - margin: 0 auto; |
55 | | - padding: 0 auto; |
56 | | - width: 88mm; |
57 | | - height: 27mm; |
58 | | -} |
59 | | -.name{ |
60 | | - font-size: {{fontSize}}; |
61 | | - font-weight: bold; |
62 | | - text-align: center; |
63 | | - letter-spacing: 1rem; |
64 | | -} |
65 | | -@media print { |
66 | | - body, html, p{ |
67 | | - margin: 0mm !important; |
68 | | - padding: 0mm !important; |
69 | | - } |
70 | | - @page{ |
71 | | - margin: 0mm !important; |
72 | | - padding: 0mm !important; |
73 | | - } |
74 | | -} |
75 | | -</script> |
76 | | -{% endverbatim %} |
77 | | - |
78 | 46 | <script type="text/javascript"> |
79 | 47 | $(document).ready( function () { |
80 | 48 | $('#issue-ticket').DataTable({ |
|
86 | 54 | searching: true, |
87 | 55 | }); |
88 | 56 | }); |
89 | | - |
90 | | -function issueTicketConfirm(userId) { |
91 | | - var csrftoken = Cookies.get('csrftoken'); |
92 | | - $.ajaxSetup({ |
93 | | - beforeSend: function(xhr, settings) { |
94 | | - if (!csrfSafeMethod(settings.type) && !this.crossDomain) { |
95 | | - xhr.setRequestHeader("X-CSRFToken", csrftoken); |
96 | | - } |
97 | | - } |
98 | | - }); |
99 | | - $.ajax("{% url 'registration_issue_submit' %}", { |
100 | | - data: {'user_id': userId}, |
101 | | - method: 'POST', |
102 | | - success: function(data) { |
103 | | - alert('발권처리 기록 되었습니다.'); |
104 | | - }, |
105 | | - error: function(data) { |
106 | | - alert('발권처리 기록에 실패 하였습니다.'); |
107 | | - } |
108 | | - }); |
109 | | -} |
110 | | - |
111 | | -function printLabelPopup(name, userId, topSize) { |
112 | | - var printWindow = window.open('', '', 'width=600, height=400'); |
113 | | - var fontSize = '1em'; |
114 | | - var printTemplateScript = $('#print_template').html(); |
115 | | - var printTemplate = Handlebars.compile(printTemplateScript); |
116 | | - var context = { |
117 | | - 'name': name, |
118 | | - 'topSize': topSize, |
119 | | - 'fontSize': fontSize |
120 | | - }; |
121 | | - printWindow.document.write(printTemplate(context)); |
122 | | - printWindow.document.close(); |
123 | | - printWindow.focus(); |
124 | | - printWindow.print(); |
125 | | - printWindow.close(); |
126 | | - issueTicketConfirm(userId); |
127 | | -} |
128 | 57 | </script> |
129 | 58 |
|
130 | 59 | {% endblock %} |
0 commit comments