import 'dart:convert'; import 'dart:core'; import 'package:http/http.dart' as http; import 'package:hris_selfservice_mobile/constants.dart'; import 'dart:developer' as developer; import 'package:shared_preferences/shared_preferences.dart'; class PengajuanST_Post { late String session; late String tanggal_st; late String uang_muka; late String keperluan; late String tanggal_berangkat; late String tanggal_kembali; late String tujuan; late String ticket_type; late String ticket_from; late String ticket_to; late String date; late String harga; PengajuanST_Post({required this.session}); static Future connectToAPI(String tanggal_st, String uang_muka, String keperluan, String tanggal_berangkat, String tanggal_kembali, String tujuan, String ticket_type, String ticket_from, String ticket_to, String date, String harga) async { String URL = baseURL + "/api/v1/pengajuan_st"; final SharedPreferences prefs = await SharedPreferences.getInstance(); final session = prefs.getString('session'); var sendData = await http.post(Uri.parse(URL), body: jsonEncode({ "data": [ { "tanggal_st" : tanggal_st, "uang_muka" : uang_muka, "keperluan" : keperluan, "tanggal_berangkat" : tanggal_berangkat, "tanggal_kembali" : tanggal_kembali, "tujuan" : tujuan, "tiketnya" : [ { "ticket_type" : ticket_type, "ticket_from" : ticket_from, "ticket_to" : ticket_to, "date" : date, "harga" : harga } ], "session" : "fsfssdfsdfsdf" } ] }), headers: { "Content-Type": "application/json", "Api-key": apiKey }); //developer.log(sendData.body, name: "Get Jenis Cuti Result"); return sendData.body; } }