pha-hermes 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -957,7 +957,7 @@ var SFWorkorderClient = /*#__PURE__*/function () {
957
957
  }
958
958
  whereClause = filters.length ? "WHERE " + filters.join(' AND ') : '';
959
959
  url = "/services/data/" + SF_API_VERSION + "/query";
960
- query = "SELECT Id,\n Region__c,\n Name,\n HospitalID__c,\n HospitalName__c,\n ProfessionalDesignation__c,\n Personnel__c,\n startdate__c,\n EndDate__c,\n CreatedDate,\n LastModifiedDate,\n Unit__c,\n HealthAuthority__c\n FROM WorkOrder__c " + whereClause;
960
+ query = "SELECT Id,\n Region__c,\n Name,\n HospitalID__c,\n HospitalName__c,\n ProfessionalDesignation__c,\n Personnel__c,\n startdate__c,\n EndDate__c,\n CreatedDate,\n LastModifiedDate,\n Unit__c,\n HealthAuthority__c,\n UnitPrice__r.Price__c,\n TravelDate__c,\n ReturnDate__c\n FROM WorkOrder__c " + whereClause;
961
961
  _context.next = 11;
962
962
  return this.axiosInstance.get(url, {
963
963
  params: {
@@ -981,7 +981,10 @@ var SFWorkorderClient = /*#__PURE__*/function () {
981
981
  unit: formatString(record.Unit__c),
982
982
  externalUnitId: formatId(record.Unit__c),
983
983
  healthAuthority: formatString(record.HealthAuthority__c),
984
- externalHealthAuthorityId: formatId(record.HealthAuthority__c)
984
+ externalHealthAuthorityId: formatId(record.HealthAuthority__c),
985
+ price: record.UnitPrice__r.Price__c,
986
+ travelInTime: new Date(record.TravelDate__c),
987
+ travelOutTime: new Date(record.ReturnDate__c)
985
988
  };
986
989
  });
987
990
  });
@@ -1179,12 +1182,12 @@ var SFExpenseClient = /*#__PURE__*/function () {
1179
1182
  _proto.updateExpense = /*#__PURE__*/function () {
1180
1183
  var _updateExpense = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(expense) {
1181
1184
  var _this$patchTimesheet;
1182
- var timesheetId, amount, field;
1185
+ var timesheetId, submittedValue, field;
1183
1186
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1184
1187
  while (1) switch (_context3.prev = _context3.next) {
1185
1188
  case 0:
1186
1189
  timesheetId = expense.workorderPeriodId;
1187
- amount = Number(expense.amount);
1190
+ submittedValue = Number(expense.submittedValue);
1188
1191
  field = EXPENSE_FIELD_MAP[expense.type];
1189
1192
  if (field) {
1190
1193
  _context3.next = 5;
@@ -1193,7 +1196,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
1193
1196
  throw new Error("Unsupported expense type: " + expense.type);
1194
1197
  case 5:
1195
1198
  _context3.next = 7;
1196
- return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = amount, _this$patchTimesheet));
1199
+ return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = submittedValue, _this$patchTimesheet));
1197
1200
  case 7:
1198
1201
  case "end":
1199
1202
  return _context3.stop();
@@ -1217,6 +1220,70 @@ function toExpense(raw) {
1217
1220
  };
1218
1221
  }
1219
1222
 
1223
+ var SFPriceClient = /*#__PURE__*/function () {
1224
+ function SFPriceClient(axiosInstance) {
1225
+ this.axiosInstance = axiosInstance;
1226
+ }
1227
+ var _proto = SFPriceClient.prototype;
1228
+ _proto.getPriceListByWorkorderId = /*#__PURE__*/function () {
1229
+ var _getPriceListByWorkorderId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(workorderId) {
1230
+ var url, query;
1231
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1232
+ while (1) switch (_context.prev = _context.next) {
1233
+ case 0:
1234
+ _context.prev = 0;
1235
+ url = "/services/data/" + SF_API_VERSION + "/query";
1236
+ query = "SELECT UnitPrice__r.Price__r.Id,\n UnitPrice__r.Price__r.Name,\n UnitPrice__r.Price__r.MileageBillingRate__c,\n UnitPrice__r.Price__r.MileageWageRate__c,\n UnitPrice__r.Price__r.BillingRate__c,\n UnitPrice__r.Price__r.WageRate__c,\n UnitPrice__r.Price__r.Overtime1BillingRate__c,\n UnitPrice__r.Price__r.Overtime1WageRate__c,\n UnitPrice__r.Price__r.Overtime2BillingRate__c,\n UnitPrice__r.Price__r.Overtime2WageRate__c,\n UnitPrice__r.Price__r.CallBackBillingRate__c,\n UnitPrice__r.Price__r.CallBackWageRate__c,\n UnitPrice__r.Price__r.OnCallBillingRate__c,\n UnitPrice__r.Price__r.OnCallWageRate__c,\n UnitPrice__r.Price__r.Additional_Billing_Information__c,\n UnitPrice__r.Price__r.Additional_Wage_Information__c\n FROM WorkOrder__c WHERE Id = '" + workorderId + "' ";
1237
+ _context.next = 5;
1238
+ return this.axiosInstance.get(url, {
1239
+ params: {
1240
+ q: query
1241
+ }
1242
+ }).then(function (_ref) {
1243
+ var records = _ref.data.records;
1244
+ return records.map(function (record) {
1245
+ var _record$UnitPrice__r, _record$UnitPrice__r2, _record$UnitPrice__r3, _record$UnitPrice__r4, _record$UnitPrice__r5, _record$UnitPrice__r6, _record$UnitPrice__r7, _record$UnitPrice__r8, _record$UnitPrice__r9, _record$UnitPrice__r10, _record$UnitPrice__r11, _record$UnitPrice__r12, _record$UnitPrice__r13, _record$UnitPrice__r14, _record$UnitPrice__r15, _record$UnitPrice__r16;
1246
+ return {
1247
+ id: record == null || (_record$UnitPrice__r = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r.Price__r.Id,
1248
+ name: record == null || (_record$UnitPrice__r2 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r2.Price__r.Name,
1249
+ mileageBillingRate: record == null || (_record$UnitPrice__r3 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r3.Price__r.MileageBillingRate__c,
1250
+ mileageWageRate: record == null || (_record$UnitPrice__r4 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r4.Price__r.MileageWageRate__c,
1251
+ regularBillingRate: record == null || (_record$UnitPrice__r5 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r5.Price__r.BillingRate__c,
1252
+ regularWageRate: record == null || (_record$UnitPrice__r6 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r6.Price__r.WageRate__c,
1253
+ overtime1BillingRate: record == null || (_record$UnitPrice__r7 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r7.Price__r.Overtime1BillingRate__c,
1254
+ overtime1WageRate: record == null || (_record$UnitPrice__r8 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r8.Price__r.Overtime1WageRate__c,
1255
+ overtime2BillingRate: record == null || (_record$UnitPrice__r9 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r9.Price__r.Overtime2BillingRate__c,
1256
+ overtime2WageRate: record == null || (_record$UnitPrice__r10 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r10.Price__r.Overtime2WageRate__c,
1257
+ callbackBillingRate: record == null || (_record$UnitPrice__r11 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r11.Price__r.CallBackBillingRate__c,
1258
+ callbackWageRate: record == null || (_record$UnitPrice__r12 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r12.Price__r.CallBackWageRate__c,
1259
+ onCallBillingRate: record == null || (_record$UnitPrice__r13 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r13.Price__r.OnCallBillingRate__c,
1260
+ onCallWageRate: record == null || (_record$UnitPrice__r14 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r14.Price__r.OnCallWageRate__c,
1261
+ additionalBillingInfo: record == null || (_record$UnitPrice__r15 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r15.Price__r.Additional_Billing_Information__c,
1262
+ additionalWageInfo: record == null || (_record$UnitPrice__r16 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r16.Price__r.Additional_Wage_Information__c
1263
+ };
1264
+ });
1265
+ });
1266
+ case 5:
1267
+ return _context.abrupt("return", _context.sent);
1268
+ case 8:
1269
+ _context.prev = 8;
1270
+ _context.t0 = _context["catch"](0);
1271
+ console.error('Error fetching Price list: ', _context.t0.message);
1272
+ throw _context.t0;
1273
+ case 12:
1274
+ case "end":
1275
+ return _context.stop();
1276
+ }
1277
+ }, _callee, this, [[0, 8]]);
1278
+ }));
1279
+ function getPriceListByWorkorderId(_x) {
1280
+ return _getPriceListByWorkorderId.apply(this, arguments);
1281
+ }
1282
+ return getPriceListByWorkorderId;
1283
+ }();
1284
+ return SFPriceClient;
1285
+ }();
1286
+
1220
1287
  var SF_API_VERSION = 'v57.0';
1221
1288
  var SFApiClient = /*#__PURE__*/function () {
1222
1289
  function SFApiClient() {
@@ -1237,10 +1304,11 @@ var SFApiClient = /*#__PURE__*/function () {
1237
1304
  this.practitionerClient = new SFPractitionerClient(this.axiosInstance);
1238
1305
  this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance);
1239
1306
  this.expenseClient = new SFExpenseClient(this.axiosInstance);
1307
+ this.priceClient = new SFPriceClient(this.axiosInstance);
1240
1308
  // creates authenticator and adds token to axios instance
1241
- _context.next = 10;
1309
+ _context.next = 11;
1242
1310
  return this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh);
1243
- case 10:
1311
+ case 11:
1244
1312
  case "end":
1245
1313
  return _context.stop();
1246
1314
  }
@@ -1768,5 +1836,5 @@ var Agency;
1768
1836
  Agency["SSI"] = "99";
1769
1837
  })(Agency || (Agency = {}));
1770
1838
 
1771
- export { Agency, LipheApiClient, LipheAuthenticator, LiphePractitionerClient, SFApiClient, SFAuthenticator, SFExpenseClient, SFPractitionerClient, SFTimesheetClient };
1839
+ export { Agency, LipheApiClient, LipheAuthenticator, LiphePractitionerClient, SFApiClient, SFAuthenticator, SFExpenseClient, SFPractitionerClient, SFPriceClient, SFTimesheetClient };
1772
1840
  //# sourceMappingURL=pha-hermes.esm.js.map