Fix call history
This commit is contained in:
		| @@ -6,18 +6,12 @@ export class CallHistory { | |||||||
|   private callerIds: { [number: string]: TapiContact } = {} |   private callerIds: { [number: string]: TapiContact } = {} | ||||||
|  |  | ||||||
|   private updateCallHistoryEntry (call: HTMLElement, callerId: TapiContact) { |   private updateCallHistoryEntry (call: HTMLElement, callerId: TapiContact) { | ||||||
|     var span = call.querySelector('span') |     var span = call.querySelector(':scope > span') | ||||||
|     this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId) |     this.showTimeManager(call, call.querySelector('.date').textContent, callerId) | ||||||
|  |  | ||||||
|     if (callerId && callerId.tD_NAME !== '') { |     if (callerId && callerId.tD_NAME !== '') { | ||||||
|       var text = span.textContent |       var text = span.textContent | ||||||
|       span.textContent = callerId.tD_NAME |       span.textContent = callerId.tD_NAME + ' ' + callerId.tD_NUMBER | ||||||
|       var br = document.createElement('br') |  | ||||||
|       var span2 = document.createElement('span') |  | ||||||
|       span2.style.fontSize = 'small' |  | ||||||
|       span2.textContent = text |  | ||||||
|       span.parentNode.insertBefore(br, span.nextSibling) |  | ||||||
|       span.parentNode.insertBefore(span2, span.nextSibling) |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -28,7 +22,6 @@ export class CallHistory { | |||||||
|       date = dateParts.groups.date |       date = dateParts.groups.date | ||||||
|       duration = dateParts.groups.duration |       duration = dateParts.groups.duration | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     var parsedDate = chrono.de.parseDate(date) |     var parsedDate = chrono.de.parseDate(date) | ||||||
|     if (!parsedDate) { |     if (!parsedDate) { | ||||||
|       parsedDate = chrono.parseDate(date) |       parsedDate = chrono.parseDate(date) | ||||||
| @@ -50,7 +43,7 @@ export class CallHistory { | |||||||
|  |  | ||||||
|     var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString() |     var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString() | ||||||
|  |  | ||||||
|     var toolbar = call.querySelector('.wcToolbarTiles') |     var toolbar = call.querySelector('call-history-options') | ||||||
|     var href = 'domizil://PM/Zeitbuchung?' |     var href = 'domizil://PM/Zeitbuchung?' | ||||||
|     if (callerId && callerId.tD_ID) { |     if (callerId && callerId.tD_ID) { | ||||||
|       href += 'KontaktId=' + callerId.tD_ID + '&' |       href += 'KontaktId=' + callerId.tD_ID + '&' | ||||||
| @@ -62,7 +55,7 @@ export class CallHistory { | |||||||
|     a.onclick = () => { |     a.onclick = () => { | ||||||
|       window.open(href) |       window.open(href) | ||||||
|     } |     } | ||||||
|     a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98" width="20" height="20">' + |     a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98">' + | ||||||
|       '<g>' + |       '<g>' + | ||||||
|       '  <g>' + |       '  <g>' + | ||||||
|       '    <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' + |       '    <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' + | ||||||
| @@ -74,11 +67,14 @@ export class CallHistory { | |||||||
|       '  </g>' + |       '  </g>' + | ||||||
|       '</g>' + |       '</g>' + | ||||||
|       '</svg>' |       '</svg>' | ||||||
|  |  | ||||||
|  |     a.classList.add('btn'); | ||||||
|  |     a.classList.add('btn-plain'); | ||||||
|     toolbar.insertBefore(a, toolbar.firstChild) |     toolbar.insertBefore(a, toolbar.firstChild) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   public async showCallHistory (element: HTMLElement) { |   public async showCallHistory (element: HTMLElement) { | ||||||
|     var span = element.querySelector('span') |     var span = element.querySelector(':scope > span') | ||||||
|     var number = extractNumber(span.textContent) |     var number = extractNumber(span.textContent) | ||||||
|     if (!number) { |     if (!number) { | ||||||
|       this.updateCallHistoryEntry(element, undefined) |       this.updateCallHistoryEntry(element, undefined) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user