mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 14:18:56 +03:30
1.7.1
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cssd/config/user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
|
||||
class Auth with ChangeNotifier {
|
||||
String _token;
|
||||
DateTime _expiaryDate;
|
||||
@@ -32,7 +33,7 @@ class Auth with ChangeNotifier {
|
||||
|
||||
Future<String> requestCode(String cellNumber) async {
|
||||
final response = await http.post(
|
||||
Url.requestResetPass,
|
||||
Uri.parse(Url.requestResetPass),
|
||||
body: {
|
||||
'cell_number': cellNumber,
|
||||
},
|
||||
@@ -49,7 +50,7 @@ class Auth with ChangeNotifier {
|
||||
|
||||
Future<String> sendCode(String code) async {
|
||||
final response = await http.post(
|
||||
Url.verifyResetPass,
|
||||
Uri.parse(Url.verifyResetPass),
|
||||
body: {
|
||||
'code': code,
|
||||
},
|
||||
@@ -74,7 +75,7 @@ class Auth with ChangeNotifier {
|
||||
print(token);
|
||||
|
||||
final response = await http.post(
|
||||
Url.sendResetPass,
|
||||
Uri.parse(Url.sendResetPass),
|
||||
body: {
|
||||
'password': password,
|
||||
'password_confirmation': password,
|
||||
@@ -98,7 +99,7 @@ class Auth with ChangeNotifier {
|
||||
|
||||
Future<String> login(String cellNumber, String password) async {
|
||||
final response = await http.post(
|
||||
Url.login,
|
||||
Uri.parse(Url.login),
|
||||
body: {
|
||||
'cell_number': cellNumber,
|
||||
'password': password,
|
||||
@@ -160,7 +161,7 @@ class Auth with ChangeNotifier {
|
||||
|
||||
Future<Map<String, dynamic>> getUserData() async {
|
||||
final response = await http.get(
|
||||
Url.getUserInfo,
|
||||
Uri.parse(Url.getUserInfo),
|
||||
headers: {'Authorization': 'Bearer ' + token},
|
||||
);
|
||||
// print(response.body);
|
||||
@@ -188,7 +189,7 @@ class Auth with ChangeNotifier {
|
||||
|
||||
Future<void> setUserData(id, name, email) async {
|
||||
var response = await http.post(
|
||||
'https://cssd-doc.com/api/UpdateInfo',
|
||||
Uri.parse('https://cssd-doc.com/api/UpdateInfo'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
import 'package:cssd/models/cycles_models.dart';
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
import '../models/cycles_models.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -61,7 +61,7 @@ class CyclesProvider extends ChangeNotifier {
|
||||
|
||||
Future<List<Map<String, String>>> getHospitalsFilters() async {
|
||||
var response = await http.get(
|
||||
Url.filterItems,
|
||||
Uri.parse(Url.filterItems),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -80,7 +80,7 @@ class CyclesProvider extends ChangeNotifier {
|
||||
|
||||
Future<List<String>> getLabelFilters() async {
|
||||
var response = await http.get(
|
||||
Url.labelItems,
|
||||
Uri.parse(Url.labelItems),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -107,7 +107,7 @@ class CyclesProvider extends ChangeNotifier {
|
||||
labs.add({'name': '', 'id': label});
|
||||
}
|
||||
// print(labs);
|
||||
var response = await http.post(Url.createCycleResult,
|
||||
var response = await http.post(Uri.parse(Url.createCycleResult),
|
||||
body: json.encode(
|
||||
{
|
||||
'note': note,
|
||||
@@ -181,7 +181,7 @@ class CyclesProvider extends ChangeNotifier {
|
||||
}
|
||||
// print(url);
|
||||
var response = await http.get(
|
||||
url,
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -214,7 +214,7 @@ class CyclesProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<CycleDetailObject> showCycleResult(String id) async {
|
||||
var response = await http.get(Url.getCycleResult(id), headers: {
|
||||
var response = await http.get(Uri.parse(Url.getCycleResult(id)), headers: {
|
||||
'Authorization': User.token,
|
||||
});
|
||||
if (response.statusCode != 200) {
|
||||
|
||||
@@ -2,8 +2,9 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
|
||||
class Inputs with ChangeNotifier {
|
||||
List<Map<String, dynamic>> inputItems = [];
|
||||
@@ -22,7 +23,7 @@ class Inputs with ChangeNotifier {
|
||||
// },
|
||||
// );
|
||||
var response = await http.post(
|
||||
Url.getInputs,
|
||||
Uri.parse(Url.getInputs),
|
||||
body: {
|
||||
'test_type_id': testTypeId,
|
||||
'test_result_id': testResultId,
|
||||
@@ -47,7 +48,7 @@ class Inputs with ChangeNotifier {
|
||||
// }
|
||||
Map<String, dynamic> values;
|
||||
if (testResultId.isNotEmpty) {
|
||||
response = await http.get(Url.testResultFormValues(testResultId),
|
||||
response = await http.get(Uri.parse(Url.testResultFormValues(testResultId)),
|
||||
headers: {'Authorization': User.token});
|
||||
values = json.decode(response.body)['data'];
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
import 'package:cssd/models/label_models.dart';
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
import '../models/label_models.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -34,7 +34,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
|
||||
Future<List<Map<String, String>>> getHospitalsFilters() async {
|
||||
var response = await http.get(
|
||||
Url.filterItems,
|
||||
Uri.parse(Url.filterItems),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -53,7 +53,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
|
||||
Future<List<Map<String, String>>> getPackageFilters() async {
|
||||
var response = await http.get(
|
||||
Url.packageItems,
|
||||
Uri.parse(Url.packageItems),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -77,7 +77,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
Future<void> createLabelResult(lotNumber, cycleNumber, sterileDate, package,
|
||||
expireDate, sterilizerId) async {
|
||||
// print(labs);
|
||||
var response = await http.post(Url.createLabelResult,
|
||||
var response = await http.post(Uri.parse(Url.createLabelResult),
|
||||
body: json.encode(
|
||||
{
|
||||
'sterile_date': sterileDate,
|
||||
@@ -112,7 +112,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
sterilizerId,
|
||||
) async {
|
||||
// print(labs);
|
||||
var response = await http.put(Url.updateLabelResult(id),
|
||||
var response = await http.put(Uri.parse(Url.updateLabelResult(id)),
|
||||
body: json.encode(
|
||||
{
|
||||
'sterile_date': sterileDate,
|
||||
@@ -187,7 +187,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
var response = await http.get(
|
||||
url,
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -216,7 +216,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
|
||||
Future<LabelDetailsObject> showLabelResult(String id) async {
|
||||
var response = await http.get(
|
||||
Url.getLabelResult(id),
|
||||
Uri.parse(Url.getLabelResult(id)),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import '../config/urls.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -28,7 +28,7 @@ class MyInfoProvider extends ChangeNotifier {
|
||||
final auth = json.decode(prefs.getString('auth')) as Map<String, Object>;
|
||||
_token = auth['token'];
|
||||
final response = await http.get(
|
||||
Url.getUserInfo,
|
||||
Uri.parse(Url.getUserInfo),
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + _token,
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -24,7 +24,7 @@ class TestResult with ChangeNotifier{
|
||||
|
||||
Future<void> toggleVerify() async {
|
||||
final response = await http.post(
|
||||
Url.verifyTest(id), headers: {
|
||||
Uri.parse(Url.verifyTest(id)), headers: {
|
||||
'Authorization': User.token
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
// import 'dart:typed_data';
|
||||
import 'package:dio/dio.dart' as di;
|
||||
@@ -7,6 +6,7 @@ import 'package:dio/dio.dart' as di;
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
import 'package:cssd/models/test_result_models.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
// import 'package:cssd/providers/test_result.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
@@ -14,13 +14,13 @@ import 'package:random_string/random_string.dart';
|
||||
// import 'package:multi_image_picker/multi_image_picker.dart';
|
||||
|
||||
class TestResultsProvider with ChangeNotifier {
|
||||
List<File> catchImages = [];
|
||||
List<PlatformFile> catchImages = [];
|
||||
List<Uint8List> images = [];
|
||||
|
||||
setImages() async {
|
||||
images = [];
|
||||
for (var image in catchImages) {
|
||||
var result = image.readAsBytesSync();
|
||||
var result = image.bytes;
|
||||
// final batchId = randomString(10);
|
||||
// addImage(batchId, result, image.path);
|
||||
images.add(result.buffer
|
||||
@@ -29,7 +29,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setCatchImages(List<File> images) {
|
||||
setCatchImages(List<PlatformFile> images) {
|
||||
catchImages = images;
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
|
||||
Future<List<Map<String, String>>> getFilterItems() async {
|
||||
var response = await http.get(
|
||||
Url.filterItems,
|
||||
Uri.parse(Url.filterItems),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
@@ -187,7 +187,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
}
|
||||
//'device_id=3526&testType_id=107&medicalCenter_id=2&user_name=erfan&fromPicker=2020-05-12&upToPicker=2020-05-19&device_label=Instrument%20ID&page=1'
|
||||
var response = await http.get(
|
||||
url,
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
// 'X-Requested-With': 'XMLHttpRequest',
|
||||
@@ -221,7 +221,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
|
||||
static Future<void> updateTestResult(String id, values) async {
|
||||
var response = await http.post(
|
||||
Url.updateTestResult(id),
|
||||
Uri.parse(Url.updateTestResult(id)),
|
||||
body: json.encode(values),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
@@ -262,7 +262,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
final batchId = randomString(10);
|
||||
|
||||
for (var image in catchImages) {
|
||||
await addImage(batchId, image.readAsBytesSync(), image.path);
|
||||
await addImage(batchId, image.bytes, image.path);
|
||||
}
|
||||
dynamic vals = values;
|
||||
vals['file_batch_id'] = batchId;
|
||||
@@ -305,7 +305,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> showTestResult(String id) async {
|
||||
var response = await http.get(Url.getTestResult(id), headers: {
|
||||
var response = await http.get(Uri.parse(Url.getTestResult(id)), headers: {
|
||||
'Authorization': User.token,
|
||||
});
|
||||
|
||||
@@ -333,7 +333,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<bool> removeTestResult(String id) async {
|
||||
var response = await http.post(Url.removeTestResult(id), body: {
|
||||
var response = await http.post(Uri.parse(Url.removeTestResult(id)), body: {
|
||||
'_method': 'delete'
|
||||
}, headers: {
|
||||
'Authorization': User.token,
|
||||
@@ -353,7 +353,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
print(id);
|
||||
print(value);
|
||||
var response = await http.post(
|
||||
Url.testResultVerification(id, value),
|
||||
Uri.parse(Url.testResultVerification(id, value)),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
|
||||
Reference in New Issue
Block a user