step 3 : hapus ai_barcode_scanner, ai barcode, update permission_handler, flutter_map,latlong2
This commit is contained in:
51
lib/repository/auth_repository.dart
Normal file
51
lib/repository/auth_repository.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/auth_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class AuthRepository extends BaseRepository {
|
||||
AuthRepository({required super.dio});
|
||||
|
||||
Future<AuthModel> login({
|
||||
required String username,
|
||||
required String password,
|
||||
}) async {
|
||||
final param = {
|
||||
"username": username,
|
||||
"password": password
|
||||
|
||||
// "username": "alhadad1",
|
||||
// "doctor_id": "2891",
|
||||
// "password": "3"
|
||||
};
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/login/login/?username=$username&password=$password";
|
||||
final resp = await post(param: param, service: service);
|
||||
final result = AuthModel(
|
||||
token: resp['data']["token"],
|
||||
model: AuthKurirModel.fromJson(resp["data"]),
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<String> logout({
|
||||
required String M_UserID,
|
||||
required String M_UserUsername,
|
||||
}) async {
|
||||
final param = {
|
||||
"M_UserID": M_UserID,
|
||||
"M_UserUsername": M_UserUsername
|
||||
// "username": "alhadad",
|
||||
// "doctor_id": "3101210841",
|
||||
// "password": "riau123"
|
||||
};
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/login/logout";
|
||||
final resp = await post(param: param, service: service);
|
||||
|
||||
if (resp["status"] == "OK") {
|
||||
return resp['status'];
|
||||
} else {
|
||||
return resp['message'];
|
||||
}
|
||||
}
|
||||
}
|
||||
100
lib/repository/base_repository.dart
Normal file
100
lib/repository/base_repository.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
abstract class BaseRepository {
|
||||
final Dio dio;
|
||||
BaseRepository({required this.dio});
|
||||
|
||||
Future<Map<String, dynamic>> post({
|
||||
required Map<String, dynamic> param,
|
||||
required String service,
|
||||
String? token,
|
||||
}) async {
|
||||
try {
|
||||
final response = await dio.post(
|
||||
service,
|
||||
data: jsonEncode(param),
|
||||
options: Options(
|
||||
headers: token != null
|
||||
? {
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
HttpHeaders.authorizationHeader: "Bearer $token",
|
||||
}
|
||||
: {
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
},
|
||||
contentType: "application/json",
|
||||
),
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw BaseRepositoryException(
|
||||
message: "Invalid Http Response ${response.statusCode}",
|
||||
);
|
||||
}
|
||||
Map<String, dynamic> jsonData = jsonDecode(response.data);
|
||||
if (jsonData["status"] != "OK") {
|
||||
throw BaseRepositoryException(
|
||||
message: jsonData["message"],
|
||||
);
|
||||
} else {
|
||||
return jsonData;
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
} on SocketException catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
} on BaseRepositoryException catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> get({
|
||||
required String service,
|
||||
String? token,
|
||||
}) async {
|
||||
try {
|
||||
final response = await dio.get(
|
||||
service,
|
||||
options: Options(
|
||||
headers: token != null
|
||||
? {
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
HttpHeaders.authorizationHeader: "Bearer $token",
|
||||
}
|
||||
: {
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
},
|
||||
contentType: "application/json",
|
||||
),
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw BaseRepositoryException(
|
||||
message: "Invalid Http Response ${response.statusCode}",
|
||||
);
|
||||
}
|
||||
Map<String, dynamic> jsonData = jsonDecode(response.data);
|
||||
if (jsonData["status"] != "OK") {
|
||||
throw BaseRepositoryException(
|
||||
message: jsonData["message"],
|
||||
);
|
||||
} else {
|
||||
return jsonData;
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
} on SocketException catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
} on BaseRepositoryException catch (e) {
|
||||
throw BaseRepositoryException(message: e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BaseRepositoryException implements Exception {
|
||||
final String? message;
|
||||
BaseRepositoryException({
|
||||
required this.message,
|
||||
});
|
||||
}
|
||||
29
lib/repository/change_password_repository.dart
Normal file
29
lib/repository/change_password_repository.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../models/personal_information_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/response_save_change_password_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class ChangePasswordRepository extends BaseRepository {
|
||||
ChangePasswordRepository({required super.dio});
|
||||
|
||||
Future<ResponseSaveChangePasswordModel> ubahPassword(
|
||||
{required String userID,
|
||||
required String oldPassword,
|
||||
required String newPassword}) async {
|
||||
final param = {
|
||||
"userid": userID,
|
||||
"old": oldPassword,
|
||||
"new": newPassword,
|
||||
};
|
||||
|
||||
print(param);
|
||||
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/login/change_password/?userid=$userID&old=$oldPassword&new=$newPassword";
|
||||
final resp = await post(param: param, service: url);
|
||||
return ResponseSaveChangePasswordModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
35
lib/repository/company_repository.dart
Normal file
35
lib/repository/company_repository.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import '../models/company_model.dart';
|
||||
import '../models/work_status_model.dart';
|
||||
import '../models/work_supervisor_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/work_type_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class CompanyRepository extends BaseRepository {
|
||||
CompanyRepository({required super.dio});
|
||||
|
||||
Future<List<CompanyModel>> search({required String keyword}) async {
|
||||
// http: //10.9.9.3/one-api/v1/courier/mobile/inputcourier/search_company_all/?search=sas
|
||||
final url = Constant.baseUrl +
|
||||
"/v1/courier/mobile/inputcourier/search_company_all/?search=$keyword";
|
||||
final resp = await get(service: url);
|
||||
List<CompanyModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
if (resp['data'] != null) {
|
||||
resp['data']['records'].forEach((e) {
|
||||
final model = CompanyModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
65
lib/repository/filter_repository.dart
Normal file
65
lib/repository/filter_repository.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import '../models/work_status_model.dart';
|
||||
import '../models/work_supervisor_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/work_type_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class FilterRepository extends BaseRepository {
|
||||
FilterRepository({required super.dio});
|
||||
|
||||
Future<List<WorkTypeModel>> getType() async {
|
||||
final url = Constant.baseUrl + "/v1/courier/mobile/homescreen/list_tipe";
|
||||
final resp = await get(service: url);
|
||||
List<WorkTypeModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = WorkTypeModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<List<WorkStatusModel>> getStatus() async {
|
||||
final url = Constant.baseUrl + "v1/courier/mobile/homescreen/list_status";
|
||||
final resp = await get(service: url);
|
||||
List<WorkStatusModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = WorkStatusModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<List<WorkSupervisorModel>> getSupervisor() async {
|
||||
final url =
|
||||
Constant.baseUrl + "v1/courier/mobile/homescreen/list_supervisor";
|
||||
final resp = await get(service: url);
|
||||
List<WorkSupervisorModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = WorkSupervisorModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
59
lib/repository/get_other_repository.dart
Normal file
59
lib/repository/get_other_repository.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import '../app/constant.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class GetOtherRepository extends BaseRepository {
|
||||
GetOtherRepository({required super.dio});
|
||||
|
||||
Future<bool> setLocation(
|
||||
{required String id,
|
||||
required String step,
|
||||
required String lat,
|
||||
required String long,
|
||||
required String address,
|
||||
required String branchID}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/add_other/?id=$id&locid=$step&lat=$lat&long=$long&address=$address&branchid=$branchID";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setDeliveryPerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_deliver_other/?id=$id&name=$name¬e=$note";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setReceivePerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_receive_other/?id=$id&name=$name¬e=$note";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
72
lib/repository/get_sample_repository.dart
Normal file
72
lib/repository/get_sample_repository.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import '../app/constant.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class GetSampleRepository extends BaseRepository {
|
||||
GetSampleRepository({required super.dio});
|
||||
|
||||
Future<bool> setLocation(
|
||||
{required String id,
|
||||
required String step,
|
||||
required String lat,
|
||||
required String long,
|
||||
required String address,
|
||||
required String branchID}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/add_sample/?id=$id&locid=$step&lat=$lat&long=$long&address=$address&branchid=$branchID";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setDeliveryPerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
// Inputan INFO
|
||||
required String jumlahPasien,
|
||||
required String edtaRutin,
|
||||
required String darahCitras,
|
||||
required String serum,
|
||||
required String urine,
|
||||
required String pleura,
|
||||
required String otherTextBahan,
|
||||
required String totalOther,
|
||||
}) async {
|
||||
// final url =
|
||||
// "${Constant.baseUrl}/v1/courier/mobile/process/update_deliver_sample/?id=$id&name=$name¬e=$note";
|
||||
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_deliver_sample/?id=$id&name=$name¬e=$note&t_patient=$jumlahPasien&t_edta=$edtaRutin&t_citras=$darahCitras&t_serum=$serum&t_urine=$urine&t_pleura=$pleura&t_other=$totalOther&other=$otherTextBahan";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setReceivePerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
required String suhuSample,
|
||||
}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_receive_sample/?id=$id&name=$name¬e=$note&suhu=$suhuSample";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
78
lib/repository/history_screen_repository.dart
Normal file
78
lib/repository/history_screen_repository.dart
Normal file
@@ -0,0 +1,78 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../models/detail_history_model.dart';
|
||||
import '../models/history_model.dart';
|
||||
import '../models/history_type_model.dart';
|
||||
import '../models/work_status_model.dart';
|
||||
import '../models/work_supervisor_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/work_type_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class HistoryRepository extends BaseRepository {
|
||||
HistoryRepository({required super.dio});
|
||||
|
||||
Future<List<HistoryModel>> getData(
|
||||
{required String id, required String date, required String type}) async {
|
||||
// http: //10.9.9.3/one-api/v1/courier/mobile/history/list_all/?id=40&startdate=11-09-2023&tipeid=3
|
||||
final url = Constant.baseUrl +
|
||||
"/v1/courier/mobile/history/list_all/?id=$id&startdate=$date&tipeid=$type";
|
||||
final resp = await get(service: url);
|
||||
List<HistoryModel> data = [];
|
||||
print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = HistoryModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<DetailHistoryModel> getDetail(
|
||||
{required String id,
|
||||
required String tipeId,
|
||||
required String deliveryId}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/history/list_by_id/?id=$id&tipeid=$tipeId&deliveryid=$deliveryId";
|
||||
final resp = await get(service: url);
|
||||
// DetailHistoryModel data;
|
||||
// print(resp['data']);
|
||||
|
||||
DetailHistoryModel data = DetailHistoryModel.fromJson(resp['data'][0]);
|
||||
|
||||
// resp['data'].forEach((e) {
|
||||
// final model = HistoryModel.fromJson(e);
|
||||
// data.add(model);
|
||||
// });
|
||||
// }
|
||||
// print(data.alamatPengambilan);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<List<HistoryTypeModel>> getHistoryType() async {
|
||||
// http: //10.9.9.3/one-api/v1/courier/mobile/homescreen/list_tipe_history
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/homescreen/list_tipe_history";
|
||||
final resp = await get(service: url);
|
||||
// DetailHistoryModel data;
|
||||
// print(resp['data']);
|
||||
|
||||
List<HistoryTypeModel> data = List.empty(growable: true);
|
||||
|
||||
resp['data'].forEach((e) {
|
||||
final model = HistoryTypeModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
|
||||
// print(data.alamatPengambilan);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
42
lib/repository/home_screen_repository.dart
Normal file
42
lib/repository/home_screen_repository.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/pending_work_model.dart';
|
||||
import '../models/work_total_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class HomeScreenRepository extends BaseRepository {
|
||||
HomeScreenRepository({required super.dio});
|
||||
Future<WorkTotalModel> getTotalWork({required String id}) async {
|
||||
final url =
|
||||
Constant.baseUrl + "v1/courier/mobile/homescreen/list_total/?id=$id";
|
||||
final resp = await get(service: url);
|
||||
WorkTotalModel data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = WorkTotalModel.fromJson(resp['data']);
|
||||
} else {
|
||||
data = {} as WorkTotalModel;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<List<PendingWorkModel>> getPendingWork({required String id}) async {
|
||||
final url =
|
||||
Constant.baseUrl + "/v1/courier/mobile/homescreen/list_order/?id=$id";
|
||||
final resp = await get(service: url);
|
||||
List<PendingWorkModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK') {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = PendingWorkModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
76
lib/repository/input_lain_lain_repository.dart
Normal file
76
lib/repository/input_lain_lain_repository.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/auth_model.dart';
|
||||
import '../models/response_list_branch_model.dart';
|
||||
import '../models/response_save_pengantaran_hasil_model.dart';
|
||||
import '../models/response_search_pengantaran_hasil_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class DummyNoLabDokter {
|
||||
final String noLab;
|
||||
final int idLab;
|
||||
final String nama;
|
||||
final String alamatPengantaran;
|
||||
|
||||
DummyNoLabDokter(
|
||||
this.noLab,
|
||||
this.idLab,
|
||||
this.nama,
|
||||
this.alamatPengantaran
|
||||
);
|
||||
}
|
||||
|
||||
class InputLainLainRepository extends BaseRepository {
|
||||
InputLainLainRepository({required super.dio});
|
||||
|
||||
List<DummyNoLabDokter> result = [
|
||||
DummyNoLabDokter("110378", 1, "Agas", "Jl wora wari"),
|
||||
DummyNoLabDokter("110390", 2, "Indy Ratna", "Jl moestopo"),
|
||||
DummyNoLabDokter("140390", 3, "Jarot", "Jl pahlawan no 1"),
|
||||
DummyNoLabDokter("190390", 4, "Deny", "Jl Ir Soekarno"),
|
||||
DummyNoLabDokter("119090", 5, "Said Hasan", "Jl mawar no 04"),
|
||||
DummyNoLabDokter("110391", 1, "Jarot P", "Jl nawangsih no 07"),
|
||||
DummyNoLabDokter("110399", 2, "Joko S", "Jl Pegangsaan no 04"),
|
||||
];
|
||||
|
||||
Future<List<ResponseListBranchModel>> loadListCabangInputLainLain() async {
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/mobile/homescreen/list_branch";
|
||||
final resp = await get(service: service);
|
||||
|
||||
final result = List<ResponseListBranchModel>.empty(growable: true);
|
||||
if (resp['data'] != null) {
|
||||
resp['data'].forEach((e) {
|
||||
final model = ResponseListBranchModel.fromJson(e);
|
||||
result.add(model);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<ResponseSavePengantaranHasilModel> inputLainLainSave({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String branchID,
|
||||
required String branchCode,
|
||||
required String pickup,
|
||||
required String destination,
|
||||
required String note
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"branchid": branchID,
|
||||
"branchcode": branchCode,
|
||||
"pickup": pickup,
|
||||
"destination":destination,
|
||||
"note": note
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/inputcourier/add/?id=$courierID&tipeid=$tipeID&branchid=$branchID&branchcode=$branchCode&pickup=$pickup&destination=$destination¬e=$note";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSavePengantaranHasilModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
28
lib/repository/kurir_tolak_repository.dart
Normal file
28
lib/repository/kurir_tolak_repository.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../app/constant.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class KurirTolakRepository extends BaseRepository {
|
||||
KurirTolakRepository({required super.dio});
|
||||
|
||||
Future<bool> getKurirTolak(
|
||||
{required String id,
|
||||
required String tipeId,
|
||||
required String deliveryId,
|
||||
required String note}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/worklist/cancel/?id=$id&tipeid=$tipeId&deliveryid=$deliveryId¬e=$note";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
// print(resp['data']);
|
||||
|
||||
if (resp["status"] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
74
lib/repository/pengambilan_bahan_repository.dart
Normal file
74
lib/repository/pengambilan_bahan_repository.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/auth_model.dart';
|
||||
import '../models/response_list_branch_model.dart';
|
||||
import '../models/response_save_pengantaran_hasil_model.dart';
|
||||
import '../models/response_search_pengantaran_hasil_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class DummyNoLabDokter {
|
||||
final String noLab;
|
||||
final int idLab;
|
||||
final String nama;
|
||||
final String alamatPengantaran;
|
||||
|
||||
DummyNoLabDokter(
|
||||
this.noLab,
|
||||
this.idLab,
|
||||
this.nama,
|
||||
this.alamatPengantaran
|
||||
);
|
||||
}
|
||||
|
||||
class PengambilanBahanRepository extends BaseRepository {
|
||||
PengambilanBahanRepository({required super.dio});
|
||||
|
||||
List<DummyNoLabDokter> result = [
|
||||
DummyNoLabDokter("110378", 1, "Agas", "Jl wora wari"),
|
||||
DummyNoLabDokter("110390", 2, "Indy Ratna", "Jl moestopo"),
|
||||
DummyNoLabDokter("140390", 3, "Jarot", "Jl pahlawan no 1"),
|
||||
DummyNoLabDokter("190390", 4, "Deny", "Jl Ir Soekarno"),
|
||||
DummyNoLabDokter("119090", 5, "Said Hasan", "Jl mawar no 04"),
|
||||
DummyNoLabDokter("110391", 1, "Jarot P", "Jl nawangsih no 07"),
|
||||
DummyNoLabDokter("110399", 2, "Joko S", "Jl Pegangsaan no 04"),
|
||||
];
|
||||
|
||||
Future<List<ResponseListBranchModel>> loadListCabangPengambilanBahan() async {
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/mobile/homescreen/list_branch";
|
||||
final resp = await get(service: service);
|
||||
|
||||
final result = List<ResponseListBranchModel>.empty(growable: true);
|
||||
if (resp['data'] != null) {
|
||||
resp['data'].forEach((e) {
|
||||
final model = ResponseListBranchModel.fromJson(e);
|
||||
result.add(model);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<ResponseSavePengantaranHasilModel> pengambilanBahanSave({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String branchID,
|
||||
required String branchCode,
|
||||
required String name,
|
||||
required String destination
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"branchid": branchID,
|
||||
"branchcode": branchCode,
|
||||
"name": name,
|
||||
"destination":destination
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/inputcourier/add/?id=$courierID&tipeid=$tipeID&branchid=$branchID&branchcode=$branchCode&name=$name&destination=$destination";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSavePengantaranHasilModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
72
lib/repository/pengantaran_hasil_dokter_repository.dart
Normal file
72
lib/repository/pengantaran_hasil_dokter_repository.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/auth_model.dart';
|
||||
import '../models/response_save_pengantaran_hasil_model.dart';
|
||||
import '../models/response_search_pengantaran_hasil_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class DummyNoLabDokter {
|
||||
final String noLab;
|
||||
final int idLab;
|
||||
final String nama;
|
||||
final String alamatPengantaran;
|
||||
|
||||
DummyNoLabDokter(
|
||||
this.noLab,
|
||||
this.idLab,
|
||||
this.nama,
|
||||
this.alamatPengantaran
|
||||
);
|
||||
}
|
||||
|
||||
class PengantaranHasilDokterRepository extends BaseRepository {
|
||||
PengantaranHasilDokterRepository({required super.dio});
|
||||
|
||||
List<DummyNoLabDokter> result = [
|
||||
DummyNoLabDokter("110378", 1, "Agas", "Jl wora wari"),
|
||||
DummyNoLabDokter("110390", 2, "Indy Ratna", "Jl moestopo"),
|
||||
DummyNoLabDokter("140390", 3, "Jarot", "Jl pahlawan no 1"),
|
||||
DummyNoLabDokter("190390", 4, "Deny", "Jl Ir Soekarno"),
|
||||
DummyNoLabDokter("119090", 5, "Said Hasan", "Jl mawar no 04"),
|
||||
DummyNoLabDokter("110391", 1, "Jarot P", "Jl nawangsih no 07"),
|
||||
DummyNoLabDokter("110399", 2, "Joko S", "Jl Pegangsaan no 04"),
|
||||
];
|
||||
|
||||
Future<List<ResponseSearchPengantaranHasilModel>> loadListNoDokterPengantaranHasilDokter({
|
||||
required String search,
|
||||
}) async {
|
||||
final param = {
|
||||
"search": search,
|
||||
};
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/mobile/inputcourier/search_doctor/?search=$search";
|
||||
final resp = await post(param: param, service: service);
|
||||
|
||||
final result = List<ResponseSearchPengantaranHasilModel>.empty(growable: true);
|
||||
if (resp['data'] != null) {
|
||||
resp['data']['records'].forEach((e) {
|
||||
final model = ResponseSearchPengantaranHasilModel.fromJson(e);
|
||||
result.add(model);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<ResponseSavePengantaranHasilModel> pengantaranHasilDokterSave({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String deliveryID,
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"deliveryid": deliveryID
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/inputcourier/add/?id=$courierID&tipeid=$tipeID&deliveryid=$deliveryID";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSavePengantaranHasilModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
71
lib/repository/pengantaran_hasil_instansi_repository.dart
Normal file
71
lib/repository/pengantaran_hasil_instansi_repository.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/auth_model.dart';
|
||||
import '../models/response_save_pengantaran_hasil_model.dart';
|
||||
import '../models/response_search_pengantaran_hasil_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class DummyNoSuratJalan {
|
||||
final String noSuratJalan;
|
||||
final int idSuratJalan;
|
||||
final String nama;
|
||||
final String alamatPengantaran;
|
||||
|
||||
DummyNoSuratJalan(
|
||||
this.noSuratJalan,
|
||||
this.idSuratJalan,
|
||||
this.nama,
|
||||
this.alamatPengantaran
|
||||
);
|
||||
}
|
||||
class PengantaranHasilInstansiRepository extends BaseRepository {
|
||||
PengantaranHasilInstansiRepository({required super.dio});
|
||||
|
||||
List<DummyNoSuratJalan> result = [
|
||||
DummyNoSuratJalan("110378", 1, "Agas", "Jl wora wari"),
|
||||
DummyNoSuratJalan("110390", 2, "Indy Ratna", "Jl moestopo"),
|
||||
DummyNoSuratJalan("140390", 3, "Jarot", "Jl pahlawan no 1"),
|
||||
DummyNoSuratJalan("190390", 4, "Deny", "Jl Ir Soekarno"),
|
||||
DummyNoSuratJalan("119090", 5, "Said Hasan", "Jl mawar no 04"),
|
||||
DummyNoSuratJalan("110391", 1, "Jarot P", "Jl nawangsih no 07"),
|
||||
DummyNoSuratJalan("110399", 2, "Joko S", "Jl Pegangsaan no 04"),
|
||||
];
|
||||
|
||||
Future<List<ResponseSearchPengantaranHasilModel>> loadListNoSuratJalanPengantaranHasilInstansi({
|
||||
required String search,
|
||||
}) async {
|
||||
final param = {
|
||||
"search": search,
|
||||
};
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/mobile/inputcourier/search_company/?search=$search";
|
||||
final resp = await post(param: param, service: service);
|
||||
|
||||
final result = List<ResponseSearchPengantaranHasilModel>.empty(growable: true);
|
||||
if (resp['data'] != null) {
|
||||
resp['data']['records'].forEach((e) {
|
||||
final model = ResponseSearchPengantaranHasilModel.fromJson(e);
|
||||
result.add(model);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<ResponseSavePengantaranHasilModel> pengantaranHasilInstansiSave({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String deliveryID,
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"deliveryid": deliveryID
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/inputcourier/add/?id=$courierID&tipeid=$tipeID&deliveryid=$deliveryID";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSavePengantaranHasilModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
48
lib/repository/pengantaran_hasil_pasien_repository.dart
Normal file
48
lib/repository/pengantaran_hasil_pasien_repository.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/response_save_pengantaran_hasil_model.dart';
|
||||
import '../models/response_search_pengantaran_hasil_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class PengantaranHasilPasienRepository extends BaseRepository {
|
||||
PengantaranHasilPasienRepository({required super.dio});
|
||||
|
||||
// search no lab pasien
|
||||
Future<List<ResponseSearchPengantaranHasilModel>>
|
||||
loadListNoLabPengantaranHasilPasien({
|
||||
required String search,
|
||||
}) async {
|
||||
final param = {
|
||||
"search": search,
|
||||
};
|
||||
final service =
|
||||
"${Constant.baseUrl}v1/courier/mobile/inputcourier/search_patient/?search=$search";
|
||||
final resp = await post(param: param, service: service);
|
||||
|
||||
final result = List<ResponseSearchPengantaranHasilModel>.empty(growable: true);
|
||||
if (resp['data'] != null) {
|
||||
resp['data']['records'].forEach((e) {
|
||||
final model = ResponseSearchPengantaranHasilModel.fromJson(e);
|
||||
result.add(model);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// simpan input pengantaran hasil pasien
|
||||
Future<ResponseSavePengantaranHasilModel> pengantaranHasilPasienSave({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String deliveryID,
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"deliveryid": deliveryID
|
||||
};
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/inputcourier/add/?id=$courierID&tipeid=$tipeID&deliveryid=$deliveryID";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSavePengantaranHasilModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
34
lib/repository/personal_information_repository.dart
Normal file
34
lib/repository/personal_information_repository.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../models/personal_information_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class PersonalInformationRepository extends BaseRepository {
|
||||
PersonalInformationRepository({required super.dio});
|
||||
|
||||
Future<List<PersonalInformationModel>> getPersonalInformation(
|
||||
{required String mCourierID}) async {
|
||||
final param = {
|
||||
"id": mCourierID
|
||||
};
|
||||
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/profile/info/?id=$mCourierID";
|
||||
final resp = await get(service: url);
|
||||
// print("url :" + url);
|
||||
List<PersonalInformationModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK' && resp['status'] != null) {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = PersonalInformationModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
59
lib/repository/result_delivery_repository.dart
Normal file
59
lib/repository/result_delivery_repository.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import '../app/constant.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class ResultDeliveryRepository extends BaseRepository {
|
||||
ResultDeliveryRepository({required super.dio});
|
||||
|
||||
Future<bool> setLocation(
|
||||
{required String id,
|
||||
required String step,
|
||||
required String lat,
|
||||
required String long,
|
||||
required String address,
|
||||
required String branchID}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/add_delivery/?id=$id&locid=$step&lat=$lat&long=$long&address=$address&branchid=$branchID";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setDeliveryPerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_deliver/?id=$id&name=$name¬e=$note";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<bool> setReceivePerson({
|
||||
required String id,
|
||||
required String name,
|
||||
required String note,
|
||||
}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/process/update_receive/?id=$id&name=$name¬e=$note";
|
||||
final resp = await get(service: url);
|
||||
bool data = false;
|
||||
|
||||
if (resp['status'] == "OK") {
|
||||
data = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
28
lib/repository/work_input_suhu_repository.dart
Normal file
28
lib/repository/work_input_suhu_repository.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/response_save_work_suhu_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
|
||||
class WorkInputSuhuRepository extends BaseRepository {
|
||||
WorkInputSuhuRepository({required super.dio});
|
||||
|
||||
Future<ResponseSaveWorkSuhuModel> inputWorkSuhu({
|
||||
required String deliveryId,
|
||||
required String suhu
|
||||
}) async {
|
||||
final param = {
|
||||
"id": deliveryId,
|
||||
"suhu": suhu
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
// Pengantaran Hasil => tipeID 1
|
||||
// Lain-lain => tipeID 4
|
||||
// Pengambilan Bahan => tipeID 5
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/process/update_temperatur_box/?id=$deliveryId&suhu=$suhu";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSaveWorkSuhuModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
58
lib/repository/work_list_repository.dart
Normal file
58
lib/repository/work_list_repository.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../models/work_list_model.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../models/detail_work_model.dart';
|
||||
import '../models/pending_work_model.dart';
|
||||
import '../models/work_total_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
class WorkListRepository extends BaseRepository {
|
||||
WorkListRepository({required super.dio});
|
||||
|
||||
Future<List<WorkListModel>> getListWork(
|
||||
{required String id,
|
||||
required String tipeId,
|
||||
required String supervisor,
|
||||
required String status}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/worklist/listbycourierv2/?id=$id&tipeid=$tipeId&status='$status'&supervisor='$supervisor'";
|
||||
final resp = await get(service: url);
|
||||
// print("url :" + url);
|
||||
List<WorkListModel> data;
|
||||
// print(resp['data']);
|
||||
if (resp['status'] == 'OK' && resp['status'] != null) {
|
||||
data = [];
|
||||
resp['data'].forEach((e) {
|
||||
final model = WorkListModel.fromJson(e);
|
||||
data.add(model);
|
||||
});
|
||||
} else {
|
||||
data = [];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<DetailWorkModel> getDetail(
|
||||
{required String id,
|
||||
required String tipeId,
|
||||
required String deliveryId}) async {
|
||||
final url =
|
||||
"${Constant.baseUrl}/v1/courier/mobile/worklist/list_by_id/?id=$id&tipeid=$tipeId&deliveryid=$deliveryId";
|
||||
final resp = await get(service: url);
|
||||
// DetailWorkModel data;
|
||||
// print(resp['data']);
|
||||
|
||||
DetailWorkModel data = DetailWorkModel.fromJson(resp['data'][0]);
|
||||
|
||||
// resp['data'].forEach((e) {
|
||||
// final model = HistoryModel.fromJson(e);
|
||||
// data.add(model);
|
||||
// });
|
||||
// }
|
||||
// print(data.alamatPengambilan);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
32
lib/repository/work_tunda_repository.dart
Normal file
32
lib/repository/work_tunda_repository.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import '../app/constant.dart';
|
||||
import '../models/response_save_work_tunda_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
|
||||
class WorkTundaRepository extends BaseRepository {
|
||||
WorkTundaRepository({required super.dio});
|
||||
|
||||
Future<ResponseSaveWorkTundaModel> inputWorkTunda({
|
||||
required String courierID,
|
||||
required String tipeID,
|
||||
required String deliveryID,
|
||||
required String note
|
||||
}) async {
|
||||
final param = {
|
||||
"id": courierID,
|
||||
"tipeid": tipeID,
|
||||
"deliveryid": deliveryID,
|
||||
"note": note
|
||||
};
|
||||
|
||||
print("param : $param");
|
||||
|
||||
// Pengantaran Hasil => tipeID 1
|
||||
// Lain-lain => tipeID 4
|
||||
// Pengambilan Bahan => tipeID 5
|
||||
|
||||
final service = "${Constant.baseUrl}v1/courier/mobile/pending/add/?id=$courierID&tipeid=$tipeID&deliveryid=$deliveryID¬e=$note";
|
||||
final resp = await post(param: param, service: service);
|
||||
return ResponseSaveWorkTundaModel.fromJson(resp);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user