| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | {{define "qrcodeModal"}} | 
					
						
							|  |  |  | <a-modal id="qrcode-modal" v-model="qrModal.visible" :title="qrModal.title" | 
					
						
							| 
									
										
										
										
											2023-03-24 13:17:14 +00:00
										 |  |  |          :closable="true" | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |          :class="themeSwitcher.darkCardClass" | 
					
						
							| 
									
										
										
										
											2023-03-24 13:17:14 +00:00
										 |  |  |          :footer="null" | 
					
						
							|  |  |  |          width="300px"> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |     <a-tag color="green" style="margin-bottom: 10px;display: block;text-align: center;"> | 
					
						
							|  |  |  |         {{ i18n "pages.inbounds.clickOnQRcode" }} | 
					
						
							|  |  |  |     </a-tag> | 
					
						
							| 
									
										
										
										
											2023-05-12 17:23:05 +00:00
										 |  |  |     <a-tag v-if="qrModal.clientName" color="orange" style="margin-bottom: 10px;display: block;text-align: center;"> | 
					
						
							|  |  |  |         {{ i18n "pages.inbounds.email" }}: "[[ qrModal.clientName ]]" | 
					
						
							|  |  |  |     </a-tag> | 
					
						
							|  |  |  |     <canvas @click="copyToClipboard()" id="qrCode" style="width: 100%; height: 100%; margin-top: 10px;"></canvas> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </a-modal> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const qrModal = { | 
					
						
							|  |  |  |         title: '', | 
					
						
							|  |  |  |         content: '', | 
					
						
							|  |  |  |         inbound: new Inbound(), | 
					
						
							|  |  |  |         dbInbound: new DBInbound(), | 
					
						
							|  |  |  |         copyText: '', | 
					
						
							| 
									
										
										
										
											2023-05-12 17:23:05 +00:00
										 |  |  |         clientName: null, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         qrcode: null, | 
					
						
							|  |  |  |         clipboard: null, | 
					
						
							|  |  |  |         visible: false, | 
					
						
							| 
									
										
										
										
											2023-05-12 17:23:05 +00:00
										 |  |  |         show: function (title = '', content = '', dbInbound = new DBInbound(), copyText = '', clientName = null) { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             this.title = title; | 
					
						
							|  |  |  |             this.content = content; | 
					
						
							|  |  |  |             this.dbInbound = dbInbound; | 
					
						
							|  |  |  |             this.inbound = dbInbound.toInbound(); | 
					
						
							| 
									
										
										
										
											2023-05-12 17:23:05 +00:00
										 |  |  |             this.clientName = clientName; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             if (ObjectUtil.isEmpty(copyText)) { | 
					
						
							|  |  |  |                 this.copyText = content; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 this.copyText = copyText; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this.visible = true; | 
					
						
							|  |  |  |             qrModalApp.$nextTick(() => { | 
					
						
							|  |  |  |                 if (this.qrcode === null) { | 
					
						
							|  |  |  |                     this.qrcode = new QRious({ | 
					
						
							|  |  |  |                         element: document.querySelector('#qrCode'), | 
					
						
							|  |  |  |                         size: 260, | 
					
						
							|  |  |  |                         value: content, | 
					
						
							|  |  |  |                     }); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.qrcode.value = content; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         close: function () { | 
					
						
							|  |  |  |             this.visible = false; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const qrModalApp = new Vue({ | 
					
						
							| 
									
										
										
										
											2023-05-12 17:23:05 +00:00
										 |  |  |         delimiters: ['[[', ']]'], | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         el: '#qrcode-modal', | 
					
						
							|  |  |  |         data: { | 
					
						
							|  |  |  |             qrModal: qrModal, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         methods: { | 
					
						
							|  |  |  |             copyToClipboard() { | 
					
						
							|  |  |  |                 this.qrModal.clipboard = new ClipboardJS('#qrCode', { | 
					
						
							|  |  |  |                     text: () => this.qrModal.copyText, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |                 this.qrModal.clipboard.on('success', () => { | 
					
						
							|  |  |  |                     app.$message.success('{{ i18n "copied" }}') | 
					
						
							|  |  |  |                     this.qrModal.clipboard.destroy(); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | {{end}} |