Add firma flag to availability and show office/home label
Server query gets the last stamp's BU_TERM in the same OUTER APPLY as LAST_STAMP, exposing FIRMA (1 = Zeiterfassung/Büro). Three OUTER APPLYs reduced to two by combining MAX(BU_BU) with TOP 1 ORDER BY. Client model gains a firma boolean and the people-tile indicator appends "· Büro" or "· Home" next to the timestamp, but only when the user is logged in.
This commit is contained in:
+5
-1
@@ -859,7 +859,11 @@ class Availability {
|
||||
var pad = (n) => n.toString().padStart(2, '0');
|
||||
time = pad(d.getDate()) + '.' + pad(d.getMonth() + 1) + '. ' + pad(d.getHours()) + ':' + pad(d.getMinutes());
|
||||
}
|
||||
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + '</small>';
|
||||
var location = '';
|
||||
if (entry.loggedIn) {
|
||||
location = entry.firma ? ' · Büro' : ' · Home';
|
||||
}
|
||||
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + location + '</small>';
|
||||
}
|
||||
updateSquare(square) {
|
||||
var extension = square.dataset.tapiExtension;
|
||||
|
||||
@@ -3,4 +3,5 @@ export class AvailabilityInfo {
|
||||
public loggedIn: boolean;
|
||||
public extension: string;
|
||||
public lastStamp: string;
|
||||
public firma: boolean;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,11 @@ export class Availability {
|
||||
var pad = (n: number) => n.toString().padStart(2, '0')
|
||||
time = pad(d.getDate()) + '.' + pad(d.getMonth() + 1) + '. ' + pad(d.getHours()) + ':' + pad(d.getMinutes())
|
||||
}
|
||||
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + '</small>'
|
||||
var location = ''
|
||||
if (entry.loggedIn) {
|
||||
location = entry.firma ? ' · Büro' : ' · Home'
|
||||
}
|
||||
indicator.innerHTML = '<span class="tapi-dot ' + dotClass + '"></span><small>' + time + location + '</small>'
|
||||
}
|
||||
|
||||
private updateSquare(square: HTMLElement) {
|
||||
|
||||
@@ -13,4 +13,6 @@ public class Availability
|
||||
public string? US_EXTENSION { get; set; }
|
||||
[JsonPropertyName("lastStamp")]
|
||||
public DateTime? LAST_STAMP { get; set; }
|
||||
[JsonPropertyName("firma")]
|
||||
public bool? FIRMA { get; set; }
|
||||
}
|
||||
|
||||
@@ -11,21 +11,24 @@ internal class ZeitConsensRepository(IConfiguration config) : Repository(config)
|
||||
ma.MA_USER_NAME
|
||||
,bu.LOGGED_IN
|
||||
,us.US_EXTENSION
|
||||
,buLastStamp.LAST_STAMP
|
||||
,buLast.LAST_STAMP
|
||||
,buLast.FIRMA
|
||||
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 (
|
||||
SELECT count(*) % 2 AS LOGGED_IN
|
||||
FROM dbo.BU
|
||||
SELECT COUNT(*) % 2 AS LOGGED_IN
|
||||
FROM dbo.BU bu
|
||||
WHERE bu.BU_MA_NR = ma.MA_NR
|
||||
AND
|
||||
BU_BU >= @from AND BU_BU < @to
|
||||
AND bu.BU_BU >= @from AND bu.BU_BU < @to
|
||||
) bu
|
||||
OUTER APPLY (
|
||||
SELECT MAX(BU_BU) AS LAST_STAMP
|
||||
FROM dbo.BU
|
||||
SELECT TOP 1
|
||||
bu.BU_BU AS LAST_STAMP
|
||||
,CASE WHEN bu.BU_TERM = 'Zeiterfassung' THEN 1 ELSE 0 END AS FIRMA
|
||||
FROM dbo.BU bu
|
||||
WHERE bu.BU_MA_NR = ma.MA_NR
|
||||
) buLastStamp
|
||||
ORDER BY bu.BU_BU DESC
|
||||
) buLast
|
||||
WHERE
|
||||
ma.MA_USER_AKTIV = 1
|
||||
""";
|
||||
|
||||
Reference in New Issue
Block a user