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.
49 lines
1.4 KiB
49 lines
1.4 KiB
import 'dart:convert';
|
|
import 'dart:core';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:employee_selfservice_mobile/constants.dart';
|
|
import 'dart:developer' as developer;
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class PengajuanReimburse_Post {
|
|
late String name;
|
|
late String product;
|
|
late String date;
|
|
late String total;
|
|
late String payment_mode;
|
|
late String description;
|
|
late List<String> file;
|
|
late String session;
|
|
|
|
PengajuanReimburse_Post({required this.session});
|
|
|
|
static Future<String> connectToAPI(String name, String product, String date, String total, String payment_mode, String description, List<String> file) async {
|
|
String URL = baseURL + "/api/v1/pengajuan_reimburse";
|
|
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
final session = prefs.getString('session');
|
|
|
|
var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
|
|
"data": [
|
|
{
|
|
"name" : name,
|
|
"product" : product,
|
|
"date" : date,
|
|
"total" : total,
|
|
"payment_mode" : payment_mode,
|
|
"description" : description,
|
|
"session": session,
|
|
"file" : file
|
|
}
|
|
]
|
|
}), headers: {
|
|
"Content-Type": "application/json",
|
|
"Api-key": apiKey
|
|
});
|
|
|
|
developer.log(sendData.body, name: "Pengajuan REIMBURSE");
|
|
return sendData.body;
|
|
}
|
|
}
|