Merge branch 'zaid_development_new' into sikander-development
# Conflicts: # ios/Runner/Info.plistmain_design2.0
commit
88185b412a
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50.481" height="50.488" viewBox="0 0 50.481 50.488">
|
||||
<g id="research_1_" data-name="research (1)" transform="translate(-2 -2)">
|
||||
<path id="Path_4616" data-name="Path 4616" d="M9.2,15H3.8A1.8,1.8,0,0,0,2,16.8V31.226a1.8,1.8,0,0,0,1.8,1.8H18.226a1.8,1.8,0,0,0,1.8-1.8v-.937a16.379,16.379,0,0,1-6.094-3.858A16.215,16.215,0,0,1,9.2,15Z" transform="translate(0 10.437)" fill="#5bb0d9"/>
|
||||
<path id="Path_4617" data-name="Path 4617" d="M3.8,20.028h6.292a15.865,15.865,0,0,1,3.84-6.094,16.379,16.379,0,0,1,6.094-3.856V3.8a1.8,1.8,0,0,0-1.8-1.8H3.8A1.8,1.8,0,0,0,2,3.8V18.226a1.8,1.8,0,0,0,1.8,1.8ZM7.03,9.41a1.785,1.785,0,0,1,2.56,0l.739.739,2.109-2.091A1.8,1.8,0,0,1,15,10.6l-3.389,3.371a1.763,1.763,0,0,1-2.542,0L7.03,11.952a1.8,1.8,0,0,1,0-2.54Z" fill="#5bb0d9"/>
|
||||
<path id="Path_4618" data-name="Path 4618" d="M46.922,39.274a1.945,1.945,0,0,0-.22-.193L37.78,32.706a1.8,1.8,0,0,0-2.322.193L32.82,30.262a14.452,14.452,0,1,0-2.558,2.558L32.9,35.458a1.8,1.8,0,0,0-.193,2.322L39.081,46.7a1.785,1.785,0,0,0,.193.227,5.408,5.408,0,1,0,7.648-7.648Zm-33.145-10.2a10.817,10.817,0,1,1,7.648,3.168,10.817,10.817,0,0,1-7.648-3.168Z" transform="translate(3.975 3.975)" fill="#5bb0d9"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -1,216 +0,0 @@
|
||||
PODS:
|
||||
- audioplayers_darwin (0.0.1):
|
||||
- Flutter
|
||||
- Firebase/CoreOnly (10.3.0):
|
||||
- FirebaseCore (= 10.3.0)
|
||||
- Firebase/Messaging (10.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (~> 10.3.0)
|
||||
- firebase_core (2.4.1):
|
||||
- Firebase/CoreOnly (= 10.3.0)
|
||||
- Flutter
|
||||
- firebase_messaging (14.2.1):
|
||||
- Firebase/Messaging (= 10.3.0)
|
||||
- firebase_core
|
||||
- Flutter
|
||||
- FirebaseCore (10.3.0):
|
||||
- FirebaseCoreInternal (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/Logger (~> 7.8)
|
||||
- FirebaseCoreInternal (10.3.0):
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.8)"
|
||||
- FirebaseInstallations (10.3.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- PromisesObjC (~> 2.1)
|
||||
- FirebaseMessaging (10.3.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleDataTransport (~> 9.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/Reachability (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- nanopb (< 2.30910.0, >= 2.30908.0)
|
||||
- Flutter (1.0.0)
|
||||
- flutter_keyboard_visibility (0.0.1):
|
||||
- Flutter
|
||||
- flutter_local_notifications (0.0.1):
|
||||
- Flutter
|
||||
- flutter_sound (9.2.13):
|
||||
- Flutter
|
||||
- flutter_sound_core (= 9.2.13)
|
||||
- flutter_sound_core (9.2.13)
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- GoogleDataTransport (9.2.0):
|
||||
- GoogleUtilities/Environment (~> 7.7)
|
||||
- nanopb (< 2.30910.0, >= 2.30908.0)
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (7.10.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network
|
||||
- GoogleUtilities/Environment (7.10.0):
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/Logger (7.10.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Network (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- "GoogleUtilities/NSData+zlib"
|
||||
- GoogleUtilities/Reachability
|
||||
- "GoogleUtilities/NSData+zlib (7.10.0)"
|
||||
- GoogleUtilities/Reachability (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/UserDefaults (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- MTBBarcodeScanner (5.0.11)
|
||||
- nanopb (2.30909.0):
|
||||
- nanopb/decode (= 2.30909.0)
|
||||
- nanopb/encode (= 2.30909.0)
|
||||
- nanopb/decode (2.30909.0)
|
||||
- nanopb/encode (2.30909.0)
|
||||
- package_info (0.0.1):
|
||||
- Flutter
|
||||
- path_provider_ios (0.0.1):
|
||||
- Flutter
|
||||
- permission_handler_apple (9.0.4):
|
||||
- Flutter
|
||||
- PromisesObjC (2.1.1)
|
||||
- qr_code_scanner (0.2.0):
|
||||
- Flutter
|
||||
- MTBBarcodeScanner
|
||||
- share (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_ios (0.0.1):
|
||||
- Flutter
|
||||
- speech_to_text (0.0.1):
|
||||
- Flutter
|
||||
- Try
|
||||
- sqflite (0.0.2):
|
||||
- Flutter
|
||||
- FMDB (>= 2.7.5)
|
||||
- Toast (4.0.0)
|
||||
- Try (2.1.1)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
|
||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||
- flutter_sound (from `.symlinks/plugins/flutter_sound/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- package_info (from `.symlinks/plugins/package_info/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
|
||||
- share (from `.symlinks/plugins/share/ios`)
|
||||
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
|
||||
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Firebase
|
||||
- FirebaseCore
|
||||
- FirebaseCoreInternal
|
||||
- FirebaseInstallations
|
||||
- FirebaseMessaging
|
||||
- flutter_sound_core
|
||||
- FMDB
|
||||
- GoogleDataTransport
|
||||
- GoogleUtilities
|
||||
- MTBBarcodeScanner
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
- Toast
|
||||
- Try
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
audioplayers_darwin:
|
||||
:path: ".symlinks/plugins/audioplayers_darwin/ios"
|
||||
firebase_core:
|
||||
:path: ".symlinks/plugins/firebase_core/ios"
|
||||
firebase_messaging:
|
||||
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_keyboard_visibility:
|
||||
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||
flutter_local_notifications:
|
||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||
flutter_sound:
|
||||
:path: ".symlinks/plugins/flutter_sound/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
package_info:
|
||||
:path: ".symlinks/plugins/package_info/ios"
|
||||
path_provider_ios:
|
||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||
permission_handler_apple:
|
||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||
qr_code_scanner:
|
||||
:path: ".symlinks/plugins/qr_code_scanner/ios"
|
||||
share:
|
||||
:path: ".symlinks/plugins/share/ios"
|
||||
shared_preferences_ios:
|
||||
:path: ".symlinks/plugins/shared_preferences_ios/ios"
|
||||
speech_to_text:
|
||||
:path: ".symlinks/plugins/speech_to_text/ios"
|
||||
sqflite:
|
||||
:path: ".symlinks/plugins/sqflite/ios"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
|
||||
Firebase: f92fc551ead69c94168d36c2b26188263860acd9
|
||||
firebase_core: bf59c32d2e53814f558efa20840c1902fa2fe461
|
||||
firebase_messaging: ee597229fc260f8fa491fa8f2d4a32dfbfa406fa
|
||||
FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a
|
||||
FirebaseCoreInternal: 29b76f784d607df8b2a1259d73c3f04f1210137b
|
||||
FirebaseInstallations: e2f26126089dcf41e215f7b8925af8d953c7d602
|
||||
FirebaseMessaging: e345b219fd15d325f0cf2fef28cb8ce00d851b3f
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
|
||||
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
|
||||
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
|
||||
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
|
||||
GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95
|
||||
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
|
||||
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
|
||||
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
|
||||
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
|
||||
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
|
||||
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
|
||||
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
|
||||
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
|
||||
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
|
||||
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
|
||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
||||
|
||||
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
|
||||
|
||||
COCOAPODS: 1.11.3
|
||||
@ -0,0 +1,149 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ApiManager {
|
||||
ApiManager._();
|
||||
|
||||
Map<String, String> get _headers => {
|
||||
'Content-Type': 'application/json',
|
||||
if (user != null) 'Authorization': 'Bearer ${user.token}',
|
||||
};
|
||||
|
||||
static ApiManager instance = ApiManager._();
|
||||
|
||||
User user;
|
||||
|
||||
Future<http.Response> get(
|
||||
String url, {
|
||||
Map<String, String> headers,
|
||||
enableToastMessage = true,
|
||||
}) async {
|
||||
headers ??= {};
|
||||
|
||||
headers.addAll(_headers);
|
||||
|
||||
Uri _url = Uri.parse(url);
|
||||
// print(_url);
|
||||
// print(headers);
|
||||
http.Response response = await http.get(_url, headers: headers);
|
||||
if (jsonDecode(response.body) is Map<String, dynamic>) {
|
||||
final message = jsonDecode(response.body)["message"];
|
||||
if (message != null && message.toString().isNotEmpty && enableToastMessage) {
|
||||
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<http.Response> post(
|
||||
String url, {
|
||||
Map<String, String> headers,
|
||||
@required Map<String, dynamic> body,
|
||||
}) async {
|
||||
headers ??= {};
|
||||
|
||||
headers.addAll(_headers);
|
||||
|
||||
Uri _url = Uri.parse(url);
|
||||
if (!kReleaseMode) {
|
||||
print("URL:$_url");
|
||||
print("Headers:$headers");
|
||||
print("Body:$body");
|
||||
}
|
||||
|
||||
var request = http.Request('POST', _url);
|
||||
request.body = json.encode(body);
|
||||
request.headers.addAll(headers);
|
||||
|
||||
http.StreamedResponse _streamedResponse = await request.send();
|
||||
http.Response response = await http.Response.fromStream(_streamedResponse);
|
||||
// print(response.statusCode);
|
||||
// log(response.body);
|
||||
|
||||
if (jsonDecode(response.body) is Map<String, dynamic>) {
|
||||
final message = jsonDecode(response.body)["message"];
|
||||
if (message != null && message.toString().isNotEmpty) {
|
||||
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<http.Response> put(
|
||||
String url, {
|
||||
Map<String, String> headers,
|
||||
@required Map<String, dynamic> body,
|
||||
}) async {
|
||||
headers ??= {};
|
||||
|
||||
headers.addAll(_headers);
|
||||
|
||||
Uri _url = Uri.parse(url);
|
||||
print(_url);
|
||||
// print(headers);
|
||||
// log(json.encode(body));
|
||||
var request = http.Request('PUT', _url);
|
||||
request.body = json.encode(body);
|
||||
request.headers.addAll(headers);
|
||||
|
||||
http.StreamedResponse streamedResponse = await request.send();
|
||||
http.Response response = await http.Response.fromStream(streamedResponse);
|
||||
// print(response.statusCode);
|
||||
// log(response.body);
|
||||
if (jsonDecode(response.body) is Map<String, dynamic>) {
|
||||
final message = jsonDecode(response.body)["message"];
|
||||
if (message != null && message.toString().isNotEmpty) {
|
||||
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<http.Response> multiPart(
|
||||
String url, {
|
||||
Map<String, String> headers,
|
||||
@required Map<String, String> body,
|
||||
@required List<Future<MultipartFile>> files,
|
||||
}) async {
|
||||
Map<String, String> _headers = const {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
};
|
||||
|
||||
headers ??= {};
|
||||
|
||||
headers.addAll(_headers);
|
||||
|
||||
Uri _url = Uri.parse(url);
|
||||
// print(_url);
|
||||
// print(_headers);
|
||||
// print(json.encode(body));
|
||||
var request = http.MultipartRequest('POST', _url);
|
||||
request.fields.addAll(body);
|
||||
request.headers.addAll(_headers);
|
||||
|
||||
for (var element in files) {
|
||||
request.files.add(await element);
|
||||
}
|
||||
|
||||
//request.files.addAll(_files);
|
||||
// print(request.files);
|
||||
http.StreamedResponse streamedResponse = await request.send();
|
||||
http.Response response = await http.Response.fromStream(streamedResponse);
|
||||
// print(response.statusCode);
|
||||
// log(response.body);
|
||||
if (jsonDecode(response.body) is Map<String, dynamic>) {
|
||||
final message = jsonDecode(response.body)["message"];
|
||||
if (message != null && message.toString().isNotEmpty) {
|
||||
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@ -1,40 +1,39 @@
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
|
||||
class HttpStatusManger{
|
||||
class HttpStatusManger {
|
||||
static String getStatusMessage({
|
||||
@required int status,
|
||||
@required Subtitle subtitle,
|
||||
String messageFor400,
|
||||
String messageFor200,
|
||||
}){
|
||||
if(status == null)
|
||||
}) {
|
||||
if (status == null)
|
||||
// no status code - code error no need for subtitle
|
||||
return "careful null status";
|
||||
if(status == -1)
|
||||
if (status == -1)
|
||||
// client's request in process
|
||||
return subtitle.currentlyServiceNotAvailable;
|
||||
if(status == -2){
|
||||
if (status == -2) {
|
||||
// client's request in process
|
||||
return subtitle.waitUntilYourRequestComplete;
|
||||
}else if(status >= 200 && status < 300){
|
||||
} else if (status >= 200 && status < 300) {
|
||||
// client's request was successfully received
|
||||
return messageFor200 ?? subtitle.requestCompleteSuccessfully;
|
||||
} else if(status >= 400 && status < 500){
|
||||
} else if (status >= 400 && status < 500) {
|
||||
// client's request have error
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 400:
|
||||
return messageFor400 ?? subtitle.failedToCompleteRequest;
|
||||
default:
|
||||
return subtitle.failedToCompleteRequest;
|
||||
}
|
||||
} else if(status >= 500){
|
||||
} else if (status >= 500) {
|
||||
// server error
|
||||
return subtitle.currentlyServiceNotAvailable;
|
||||
} else {
|
||||
// no error match so return default error
|
||||
return subtitle.failedToCompleteRequest;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,67 +1,105 @@
|
||||
class URLs{
|
||||
class URLs {
|
||||
URLs._();
|
||||
|
||||
static const host2 = "http://194.163.164.213/atoms/api";
|
||||
static const host1 = "https://atoms.hmg.com/api";
|
||||
static const host1 = "https://atomsuat.hmg.com"; // uat url
|
||||
|
||||
// static const host1 = "http://109.123.243.118:9000";
|
||||
|
||||
static String _baseUrl = "$_host/mobile";
|
||||
|
||||
static String _host = host1;
|
||||
|
||||
set host(String value) => _host = value;
|
||||
|
||||
static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/Files/DownloadFile?fileName=$file");
|
||||
// static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/attachment/$file");
|
||||
|
||||
// API Routes
|
||||
static const login = "/handle/user/login"; // post
|
||||
static const register = "/handle/create/user"; // post
|
||||
static const updateProfile = "/update/user/profile"; // post
|
||||
static const getHospitals = "/handle/return/all/clients"; // get
|
||||
static const getDepartments = "/handle/return/all/departments"; // get
|
||||
static const getEquipment = "/handle/return/all/client/equipments"; // get ?client=208051
|
||||
static const getServiceRequests = "/return/user/calls"; // get
|
||||
|
||||
static const getPreventiveMaintenanceVisits = "/return/user/calibrations"; // get
|
||||
static const updatePreventiveMaintenanceVisits = "/update/user/calibrations"; // get
|
||||
|
||||
static const getRegularVisits = "/return/user/ppm"; // get
|
||||
static const updateRegularVisits = "/update/user/ppm"; // get
|
||||
|
||||
static const getSingleServiceRequest = "/return/call/information"; // get
|
||||
static const getNotifications = "/return/user/notification"; // get
|
||||
static const getRecentNotifications = "/return/user/recent/notification"; // get
|
||||
static const createRequest = "/handle/create/request"; // get
|
||||
static const createReport = "/handle/create/report/issue"; // get
|
||||
static const updateRequestDate = "/handle/update/request"; // get
|
||||
static get login => "$_baseUrl/MobileAuth/LoginIntegration"; // post
|
||||
static get register => "$_baseUrl/handle/create/user"; // post
|
||||
static get updateProfile => "$_baseUrl/update/user/profile"; // post
|
||||
static get getHospitals => "$_baseUrl/Customer/GetCustomers"; // get
|
||||
static get getHospitalsAutoComplete => "$_baseUrl/Customer/GetCustomersAutoComplete"; // get
|
||||
|
||||
static get getDepartments => "$_baseUrl/Customer/GetDepartmentLookup"; // get
|
||||
static get getEquipment => "$_baseUrl/Asset/GetAssets"; // get ?client=208051
|
||||
static get getModels => "$_baseUrl/ModelDefinition/GetModelDefinitionAsset"; // get ?client=2
|
||||
// 08051
|
||||
static get getServiceRequests => "$_baseUrl/CallRequest/GetCallRequests"; // get
|
||||
static get getServiceRequestById => "$_baseUrl/CallRequest/GetCallRequestById"; // get
|
||||
static get getServiceRequestThrough => "$_baseUrl/Lookups/GetLookup?lookupEnum=603"; // get
|
||||
static get getServiceLoanAvailability => "$_baseUrl/Lookups/GetLookup?lookupEnum=4"; // get
|
||||
static get getServiceFirstAction => "$_baseUrl/Lookups/GetLookup?lookupEnum=700"; // get
|
||||
static get getServiceRequestTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=604"; // get
|
||||
static get getServiceRequestStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=503";
|
||||
|
||||
static get getRepairLocation => "$_baseUrl/Lookups/GetLookup?lookupEnum=504";
|
||||
|
||||
static get equipmentStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=601";
|
||||
|
||||
static get getDateOperators => "$_baseUrl/Lookups/GetLookup?lookupEnum=200";
|
||||
|
||||
static get getMaintenanceSituation => "$_baseUrl/Lookups/GetLookup?lookupEnum=502";
|
||||
|
||||
static get getAllUsers => "http://109.123.243.118:5000/api/Account/GetAllUsers";
|
||||
|
||||
static get getPreventiveMaintenanceVisits => "$_baseUrl/return/user/calibrations"; // get
|
||||
static get updatePreventiveMaintenanceVisits => "$_baseUrl/Visit/UpdateVisits"; // get
|
||||
|
||||
static get getRegularVisits => "$_baseUrl/Visit/GetVisits"; // get
|
||||
static get updateRegularVisits => "$_baseUrl/Visit/UpdateVisits"; // get
|
||||
|
||||
static get getSingleServiceRequest => "$_baseUrl/return/call/information"; // get
|
||||
static get getNotifications => "$_baseUrl/return/user/notification"; // get
|
||||
static get getRecentNotifications => "$_baseUrl/return/user/recent/notification"; // get
|
||||
static get createRequest => "$_baseUrl/CallRequest/AddCallRequest"; // get
|
||||
static get createReport => "$_baseUrl/handle/create/report/issue"; // get
|
||||
static get updateRequestDate => "$_baseUrl/CallRequest/UpdateCallRequest"; // get
|
||||
|
||||
// service report
|
||||
static const createServiceReport = "/handle/create/service/report"; // get
|
||||
static const updateServiceReport = "/handle/update/service/report"; // get
|
||||
static const getServiceReport = "/handle/view/service/report"; // get
|
||||
static const createDuplicatedReport = "/handle/duplicate/request"; // get
|
||||
|
||||
static const getServiceReportReasons = "/return/service/report/reasons"; // get
|
||||
static const getServiceReportTypes = "/return/service/report/type"; // get
|
||||
static const getServiceReportStatus = "/return/service/report/status"; // get
|
||||
static const getServiceReportLastCalls = "/return/call/last/situation"; // get
|
||||
static const getServiceTypes = "/return/service/type"; // get
|
||||
static const getPartNumber = "/handle/return/all/parts"; // get
|
||||
static const getServiceReportPriority = "/return/call/priority/list"; // get
|
||||
static const getServiceReportDefectTypes = "/return/call/defect/type/list"; // get
|
||||
static get createServiceReport => "$_baseUrl/WorkOrder/AddWorkOrder"; // get
|
||||
static get updateServiceReport => "$_baseUrl/WorkOrder/UpdateWorkOrder"; // get
|
||||
static get getServiceReport => "$_baseUrl/WorkOrder/GetWorkOrderById"; // get
|
||||
static get createDuplicatedReport => "$_baseUrl/handle/duplicate/request"; // get
|
||||
static get searchWorkOrders => "$_baseUrl/WorkOrder/SearchWorkOrders";
|
||||
|
||||
static get getServiceReportReasons => "$_baseUrl/Lookups/GetLookup?lookupEnum=522"; // get
|
||||
static get getServiceReportTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=501"; // get
|
||||
static get getServiceReportStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=521"; // get
|
||||
static get getServiceReportLastCalls => "$_baseUrl/WorkOrder/GetLookupCallLastSituationBasedOnCase"; // get
|
||||
static get getAssetTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=500"; // get
|
||||
static get getPartNumber => "$_baseUrl/PartCatalog/GetPartAutoComplete"; // get
|
||||
static get getServiceReportPriority => "$_baseUrl/Lookups/GetLookup?lookupEnum=602"; // get
|
||||
static get getServiceReportDefectTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=601"; // get
|
||||
static get getCallRequestForWorkOrder => "$_baseUrl/CallRequest/GetCallRequestForWorkOrder"; // get
|
||||
|
||||
//gas refill
|
||||
static const getGasTypes = "/return/gas/refill/types"; // get
|
||||
static const getGasCylinderSize = "/return/gas/refill/size/cylinder"; // get
|
||||
static const getGasStatus = "/return/gas/refill/status"; // get
|
||||
static const requestGasRefill = "/create/gas/refill"; // get
|
||||
static const updateGasRefill = "/update/gas/refill/"; // get
|
||||
static const getGasRefill = "/search/gas/refill"; // get
|
||||
static get getGasTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=606"; // get
|
||||
// todo check edits with backend
|
||||
static get getGasCylinderSize => "$_baseUrl/Lookups/GetLookup?lookupEnum=608"; // get
|
||||
static get getGasCylinderType => "$_baseUrl/Lookups/GetLookup?lookupEnum=607"; // get
|
||||
static get getGasStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=609"; // get
|
||||
static get requestGasRefill => "$_baseUrl/GazRefill/AddGazRefill"; // get
|
||||
static get updateGasRefill => "$_baseUrl/GazRefill/UpdateGazRefill"; // get
|
||||
static get getGasRefill => "$_baseUrl/GazRefill/GetGazRefills"; // get
|
||||
|
||||
//device transfer
|
||||
static const requestDeviceTransfer = "/create/transfer/asset"; // get
|
||||
static const updateDeviceTransfer = "/update/transfer/asset"; // get
|
||||
static const getDeviceTransfer = "/search/transfer/asset"; // get
|
||||
static get requestDeviceTransfer => "$_baseUrl/AssetTransfer/AddAssetTransfer"; // get
|
||||
static get updateDeviceTransfer => "$_baseUrl/AssetTransfer/UpdateAssetTransfer"; // get
|
||||
static get getDeviceTransfer => "$_baseUrl/AssetTransfer/GetAssetTransfers"; // get
|
||||
static get getAssetTransferById => "$_baseUrl/AssetTransfer/GetAssetTransferById"; // get
|
||||
|
||||
// employee
|
||||
static const getEmployees = "/return/assigned/employee"; // get
|
||||
static get getEmployees => "$_baseUrl/Lookups/GetLookup?lookupEnum=33"; // get
|
||||
static get getEngineers => "$_baseUrl/Account/GetUserByRoleValue?value=R-6"; // get
|
||||
|
||||
// pentry
|
||||
static const getPentry = "/return/pentry/details"; // get
|
||||
static const updatePentry = "/update/pentry/details"; // get
|
||||
static const getPentryTaskStatus = "/return/pentry/task/status"; // get
|
||||
static const getPentryVisitStatus = "/return/pentry/visit/status/list"; // get
|
||||
static const getPentryStatus = "/return/pentry/status/list"; // get
|
||||
static get getPentry => "$_baseUrl/return/pentry/details"; // get
|
||||
static get updatePentry => "$_baseUrl/Visit/UpdateVisit"; // get
|
||||
static get getPentryTaskStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=403"; // get
|
||||
static get getPentryVisitStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=402"; // get
|
||||
static get getPentryStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=401"; // get
|
||||
// contacts
|
||||
static const getPentryContacts = "/handle/return/all/contacts"; // get
|
||||
|
||||
}
|
||||
static get getPentryContacts => "$_baseUrl/handle/return/all/contacts"; // get
|
||||
}
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/engineer.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class EngineersProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_items = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Engineer> _items;
|
||||
List<Engineer> get items => _items;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getEngineers,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body);
|
||||
_items = categoriesListJson.map((type) => Engineer.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class GasCylinderTypesProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_items = null;
|
||||
_loading = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _items;
|
||||
List<Lookup> get items => _items;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({
|
||||
String host,
|
||||
User user,
|
||||
}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getGasCylinderType,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_items = categoriesListJson.map((item) => Lookup.fromJson(item)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/service_request/search_work_order.dart';
|
||||
|
||||
class ServiceReportAssistantsEmployeeProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_assistantEmployees = null;
|
||||
_loading = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<AssistantEmployees> _assistantEmployees;
|
||||
List<AssistantEmployees> get assistantEmployees => _assistantEmployees;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getAssistantEmployees() async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
"${URLs.getEngineers}",
|
||||
);
|
||||
// response = await get(
|
||||
// Uri.parse(
|
||||
// URLs.getServiceReportLastCalls
|
||||
// +(serviceStatus == null ? "" : "?service_status=$serviceStatus")
|
||||
// ),
|
||||
// );
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List usersListJson = json.decode(response.body);
|
||||
_assistantEmployees = [];
|
||||
_assistantEmployees = usersListJson.map((type) => AssistantEmployees.fromJson(type ?? {})).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceReportEquipmentStatusProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_status = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _status;
|
||||
|
||||
List<Lookup> get statuses => _status;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
|
||||
bool get isLoading => _loading;
|
||||
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getTypes({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(URLs.equipmentStatus);
|
||||
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_status = categoriesListJson.map((type) => Lookup.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
import '../../../../../models/fault_description.dart';
|
||||
|
||||
class ServiceRequestFaultDescriptionProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_items = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<FaultDescription> _items;
|
||||
List<FaultDescription> get items => _items;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getCallRequestForWorkOrder({String host, User user, String requestId}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getCallRequestForWorkOrder + "?callId=$requestId",
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List listJson = json.decode(response.body)["data"]['asset']['modelDefinition']['modelDefRelatedDefects'];
|
||||
_items = listJson?.map((type) => FaultDescription.fromJson(type))?.toList() ?? [];
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class ServiceReportMaintenanceSituationProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_calls = null;
|
||||
_loading = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _calls;
|
||||
List<Lookup> get operators => _calls;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getOperators(String woId) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
woId == null ? "${URLs.getMaintenanceSituation}" : "${URLs.getServiceReportLastCalls}?parentWOId=$woId&isAdd=true&id=${0}&typeTransaction='Nothing'",
|
||||
);
|
||||
// response = await get(
|
||||
// Uri.parse(
|
||||
// URLs.getServiceReportLastCalls
|
||||
// +(serviceStatus == null ? "" : "?service_status=$serviceStatus")
|
||||
// ),
|
||||
// );
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_calls = categoriesListJson.map((type) => Lookup.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceReportRepairLocationProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_reasons = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _reasons;
|
||||
List<Lookup> get reasons => _reasons;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getTypes({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getRepairLocation,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_reasons = categoriesListJson.map((type) => Lookup.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/engineer.dart';
|
||||
|
||||
class ServiceReportUsersProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_engineers = null;
|
||||
_loading = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Engineer> _engineers;
|
||||
List<Engineer> get engineers => _engineers;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getAllUsers() async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
"${URLs.getAllUsers}",
|
||||
);
|
||||
// response = await get(
|
||||
// Uri.parse(
|
||||
// URLs.getServiceReportLastCalls
|
||||
// +(serviceStatus == null ? "" : "?service_status=$serviceStatus")
|
||||
// ),
|
||||
// );
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List usersListJson = json.decode(response.body);
|
||||
_engineers = usersListJson.map((type) => Engineer.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class ServiceReportVisitOperatorProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_calls = null;
|
||||
_loading = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _calls;
|
||||
List<Lookup> get operators => _calls;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getOperators() async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
"${URLs.getDateOperators}",
|
||||
);
|
||||
// response = await get(
|
||||
// Uri.parse(
|
||||
// URLs.getServiceReportLastCalls
|
||||
// +(serviceStatus == null ? "" : "?service_status=$serviceStatus")
|
||||
// ),
|
||||
// );
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_calls = categoriesListJson.map((type) => Lookup.fromJson(type)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceFirstActionProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_statuses = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _statuses;
|
||||
List<Lookup> get items => _statuses;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getServiceFirstAction,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_statuses = categoriesListJson.map((e) => Lookup.fromJson(e)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceLoanAvailabilityProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_statuses = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _statuses;
|
||||
List<Lookup> get items => _statuses;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getServiceLoanAvailability,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_statuses = categoriesListJson.map((e) => Lookup.fromJson(e)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceRequestStatusProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_statuses = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _statuses;
|
||||
List<Lookup> get items => _statuses;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getServiceRequestStatus,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_statuses = categoriesListJson.map((e) => Lookup.fromJson(e)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceRequestedThroughProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_statuses = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _statuses;
|
||||
List<Lookup> get items => _statuses;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getServiceRequestThrough,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_statuses = categoriesListJson.map((e) => Lookup.fromJson(e)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Lookup getDefaultItem() {
|
||||
return items?.firstWhere((element) => element.name.toLowerCase().contains("app"));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/user.dart';
|
||||
|
||||
class ServiceRequestTypeProvider extends ChangeNotifier {
|
||||
//reset provider data
|
||||
void reset() {
|
||||
_statuses = null;
|
||||
_stateCode = null;
|
||||
}
|
||||
|
||||
// state code of current request to defied error message
|
||||
// like 400 customer request failed
|
||||
// 500 service not available
|
||||
int _stateCode;
|
||||
int get stateCode => _stateCode;
|
||||
|
||||
// contain user data
|
||||
// when user not login or register _user = null
|
||||
List<Lookup> _statuses;
|
||||
List<Lookup> get items => _statuses;
|
||||
|
||||
// when categories in-process _loading = true
|
||||
// done _loading = true
|
||||
// failed _loading = false
|
||||
bool _loading;
|
||||
bool get isLoading => _loading;
|
||||
set isLoading(bool isLoading) {
|
||||
_loading = isLoading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// return -2 if request in progress
|
||||
/// return -1 if error happen when sending request
|
||||
/// return state code if request complete may be 200, 404 or 403
|
||||
/// for more details check http state manager
|
||||
/// lib\controllers\http_status_manger\http_status_manger.dart
|
||||
Future<int> getData({String host, User user}) async {
|
||||
if (_loading == true) return -2;
|
||||
_loading = true;
|
||||
notifyListeners();
|
||||
Response response;
|
||||
try {
|
||||
response = await ApiManager.instance.get(
|
||||
URLs.getServiceRequestTypes,
|
||||
);
|
||||
_stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
_statuses = categoriesListJson.map((e) => Lookup.fromJson(e)).toList();
|
||||
}
|
||||
_loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
_loading = false;
|
||||
_stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Lookup getDefaultItem() {
|
||||
return items?.firstWhere((element) => element.name.toLowerCase().contains("maintenance"));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,542 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class CallRequestForWorkOrder {
|
||||
int id;
|
||||
String callNo;
|
||||
Asset asset;
|
||||
AssignedEmployee assignedEmployee;
|
||||
List<CallSiteContactPerson> callSiteContactPerson;
|
||||
Status status;
|
||||
Status callLastSituation;
|
||||
Status defectType;
|
||||
Status firstAction;
|
||||
int assetType;
|
||||
|
||||
CallRequestForWorkOrder(
|
||||
{this.id, this.callNo, this.asset, this.assignedEmployee, this.callSiteContactPerson, this.status, this.callLastSituation, this.defectType, this.firstAction, this.assetType});
|
||||
|
||||
CallRequestForWorkOrder.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
callNo = json['callNo'];
|
||||
asset = json['asset'] != null ? new Asset.fromJson(json['asset']) : null;
|
||||
assignedEmployee = json['assignedEmployee'] != null ? new AssignedEmployee.fromJson(json['assignedEmployee']) : null;
|
||||
if (json['callSiteContactPerson'] != null) {
|
||||
callSiteContactPerson = <CallSiteContactPerson>[];
|
||||
json['callSiteContactPerson'].forEach((v) {
|
||||
callSiteContactPerson.add(new CallSiteContactPerson.fromJson(v));
|
||||
});
|
||||
}
|
||||
status = json['status'] != null ? new Status.fromJson(json['status']) : null;
|
||||
callLastSituation = json['callLastSituation'] != null ? new Status.fromJson(json['callLastSituation']) : null;
|
||||
defectType = json['defectType'] != null ? new Status.fromJson(json['defectType']) : null;
|
||||
firstAction = json['firstAction'] != null ? new Status.fromJson(json['firstAction']) : null;
|
||||
assetType = json['assetType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['callNo'] = this.callNo;
|
||||
if (this.asset != null) {
|
||||
data['asset'] = this.asset.toJson();
|
||||
}
|
||||
if (this.assignedEmployee != null) {
|
||||
data['assignedEmployee'] = this.assignedEmployee.toJson();
|
||||
}
|
||||
if (this.callSiteContactPerson != null) {
|
||||
data['callSiteContactPerson'] = this.callSiteContactPerson.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.status != null) {
|
||||
data['status'] = this.status.toJson();
|
||||
}
|
||||
if (this.callLastSituation != null) {
|
||||
data['callLastSituation'] = this.callLastSituation.toJson();
|
||||
}
|
||||
if (this.defectType != null) {
|
||||
data['defectType'] = this.defectType.toJson();
|
||||
}
|
||||
if (this.firstAction != null) {
|
||||
data['firstAction'] = this.firstAction.toJson();
|
||||
}
|
||||
data['assetType'] = this.assetType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Asset {
|
||||
int id;
|
||||
String assetSerialNo;
|
||||
String systemID;
|
||||
String assetNumber;
|
||||
ModelDefinition modelDefinition;
|
||||
String supplier;
|
||||
String ipAddress;
|
||||
String macAddress;
|
||||
String portNumber;
|
||||
Lookup assetReplace;
|
||||
String oldAsset;
|
||||
Lookup isParent;
|
||||
String parentAsset;
|
||||
Lookup assetType;
|
||||
Site site;
|
||||
Building building;
|
||||
String floor;
|
||||
Department department;
|
||||
String room;
|
||||
String testsDay;
|
||||
num purchasingPrice;
|
||||
String nbv;
|
||||
String currency;
|
||||
String poNo;
|
||||
String invoiceNumber;
|
||||
String invoiceDate;
|
||||
String replacementDate;
|
||||
Department originDepartment;
|
||||
Site originSite;
|
||||
String budgetYear;
|
||||
String lastPOPrice;
|
||||
String commissioningStatus;
|
||||
String productionDate;
|
||||
String edd;
|
||||
String technicalInspectionDate;
|
||||
String deliveryInspectionDate;
|
||||
String endUserAcceptanceDate;
|
||||
String receivingCommittee;
|
||||
String siteWarrantyMonths;
|
||||
String extendedWarrantyMonths;
|
||||
String remainderWarrantyMonths;
|
||||
String eomWarrantyMonthsNo;
|
||||
String warrantyValue;
|
||||
String warrantyEndDate;
|
||||
String warrantyContractConditions;
|
||||
List technicalGuidanceBooks;
|
||||
String comment;
|
||||
String tagCode;
|
||||
|
||||
Asset(
|
||||
{this.id,
|
||||
this.assetSerialNo,
|
||||
this.systemID,
|
||||
this.assetNumber,
|
||||
this.modelDefinition,
|
||||
this.supplier,
|
||||
this.ipAddress,
|
||||
this.macAddress,
|
||||
this.portNumber,
|
||||
this.assetReplace,
|
||||
this.oldAsset,
|
||||
this.isParent,
|
||||
this.parentAsset,
|
||||
this.assetType,
|
||||
this.site,
|
||||
this.building,
|
||||
this.floor,
|
||||
this.department,
|
||||
this.room,
|
||||
this.testsDay,
|
||||
this.purchasingPrice,
|
||||
this.nbv,
|
||||
this.currency,
|
||||
this.poNo,
|
||||
this.invoiceNumber,
|
||||
this.invoiceDate,
|
||||
this.replacementDate,
|
||||
this.originDepartment,
|
||||
this.originSite,
|
||||
this.budgetYear,
|
||||
this.lastPOPrice,
|
||||
this.commissioningStatus,
|
||||
this.productionDate,
|
||||
this.edd,
|
||||
this.technicalInspectionDate,
|
||||
this.deliveryInspectionDate,
|
||||
this.endUserAcceptanceDate,
|
||||
this.receivingCommittee,
|
||||
this.siteWarrantyMonths,
|
||||
this.extendedWarrantyMonths,
|
||||
this.remainderWarrantyMonths,
|
||||
this.eomWarrantyMonthsNo,
|
||||
this.warrantyValue,
|
||||
this.warrantyEndDate,
|
||||
this.warrantyContractConditions,
|
||||
this.technicalGuidanceBooks,
|
||||
this.comment,
|
||||
this.tagCode});
|
||||
|
||||
Asset.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
assetSerialNo = json['assetSerialNo'];
|
||||
systemID = json['systemID'];
|
||||
assetNumber = json['assetNumber'];
|
||||
modelDefinition = json['modelDefinition'] != null ? new ModelDefinition.fromJson(json['modelDefinition']) : null;
|
||||
supplier = json['supplier'];
|
||||
ipAddress = json['ipAddress'];
|
||||
macAddress = json['macAddress'];
|
||||
portNumber = json['portNumber'];
|
||||
assetReplace = json['assetReplace'] != null ? Lookup.fromJson(json['assetReplace']) : null;
|
||||
oldAsset = json['oldAsset'];
|
||||
isParent = json['isParent'] != null ? Lookup.fromJson(json['isParent']) : null;
|
||||
parentAsset = json['parentAsset'];
|
||||
assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
|
||||
site = json['site'] != null ? new Site.fromJson(json['site']) : null;
|
||||
building = json['building'];
|
||||
floor = json['floor'];
|
||||
department = json['department'] != null ? new Department.fromJson(json['department']) : null;
|
||||
room = json['room'];
|
||||
testsDay = json['testsDay'];
|
||||
purchasingPrice = json['purchasingPrice'];
|
||||
nbv = json['nbv'];
|
||||
currency = json['currency'];
|
||||
poNo = json['poNo'];
|
||||
invoiceNumber = json['invoiceNumber'];
|
||||
invoiceDate = json['invoiceDate'];
|
||||
replacementDate = json['replacementDate'];
|
||||
originDepartment = json['originDepartment'] != null ? new Department.fromJson(json['originDepartment']) : null;
|
||||
originSite = json['originSite'] != null ? new Site.fromJson(json['originSite']) : null;
|
||||
budgetYear = json['budgetYear'];
|
||||
lastPOPrice = json['lastPOPrice'];
|
||||
commissioningStatus = json['commissioningStatus'];
|
||||
productionDate = json['productionDate'];
|
||||
edd = json['edd'];
|
||||
technicalInspectionDate = json['technicalInspectionDate'];
|
||||
deliveryInspectionDate = json['deliveryInspectionDate'];
|
||||
endUserAcceptanceDate = json['endUserAcceptanceDate'];
|
||||
receivingCommittee = json['receivingCommittee'];
|
||||
siteWarrantyMonths = json['siteWarrantyMonths'];
|
||||
extendedWarrantyMonths = json['extendedWarrantyMonths'];
|
||||
remainderWarrantyMonths = json['remainderWarrantyMonths'];
|
||||
eomWarrantyMonthsNo = json['eomWarrantyMonthsNo'];
|
||||
warrantyValue = json['warrantyValue'];
|
||||
warrantyEndDate = json['warrantyEndDate'];
|
||||
warrantyContractConditions = json['warrantyContractConditions'];
|
||||
if (json['technicalGuidanceBooks'] != null) {
|
||||
technicalGuidanceBooks = [];
|
||||
json['technicalGuidanceBooks'].forEach((v) {
|
||||
//technicalGuidanceBooks.add(new Null.fromJson(v));
|
||||
});
|
||||
}
|
||||
comment = json['comment'];
|
||||
tagCode = json['tagCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['assetSerialNo'] = this.assetSerialNo;
|
||||
data['systemID'] = this.systemID;
|
||||
data['assetNumber'] = this.assetNumber;
|
||||
if (this.modelDefinition != null) {
|
||||
data['modelDefinition'] = this.modelDefinition.toJson();
|
||||
}
|
||||
data['supplier'] = this.supplier;
|
||||
data['ipAddress'] = this.ipAddress;
|
||||
data['macAddress'] = this.macAddress;
|
||||
data['portNumber'] = this.portNumber;
|
||||
data['assetReplace'] = this.assetReplace;
|
||||
data['oldAsset'] = this.oldAsset;
|
||||
data['isParent'] = this.isParent;
|
||||
data['parentAsset'] = this.parentAsset;
|
||||
data['assetType'] = this.assetType;
|
||||
if (this.site != null) {
|
||||
data['site'] = this.site.toJson();
|
||||
}
|
||||
data['building'] = this.building;
|
||||
data['floor'] = this.floor;
|
||||
if (this.department != null) {
|
||||
data['department'] = this.department.toJson();
|
||||
}
|
||||
data['room'] = this.room;
|
||||
data['testsDay'] = this.testsDay;
|
||||
data['purchasingPrice'] = this.purchasingPrice;
|
||||
data['nbv'] = this.nbv;
|
||||
data['currency'] = this.currency;
|
||||
data['poNo'] = this.poNo;
|
||||
data['invoiceNumber'] = this.invoiceNumber;
|
||||
data['invoiceDate'] = this.invoiceDate;
|
||||
data['replacementDate'] = this.replacementDate;
|
||||
if (this.originDepartment != null) {
|
||||
data['originDepartment'] = this.originDepartment.toJson();
|
||||
}
|
||||
if (this.originSite != null) {
|
||||
data['originSite'] = this.originSite.toJson();
|
||||
}
|
||||
data['budgetYear'] = this.budgetYear;
|
||||
data['lastPOPrice'] = this.lastPOPrice;
|
||||
data['commissioningStatus'] = this.commissioningStatus;
|
||||
data['productionDate'] = this.productionDate;
|
||||
data['edd'] = this.edd;
|
||||
data['technicalInspectionDate'] = this.technicalInspectionDate;
|
||||
data['deliveryInspectionDate'] = this.deliveryInspectionDate;
|
||||
data['endUserAcceptanceDate'] = this.endUserAcceptanceDate;
|
||||
data['receivingCommittee'] = this.receivingCommittee;
|
||||
data['siteWarrantyMonths'] = this.siteWarrantyMonths;
|
||||
data['extendedWarrantyMonths'] = this.extendedWarrantyMonths;
|
||||
data['remainderWarrantyMonths'] = this.remainderWarrantyMonths;
|
||||
data['eomWarrantyMonthsNo'] = this.eomWarrantyMonthsNo;
|
||||
data['warrantyValue'] = this.warrantyValue;
|
||||
data['warrantyEndDate'] = this.warrantyEndDate;
|
||||
data['warrantyContractConditions'] = this.warrantyContractConditions;
|
||||
if (this.technicalGuidanceBooks != null) {
|
||||
data['technicalGuidanceBooks'] = this.technicalGuidanceBooks.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['comment'] = this.comment;
|
||||
data['tagCode'] = this.tagCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelDefinition {
|
||||
int id;
|
||||
String assetName;
|
||||
String modelDefCode;
|
||||
String modelName;
|
||||
int manufacturerId;
|
||||
String manufacturerName;
|
||||
String supplierName;
|
||||
String replacementDate;
|
||||
int lifeSpan;
|
||||
List<ModelDefRelatedDefects> modelDefRelatedDefects;
|
||||
List suppliers;
|
||||
|
||||
ModelDefinition(
|
||||
{this.id,
|
||||
this.assetName,
|
||||
this.modelDefCode,
|
||||
this.modelName,
|
||||
this.manufacturerId,
|
||||
this.manufacturerName,
|
||||
this.supplierName,
|
||||
this.replacementDate,
|
||||
this.lifeSpan,
|
||||
this.modelDefRelatedDefects,
|
||||
this.suppliers});
|
||||
|
||||
ModelDefinition.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
assetName = json['assetName'];
|
||||
modelDefCode = json['modelDefCode'];
|
||||
modelName = json['modelName'];
|
||||
manufacturerId = json['manufacturerId'];
|
||||
manufacturerName = json['manufacturerName'];
|
||||
supplierName = json['supplierName'];
|
||||
replacementDate = json['replacementDate'];
|
||||
lifeSpan = json['lifeSpan'];
|
||||
if (json['modelDefRelatedDefects'] != null) {
|
||||
modelDefRelatedDefects = <ModelDefRelatedDefects>[];
|
||||
json['modelDefRelatedDefects'].forEach((v) {
|
||||
modelDefRelatedDefects.add(new ModelDefRelatedDefects.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['suppliers'] != null) {
|
||||
suppliers = [];
|
||||
json['suppliers'].forEach((v) {
|
||||
// suppliers!.add(new Null.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['assetName'] = this.assetName;
|
||||
data['modelDefCode'] = this.modelDefCode;
|
||||
data['modelName'] = this.modelName;
|
||||
data['manufacturerId'] = this.manufacturerId;
|
||||
data['manufacturerName'] = this.manufacturerName;
|
||||
data['supplierName'] = this.supplierName;
|
||||
data['replacementDate'] = this.replacementDate;
|
||||
data['lifeSpan'] = this.lifeSpan;
|
||||
if (this.modelDefRelatedDefects != null) {
|
||||
data['modelDefRelatedDefects'] = this.modelDefRelatedDefects.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.suppliers != null) {
|
||||
data['suppliers'] = this.suppliers.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelDefRelatedDefects {
|
||||
int id;
|
||||
String defectName;
|
||||
String workPerformed;
|
||||
String estimatedTime;
|
||||
|
||||
ModelDefRelatedDefects({this.id, this.defectName, this.workPerformed, this.estimatedTime});
|
||||
|
||||
ModelDefRelatedDefects.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
defectName = json['defectName'];
|
||||
workPerformed = json['workPerformed'];
|
||||
estimatedTime = json['estimatedTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['defectName'] = this.defectName;
|
||||
data['workPerformed'] = this.workPerformed;
|
||||
data['estimatedTime'] = this.estimatedTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Site {
|
||||
int id;
|
||||
int customerCode;
|
||||
String custName;
|
||||
List buildings;
|
||||
|
||||
Site({this.id, this.customerCode, this.custName, this.buildings});
|
||||
|
||||
Site.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
customerCode = json['customerCode'];
|
||||
custName = json['custName'];
|
||||
if (json['buildings'] != null) {
|
||||
buildings = [];
|
||||
json['buildings'].forEach((v) {
|
||||
// buildings!.add(new Null.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['customerCode'] = this.customerCode;
|
||||
data['custName'] = this.custName;
|
||||
if (this.buildings != null) {
|
||||
data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Department {
|
||||
int id;
|
||||
String departmentName;
|
||||
String departmentCode;
|
||||
String ntCode;
|
||||
|
||||
Department({this.id, this.departmentName, this.departmentCode, this.ntCode});
|
||||
|
||||
Department.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
departmentName = json['departmentName'];
|
||||
departmentCode = json['departmentCode'];
|
||||
ntCode = json['ntCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['departmentName'] = departmentName;
|
||||
data['departmentCode'] = departmentCode;
|
||||
data['ntCode'] = ntCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AssignedEmployee {
|
||||
String id;
|
||||
String name;
|
||||
|
||||
AssignedEmployee({this.id, this.name});
|
||||
|
||||
AssignedEmployee.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CallSiteContactPerson {
|
||||
int id;
|
||||
String employeeCode;
|
||||
String name;
|
||||
String telephone;
|
||||
String job;
|
||||
String email;
|
||||
String land;
|
||||
String contactUserId;
|
||||
|
||||
CallSiteContactPerson({this.id, this.employeeCode, this.name, this.telephone, this.job, this.email, this.land, this.contactUserId});
|
||||
|
||||
CallSiteContactPerson.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
employeeCode = json['employeeCode'];
|
||||
name = json['name'];
|
||||
telephone = json['telephone'];
|
||||
job = json['job'];
|
||||
email = json['email'];
|
||||
land = json['land'];
|
||||
contactUserId = json['contactUserId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['employeeCode'] = this.employeeCode;
|
||||
data['name'] = this.name;
|
||||
data['telephone'] = this.telephone;
|
||||
data['job'] = this.job;
|
||||
data['email'] = this.email;
|
||||
data['land'] = this.land;
|
||||
data['contactUserId'] = this.contactUserId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Status {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
|
||||
Status({this.id, this.name, this.value});
|
||||
|
||||
Status.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Building {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
var floor;
|
||||
|
||||
Building({this.id, this.name, this.value, this.floor});
|
||||
|
||||
Building.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
floor = json['floor'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
data['floor'] = this.floor;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
class Customer {
|
||||
List<Data> data;
|
||||
String message;
|
||||
String innerMessage;
|
||||
int responseCode;
|
||||
bool isSuccess;
|
||||
|
||||
Customer({this.data, this.message, this.innerMessage, this.responseCode, this.isSuccess});
|
||||
|
||||
Customer.fromJson(Map<String, dynamic> json) {
|
||||
if (json['data'] != null) {
|
||||
data = [];
|
||||
json['data'].forEach((v) {
|
||||
data.add(new Data.fromJson(v));
|
||||
});
|
||||
}
|
||||
message = json['message'];
|
||||
innerMessage = json['innerMessage'];
|
||||
responseCode = json['responseCode'];
|
||||
isSuccess = json['isSuccess'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['message'] = this.message;
|
||||
data['innerMessage'] = this.innerMessage;
|
||||
data['responseCode'] = this.responseCode;
|
||||
data['isSuccess'] = this.isSuccess;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
int id;
|
||||
int customerCode;
|
||||
String custName;
|
||||
List<Buildings> buildings;
|
||||
|
||||
Data({this.id, this.customerCode, this.custName, this.buildings});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
customerCode = json['customerCode'];
|
||||
custName = json['custName'];
|
||||
if (json['buildings'] != null) {
|
||||
buildings = [];
|
||||
json['buildings'].forEach((v) {
|
||||
buildings.add(new Buildings.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['customerCode'] = this.customerCode;
|
||||
data['custName'] = this.custName;
|
||||
if (this.buildings != null) {
|
||||
data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Buildings {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Floors> floors;
|
||||
|
||||
Buildings({this.id, this.name, this.value, this.floors});
|
||||
|
||||
Buildings.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['floors'] != null) {
|
||||
floors = [];
|
||||
json['floors'].forEach((v) {
|
||||
floors.add(new Floors.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.floors != null) {
|
||||
data['floors'] = this.floors.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Floors {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Departments> departments;
|
||||
|
||||
Floors({this.id, this.name, this.value, this.departments});
|
||||
|
||||
Floors.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['departments'] != null) {
|
||||
departments = [];
|
||||
json['departments'].forEach((v) {
|
||||
departments.add(new Departments.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.departments != null) {
|
||||
data['departments'] = this.departments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Departments {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
Departments({this.id, this.name});
|
||||
|
||||
Departments.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,66 +1,90 @@
|
||||
class Device{
|
||||
String id;
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
import 'model.dart';
|
||||
|
||||
class Device {
|
||||
int id;
|
||||
String serialNumber;
|
||||
String number;
|
||||
String brand;
|
||||
String model;
|
||||
DateTime productionDate;
|
||||
DateTime supplyDate;
|
||||
DateTime installDate;
|
||||
DateTime receivingDate;
|
||||
DateTime operationDate;
|
||||
DateTime warrantyDate;
|
||||
String assetName;
|
||||
String destBuildingName;
|
||||
int destBuildingId;
|
||||
String destDepartmentName;
|
||||
int destDepartmentId;
|
||||
String destRoom;
|
||||
String destFloor;
|
||||
int destFloorId;
|
||||
String destSiteName;
|
||||
|
||||
// String brand;
|
||||
// String model;
|
||||
ModelDefinition modelDefinition;
|
||||
Hospital hospital;
|
||||
|
||||
Device({
|
||||
this.id,
|
||||
this.serialNumber,
|
||||
this.number,
|
||||
this.brand,
|
||||
this.model,
|
||||
this.productionDate,
|
||||
this.supplyDate,
|
||||
this.installDate,
|
||||
this.receivingDate,
|
||||
this.operationDate,
|
||||
this.warrantyDate,
|
||||
this.assetName,
|
||||
this.hospital,
|
||||
this.destBuildingName,
|
||||
this.destDepartmentName,
|
||||
this.destRoom,
|
||||
this.destFloor,
|
||||
this.destSiteName,
|
||||
// this.brand,
|
||||
// this.model,
|
||||
this.modelDefinition,
|
||||
this.destFloorId,
|
||||
this.destDepartmentId,
|
||||
this.destBuildingId,
|
||||
});
|
||||
|
||||
factory Device.fromJson(Map<String,dynamic> parsedJson){
|
||||
factory Device.fromJson(Map<String, dynamic> parsedJson, {bool startKeyWithDest = true}) {
|
||||
print("parsedJson:$parsedJson");
|
||||
return Device(
|
||||
id: parsedJson["nid"] ?? parsedJson["id"],
|
||||
serialNumber: parsedJson["sn"] ?? parsedJson["value"],
|
||||
number: parsedJson["asset_no"],
|
||||
brand: parsedJson["brand"].toString(),
|
||||
model: parsedJson["model"].toString(),
|
||||
productionDate: getDateFromString(parsedJson["production_date"]),
|
||||
supplyDate: getDateFromString(parsedJson["supply_date "]),
|
||||
installDate: getDateFromString(parsedJson["install_date "]),
|
||||
receivingDate: getDateFromString(parsedJson["receving_date "]),
|
||||
operationDate: getDateFromString(parsedJson["operation_date "]),
|
||||
warrantyDate: getDateFromString(parsedJson["warranty_date "]),
|
||||
);
|
||||
id: parsedJson["id"],
|
||||
serialNumber: parsedJson["assetSerialNo"],
|
||||
number: parsedJson["assetNumber"],
|
||||
assetName: parsedJson["assetName"],
|
||||
modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]),
|
||||
hospital: Hospital.fromJson(parsedJson["site"]),
|
||||
destBuildingName: startKeyWithDest ? parsedJson["destBuildingName"] : parsedJson['building']['name'],
|
||||
destBuildingId: startKeyWithDest ? parsedJson["destBuildingName"] : parsedJson['building']['id'],
|
||||
destDepartmentName: startKeyWithDest ? parsedJson["destDepartmentName"] : parsedJson['department']['departmentName'],
|
||||
destDepartmentId: startKeyWithDest ? parsedJson["destDepartmentName"] : parsedJson['department']['id'],
|
||||
destRoom: startKeyWithDest ? parsedJson["destRoom"] : parsedJson['room'],
|
||||
destFloor: startKeyWithDest ? parsedJson["destFloor"] : parsedJson['floor']['name'],
|
||||
destFloorId: startKeyWithDest ? null : parsedJson['floor']['id'],
|
||||
destSiteName: parsedJson['destSiteName']
|
||||
// parsedJson["modelDefinition"] == null ? "" :
|
||||
// parsedJson["modelDefinition"]["manufacturerName"],
|
||||
// model: parsedJson["modelDefinition"] == null ? "" :
|
||||
// parsedJson["modelDefinition"]["modelName"],
|
||||
);
|
||||
}
|
||||
|
||||
factory Device.fromDevice(Device device){
|
||||
factory Device.fromDevice(Device device) {
|
||||
return Device(
|
||||
id: device.id,
|
||||
serialNumber: device.serialNumber,
|
||||
number: device.number,
|
||||
brand: device.brand,
|
||||
model: device.model,
|
||||
productionDate: device.productionDate,
|
||||
supplyDate: device.supplyDate,
|
||||
installDate: device.installDate,
|
||||
receivingDate: device.receivingDate,
|
||||
operationDate: device.operationDate,
|
||||
warrantyDate: device.warrantyDate,
|
||||
// brand: device.brand,
|
||||
// model: device.model,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DateTime getDateFromString(String unixDate){
|
||||
if(unixDate == null)
|
||||
return null;
|
||||
return DateTime.fromMillisecondsSinceEpoch(
|
||||
int.parse(unixDate));
|
||||
}
|
||||
Map<String, dynamic> toMap(Lookup assetType) {
|
||||
return {
|
||||
'id': id,
|
||||
'assetSerialNo': serialNumber,
|
||||
'assetNumber': number,
|
||||
'assetName': assetName,
|
||||
'modelDefinition': modelDefinition.toJson(),
|
||||
'site': hospital.toMap(),
|
||||
'AssetType': assetType.toMap(),
|
||||
"supplier": {"id": 0, "suppliername": "string"},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
import '../lookup.dart';
|
||||
|
||||
class DeviceTransferSearch {
|
||||
String assetName, assetNumber, site;
|
||||
bool mostRecent;
|
||||
Lookup dateOperator;
|
||||
String from, to;
|
||||
|
||||
DeviceTransferSearch({
|
||||
this.assetName,
|
||||
this.assetNumber,
|
||||
this.site,
|
||||
this.mostRecent,
|
||||
this.dateOperator,
|
||||
this.from,
|
||||
this.to,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
Map<String, dynamic> search = {};
|
||||
if (assetName != null && assetName.isNotEmpty) {
|
||||
search["assetName"] = assetName;
|
||||
}
|
||||
if (assetNumber != null && assetNumber.isNotEmpty) {
|
||||
search["assetNumber"] = assetNumber;
|
||||
}
|
||||
if (site != null && site.isNotEmpty) {
|
||||
search["site"] = site;
|
||||
}
|
||||
if (dateOperator != null && from != null) {
|
||||
search["requestedDateSymbol"] = dateOperator.toMap();
|
||||
search["requestedDateFrom"] = from;
|
||||
}
|
||||
if (dateOperator != null && to != null) {
|
||||
search["requestedDateTo"] = to;
|
||||
}
|
||||
return search;
|
||||
}
|
||||
|
||||
void fromSearch(DeviceTransferSearch newSearch) {
|
||||
assetName = newSearch.assetName;
|
||||
assetNumber = newSearch.assetNumber;
|
||||
site = newSearch.site;
|
||||
mostRecent = newSearch.mostRecent;
|
||||
from = newSearch.from;
|
||||
to = newSearch.to;
|
||||
dateOperator = newSearch.dateOperator;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
class ModelDefinition {
|
||||
int id;
|
||||
String assetName;
|
||||
String modelDefCode;
|
||||
String modelName;
|
||||
String manufacturerName;
|
||||
String supplierName;
|
||||
String replacementDate;
|
||||
int lifeSpan;
|
||||
|
||||
ModelDefinition({
|
||||
this.id,
|
||||
this.assetName,
|
||||
this.modelDefCode,
|
||||
this.modelName,
|
||||
this.manufacturerName,
|
||||
this.supplierName,
|
||||
this.replacementDate,
|
||||
this.lifeSpan,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['assetName'] = assetName;
|
||||
data['modelDefCode'] = modelDefCode;
|
||||
data['modelName'] = modelName;
|
||||
data['manufacturerName'] = manufacturerName;
|
||||
data['supplierName'] = supplierName;
|
||||
data['replacementDate'] = replacementDate;
|
||||
data['lifeSpan'] = lifeSpan;
|
||||
return data;
|
||||
}
|
||||
|
||||
factory ModelDefinition.fromJson(Map<String, dynamic> map) {
|
||||
if (map == null) return null;
|
||||
return ModelDefinition(
|
||||
id: map['id'] as int,
|
||||
assetName: map['assetName'] as String,
|
||||
modelDefCode: map['modelDefCode'] as String,
|
||||
modelName: map['modelName'] as String,
|
||||
manufacturerName: map['manufacturerName'] as String,
|
||||
supplierName: map['supplierName'] as String,
|
||||
replacementDate: map['replacementDate'] as String,
|
||||
lifeSpan: map['lifeSpan'] as int,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
class Engineer {
|
||||
String id;
|
||||
String name;
|
||||
|
||||
Engineer({
|
||||
this.id,
|
||||
this.name,
|
||||
});
|
||||
|
||||
factory Engineer.fromJson(Map<String, dynamic> parsedJson) {
|
||||
if (parsedJson == null) return Engineer();
|
||||
return Engineer(
|
||||
id: parsedJson["userId"] ?? parsedJson["id"],
|
||||
name: parsedJson["userName"] ?? parsedJson["name"],
|
||||
);
|
||||
}
|
||||
factory Engineer.fromEngineer(Engineer department) {
|
||||
return Engineer(
|
||||
id: department?.id,
|
||||
name: department?.name,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is Engineer && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
enum UsersTypes{
|
||||
enum UsersTypes {
|
||||
engineer, // 0
|
||||
normal_user, // 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
class FaultDescription {
|
||||
FaultDescription({
|
||||
this.id,
|
||||
this.defectName,
|
||||
this.workPerformed,
|
||||
this.estimatedTime,
|
||||
});
|
||||
|
||||
FaultDescription.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
defectName = json['defectName'];
|
||||
workPerformed = json['workPerformed'];
|
||||
estimatedTime = json['estimatedTime'];
|
||||
}
|
||||
num id;
|
||||
String defectName;
|
||||
String workPerformed;
|
||||
String estimatedTime;
|
||||
FaultDescription copyWith({
|
||||
num id,
|
||||
String defectName,
|
||||
String workPerformed,
|
||||
String estimatedTime,
|
||||
}) =>
|
||||
FaultDescription(
|
||||
id: id ?? this.id,
|
||||
defectName: defectName ?? this.defectName,
|
||||
workPerformed: workPerformed ?? this.workPerformed,
|
||||
estimatedTime: estimatedTime ?? this.estimatedTime,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['defectName'] = defectName;
|
||||
map['workPerformed'] = workPerformed;
|
||||
map['estimatedTime'] = estimatedTime;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,149 @@
|
||||
class Hospital{
|
||||
String id;
|
||||
class Hospital {
|
||||
int id;
|
||||
int customerCode;
|
||||
String name;
|
||||
List<Buildings> buildings;
|
||||
|
||||
Hospital({
|
||||
this.id,
|
||||
this.customerCode,
|
||||
this.name,
|
||||
this.buildings,
|
||||
});
|
||||
|
||||
factory Hospital.fromJson(Map<String,dynamic> parsedJson){
|
||||
return Hospital(
|
||||
id: parsedJson["nid"] ?? parsedJson["id"],
|
||||
name: parsedJson["client_name"] ?? parsedJson["value"],
|
||||
);
|
||||
factory Hospital.fromJson(Map<String, dynamic> parsedJson) {
|
||||
List<Buildings> buildings = [];
|
||||
|
||||
if (parsedJson['buildings'] != null) {
|
||||
buildings = [];
|
||||
parsedJson['buildings'].forEach((v) {
|
||||
buildings.add(Buildings.fromJson(v));
|
||||
});
|
||||
}
|
||||
|
||||
return Hospital(id: parsedJson["id"], name: parsedJson["custName"], customerCode: parsedJson["customerCode"], buildings: buildings);
|
||||
}
|
||||
|
||||
factory Hospital.fromHospital(Hospital hospital) {
|
||||
return Hospital(id: hospital?.id, name: hospital?.name, customerCode: hospital?.customerCode, buildings: hospital?.buildings);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {'id': id, 'customerCode': customerCode, 'custName': name, "buildings": buildings};
|
||||
}
|
||||
}
|
||||
|
||||
// class Data {
|
||||
// int id;
|
||||
// int customerCode;
|
||||
// String custName;
|
||||
// List<Buildings> buildings;
|
||||
//
|
||||
// Data({this.id, this.customerCode, this.custName, this.buildings});
|
||||
//
|
||||
// Data.fromJson(Map<String, dynamic> json) {
|
||||
// id = json['id'];
|
||||
// customerCode = json['customerCode'];
|
||||
// custName = json['custName'];
|
||||
// if (json['buildings'] != null) {
|
||||
// buildings = new List<Buildings>();
|
||||
// json['buildings'].forEach((v) {
|
||||
// buildings.add(new Buildings.fromJson(v));
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
// data['id'] = this.id;
|
||||
// data['customerCode'] = this.customerCode;
|
||||
// data['custName'] = this.custName;
|
||||
// if (this.buildings != null) {
|
||||
// data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
|
||||
// }
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
|
||||
class Buildings {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Floors> floors;
|
||||
|
||||
Buildings({this.id, this.name, this.value, this.floors});
|
||||
|
||||
Buildings.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['floors'] != null) {
|
||||
floors = [];
|
||||
json['floors'].forEach((v) {
|
||||
floors.add(Floors.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson({bool includeFloors = true}) {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['name'] = name;
|
||||
data['value'] = value;
|
||||
if (floors != null && includeFloors) {
|
||||
data['floors'] = floors.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Floors {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Departments> departments;
|
||||
|
||||
Floors({this.id, this.name, this.value, this.departments});
|
||||
|
||||
Floors.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['departments'] != null) {
|
||||
departments = [];
|
||||
json['departments'].forEach((v) {
|
||||
departments.add(Departments.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson({bool includeDepartments = true}) {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['name'] = name;
|
||||
data['value'] = value;
|
||||
if (departments != null && includeDepartments) {
|
||||
data['departments'] = departments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Departments {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
Departments({this.id, this.name});
|
||||
|
||||
Departments.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
factory Hospital.fromHospital(Hospital hospital){
|
||||
return Hospital(
|
||||
id: hospital?.id,
|
||||
name: hospital?.name,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['name'] = name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,47 +1,58 @@
|
||||
class Lookup{
|
||||
|
||||
final String label;
|
||||
final String key;
|
||||
class Lookup {
|
||||
//old name label
|
||||
final String name;
|
||||
// old name key
|
||||
final int value;
|
||||
final int id;
|
||||
|
||||
const Lookup({
|
||||
this.label,
|
||||
this.key,
|
||||
this.name,
|
||||
this.value,
|
||||
this.id,
|
||||
});
|
||||
|
||||
@override
|
||||
bool operator == (Object other) =>
|
||||
identical(this, other) || other is Lookup &&
|
||||
key == other.key &&
|
||||
id == other.id;
|
||||
|
||||
bool operator ==(Object other) => identical(this, other) || other is Lookup && ((value != null && value == other.value) || (id != null && id == other.id));
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
int get hashCode => id?.hashCode ?? value?.hashCode;
|
||||
|
||||
factory Lookup.fromStatus(Lookup old){
|
||||
return Lookup(
|
||||
label: old.label,
|
||||
id: old.id,
|
||||
key: old.key,
|
||||
);
|
||||
toMap() {
|
||||
return {"id": id, "name": name, "value": value};
|
||||
}
|
||||
|
||||
factory Lookup.fromJson(Map<String,dynamic> parsedJson){
|
||||
if(parsedJson["id"] == null && parsedJson["uid"] == null) return null;
|
||||
factory Lookup.fromStatus(Lookup old) {
|
||||
if (old == null) return null;
|
||||
return Lookup(
|
||||
label: parsedJson["value"],
|
||||
id: parsedJson["id"] is int
|
||||
? parsedJson["id"]
|
||||
: int.tryParse(parsedJson["id"] ?? parsedJson["uid"]),
|
||||
name: old.name,
|
||||
id: old.id,
|
||||
value: old.value,
|
||||
);
|
||||
}
|
||||
|
||||
factory Lookup.fromIntIdJson(Map<String,dynamic> parsedJson){
|
||||
factory Lookup.fromJson(Map<String, dynamic> parsedJson) {
|
||||
if (parsedJson == null) return null;
|
||||
return Lookup(
|
||||
label: parsedJson["value"],
|
||||
name: parsedJson["name"],
|
||||
id: parsedJson["id"],
|
||||
value: parsedJson["value"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// factory Lookup.fromJson(Map<String,dynamic> parsedJson){
|
||||
// if(parsedJson["id"] == null && parsedJson["uid"] == null) return null;
|
||||
// return Lookup(
|
||||
// name: parsedJson["value"],
|
||||
// id: parsedJson["id"] is int
|
||||
// ? parsedJson["id"]
|
||||
// : int.tryParse(parsedJson["id"] ?? parsedJson["uid"]),
|
||||
// );
|
||||
// }
|
||||
|
||||
// factory Lookup.fromIntIdJson(Map<String,dynamic> parsedJson){
|
||||
// return Lookup(
|
||||
// name: parsedJson["value"],
|
||||
// id: parsedJson["id"],
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -1,26 +1,40 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class CalibrationTool{
|
||||
class CalibrationTool {
|
||||
int id;
|
||||
Lookup assetsNumber;
|
||||
DateTime dataOfTesting;
|
||||
|
||||
CalibrationTool({
|
||||
this.id,
|
||||
this.assetsNumber,
|
||||
this.dataOfTesting,
|
||||
});
|
||||
|
||||
Map<String, String> toMap() {
|
||||
Map<String, dynamic> toMap(int visitId) {
|
||||
return {
|
||||
if(assetsNumber != null) 'assetsSN': (assetsNumber?.id).toString(),
|
||||
if(dataOfTesting != null) 'dataOfTesting': (dataOfTesting.millisecondsSinceEpoch ~/ 1000).toString(),
|
||||
"id": id ?? 0,
|
||||
"visitId": visitId,
|
||||
if (assetsNumber != null) 'assetId': (assetsNumber?.id).toString(),
|
||||
if (dataOfTesting != null) 'calibrationDateOfTesters': dataOfTesting.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
factory CalibrationTool.fromMap(Map<String, dynamic> map) {
|
||||
return CalibrationTool(
|
||||
assetsNumber: Lookup.fromJson(map['assetsSN']),
|
||||
dataOfTesting: map['dataOfTesting'] == null || map['dataOfTesting'] == "" ? null :
|
||||
DateTime.fromMillisecondsSinceEpoch(int.tryParse(map['dataOfTesting']) * 1000),
|
||||
assetsNumber: Lookup(id: map["assetId"], name: map['assetSerialNo']),
|
||||
dataOfTesting: DateTime.tryParse(map['calibrationDateOfTesters'] ?? ""),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CalibrationTool copyWith({
|
||||
Lookup assetsNumber,
|
||||
DateTime dataOfTesting,
|
||||
}) {
|
||||
return CalibrationTool(
|
||||
id: id,
|
||||
assetsNumber: assetsNumber ?? this.assetsNumber,
|
||||
dataOfTesting: dataOfTesting ?? this.dataOfTesting,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class ContactTitle extends Lookup {
|
||||
ContactTitle({
|
||||
int id,
|
||||
String label
|
||||
}):super(id: id,label: label);
|
||||
ContactTitle({int id, String label}) : super(id: id, name: label);
|
||||
|
||||
factory ContactTitle.fromMap(Map<String,dynamic> parsedJson){
|
||||
factory ContactTitle.fromMap(Map<String, dynamic> parsedJson) {
|
||||
return ContactTitle(
|
||||
label: parsedJson["value"],
|
||||
id: parsedJson["id"],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class ContactTitle extends Lookup {
|
||||
ContactTitle({
|
||||
int id,
|
||||
String label
|
||||
}):super(id: id,label: label);
|
||||
ContactTitle({int id, String label}) : super(id: id, name: label);
|
||||
|
||||
factory ContactTitle.fromMap(Map<String,dynamic> parsedJson){
|
||||
factory ContactTitle.fromMap(Map<String, dynamic> parsedJson) {
|
||||
return ContactTitle(
|
||||
label: parsedJson["value"],
|
||||
id: parsedJson["id"],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,54 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class PPMCheckList{
|
||||
class PPMCheckList {
|
||||
int id;
|
||||
Lookup status;
|
||||
String title;
|
||||
String comment;
|
||||
String measuredValue;
|
||||
|
||||
PPMCheckList({
|
||||
this.id,
|
||||
this.title,
|
||||
this.status,
|
||||
this.comment,
|
||||
this.measuredValue,
|
||||
});
|
||||
|
||||
Map<String, String> toMap() {
|
||||
Map<String, dynamic> toMap(int visitId) {
|
||||
return {
|
||||
if(status != null) 'status': status?.id.toString(),
|
||||
if(title != null) 'title': title,
|
||||
if(comment != null) 'comment': comment,
|
||||
if(measuredValue != null) 'measuredValue': measuredValue,
|
||||
'id': id ?? 0,
|
||||
"visitId": visitId,
|
||||
if (status != null) 'taskStatusId': status?.id,
|
||||
if (title != null) 'task': title,
|
||||
if (comment != null) 'taskComment': comment,
|
||||
if (measuredValue != null) 'measuredValue': measuredValue,
|
||||
};
|
||||
}
|
||||
|
||||
factory PPMCheckList.fromMap(Map<String, dynamic> map) {
|
||||
return PPMCheckList(
|
||||
status: Lookup.fromJson(map['status']),
|
||||
title: map['title'] as String,
|
||||
comment: map['comment'] as String,
|
||||
id: map['id'] as int,
|
||||
status: Lookup(id: map["taskStatusId"], name: map["taskStatusName"]),
|
||||
title: map['task'] as String,
|
||||
comment: map['taskComment'] as String,
|
||||
measuredValue: map['measuredValue'] as String,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PPMCheckList copyWith({
|
||||
int id,
|
||||
Lookup status,
|
||||
String title,
|
||||
String comment,
|
||||
String measuredValue,
|
||||
}) {
|
||||
return PPMCheckList(
|
||||
id: id ?? this.id,
|
||||
status: status ?? this.status,
|
||||
title: title ?? this.title,
|
||||
comment: comment ?? this.comment,
|
||||
measuredValue: measuredValue ?? this.measuredValue,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,33 @@
|
||||
class Part{
|
||||
String id;
|
||||
class Part {
|
||||
int id;
|
||||
int reportPartID;
|
||||
String code;
|
||||
String name;
|
||||
int quantity;
|
||||
|
||||
Part({
|
||||
this.id,
|
||||
this.reportPartID,
|
||||
this.code,
|
||||
this.name,
|
||||
this.quantity = 1,
|
||||
});
|
||||
|
||||
factory Part.fromJson(Map<String,dynamic> parsedJson){
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"id": reportPartID ?? 0,
|
||||
"sparePart": {"id": id, "partNo": code, "partName": name},
|
||||
"qty": quantity
|
||||
};
|
||||
}
|
||||
|
||||
factory Part.fromJson(Map<String, dynamic> parsedJson, {Map<String, dynamic> reportJson}) {
|
||||
return Part(
|
||||
id: parsedJson["nid"] ?? parsedJson["id"],
|
||||
code: parsedJson["part_code"] ?? parsedJson["name"],
|
||||
name: parsedJson["part_name"],
|
||||
quantity: parsedJson["qty"] == null
|
||||
? 1 : int.tryParse(parsedJson["qty"].toString()) ?? 1,
|
||||
id: parsedJson["id"],
|
||||
reportPartID: reportJson != null ? reportJson["id"] : null,
|
||||
code: parsedJson["partNo"],
|
||||
name: parsedJson["partName"],
|
||||
quantity: reportJson != null ? (reportJson["qty"] ?? 1).toInt() : 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,149 +1,245 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/engineer.dart';
|
||||
import 'package:test_sa/models/fault_description.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/part.dart';
|
||||
import 'package:test_sa/models/service_request/service_request.dart';
|
||||
import 'package:test_sa/models/timer_model.dart';
|
||||
|
||||
class ServiceReport {
|
||||
String id;
|
||||
String operatingHours;
|
||||
int id;
|
||||
double operatingHours;
|
||||
DateTime visitDate;
|
||||
DateTime endDate;
|
||||
Lookup serviceType;
|
||||
DateTime returnToService;
|
||||
|
||||
// DateTime endDate;
|
||||
// DateTime startDate;
|
||||
Lookup assetType;
|
||||
Lookup callLastSituation;
|
||||
Lookup status;
|
||||
Lookup currentSituation;
|
||||
Lookup repairLocation;
|
||||
Engineer engineer;
|
||||
Lookup equipmentStatus;
|
||||
Lookup type;
|
||||
Lookup reason;
|
||||
String faultDescription;
|
||||
int faultDescriptionId;
|
||||
String workPreformed;
|
||||
//String workHours;
|
||||
String travelingHours;
|
||||
|
||||
num workingHours;
|
||||
double travelingHours;
|
||||
String invoiceNumber;
|
||||
String invoiceCode;
|
||||
List<Part> parts;
|
||||
String image;
|
||||
List<String> image;
|
||||
Device device;
|
||||
String quantity;
|
||||
String jobSheetNumber;
|
||||
TimerModel timer;
|
||||
String signatureNurse;
|
||||
String signatureEngineer;
|
||||
String comment;
|
||||
Uint8List localNurseSignature;
|
||||
Uint8List localEngineerSignature;
|
||||
num travelingExpense;
|
||||
String reviewComment;
|
||||
FaultDescription faultDescription;
|
||||
|
||||
ServiceReport({
|
||||
this.id,
|
||||
this.visitDate,
|
||||
this.endDate,
|
||||
this.serviceType,
|
||||
this.status,
|
||||
this.type,
|
||||
this.faultDescription,
|
||||
//this.workHours,
|
||||
this.travelingHours,
|
||||
this.parts,
|
||||
this.workPreformed,
|
||||
this.reason,
|
||||
this.operatingHours,
|
||||
this.callLastSituation,
|
||||
this.jobSheetNumber,
|
||||
this.image,
|
||||
this.device,
|
||||
this.invoiceCode,
|
||||
this.invoiceNumber,
|
||||
this.quantity = "1",
|
||||
this.timer,
|
||||
});
|
||||
ServiceReport(
|
||||
{this.id,
|
||||
this.visitDate,
|
||||
// this.endDate,
|
||||
this.assetType,
|
||||
this.equipmentStatus,
|
||||
this.type,
|
||||
this.faultDescriptionId,
|
||||
this.workingHours,
|
||||
this.travelingHours,
|
||||
this.parts,
|
||||
this.engineer,
|
||||
this.workPreformed,
|
||||
this.reason,
|
||||
this.operatingHours,
|
||||
this.callLastSituation,
|
||||
this.currentSituation,
|
||||
this.jobSheetNumber,
|
||||
this.image,
|
||||
this.device,
|
||||
this.invoiceCode,
|
||||
this.invoiceNumber,
|
||||
this.quantity = "1",
|
||||
this.timer,
|
||||
this.signatureNurse,
|
||||
this.signatureEngineer,
|
||||
this.localNurseSignature,
|
||||
this.localEngineerSignature,
|
||||
this.comment,
|
||||
this.repairLocation,
|
||||
this.travelingExpense,
|
||||
// this.startDate,
|
||||
this.reviewComment,
|
||||
this.faultDescription,
|
||||
this.returnToService});
|
||||
|
||||
Map<String,String> toMap(){
|
||||
Map<String,String> _map = {};
|
||||
if(id != null) _map["id"] = id;
|
||||
if(visitDate != null) _map["visit_date"] = (visitDate.millisecondsSinceEpoch ~/ 1000).toString();
|
||||
if(serviceType != null) _map["service_type"] = serviceType.id.toString();
|
||||
if(status != null) _map["status"] = status.id.toString();
|
||||
if(type != null) _map["service_report_type"] = type.id.toString();
|
||||
if(faultDescription != null && faultDescription.isNotEmpty) _map["fault_description"] = faultDescription;
|
||||
Map<String, dynamic> toMap(ServiceRequest request) {
|
||||
Map<String, dynamic> _map = {};
|
||||
if (id != null) _map["id"] = id;
|
||||
if (visitDate != null) _map["visitDate"] = visitDate.toIso8601String();
|
||||
if (returnToService != null) _map["replacementDate"] = returnToService.toIso8601String();
|
||||
|
||||
//if(serviceType != null) _map["service_type"] = serviceType.id.toString();
|
||||
if (equipmentStatus != null) _map["equipmentStatus"] = equipmentStatus?.toMap();
|
||||
if (type != null) _map["typeOfWO"] = type?.toMap();
|
||||
if (assetType != null) _map["TypeOfWO"] = assetType?.toMap();
|
||||
//if(faultDescriptionId != null && faultDescriptionId.isNotEmpty) _map["fault_description"] = faultDescriptionId;
|
||||
//if(workHours != null && workHours.isNotEmpty) _map["working_hours"] = workHours;
|
||||
if(timer != null){
|
||||
_map["start_time"] = (timer.startAt.millisecondsSinceEpoch / 1000).toStringAsFixed(0);
|
||||
_map["end_time"] = ((timer.endAt ?? DateTime.now()).millisecondsSinceEpoch / 1000).toStringAsFixed(0);
|
||||
_map["working_hours"] = (timer.durationInSecond / 60 / 60).toStringAsFixed(5);
|
||||
if (timer != null) {
|
||||
_map["startofWorkTime"] = timer.startAt.toIso8601String();
|
||||
_map["endofWorkTime"] = (timer.endAt ?? DateTime.now()).toIso8601String();
|
||||
_map["workingHours"] = (timer.durationInSecond / 60 / 60).toStringAsFixed(5);
|
||||
}
|
||||
if (travelingHours != null && travelingHours.toString().isNotEmpty) _map["travelingHours"] = travelingHours;
|
||||
// if(workPreformed != null && workPreformed.isNotEmpty){
|
||||
// _map["faultDescription"] = {
|
||||
// "id":faultDescriptionId ?? 0,
|
||||
// "workPerformed":workPreformed
|
||||
// };
|
||||
// }
|
||||
_map["faultDescription"] = faultDescription?.id == null ? null : {"id": faultDescription?.id ?? 0, "workPerformed": faultDescription?.workPerformed};
|
||||
if (travelingHours != null) _map["travelingHours"] = travelingHours;
|
||||
// if (workingHours != null) _map["workingHours"] = workingHours;
|
||||
// if (workPreformed != null && workPreformed.isNotEmpty) {
|
||||
// _map["faultDescription"] = faultDescription.toJson();
|
||||
// }
|
||||
if (jobSheetNumber != null && jobSheetNumber.isNotEmpty) _map["job_sheet_no"] = jobSheetNumber;
|
||||
if (parts != null && parts.isNotEmpty) {
|
||||
_map["sparePartsWorkOrders"] = parts.map((e) => e.toJson()).toList();
|
||||
}
|
||||
if(travelingHours != null && travelingHours.isNotEmpty) _map["traveling_hours"] = travelingHours;
|
||||
if(workPreformed != null && workPreformed.isNotEmpty) _map["work_performed"] = workPreformed;
|
||||
if(jobSheetNumber != null && jobSheetNumber.isNotEmpty) _map["job_sheet_no"] = jobSheetNumber;
|
||||
if(parts != null && parts.isNotEmpty){
|
||||
Map<String,int> _partsMap = {};
|
||||
parts.forEach((part) {
|
||||
if(part.id.isNotEmpty)
|
||||
_partsMap[part.id] = part.quantity;
|
||||
});
|
||||
_map["parts"] = json.encode(_partsMap);
|
||||
if (device != null && device.id != null) {
|
||||
_map["callRequest"] = {
|
||||
"id": request.id,
|
||||
"asset": device?.toMap(assetType),
|
||||
};
|
||||
_map["callRequest"]["asset"]["invoiceNumber"] = invoiceNumber;
|
||||
}
|
||||
if(device?.id != null && device.id != null) _map["eq_id"] = device.id;
|
||||
if(quantity != null && quantity.isNotEmpty) _map["qty"] = quantity;
|
||||
if(endDate != null) _map["end_date"] = (endDate.millisecondsSinceEpoch ~/ 1000).toString();
|
||||
if(reason != null) _map["reasons"] = reason.id.toString();
|
||||
if(operatingHours != null && operatingHours.isNotEmpty) _map["operation_hours"] = operatingHours;
|
||||
if(callLastSituation != null) _map["call_last_situtation"] = callLastSituation.id.toString();
|
||||
if(image != null) _map["image"] = image;
|
||||
if(invoiceCode != null) _map["invoice_no"] = invoiceCode;
|
||||
if(invoiceNumber != null) _map["invoice_code"] = invoiceNumber;
|
||||
_map["AssignedEmployee"] = engineer?.toMap();
|
||||
_map["repairLocation"] = repairLocation?.toMap();
|
||||
//if(quantity != null && quantity.isNotEmpty) _map["qty"] = quantity;
|
||||
//if(endDate != null) _map["end_date"] = (endDate.millisecondsSinceEpoch ~/ 1000).toString();
|
||||
if (reason != null) _map["reason"] = reason.toMap();
|
||||
//if(operatingHours != null && operatingHours.isNotEmpty) _map["operation_hours"] = operatingHours;
|
||||
if (callLastSituation != null) _map["calllastSituation"] = callLastSituation.toMap();
|
||||
if (currentSituation != null) _map["currentSituation"] = currentSituation.toMap();
|
||||
//if(image != null) _map["image"] = image;
|
||||
//if(invoiceCode != null) _map["invoice_no"] = invoiceCode;
|
||||
//if(invoiceNumber != null) _map["invoice_code"] = invoiceNumber;
|
||||
if (image != null) {
|
||||
_map["attachmentsWorkOrder"] = image.map((e) => {"name": e}).toList();
|
||||
print(_map["attachmentsWorkOrder"]);
|
||||
}
|
||||
_map["nurseSignature"] = signatureNurse;
|
||||
_map["engSignature"] = signatureEngineer;
|
||||
_map["comment"] = comment;
|
||||
_map["travelingExpenses"] = travelingExpense;
|
||||
// _map["startofWorkTime"] = startDate.toIso8601String();
|
||||
// _map["endofWorkTime"] = endDate.toIso8601String();
|
||||
// _map["workingHours"] = endDate?.difference(startDate)?.inHours ?? 0;
|
||||
if (timer?.startAt != null) _map["startofWorkTime"] = timer?.startAt?.toIso8601String();
|
||||
if (timer?.endAt != null) _map["endofWorkTime"] = timer?.endAt?.toIso8601String();
|
||||
_map["workingHours"] = workingHours;
|
||||
_map["reviewComment"] = reviewComment;
|
||||
return _map;
|
||||
}
|
||||
|
||||
bool validate(){
|
||||
if(visitDate == null) return false;
|
||||
if(serviceType == null) return false;
|
||||
if(status == null) return false;
|
||||
if(type == null) return false;
|
||||
if(callLastSituation == null) return false;
|
||||
if(callLastSituation?.id == 12){
|
||||
if(invoiceCode != null || invoiceCode?.isEmpty == true) return false;
|
||||
if(invoiceNumber != null || invoiceNumber?.isEmpty== true ) return false;
|
||||
Future<bool> validate() async {
|
||||
if (visitDate == null) {
|
||||
await Fluttertoast.showToast(msg: "Visit Date Required");
|
||||
return false;
|
||||
}
|
||||
if (returnToService == null) {
|
||||
await Fluttertoast.showToast(msg: "Return To Service Date Required");
|
||||
return false;
|
||||
}
|
||||
if (timer?.startAt == null) {
|
||||
await Fluttertoast.showToast(msg: "Working Hours Required");
|
||||
return false;
|
||||
}
|
||||
if(parts == null) return false;
|
||||
if (timer?.endAt == null) {
|
||||
await Fluttertoast.showToast(msg: "Please Stop The Timer");
|
||||
return false;
|
||||
}
|
||||
//if(serviceType == null) return false;
|
||||
if (equipmentStatus == null) return false;
|
||||
//if (type == null && assetType == null) return false;
|
||||
// if (engineer == null) return false;
|
||||
if (callLastSituation == null) return false;
|
||||
if (callLastSituation?.value == 12) {
|
||||
// if(invoiceCode != null || invoiceCode?.isEmpty == true) return false;
|
||||
if (invoiceNumber != null || invoiceNumber?.isEmpty == true) return false;
|
||||
}
|
||||
if (parts == null) return false;
|
||||
//if(endDate == null) return false;
|
||||
//if(reason == null) return false;
|
||||
if((device?.id == null || device.id.isEmpty) && type?.id != 1) return false;
|
||||
if (reason == null) return false;
|
||||
//todo uncoment this line
|
||||
//if((device?.id == null || device.id.isEmpty) && type?.id != 1) return false;
|
||||
//if(quantity == null || quantity.isEmpty) return false;
|
||||
//if(image == null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
factory ServiceReport.fromJson(Map<String,dynamic> parsedJson,String id){
|
||||
List<Part> _parts = [];
|
||||
if(parsedJson["parts"] != null){
|
||||
if(parsedJson["parts"][0]["id"] != null){
|
||||
List partsList = parsedJson["parts"];
|
||||
_parts = partsList.map((e) => Part.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
factory ServiceReport.fromJson(Map<String, dynamic> parsedJson, int id) {
|
||||
List<Part> _parts = [];
|
||||
if (parsedJson["sparePartsWorkOrders"] != null) {
|
||||
if ((parsedJson["sparePartsWorkOrders"] as List).isNotEmpty && parsedJson["sparePartsWorkOrders"][0]["id"] != null) {
|
||||
List partsList = parsedJson["sparePartsWorkOrders"];
|
||||
_parts = partsList.map((e) => Part.fromJson(e["sparePart"], reportJson: e)).toList();
|
||||
}
|
||||
}
|
||||
return ServiceReport(
|
||||
id: id,
|
||||
serviceType: Lookup.fromJson(parsedJson["service_type"]),
|
||||
callLastSituation: Lookup.fromJson(parsedJson["call_last_situtation"]),
|
||||
reason: Lookup.fromJson(parsedJson["reasons"]),
|
||||
status: Lookup.fromJson(parsedJson["service_report_status"]),
|
||||
type: Lookup.fromJson(parsedJson["service_report_type"]),
|
||||
faultDescription: parsedJson["fault_description"],
|
||||
endDate:getDate(parsedJson["end_date"]),
|
||||
invoiceCode: parsedJson["invoice_code"],
|
||||
invoiceNumber: parsedJson["invoice_no"],
|
||||
jobSheetNumber: parsedJson["job_sheet_no"],
|
||||
operatingHours: parsedJson["operation_hours"],
|
||||
assetType: Lookup.fromJson(parsedJson["assetType"]),
|
||||
callLastSituation: Lookup.fromJson(parsedJson["calllastSituation"]),
|
||||
currentSituation: Lookup.fromJson(parsedJson["currentSituation"]),
|
||||
repairLocation: Lookup.fromJson(parsedJson["repairLocation"]),
|
||||
reason: Lookup.fromJson(parsedJson["reason"]),
|
||||
equipmentStatus: Lookup.fromJson(parsedJson["equipmentStatus"]),
|
||||
type: Lookup.fromJson(parsedJson["typeOfWO"]),
|
||||
faultDescription: parsedJson['faultDescription'] != null ? FaultDescription.fromJson(parsedJson['faultDescription']) : null,
|
||||
|
||||
// faultDescription: parsedJson["faultDescription"],
|
||||
// startDate: DateTime.tryParse(parsedJson["startofWorkTime"] ?? ""),
|
||||
// endDate: DateTime.tryParse(parsedJson["endofWorkTime"] ?? ""),
|
||||
//invoiceCode: parsedJson["invoice_code"],
|
||||
//invoiceNumber: parsedJson["invoice_no"],
|
||||
//jobSheetNumber: parsedJson["job_sheet_no"],
|
||||
// workingHours: parsedJson["workingHours"],
|
||||
engineer: Engineer.fromJson(parsedJson["assignedEmployee"]),
|
||||
parts: _parts,
|
||||
quantity: parsedJson["nid"],
|
||||
travelingHours: parsedJson["traveling_hours"],
|
||||
visitDate: getDate(parsedJson["visit_date"]),
|
||||
//workHours: parsedJson["working_hours"],
|
||||
//quantity: parsedJson["nid"],
|
||||
travelingHours: parsedJson["travelingHours"],
|
||||
travelingExpense: parsedJson["travelingExpenses"],
|
||||
visitDate: DateTime.tryParse(parsedJson["visitDate"]),
|
||||
returnToService: DateTime.tryParse(parsedJson["replacementDate"] ?? ""),
|
||||
workingHours: parsedJson["workingHours"],
|
||||
timer: TimerModel(
|
||||
durationInSecond: (int.tryParse(parsedJson["working_hours"] ?? "") ?? 0) * 60 *60),
|
||||
workPreformed: parsedJson["work_performed"],
|
||||
device: parsedJson["eq_nid"] == null ? null : Device(id: parsedJson["eq_nid"],serialNumber: parsedJson["eq_serial"])
|
||||
startAt: DateTime.tryParse(parsedJson["startofWorkTime"] ?? ""),
|
||||
endAt: DateTime.tryParse(parsedJson["endofWorkTime"] ?? ""),
|
||||
durationInSecond: ((parsedJson["workingHours"] ?? 0) * 60 * 60).toInt(),
|
||||
),
|
||||
//workPreformed: parsedJson["work_performed"],
|
||||
device: Device.fromJson(parsedJson["callRequest"]["asset"]),
|
||||
signatureNurse: URLs.getFileUrl(parsedJson["nurseSignature"]),
|
||||
signatureEngineer: URLs.getFileUrl(parsedJson["engSignature"]),
|
||||
comment: parsedJson['comment'],
|
||||
reviewComment: parsedJson['reviewComment'],
|
||||
);
|
||||
}
|
||||
|
||||
static getDate(String date){
|
||||
return date == null || date.isEmpty
|
||||
? null : DateTime.fromMillisecondsSinceEpoch(int.tryParse(date) * 1000);
|
||||
}
|
||||
}
|
||||
// static getDate(String date){
|
||||
// return date == null || date.isEmpty
|
||||
// ? null : DateTime.fromMillisecondsSinceEpoch(int.tryParse(date) * 1000);
|
||||
// }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,46 +1,90 @@
|
||||
class ServiceRequestSearch{
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
import '../call_request_for_work_order_model.dart';
|
||||
|
||||
class ServiceRequestSearch {
|
||||
String callId;
|
||||
String deviceSerialNumber;
|
||||
String deviceNumber;
|
||||
String deviceName;
|
||||
String hospital;
|
||||
Hospital hospital;
|
||||
String model;
|
||||
int statusValue;
|
||||
|
||||
Lookup statusValue;
|
||||
bool mostRecent;
|
||||
String from, to;
|
||||
Lookup dateOperator;
|
||||
AssignedEmployee assignedEmployee;
|
||||
|
||||
ServiceRequestSearch({
|
||||
this.deviceSerialNumber,
|
||||
this.deviceNumber,
|
||||
this.statusValue,
|
||||
this.deviceName,
|
||||
this.model,
|
||||
this.hospital,
|
||||
this.mostRecent,
|
||||
this.callId,
|
||||
this.from,
|
||||
this.to,
|
||||
this.assignedEmployee,
|
||||
this.dateOperator,
|
||||
});
|
||||
|
||||
fromSearch(ServiceRequestSearch newSearch){
|
||||
fromSearch(ServiceRequestSearch newSearch) {
|
||||
deviceSerialNumber = newSearch.deviceSerialNumber;
|
||||
deviceNumber = newSearch.deviceNumber;
|
||||
statusValue = newSearch.statusValue;
|
||||
hospital = newSearch.hospital;
|
||||
model = newSearch.model;
|
||||
mostRecent = newSearch.mostRecent;
|
||||
callId = newSearch.callId;
|
||||
from = newSearch.from;
|
||||
to = newSearch.to;
|
||||
assignedEmployee = newSearch.assignedEmployee;
|
||||
dateOperator = newSearch.dateOperator;
|
||||
}
|
||||
|
||||
String toSearchString(){
|
||||
String _search = "";
|
||||
if(deviceSerialNumber != null && deviceSerialNumber.isNotEmpty){
|
||||
_search += "&sn_id=$deviceSerialNumber";
|
||||
Map<String, dynamic> toMap() {
|
||||
Map<String, dynamic> search = {};
|
||||
if (deviceSerialNumber != null && deviceSerialNumber.isNotEmpty) {
|
||||
search["assetSerialNumber"] = deviceSerialNumber;
|
||||
}
|
||||
|
||||
if (deviceNumber != null && deviceNumber.isNotEmpty) {
|
||||
search["assetNo"] = deviceNumber;
|
||||
}
|
||||
|
||||
if (statusValue != null) {
|
||||
search["status"] = statusValue.toMap();
|
||||
}
|
||||
|
||||
if (deviceName != null && deviceName.isNotEmpty) {
|
||||
search["assetName"] = deviceName;
|
||||
}
|
||||
|
||||
if(statusValue != null){
|
||||
_search += "&status=$statusValue";
|
||||
if (hospital != null) {
|
||||
search["site"] = hospital.name;
|
||||
}
|
||||
|
||||
if(deviceName != null && deviceName.isNotEmpty){
|
||||
_search += "&equipment_en_name=$deviceName";
|
||||
if (model != null && model.isNotEmpty) {
|
||||
search["modelDefinition"] = model;
|
||||
}
|
||||
|
||||
if(hospital != null && hospital.isNotEmpty){
|
||||
_search += "&client=$hospital";
|
||||
if (callId != null && callId.isNotEmpty) {
|
||||
search["callId"] = callId;
|
||||
}
|
||||
|
||||
if (dateOperator != null && from != null) {
|
||||
search["requestedDateSymbol"] = dateOperator.toMap();
|
||||
search["requestedDateFrom"] = from;
|
||||
}
|
||||
if (dateOperator != null && to != null) {
|
||||
search["requestedDateTo"] = to;
|
||||
}
|
||||
if(model != null && model.isNotEmpty){
|
||||
_search += "&model=$model";
|
||||
if (assignedEmployee != null) {
|
||||
search["assignedEmployee"] = assignedEmployee.toJson();
|
||||
}
|
||||
return _search;
|
||||
return search;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,111 +1,229 @@
|
||||
import 'package:test_sa/controllers/notification/firebase_notification_manger.dart';
|
||||
import 'package:test_sa/models/department.dart';
|
||||
import 'package:test_sa/models/enums/user_types.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
|
||||
class User {
|
||||
int clientId;
|
||||
String clientName;
|
||||
List<int> departmentId;
|
||||
List<String> departmentName;
|
||||
String message;
|
||||
String username;
|
||||
String userID;
|
||||
String email;
|
||||
String password;
|
||||
String token;
|
||||
dynamic roles;
|
||||
List<UserRoles> userRoles;
|
||||
String tokenlife;
|
||||
bool isAuthenticated;
|
||||
bool hasError;
|
||||
String profilePhotoName;
|
||||
String id;
|
||||
String userName;
|
||||
String password;
|
||||
String email;
|
||||
String image;
|
||||
Hospital hospital;
|
||||
Department department;
|
||||
UsersTypes type;
|
||||
String normalizedUserName;
|
||||
String normalizedEmail;
|
||||
bool emailConfirmed;
|
||||
dynamic passwordHash;
|
||||
String securityStamp;
|
||||
String concurrencyStamp;
|
||||
String phoneNumber;
|
||||
String whatsApp;
|
||||
String token;
|
||||
bool isActive;
|
||||
bool phoneNumberConfirmed;
|
||||
bool twoFactorEnabled;
|
||||
dynamic lockoutEnd;
|
||||
bool lockoutEnabled;
|
||||
int accessFailedCount;
|
||||
|
||||
User(
|
||||
{this.id,
|
||||
this.userName = "",
|
||||
this.email = "",
|
||||
this.password = "",
|
||||
this.phoneNumber = "",
|
||||
this.hospital,
|
||||
this.image,
|
||||
this.department,
|
||||
this.type,
|
||||
this.whatsApp,
|
||||
this.token,
|
||||
this.isActive = false});
|
||||
User({
|
||||
this.clientId,
|
||||
this.clientName,
|
||||
this.departmentId,
|
||||
this.departmentName,
|
||||
this.message,
|
||||
this.username,
|
||||
this.userID,
|
||||
this.email,
|
||||
this.password,
|
||||
this.token,
|
||||
this.roles,
|
||||
this.userRoles,
|
||||
this.tokenlife,
|
||||
this.isAuthenticated,
|
||||
this.hasError,
|
||||
this.profilePhotoName,
|
||||
this.id,
|
||||
this.userName,
|
||||
this.normalizedUserName,
|
||||
this.normalizedEmail,
|
||||
this.emailConfirmed,
|
||||
this.passwordHash,
|
||||
this.securityStamp,
|
||||
this.concurrencyStamp,
|
||||
this.phoneNumber,
|
||||
this.phoneNumberConfirmed,
|
||||
this.twoFactorEnabled,
|
||||
this.lockoutEnd,
|
||||
this.lockoutEnabled,
|
||||
this.accessFailedCount,
|
||||
});
|
||||
|
||||
Future<Map<String, dynamic>> toLoginJson() async {
|
||||
if (FirebaseNotificationManger.token == null) await FirebaseNotificationManger.getToken();
|
||||
return {
|
||||
"username": userName,
|
||||
"pass": password,
|
||||
"firebase_token": FirebaseNotificationManger?.token ?? "",
|
||||
"password": password,
|
||||
"fireBaseToken": FirebaseNotificationManger?.token ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
UsersTypes get type {
|
||||
switch (userRoles?.first?.name) {
|
||||
case "Engineer":
|
||||
return UsersTypes.engineer;
|
||||
case "Hospital":
|
||||
return UsersTypes.normal_user;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toUpdateProfileJson() {
|
||||
Map<String, dynamic> jsonObject = {};
|
||||
if (department?.id != null && department.id.isNotEmpty) jsonObject["department"] = department.id;
|
||||
if (whatsApp != null && whatsApp.isNotEmpty) jsonObject["whatsapp"] = whatsApp;
|
||||
if (phoneNumber != null && phoneNumber.isNotEmpty) jsonObject["phone"] = phoneNumber;
|
||||
// if (departmentId != null) jsonObject["department"] = departmentId;
|
||||
// if (whatsApp != null && whatsApp.isNotEmpty) jsonObject["whatsapp"] = whatsApp;
|
||||
// if (phoneNumber != null && phoneNumber.isNotEmpty) jsonObject["phone"] = phoneNumber;
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> toRegisterJson() async {
|
||||
if (FirebaseNotificationManger.token == null) await FirebaseNotificationManger.getToken();
|
||||
// if (FirebaseNotificationManger.token == null) await FirebaseNotificationManger.getToken();
|
||||
return {
|
||||
"username": userName,
|
||||
"email": email,
|
||||
"whatsapp": whatsApp,
|
||||
"client": hospital.id,
|
||||
"department": department?.id,
|
||||
"phone": phoneNumber,
|
||||
"pass": password,
|
||||
"firebase_token": FirebaseNotificationManger?.token ?? "",
|
||||
// "username": userName,
|
||||
// "email": email,
|
||||
// "whatsapp": whatsApp,
|
||||
// "client": hospital.id,
|
||||
// "department": department?.id,
|
||||
// "phone": phoneNumber,
|
||||
// "pass": password,
|
||||
// "firebase_token": FirebaseNotificationManger?.token ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"uid": id,
|
||||
"name": userName,
|
||||
"email": email,
|
||||
"token": token,
|
||||
"phone": phoneNumber,
|
||||
"whatsapp": whatsApp,
|
||||
"client": hospital?.id,
|
||||
"client_name": hospital?.name,
|
||||
"department": department?.id,
|
||||
"department_name": department?.name,
|
||||
"password": password,
|
||||
"picture": image,
|
||||
"active": isActive ? 1 : 0,
|
||||
"role": type == UsersTypes.engineer ? "field_engineer" : "normal_user",
|
||||
// "token":token, pass is token
|
||||
};
|
||||
final map = <String, dynamic>{};
|
||||
map['client_id'] = clientId;
|
||||
map['client_name'] = clientName;
|
||||
map['department_id'] = departmentId;
|
||||
map['department_name'] = departmentName;
|
||||
map['message'] = message;
|
||||
map['username'] = username;
|
||||
map['userID'] = userID;
|
||||
map['email'] = email;
|
||||
map['password'] = password;
|
||||
map['token'] = token;
|
||||
map['roles'] = roles;
|
||||
if (userRoles != null) {
|
||||
map['userRoles'] = userRoles.map((v) => v.toJson()).toList();
|
||||
}
|
||||
map['tokenlife'] = tokenlife;
|
||||
map['isAuthenticated'] = isAuthenticated;
|
||||
map['hasError'] = hasError;
|
||||
map['profilePhotoName'] = profilePhotoName;
|
||||
map['id'] = id;
|
||||
map['userName'] = userName;
|
||||
map['normalizedUserName'] = normalizedUserName;
|
||||
map['normalizedEmail'] = normalizedEmail;
|
||||
map['emailConfirmed'] = emailConfirmed;
|
||||
map['passwordHash'] = passwordHash;
|
||||
map['securityStamp'] = securityStamp;
|
||||
map['concurrencyStamp'] = concurrencyStamp;
|
||||
map['phoneNumber'] = phoneNumber;
|
||||
map['phoneNumberConfirmed'] = phoneNumberConfirmed;
|
||||
map['twoFactorEnabled'] = twoFactorEnabled;
|
||||
map['lockoutEnd'] = lockoutEnd;
|
||||
map['lockoutEnabled'] = lockoutEnabled;
|
||||
map['accessFailedCount'] = accessFailedCount;
|
||||
return map;
|
||||
}
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> parsedJson) {
|
||||
UsersTypes type;
|
||||
switch (parsedJson["role"]) {
|
||||
case "field_engineer":
|
||||
type = UsersTypes.engineer;
|
||||
break;
|
||||
default:
|
||||
type = UsersTypes.normal_user;
|
||||
break;
|
||||
User.fromJson(dynamic json) {
|
||||
clientId = json['client_id'];
|
||||
clientName = json['client_name'];
|
||||
if (json['department_id'] != null) {
|
||||
departmentId = [];
|
||||
json['department_id'].forEach((v) {
|
||||
departmentId.add(v);
|
||||
});
|
||||
}
|
||||
return User(
|
||||
id: parsedJson["uid"],
|
||||
userName: parsedJson["name"] ?? parsedJson["title"],
|
||||
email: parsedJson["mail"] ?? parsedJson["email"],
|
||||
hospital: Hospital(id: parsedJson["client"], name: parsedJson["client_name"]),
|
||||
department: Department(
|
||||
id: parsedJson["department"],
|
||||
name: parsedJson["department_name"],
|
||||
),
|
||||
image: parsedJson["picture"],
|
||||
phoneNumber: parsedJson["phone"],
|
||||
whatsApp: parsedJson["whatsapp"],
|
||||
token: parsedJson["token"],
|
||||
isActive: parsedJson["active"] == "1",
|
||||
type: type);
|
||||
if (json['department_name'] != null) {
|
||||
departmentId = [];
|
||||
json['department_name'].forEach((v) {
|
||||
departmentId.add(v);
|
||||
});
|
||||
}
|
||||
message = json['message'];
|
||||
username = json['username'];
|
||||
userID = json['userID'];
|
||||
email = json['email'];
|
||||
password = json['password'];
|
||||
token = json['token'];
|
||||
roles = json['roles'];
|
||||
if (json['userRoles'] != null) {
|
||||
userRoles = [];
|
||||
json['userRoles'].forEach((v) {
|
||||
userRoles.add(UserRoles.fromJson(v));
|
||||
});
|
||||
}
|
||||
tokenlife = json['tokenlife'];
|
||||
isAuthenticated = json['isAuthenticated'];
|
||||
hasError = json['hasError'];
|
||||
profilePhotoName = json['profilePhotoName'];
|
||||
id = json['id'];
|
||||
userName = json['userName'];
|
||||
normalizedUserName = json['normalizedUserName'];
|
||||
normalizedEmail = json['normalizedEmail'];
|
||||
emailConfirmed = json['emailConfirmed'];
|
||||
passwordHash = json['passwordHash'];
|
||||
securityStamp = json['securityStamp'];
|
||||
concurrencyStamp = json['concurrencyStamp'];
|
||||
phoneNumber = json['phoneNumber'];
|
||||
phoneNumberConfirmed = json['phoneNumberConfirmed'];
|
||||
twoFactorEnabled = json['twoFactorEnabled'];
|
||||
lockoutEnd = json['lockoutEnd'];
|
||||
lockoutEnabled = json['lockoutEnabled'];
|
||||
accessFailedCount = json['accessFailedCount'];
|
||||
}
|
||||
}
|
||||
|
||||
class UserRoles {
|
||||
UserRoles({
|
||||
this.id,
|
||||
this.name,
|
||||
this.value,
|
||||
});
|
||||
|
||||
UserRoles.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
}
|
||||
String id;
|
||||
String name;
|
||||
String value;
|
||||
UserRoles copyWith({
|
||||
String id,
|
||||
String name,
|
||||
String value,
|
||||
}) =>
|
||||
UserRoles(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
value: value ?? this.value,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['name'] = name;
|
||||
map['value'] = value;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,45 +1,45 @@
|
||||
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/models/engineer.dart';
|
||||
import 'package:test_sa/models/visits/visit.dart';
|
||||
|
||||
class VisitsGroup{
|
||||
String userId;
|
||||
String workingHours;
|
||||
String travelingHours;
|
||||
String jobSheetNumber;
|
||||
String image;
|
||||
Lookup status;
|
||||
Lookup taskStatus;
|
||||
DateTime date;
|
||||
class VisitsGroup {
|
||||
// String userId;
|
||||
// String workingHours;
|
||||
// String travelingHours;
|
||||
// String jobSheetNumber;
|
||||
// String image;
|
||||
// Lookup status;
|
||||
// Lookup taskStatus;
|
||||
// DateTime date;
|
||||
Engineer engineer;
|
||||
List<Visit> visits;
|
||||
|
||||
VisitsGroup({
|
||||
this.userId,
|
||||
this.status,
|
||||
this.date,
|
||||
this.jobSheetNumber,
|
||||
this.travelingHours,
|
||||
this.workingHours,
|
||||
// this.userId,
|
||||
// this.status,
|
||||
// this.date,
|
||||
// this.jobSheetNumber,
|
||||
// this.travelingHours,
|
||||
// this.workingHours,
|
||||
this.visits,
|
||||
this.image,
|
||||
this.taskStatus,
|
||||
this.engineer,
|
||||
// this.image,
|
||||
// this.taskStatus,
|
||||
});
|
||||
|
||||
Map<String,String> toJson(){
|
||||
Map<String,String> jsonObject = {};
|
||||
jsonObject["nids"] = visits.map((e) => e.id).toList().join(',');
|
||||
if(status != null) jsonObject["status"] = status.id.toString();
|
||||
if(date != null) jsonObject["date"] = date.toString().split(" ").first;
|
||||
if(jobSheetNumber != null && jobSheetNumber.isNotEmpty)
|
||||
jsonObject["job_sheet_no"] = jobSheetNumber;
|
||||
if(travelingHours != null && travelingHours.isNotEmpty)
|
||||
jsonObject["traveling_hours"] = travelingHours;
|
||||
if(workingHours != null && workingHours.isNotEmpty)
|
||||
jsonObject["working_hours"] = workingHours;
|
||||
if(image != null) jsonObject["image"] = image;
|
||||
if(taskStatus != null) jsonObject["task_status"] = taskStatus.id.toString();
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> jsonObject = {};
|
||||
jsonObject["ids"] = visits.map((e) => e.id).toList();
|
||||
jsonObject["assignedEmployeeId"] = engineer?.id;
|
||||
// if(status != null) jsonObject["taskStatusId"] = status.id.toString();
|
||||
// if(date != null) jsonObject["actualDate"] = date.toIso8601String();
|
||||
// if(jobSheetNumber != null && jobSheetNumber.isNotEmpty)
|
||||
// jsonObject["jobSheetNo"] = jobSheetNumber;
|
||||
// if(travelingHours != null && travelingHours.isNotEmpty)
|
||||
// jsonObject["travelingHours"] = travelingHours;
|
||||
// if(workingHours != null && workingHours.isNotEmpty)
|
||||
// jsonObject["workingHours"] = workingHours;
|
||||
// if(image != null) jsonObject["image"] = image;
|
||||
// if(taskStatus != null) jsonObject["task_status"] = taskStatus.id.toString();
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,39 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppStyle {
|
||||
AppStyle._();
|
||||
|
||||
static const double borderRadius = 10;
|
||||
|
||||
static const BoxShadow boxShadow = BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 3,
|
||||
offset: Offset(0,2)
|
||||
);
|
||||
static const BoxShadow boxShadow = BoxShadow(color: Colors.black26, blurRadius: 3, offset: Offset(0, 2));
|
||||
|
||||
static double getBorderRadius(BuildContext context){
|
||||
static double getBorderRadius(BuildContext context) {
|
||||
return borderRadius * getScaleFactor(context);
|
||||
}
|
||||
|
||||
static double getScaleFactor(BuildContext context){
|
||||
static double getScaleFactor(BuildContext context) {
|
||||
return MediaQuery.of(context).orientation == Orientation.portrait
|
||||
? MediaQuery.of(context).size.width/(360) > 1.5
|
||||
? 1.5 : MediaQuery.of(context).size.width/(360)
|
||||
: MediaQuery.of(context).size.height/(360) > 1.5
|
||||
? 1.5 : MediaQuery.of(context).size.height/(360);
|
||||
? MediaQuery.of(context).size.width / (360) > 1.5
|
||||
? 1.5
|
||||
: MediaQuery.of(context).size.width / (360)
|
||||
: MediaQuery.of(context).size.height / (360) > 1.5
|
||||
? 1.5
|
||||
: MediaQuery.of(context).size.height / (360);
|
||||
}
|
||||
|
||||
static BorderRadius getCardBorder(BuildContext context){
|
||||
static BorderRadius getCardBorder(BuildContext context) {
|
||||
return BorderRadius.only(
|
||||
topRight: Radius.circular(
|
||||
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
||||
),
|
||||
topLeft: Radius.circular(
|
||||
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
||||
),
|
||||
bottomRight: Radius.circular(
|
||||
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
||||
),
|
||||
topRight: Radius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
topLeft: Radius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
bottomRight: Radius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue