| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | {{define "clientsModal"}} | 
					
						
							|  |  |  | <a-modal id="client-modal" v-model="clientModal.visible" :title="clientModal.title" @ok="clientModal.ok" | 
					
						
							|  |  |  |          :confirm-loading="clientModal.confirmLoading" :closable="true" :mask-closable="false" | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |          :class="themeSwitcher.currentTheme" | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |          :ok-text="clientModal.okText" cancel-text='{{ i18n "close" }}'> | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |     <template v-if="isEdit"> | 
					
						
							| 
									
										
										
										
											2025-01-13 17:09:04 +00:00
										 |  |  |         <a-tag v-if="isExpiry || isTrafficExhausted" color="red" style="margin-bottom: 10px;display: block;text-align: center;">Account is (Expired|Traffic Ended) And Disabled</a-tag> | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |     </template> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |     {{template "form/client"}} | 
					
						
							|  |  |  | </a-modal> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const clientModal = { | 
					
						
							|  |  |  |         visible: false, | 
					
						
							|  |  |  |         confirmLoading: false, | 
					
						
							|  |  |  |         title: '', | 
					
						
							|  |  |  |         okText: '', | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |         isEdit: false, | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |         group: { | 
					
						
							|  |  |  |             canGroup: true, | 
					
						
							|  |  |  |             isGroup: false, | 
					
						
							|  |  |  |             currentClient: null, | 
					
						
							|  |  |  |             inbounds: [], | 
					
						
							|  |  |  |             clients: [], | 
					
						
							|  |  |  |             editIds: [] | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         dbInbound: new DBInbound(), | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |         dbInbounds: null, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         inbound: new Inbound(), | 
					
						
							|  |  |  |         clients: [], | 
					
						
							|  |  |  |         clientStats: [], | 
					
						
							| 
									
										
										
										
											2023-04-25 11:08:35 +00:00
										 |  |  |         oldClientId: "", | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         index: null, | 
					
						
							|  |  |  |         clientIps: null, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         delayedStart: false, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         ok() { | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             if (app.subSettings.enable && clientModal.group.isGroup && clientModal.group.canGroup) { | 
					
						
							|  |  |  |                 const currentClient = clientModal.group.currentClient; | 
					
						
							|  |  |  |                 const { limitIp, totalGB, expiryTime, reset, enable, subId, tgId, flow } = currentClient; | 
					
						
							|  |  |  |                 const uniqueEmails = clientModalApp.makeGroupEmailsUnique(clientModal.dbInbounds, currentClient.email, clientModal.group.clients); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 clientModal.group.clients.forEach((client, index) => { | 
					
						
							|  |  |  |                     client.email = uniqueEmails[index]; | 
					
						
							|  |  |  |                     client.limitIp = limitIp; | 
					
						
							|  |  |  |                     client.totalGB = totalGB; | 
					
						
							|  |  |  |                     client.expiryTime = expiryTime; | 
					
						
							|  |  |  |                     client.reset = reset; | 
					
						
							|  |  |  |                     client.enable = enable; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     if (subId) { | 
					
						
							|  |  |  |                         client.subId = subId; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     if (tgId) { | 
					
						
							|  |  |  |                         client.tgId = tgId; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     if (flow) { | 
					
						
							|  |  |  |                         client.flow = flow; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if (clientModal.isEdit) { | 
					
						
							|  |  |  |                     ObjectUtil.execute(clientModal.confirm, clientModal.group.clients, clientModal.group.inbounds, clientModal.group.editIds); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     ObjectUtil.execute(clientModal.confirm, clientModal.group.clients, clientModal.group.inbounds); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2024-01-22 11:36:01 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                 if (clientModal.isEdit) { | 
					
						
							|  |  |  |                     ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id, clientModal.oldClientId); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         }, | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |         show({ | 
					
						
							|  |  |  |                  title = '', | 
					
						
							|  |  |  |                  okText = '{{ i18n "sure" }}', | 
					
						
							|  |  |  |                  index = null, | 
					
						
							|  |  |  |                  dbInbound = null, | 
					
						
							|  |  |  |                  dbInbounds = null, | 
					
						
							|  |  |  |                  confirm = () => { | 
					
						
							|  |  |  |                  }, | 
					
						
							|  |  |  |                  isEdit = false | 
					
						
							|  |  |  |              }) { | 
					
						
							|  |  |  |             this.group = { | 
					
						
							|  |  |  |                 canGroup: true, | 
					
						
							|  |  |  |                 isGroup: false, | 
					
						
							|  |  |  |                 currentClient: null, | 
					
						
							|  |  |  |                 inbounds: [], | 
					
						
							|  |  |  |                 clients: [], | 
					
						
							|  |  |  |                 editIds: [] | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this.dbInbounds = dbInbounds; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             this.visible = true; | 
					
						
							|  |  |  |             this.title = title; | 
					
						
							|  |  |  |             this.okText = okText; | 
					
						
							|  |  |  |             this.isEdit = isEdit; | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             if (app.subSettings.enable && dbInbounds !== null && Array.isArray(dbInbounds)) { | 
					
						
							|  |  |  |                 if (isEdit) { | 
					
						
							|  |  |  |                     this.showProcess(dbInbound, index); | 
					
						
							|  |  |  |                     let processSingleEdit = true | 
					
						
							|  |  |  |                     if (this.group.canGroup) { | 
					
						
							|  |  |  |                         this.group.currentClient = this.clients[this.index] | 
					
						
							|  |  |  |                         const response = app.getSubGroupClients(dbInbounds, this.group.currentClient) | 
					
						
							|  |  |  |                         if (response.clients.length > 1) { | 
					
						
							|  |  |  |                             this.group.isGroup = true; | 
					
						
							|  |  |  |                             this.group.inbounds = response.inbounds | 
					
						
							|  |  |  |                             this.group.clients = response.clients | 
					
						
							|  |  |  |                             this.group.editIds = response.editIds | 
					
						
							|  |  |  |                             if (this.clients[index].expiryTime < 0) { | 
					
						
							|  |  |  |                                 this.delayedStart = true; | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             processSingleEdit = false | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     if (processSingleEdit) { | 
					
						
							|  |  |  |                         this.singleEditClientProcess(index) | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.group.isGroup = true; | 
					
						
							|  |  |  |                     dbInbounds.forEach((dbInboundItem) => { | 
					
						
							|  |  |  |                         this.showProcess(dbInboundItem); | 
					
						
							|  |  |  |                         this.addClient(this.inbound.protocol, this.clients); | 
					
						
							|  |  |  |                         this.group.inbounds.push(dbInboundItem.id) | 
					
						
							|  |  |  |                         this.group.clients.push(this.clients[this.index]) | 
					
						
							|  |  |  |                     }) | 
					
						
							|  |  |  |                     this.group.currentClient = this.clients[this.index] | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 this.showProcess(dbInbound, index); | 
					
						
							|  |  |  |                 if (isEdit) { | 
					
						
							|  |  |  |                     this.singleEditClientProcess(index) | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.addClient(this.inbound.protocol, this.clients); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this.clientStats = this.dbInbound.clientStats.find(row => row.email === this.clients[this.index].email); | 
					
						
							|  |  |  |             this.confirm = confirm; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         showProcess(dbInbound, index = null) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             this.dbInbound = new DBInbound(dbInbound); | 
					
						
							|  |  |  |             this.inbound = dbInbound.toInbound(); | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |             this.clients = this.inbound.clients; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             this.index = index === null ? this.clients.length : index; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             this.delayedStart = false; | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         singleEditClientProcess(index) { | 
					
						
							|  |  |  |             if (this.clients[index].expiryTime < 0) { | 
					
						
							|  |  |  |                 this.delayedStart = true; | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             this.oldClientId = this.getClientId(this.dbInbound.protocol, this.clients[index]); | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |         getClientId(protocol, client) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             switch (protocol) { | 
					
						
							| 
									
										
										
										
											2025-01-13 17:09:04 +00:00
										 |  |  |                 case Protocols.TROJAN: return client.password; | 
					
						
							|  |  |  |                 case Protocols.SHADOWSOCKS: return client.email; | 
					
						
							|  |  |  |                 default: return client.id; | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         addClient(protocol, clients) { | 
					
						
							|  |  |  |             switch (protocol) { | 
					
						
							| 
									
										
										
										
											2025-01-13 17:09:04 +00:00
										 |  |  |                 case Protocols.VMESS: return clients.push(new Inbound.VmessSettings.VMESS()); | 
					
						
							|  |  |  |                 case Protocols.VLESS: return clients.push(new Inbound.VLESSSettings.VLESS()); | 
					
						
							|  |  |  |                 case Protocols.TROJAN: return clients.push(new Inbound.TrojanSettings.Trojan()); | 
					
						
							|  |  |  |                 case Protocols.SHADOWSOCKS: return clients.push(new Inbound.ShadowsocksSettings.Shadowsocks(clients[0].method)); | 
					
						
							|  |  |  |                 default: return null; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         close() { | 
					
						
							|  |  |  |             clientModal.visible = false; | 
					
						
							|  |  |  |             clientModal.loading(false); | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |         loading(loading = true) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             clientModal.confirmLoading = loading; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const clientModalApp = new Vue({ | 
					
						
							|  |  |  |         delimiters: ['[[', ']]'], | 
					
						
							|  |  |  |         el: '#client-modal', | 
					
						
							|  |  |  |         data: { | 
					
						
							|  |  |  |             clientModal, | 
					
						
							|  |  |  |             get inbound() { | 
					
						
							|  |  |  |                 return this.clientModal.inbound; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             get client() { | 
					
						
							|  |  |  |                 return this.clientModal.clients[this.clientModal.index]; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             get clientStats() { | 
					
						
							|  |  |  |                 return this.clientModal.clientStats; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             get isEdit() { | 
					
						
							|  |  |  |                 return this.clientModal.isEdit; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             get isGroup() { | 
					
						
							|  |  |  |                 return this.clientModal.group.isGroup; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             get isGroupEdit() { | 
					
						
							|  |  |  |                 return this.clientModal.group.canGroup; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             set isGroupEdit(value) { | 
					
						
							|  |  |  |                 this.clientModal.group.canGroup = value; | 
					
						
							|  |  |  |                 if (!value) { | 
					
						
							|  |  |  |                     this.clientModal.singleEditClientProcess(this.clientModal.index) | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-01-02 08:32:21 +00:00
										 |  |  |             get datepicker() { | 
					
						
							|  |  |  |                 return app.datepicker; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             get isTrafficExhausted() { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 if (!clientStats) return false | 
					
						
							|  |  |  |                 if (clientStats.total <= 0) return false | 
					
						
							|  |  |  |                 if (clientStats.up + clientStats.down < clientStats.total) return false | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 return true | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             get isExpiry() { | 
					
						
							| 
									
										
										
										
											2023-05-16 22:31:56 +00:00
										 |  |  |                 return this.clientModal.isEdit && this.client.expiryTime >0 ? (this.client.expiryTime < new Date().getTime()) : false; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:20:16 +00:00
										 |  |  |             get delayedStart() { | 
					
						
							|  |  |  |                 return this.clientModal.delayedStart; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             set delayedStart(value) { | 
					
						
							|  |  |  |                 this.clientModal.delayedStart = value; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             get delayedExpireDays() { | 
					
						
							|  |  |  |                 return this.client && this.client.expiryTime < 0 ? this.client.expiryTime / -86400000 : 0; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             set delayedExpireDays(days) { | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 this.client.expiryTime = -86400000 * days; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         methods: { | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             makeGroupEmailsUnique(dbInbounds, baseEmail, groupClients) { | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                 // Extract the base part of the email (before the "__" if present) | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                 const match = baseEmail.match(/^(.*?)__/); | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                 const base = match ? match[1] : baseEmail; | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                 // Generate initial emails for each client in the group | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                 const generatedEmails = groupClients.map((_, index) => `${base}__${index + 1}`); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                 // Function to check if an email already exists in dbInbounds but belongs to a different subId | 
					
						
							|  |  |  |                 const isDuplicate = (emailToCheck, clientSubId) => { | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                     return dbInbounds.some((dbInbound) => { | 
					
						
							|  |  |  |                         const settings = JSON.parse(dbInbound.settings); | 
					
						
							|  |  |  |                         const clients = settings && settings.clients ? settings.clients : []; | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                         return clients.some(client => client.email === emailToCheck && client.subId !== clientSubId); | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                     }); | 
					
						
							|  |  |  |                 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-15 18:23:38 +00:00
										 |  |  |                 // Check if any of the generated emails are duplicates | 
					
						
							|  |  |  |                 const hasDuplicates = generatedEmails.some((email, index) => { | 
					
						
							|  |  |  |                     return isDuplicate(email, groupClients[index].subId); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // If duplicates exist, add a random string to the base email to ensure uniqueness | 
					
						
							|  |  |  |                 if (hasDuplicates) { | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                     const randomString = `-${RandomUtil.randomLowerAndNum(4)}`; | 
					
						
							|  |  |  |                     return groupClients.map((_, index) => `${base}${randomString}__${index + 1}`); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 return generatedEmails; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 18:04:07 +00:00
										 |  |  |             async clearDBClientIps(email) { | 
					
						
							| 
									
										
										
										
											2023-06-03 15:29:32 +00:00
										 |  |  |                 try { | 
					
						
							|  |  |  |                     const msg = await HttpUtil.post(`/panel/inbound/clearClientIps/${email}`); | 
					
						
							|  |  |  |                     if (!msg.success) { | 
					
						
							|  |  |  |                         return; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     document.getElementById("clientIPs").value = ""; | 
					
						
							|  |  |  |                 } catch (error) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |             async resetClientTrafficHandler(client, dbInboundId, clients = []) { | 
					
						
							|  |  |  |                 if (clients.length > 0) { | 
					
						
							| 
									
										
										
										
											2025-01-15 20:09:34 +00:00
										 |  |  |                     const resetRequests = clients | 
					
						
							|  |  |  |                         .filter(client => { | 
					
						
							|  |  |  |                             const inbound = clientModal.dbInbounds.find(inbound => inbound.id === client.inboundId); | 
					
						
							|  |  |  |                             return inbound && app.hasClientStats(inbound, client.email); | 
					
						
							|  |  |  |                         }).map(client => ({ inboundId: client.inboundId, email: client.email})); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return HttpUtil.postWithModalJson('/panel/inbound/resetGroupClientTraffic', resetRequests, null) | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                 } else { | 
					
						
							|  |  |  |                     return HttpUtil.postWithModal('/panel/inbound/' + dbInboundId + '/resetClientTraffic/' + client.email) | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             resetClientTraffic(client, dbInboundId, iconElement) { | 
					
						
							|  |  |  |                 const subGroup = app.subSettings.enable && clientModal.group.isGroup && clientModal.group.canGroup && clientModal.dbInbounds && clientModal.dbInbounds.length > 0 ? app.getSubGroupClients(clientModal.dbInbounds, client) : []; | 
					
						
							| 
									
										
										
										
											2025-01-15 20:09:34 +00:00
										 |  |  |                 const clients = subGroup && subGroup.clients && subGroup.clients.length > 1 ? subGroup.clients : []; | 
					
						
							| 
									
										
										
										
											2023-04-20 12:25:51 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.resetTraffic"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.resetTrafficContent"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											2023-04-20 12:25:51 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							|  |  |  |                     onOk: async () => { | 
					
						
							|  |  |  |                         iconElement.disabled = true; | 
					
						
							| 
									
										
										
										
											2024-01-21 14:26:19 +00:00
										 |  |  |                         const msg = await this.resetClientTrafficHandler(client, dbInboundId, clients); | 
					
						
							|  |  |  |                         if (msg && msg.success) { | 
					
						
							| 
									
										
										
										
											2023-04-20 12:25:51 +00:00
										 |  |  |                             this.clientModal.clientStats.up = 0; | 
					
						
							|  |  |  |                             this.clientModal.clientStats.down = 0; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                         iconElement.disabled = false; | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                 }) | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | </script> | 
					
						
							|  |  |  | {{end}} |