generated from SAP-samples/cloud-sdk-team-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite-appointments.ts
41 lines (38 loc) · 1.22 KB
/
write-appointments.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* eslint-disable unused-imports/no-unused-imports-ts */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { BigNumber } from 'bignumber.js';
import moment from 'moment';
import {
TimeSheetEntry,
manageWorkforceTimesheetService
} from './generated/manage-workforce-timesheet-service';
import { Appointment } from './model/appointment';
import { Person } from './model/person';
import { S4AppointmentStatus } from './model/s4-appointment-status';
export async function writeTimeSheetEntry(
entry: TimeSheetEntry
): Promise<TimeSheetEntry> {
// TODO: Update the TimeSheetEntry in S/4HANA here.
return entry;
}
export function buildTimeSheetEntry(
appointment: Appointment,
person: Person,
day: moment.Moment
): TimeSheetEntry {
const timeSheetDataFields = {
activityType: 'T001',
wbsElement: 'Teched',
workItem: 'P002',
recordedHours: new BigNumber(8),
timeSheetNote: appointment.title
};
// const externalId = person.s4ID;
// const companyCode = person.s4CompanyCode;
const status = S4AppointmentStatus.APPROVED;
const isReleasedOnSave = true;
const isExecutedInTestRun = false;
const operation = 'C';
// TODO: Build a TimeSheetEntry here using the variables above.
return null;
}