Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2874ea78c4 | |||
| d5558b61b2 |
@@ -2,6 +2,6 @@ export class AvailabilityInfo {
|
|||||||
public user: string;
|
public user: string;
|
||||||
public loggedIn: boolean;
|
public loggedIn: boolean;
|
||||||
public extension: string;
|
public extension: string;
|
||||||
public lastStamp: string;
|
public lastStamp: Date;
|
||||||
public firma: boolean;
|
public atCompany: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ export class AvailabilityService {
|
|||||||
try {
|
try {
|
||||||
var response = await GM_fetch(Config.tapi_server_url + '/availability')
|
var response = await GM_fetch(Config.tapi_server_url + '/availability')
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this._availabilities = await response.json() as AvailabilityInfo[]
|
var raw = await response.json() as AvailabilityInfo[]
|
||||||
|
this._availabilities = raw.map(a => ({
|
||||||
|
...a,
|
||||||
|
lastStamp: a.lastStamp ? new Date(a.lastStamp) : null,
|
||||||
|
}))
|
||||||
this._listeners.forEach(l => l(this._availabilities))
|
this._listeners.forEach(l => l(this._availabilities))
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ export class Availability {
|
|||||||
var dotClass = entry.loggedIn ? 'tapi-dot-on' : 'tapi-dot-off'
|
var dotClass = entry.loggedIn ? 'tapi-dot-on' : 'tapi-dot-off'
|
||||||
var time = ''
|
var time = ''
|
||||||
if (entry.lastStamp) {
|
if (entry.lastStamp) {
|
||||||
var d = new Date(entry.lastStamp)
|
|
||||||
var pad = (n: number) => n.toString().padStart(2, '0')
|
var pad = (n: number) => n.toString().padStart(2, '0')
|
||||||
|
var d = entry.lastStamp
|
||||||
time = pad(d.getDate()) + '.' + pad(d.getMonth() + 1) + '. ' + pad(d.getHours()) + ':' + pad(d.getMinutes())
|
time = pad(d.getDate()) + '.' + pad(d.getMonth() + 1) + '. ' + pad(d.getHours()) + ':' + pad(d.getMinutes())
|
||||||
}
|
}
|
||||||
var location = ''
|
var location = ''
|
||||||
if (entry.loggedIn) {
|
if (entry.loggedIn) {
|
||||||
location = entry.firma ? ' · Büro' : ' · Home'
|
location = entry.atCompany ? ' · Büro' : ' · Home'
|
||||||
}
|
}
|
||||||
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + location + '</small>'
|
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + location + '</small>'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ public class Availability
|
|||||||
public string? US_EXTENSION { get; set; }
|
public string? US_EXTENSION { get; set; }
|
||||||
[JsonPropertyName("lastStamp")]
|
[JsonPropertyName("lastStamp")]
|
||||||
public DateTime? LAST_STAMP { get; set; }
|
public DateTime? LAST_STAMP { get; set; }
|
||||||
[JsonPropertyName("firma")]
|
[JsonPropertyName("atCompany")]
|
||||||
public bool? FIRMA { get; set; }
|
public bool? AT_COMPANY { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ internal class ZeitConsensRepository(IConfiguration config) : Repository(config)
|
|||||||
,bu.LOGGED_IN
|
,bu.LOGGED_IN
|
||||||
,us.US_EXTENSION
|
,us.US_EXTENSION
|
||||||
,buLast.LAST_STAMP
|
,buLast.LAST_STAMP
|
||||||
,buLast.FIRMA
|
,buLast.AT_COMPANY
|
||||||
FROM dbo.MA_DATEN ma
|
FROM dbo.MA_DATEN ma
|
||||||
INNER JOIN projectmanagement.dbo.CP_USER us ON us.US_LOGINNAME = ma.MA_USER_NAME
|
INNER JOIN projectmanagement.dbo.CP_USER us ON us.US_LOGINNAME = ma.MA_USER_NAME
|
||||||
OUTER APPLY (
|
OUTER APPLY (
|
||||||
@@ -24,7 +24,7 @@ internal class ZeitConsensRepository(IConfiguration config) : Repository(config)
|
|||||||
OUTER APPLY (
|
OUTER APPLY (
|
||||||
SELECT TOP 1
|
SELECT TOP 1
|
||||||
bu.BU_BU AS LAST_STAMP
|
bu.BU_BU AS LAST_STAMP
|
||||||
,CASE WHEN bu.BU_TERM = 'Zeiterfassung' THEN 1 ELSE 0 END AS FIRMA
|
,CASE WHEN bu.BU_TERM = 'Zeiterfassung' THEN 1 ELSE 0 END AS AT_COMPANY
|
||||||
FROM dbo.BU bu
|
FROM dbo.BU bu
|
||||||
WHERE bu.BU_MA_NR = ma.MA_NR
|
WHERE bu.BU_MA_NR = ma.MA_NR
|
||||||
ORDER BY bu.BU_BU DESC
|
ORDER BY bu.BU_BU DESC
|
||||||
|
|||||||
Reference in New Issue
Block a user