No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pengajuanReimburse_post.dart 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:http/http.dart' as http;
  4. import 'package:hris_selfservice_mobile/constants.dart';
  5. import 'dart:developer' as developer;
  6. import 'package:shared_preferences/shared_preferences.dart';
  7. class PengajuanReimburse_Post {
  8. late String name;
  9. late String product;
  10. late String date;
  11. late String total;
  12. late String payment_mode;
  13. late String description;
  14. late List<String> file;
  15. late String session;
  16. PengajuanReimburse_Post({required this.session});
  17. static Future<String> connectToAPI(String name, String product, String date, String total, String payment_mode, String description) async {
  18. String URL = baseURL + "/api/v1/pengajuan_reimburse";
  19. final SharedPreferences prefs = await SharedPreferences.getInstance();
  20. final session = prefs.getString('session');
  21. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  22. "data": [
  23. {
  24. "name" : name,
  25. "product" : product,
  26. "date" : date,
  27. "total" : total,
  28. "payment_mode" : payment_mode,
  29. "description" : description,
  30. "session": session
  31. }
  32. ]
  33. }), headers: {
  34. "Content-Type": "application/json",
  35. "Api-key": apiKey
  36. });
  37. //developer.log(sendData.body, name: "Get Jenis Cuti Result");
  38. return sendData.body;
  39. }
  40. }