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.4KB

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