Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
StoreMonitor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramesh Babu Puvvadi
StoreMonitor
Commits
b2fb65e0
Commit
b2fb65e0
authored
Aug 19, 2024
by
Ramesh Babu Puvvadi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new changes
parent
f4cbf453
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
401 additions
and
520 deletions
+401
-520
Info.plist
ios/Runner/Info.plist
+2
-0
FirebaseApi.dart
lib/FirebaseApi.dart
+7
-4
Authentication.dart
lib/Screens/Authentication.dart
+19
-42
Chatboat.dart
lib/Screens/Chatboat.dart
+22
-43
CheckRegistration.dart
lib/Screens/CheckRegistration.dart
+3
-2
Home.dart
lib/Screens/Home.dart
+206
-211
IssueVideos.dart
lib/Screens/IssueVideos.dart
+5
-16
NavBar.dart
lib/Screens/NavBar.dart
+42
-89
SignUp.dart
lib/Screens/SignUp.dart
+1
-0
RemoteData.dart
lib/Services/RemoteData.dart
+94
-113
No files found.
ios/Runner/Info.plist
View file @
b2fb65e0
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
<
a
rr
a
y
>
<
a
rr
a
y
>
<
string
>
tel
<
/string
>
<
string
>
tel
<
/string
>
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
NSAppleMusicUsageDescription
<
/k
e
y
>
<
string
>
This
app
requires
access
to
your
music
usage
description
<
/string
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
string
>
Camera
access
is
required
to
capture
<
/string
>
<
string
>
Camera
access
is
required
to
capture
<
/string
>
<
k
e
y
>
NSPhotoLibraryAddUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSPhotoLibraryAddUsageDescription
<
/k
e
y
>
...
...
lib/FirebaseApi.dart
View file @
b2fb65e0
...
@@ -3,8 +3,8 @@ import 'package:firebase_messaging/firebase_messaging.dart';
...
@@ -3,8 +3,8 @@ import 'package:firebase_messaging/firebase_messaging.dart';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
class
FirebaseApi
{
class
FirebaseApi
{
final
_firebasemessaging
=
FirebaseMessaging
.
instance
;
final
_firebasemessaging
=
FirebaseMessaging
.
instance
;
Future
<
void
>
initNotifications
()
async
{
Future
<
void
>
initNotifications
()
async
{
await
_firebasemessaging
.
requestPermission
();
await
_firebasemessaging
.
requestPermission
();
final
fcmToken
=
await
_firebasemessaging
.
getToken
();
final
fcmToken
=
await
_firebasemessaging
.
getToken
();
...
@@ -15,8 +15,11 @@ class FirebaseApi {
...
@@ -15,8 +15,11 @@ class FirebaseApi {
Future
<
void
>
handleBackgroundMessage
(
RemoteMessage
message
)
async
{
Future
<
void
>
handleBackgroundMessage
(
RemoteMessage
message
)
async
{
await
Firebase
.
initializeApp
();
await
Firebase
.
initializeApp
();
//print('Title :${message.notification?.title}');
if
(
kDebugMode
)
{
//print('Title :${message.notification?.body}');
print
(
'Firebase title :
${message.notification?.title}
'
);
//print('Title :${message.data}');
print
(
'Firebase body :
${message.notification?.body}
'
);
print
(
'Firebase data :
${message.data}
'
);
}
}
}
}
}
lib/Screens/Authentication.dart
View file @
b2fb65e0
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:storemonitor/Screens/Constants.dart'
;
import
'package:storemonitor/Screens/Constants.dart'
;
import
'package:video_player/video_player.dart'
;
import
'package:video_player/video_player.dart'
;
...
@@ -7,10 +8,7 @@ class VideoApp extends StatefulWidget {
...
@@ -7,10 +8,7 @@ class VideoApp extends StatefulWidget {
final
String
id
;
final
String
id
;
final
String
comment
;
final
String
comment
;
const
VideoApp
({
Key
?
key
,
const
VideoApp
({
Key
?
key
,
required
this
.
message
,
required
this
.
id
,
required
this
.
comment
}):
super
(
key:
key
);
required
this
.
message
,
required
this
.
id
,
required
this
.
comment
}):
super
(
key:
key
);
@override
@override
_VideoAppState
createState
()
=>
_VideoAppState
();
_VideoAppState
createState
()
=>
_VideoAppState
();
...
@@ -25,49 +23,28 @@ class _VideoAppState extends State<VideoApp> {
...
@@ -25,49 +23,28 @@ class _VideoAppState extends State<VideoApp> {
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
isdata
=
widget
.
message
;
isdata
=
widget
.
message
;
//List<String> parts = isdata.split('/');
// // Find the part that contains the file ID
// String? fileId;
// for (String part in parts) {
// if (part.startsWith('d/')) {
// fileId = part.substring(2);
// print('if Condition: $fileId');
// break;
// }
// }
// if (fileId != null) {
// print('File ID: $fileId');
// } else {
// print('File ID not found in the link');
// }
String
googleDriveFileUrl
=
isdata
;
String
googleDriveFileUrl
=
isdata
;
List
<
String
>
urlParts
=
googleDriveFileUrl
.
split
(
'/'
);
// Split the URL by '/'
int
indexOfD
=
urlParts
.
indexOf
(
'd'
);
List
<
String
>
urlParts
=
googleDriveFileUrl
.
split
(
'/'
);
String
fileId
=
urlParts
.
elementAt
(
indexOfD
+
1
);
int
indexOfD
=
urlParts
.
indexOf
(
'd'
);
if
(
kDebugMode
)
{
print
(
'File ID:
$fileId
'
);
// The file ID is the part after 'd'
}
String
fileId
=
urlParts
.
elementAt
(
indexOfD
+
1
);
//print('Testing : $urlParts[5]');
// The fileId is the first part after the last '/'
//String fileId = urlParts.last;
print
(
'File ID:
$fileId
'
);
videoUrl
=
'https://drive.google.com/uc?export=view&id=
$fileId
'
;
videoUrl
=
'https://drive.google.com/uc?export=view&id=
$fileId
'
;
if
(
kDebugMode
)
{
print
(
'VideoLink :
$videoUrl
'
);
print
(
'VideoLink :
$videoUrl
'
);
}
_controller
=
VideoPlayerController
.
networkUrl
(
Uri
.
parse
(
videoUrl
))
_controller
=
VideoPlayerController
.
networkUrl
(
Uri
.
parse
(
videoUrl
))
..
initialize
().
then
((
_
)
{
..
initialize
().
then
((
_
)
{
setState
(()
{
setState
(()
{
_controller
.
seekTo
(
const
Duration
(
microseconds:
1
));
_controller
.
seekTo
(
const
Duration
(
microseconds:
1
));
_controller
.
play
();
_controller
.
play
();
true
;
true
;
});
});
});
});
}
}
// void _initializeVideoPlayer() async {
// void _initializeVideoPlayer() async {
// videoUrl =
// videoUrl =
// 'https://drive.google.com/uc?export=view&id=1QVUJ34BKRilfchA_0ppmM3gFIPvYIl7i';
// 'https://drive.google.com/uc?export=view&id=1QVUJ34BKRilfchA_0ppmM3gFIPvYIl7i';
...
...
lib/Screens/Chatboat.dart
View file @
b2fb65e0
...
@@ -382,30 +382,22 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -382,30 +382,22 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
void
startListening
()
{
void
startListening
()
{
_logEvent
(
'start listening'
);
_logEvent
(
'start listening'
);
lastWords
=
''
;
lastWords
=
''
;
lastError
=
''
;
lastError
=
''
;
final
pauseFor
=
int
.
tryParse
(
_pauseForController
.
text
);
final
pauseFor
=
int
.
tryParse
(
_pauseForController
.
text
);
final
listenFor
=
int
.
tryParse
(
_listenForController
.
text
);
final
listenFor
=
int
.
tryParse
(
_listenForController
.
text
);
final
options
=
SpeechListenOptions
(
final
options
=
SpeechListenOptions
(
onDevice:
_onDevice
,
listenMode:
ListenMode
.
confirmation
,
cancelOnError:
true
,
partialResults:
true
,
autoPunctuation:
true
,
enableHapticFeedback:
true
);
onDevice:
_onDevice
,
listenMode:
ListenMode
.
confirmation
,
cancelOnError:
true
,
partialResults:
true
,
autoPunctuation:
true
,
enableHapticFeedback:
true
);
// Note that `listenFor` is the maximum, not the minimum, on some
// systems recognition will be stopped before this value is reached.
// Similarly `pauseFor` is a maximum not a minimum and may be ignored
// on some devices.
speech
.
listen
(
speech
.
listen
(
onResult
:
resultListener
,
onResult
:
resultListener
,
listenFor:
Duration
(
seconds:
listenFor
??
30
),
listenFor:
Duration
(
seconds:
listenFor
??
30
),
pauseFor
:
Duration
(
seconds:
pauseFor
??
3
),
pauseFor
:
Duration
(
seconds:
pauseFor
??
3
),
localeId
:
_currentLocaleId
,
localeId
:
_currentLocaleId
,
onSoundLevelChange:
soundLevelListener
,
onSoundLevelChange:
soundLevelListener
,
listenOptions:
options
,
listenOptions:
options
,
);
);
setState
(()
{});
setState
(()
{});
}
}
void
stopListening
()
{
void
stopListening
()
{
...
@@ -426,21 +418,18 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -426,21 +418,18 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
// This callback is invoked each time new recognition results are
// This callback is invoked each time new recognition results are
// available after `listen` is called.
// available after `listen` is called.
void
resultListener
(
SpeechRecognitionResult
result
)
{
void
resultListener
(
SpeechRecognitionResult
result
)
{
_logEvent
(
_logEvent
(
'Result listener final:
${result.finalResult}
, words:
${result.recognizedWords}
'
);
'Result listener final:
${result.finalResult}
, words:
${result.recognizedWords}
'
);
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
print
(
'
\n
Testing listener final:
${result.finalResult}
, words:
${result.recognizedWords}
'
);
'
\n
Testing listener final:
${result.finalResult}
, words:
${result.recognizedWords}
'
);
}
}
setState
(()
async
{
setState
(()
async
{
//lastWords = '${result.recognizedWords} - ${result.finalResult}';
lastWords
=
result
.
recognizedWords
;
lastWords
=
result
.
recognizedWords
;
if
(
result
.
finalResult
)
{
if
(
result
.
finalResult
)
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'Final Result:
$lastWords
'
);
print
(
'Final Result:
$lastWords
'
);
}
}
//await Future.delayed(Duration.zero);
remotevalidate
(
lastWords
);
remotevalidate
(
lastWords
);
}
}
});
});
...
@@ -449,23 +438,20 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -449,23 +438,20 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
void
soundLevelListener
(
double
level
)
{
void
soundLevelListener
(
double
level
)
{
minSoundLevel
=
min
(
minSoundLevel
,
level
);
minSoundLevel
=
min
(
minSoundLevel
,
level
);
maxSoundLevel
=
max
(
maxSoundLevel
,
level
);
maxSoundLevel
=
max
(
maxSoundLevel
,
level
);
// _logEvent('sound level $level: $minSoundLevel - $maxSoundLevel ');
setState
(()
{
setState
(()
{
this
.
level
=
level
;
this
.
level
=
level
;
});
});
}
}
void
errorListener
(
SpeechRecognitionError
error
)
{
void
errorListener
(
SpeechRecognitionError
error
)
{
_logEvent
(
_logEvent
(
'Received error status:
$error
, listening:
${speech.isListening}
'
);
'Received error status:
$error
, listening:
${speech.isListening}
'
);
setState
(()
{
setState
(()
{
lastError
=
'
${error.errorMsg}
-
${error.permanent}
'
;
lastError
=
'
${error.errorMsg}
-
${error.permanent}
'
;
});
});
}
}
void
statusListener
(
String
status
)
{
void
statusListener
(
String
status
)
{
_logEvent
(
_logEvent
(
'Received listener status:
$status
, listening:
${speech.isListening}
'
);
'Received listener status:
$status
, listening:
${speech.isListening}
'
);
setState
(()
{
setState
(()
{
lastStatus
=
status
;
lastStatus
=
status
;
});
});
...
@@ -478,6 +464,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -478,6 +464,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
// debugPrint(selectedVal);
// debugPrint(selectedVal);
//}
//}
void
_logEvent
(
String
eventDescription
)
{
void
_logEvent
(
String
eventDescription
)
{
if
(
_logEvents
)
{
if
(
_logEvents
)
{
var
eventTime
=
DateTime
.
now
().
toIso8601String
();
var
eventTime
=
DateTime
.
now
().
toIso8601String
();
...
@@ -491,7 +478,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -491,7 +478,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
print
(
'Hitting from Keyboard or voice !!!!!!!!!!!!
$lastWords
'
);
print
(
'Hitting from Keyboard or voice !!!!!!!!!!!!
$lastWords
'
);
}
}
//String res = await RemoteData().getSpeechResponse(lastWords, userid!);
//String res = await RemoteData().getSpeechResponse(lastWords, userid!);
String
res
=
await
RemoteData
().
getSpeechResponse
(
lastWords
,
userid
!);
String
res
=
await
RemoteData
().
getSpeechResponse
(
lastWords
,
userid
!);
//var response = jsonDecode(res);
//var response = jsonDecode(res);
Map
<
String
,
dynamic
>
jsonResponse
=
jsonDecode
(
res
);
Map
<
String
,
dynamic
>
jsonResponse
=
jsonDecode
(
res
);
//List<dynamic> output1 = jsonResponse['output1'];
//List<dynamic> output1 = jsonResponse['output1'];
...
@@ -511,8 +498,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -511,8 +498,7 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'DataFetching1
$zoneValue
'
);
print
(
'DataFetching1
$zoneValue
'
);
}
}
Data
dataInstance
=
Data
dataInstance
=
Data
(
question:
lastWords
,
answer:
zoneValue
,
image:
'None'
);
Data
(
question:
lastWords
,
answer:
zoneValue
,
image:
'None'
);
await
ftts
.
setLanguage
(
'en-IN'
);
await
ftts
.
setLanguage
(
'en-IN'
);
//await ftts.setLanguage("en-IN");
//await ftts.setLanguage("en-IN");
await
ftts
.
setSpeechRate
(
0.5
);
//speed of speech
await
ftts
.
setSpeechRate
(
0.5
);
//speed of speech
...
@@ -525,20 +511,14 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -525,20 +511,14 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
print
(
await
ftts
.
getVoices
);
print
(
await
ftts
.
getVoices
);
}
}
await
ftts
.
setVoice
({
'name'
:
'Rishi'
,
'locale'
:
'en-IN'
});
await
ftts
.
setVoice
({
'name'
:
'Rishi'
,
'locale'
:
'en-IN'
});
//await ftts.setVoice(ftts.getDefaultVoice());
//await ftts.setIosAudioCategory(
//[IosTextToSpeechAudioCategory.playAndRecord,
//IosTextToSpeechAudioCategoryOptions.defaultToSpeaker],
//);
await
ftts
.
setIosAudioCategory
(
await
ftts
.
setIosAudioCategory
(
IosTextToSpeechAudioCategory
.
playback
,
IosTextToSpeechAudioCategory
.
playback
,
[
[
IosTextToSpeechAudioCategoryOptions
.
allowBluetooth
,
IosTextToSpeechAudioCategoryOptions
.
allowBluetooth
,
IosTextToSpeechAudioCategoryOptions
.
allowBluetoothA2DP
,
IosTextToSpeechAudioCategoryOptions
.
allowBluetoothA2DP
,
IosTextToSpeechAudioCategoryOptions
.
mixWithOthers
,
IosTextToSpeechAudioCategoryOptions
.
mixWithOthers
,
IosTextToSpeechAudioCategoryOptions
.
defaultToSpeaker
IosTextToSpeechAudioCategoryOptions
.
defaultToSpeaker
],
],
IosTextToSpeechAudioMode
.
defaultMode
IosTextToSpeechAudioMode
.
defaultMode
);
);
}
else
{
}
else
{
await
ftts
.
setVoice
({
'name'
:
' Rishi'
,
"locale"
:
"en-IN"
});
await
ftts
.
setVoice
({
'name'
:
' Rishi'
,
"locale"
:
"en-IN"
});
}
}
...
@@ -589,7 +569,6 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
...
@@ -589,7 +569,6 @@ class _SpeechSampleAppState extends State<SpeechSampleApp1> {
setState
(()
{
setState
(()
{
data
=
data
;
data
=
data
;
});
});
lastWords
=
''
;
lastWords
=
''
;
setState
(()
{});
setState
(()
{});
}
}
...
...
lib/Screens/CheckRegistration.dart
View file @
b2fb65e0
...
@@ -109,6 +109,7 @@ class _CheckRegistration extends State<CheckRegistration> {
...
@@ -109,6 +109,7 @@ class _CheckRegistration extends State<CheckRegistration> {
),
),
),
),
),
),
// ElevatedButton(
// ElevatedButton(
// onPressed: () {
// onPressed: () {
// if (_empId.text.isNotEmpty) {
// if (_empId.text.isNotEmpty) {
...
@@ -171,11 +172,11 @@ class _CheckRegistration extends State<CheckRegistration> {
...
@@ -171,11 +172,11 @@ class _CheckRegistration extends State<CheckRegistration> {
_empId
.
text
==
''
;
_empId
.
text
==
''
;
_empId
.
clear
();
_empId
.
clear
();
Constants
(
'Check Registration'
,
'Registered Sucessfully'
)
Constants
(
'Check Registration'
,
'Registered Sucessfully'
)
.
showAlertDialog
(
context
,
fals
e
);
.
showAlertDialog
(
context
,
tru
e
);
}
else
{
}
else
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
Constants
(
'Check Registration'
,
'Registation Failed'
)
Constants
(
'Check Registration'
,
'Registation Failed'
)
.
showAlertDialog
(
context
,
fals
e
);
.
showAlertDialog
(
context
,
tru
e
);
file
.
delete
();
file
.
delete
();
//Navigator.of(context).pop();
//Navigator.of(context).pop();
}
}
...
...
lib/Screens/Home.dart
View file @
b2fb65e0
import
'dart:convert'
;
import
'dart:convert'
;
import
'dart:math'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
...
@@ -27,23 +28,22 @@ class Home extends StatefulWidget {
...
@@ -27,23 +28,22 @@ class Home extends StatefulWidget {
}
}
class
_Home
extends
State
<
Home
>
{
class
_Home
extends
State
<
Home
>
{
String
?
selectedRegion
;
String
?
selectedDropdownItem
=
''
;
String
?
selectedDropdownItem
=
''
;
List
<
String
>
storeNames
=
[];
List
<
Store
>
stores
=
[];
List
<
String
>
regions
=
[];
DateTime
_selectedDate
=
DateTime
.
now
();
bool
isAuthenticated
=
false
;
bool
iswarehouserelated
=
false
;
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
final
_controller
=
TextEditingController
();
List
<
Insight
>?
insightslist
=
[];
bool
isSwitched
=
false
;
String
?
empId
;
String
?
empId
;
List
<
String
>?
namesList
;
List
<
String
>
storeNames
=
[];
List
<
Store
>
stores
=
[];
List
<
String
>
regions
=
[];
late
List
<
GDPData
>
_chartData
;
late
List
<
GDPData
>
_chartData
;
DateTime
_selectedDate
=
DateTime
.
now
();
String
?
selectedRegion
;
List
<
String
>?
namesList
;
final
TextEditingController
_dateTime
=
TextEditingController
();
final
TextEditingController
_dateTime
=
TextEditingController
();
bool
isAuthenticated
=
false
;
bool
iswarehouserelated
=
false
;
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
final
_controller
=
TextEditingController
();
List
<
Insight
>?
insightslist
=
[];
bool
isSwitched
=
false
;
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
...
@@ -52,15 +52,22 @@ class _Home extends State<Home> {
...
@@ -52,15 +52,22 @@ class _Home extends State<Home> {
_selectedDate
=
DateTime
.
now
();
_selectedDate
=
DateTime
.
now
();
_dateTime
.
text
=
DateFormat
(
'yyyy/MM/dd'
).
format
(
_selectedDate
);
_dateTime
.
text
=
DateFormat
(
'yyyy/MM/dd'
).
format
(
_selectedDate
);
}
}
loadData
()
async
{
loadData
()
async
{
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
if
(
prefs
.
getString
(
'access'
)
==
'DIRECTOR'
)
{
setState
(()
{
isAuthenticated
=
true
;
});
}
else
{
setState
(()
{
isAuthenticated
=
false
;
});
}
String
?
userId
=
prefs
.
getString
(
"stores_list"
);
String
?
userId
=
prefs
.
getString
(
"stores_list"
);
empId
=
prefs
.
getString
(
'empId'
);
empId
=
prefs
.
getString
(
'empId'
);
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
empId
);
print
(
empId
);
}
}
final
List
<
dynamic
>
jsonResponse
=
json
.
decode
(
userId
!);
final
List
<
dynamic
>
jsonResponse
=
json
.
decode
(
userId
!);
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
jsonResponse
);
print
(
jsonResponse
);
...
@@ -70,31 +77,29 @@ class _Home extends State<Home> {
...
@@ -70,31 +77,29 @@ class _Home extends State<Home> {
print
(
stores
);
print
(
stores
);
}
}
// Get unique regions
// Get unique regions
regions
=
stores
.
map
((
store
)
=>
store
.
region
).
toSet
().
toList
();
if
(
isAuthenticated
){
selectedRegion
=
regions
[
0
];
regions
=
stores
.
map
((
store
)
=>
store
.
region
).
toSet
().
toList
();
updateStoreNames
(
selectedRegion
!);
//print(regions);
setState
(()
{});
selectedRegion
=
regions
[
0
];
updateStoreNames
(
selectedRegion
!);
setState
((){
});
selectedDropdownItem
=
storeNames
[
0
];
getupdateData
(
selectedDropdownItem
,
empId
!);
}
else
{
updateStores
();
selectedDropdownItem
=
storeNames
[
0
];
getupdateData
(
selectedDropdownItem
,
empId
!);
}
//namesList = (json.decode(userId!) as List<dynamic>)
//namesList = (json.decode(userId!) as List<dynamic>)
//.map((map) => map['name'] as String)
//.map((map) => map['name'] as String)
//.toList();
//.toList();
selectedDropdownItem
=
storeNames
[
0
];
if
(
selectedDropdownItem
==
'WH KISMATPUR'
||
getupdateData
(
selectedDropdownItem
);
selectedDropdownItem
==
'WH BANGALORE'
||
if
(
prefs
.
getString
(
'access'
)
==
'ADMIN'
||
selectedDropdownItem
==
'WH VIJAYAWADA'
||
prefs
.
getString
(
'access'
)
==
'MANAGER'
)
{
selectedDropdownItem
==
'WH KANCHI'
)
{
setState
(()
{
isAuthenticated
=
true
;
});
}
else
{
setState
(()
{
isAuthenticated
=
false
;
});
}
if
(
selectedDropdownItem
==
'WH KISMATPUR'
||
selectedDropdownItem
==
'WH BANGALORE'
||
selectedDropdownItem
==
'WH VIJAYAWADA'
||
selectedDropdownItem
==
'WH KANCHI'
)
{
iswarehouserelated
=
false
;
iswarehouserelated
=
false
;
}
else
{
}
else
{
iswarehouserelated
=
false
;
iswarehouserelated
=
false
;
...
@@ -102,45 +107,58 @@ class _Home extends State<Home> {
...
@@ -102,45 +107,58 @@ class _Home extends State<Home> {
}
}
Future
<
void
>
_selectDate
(
BuildContext
context
)
async
{
Future
<
void
>
_selectDate
(
BuildContext
context
)
async
{
final
DateTime
?
picked
=
await
showDatePicker
(
final
DateTime
?
picked
=
await
showDatePicker
(
context:
context
,
context:
context
,
initialDate:
_selectedDate
,
initialDate:
_selectedDate
,
firstDate:
DateTime
(
1900
),
firstDate:
DateTime
(
1900
),
lastDate:
DateTime
.
now
(),
lastDate:
DateTime
.
now
(),
builder:
(
context
,
child
)
{
builder:
(
context
,
child
)
{
return
Theme
(
return
Theme
(
data:
Theme
.
of
(
context
).
copyWith
(
data:
Theme
.
of
(
context
).
copyWith
(
colorScheme:
const
ColorScheme
.
light
(
colorScheme:
const
ColorScheme
.
light
(
primary:
Color
.
fromARGB
(
255
,
125
,
50
,
253
),
primary:
Color
.
fromARGB
(
255
,
125
,
50
,
253
),
onPrimary:
Colors
.
white
,
onPrimary:
Colors
.
white
,
onSurface:
Colors
.
black
,
onSurface:
Colors
.
black
,
),
),
textButtonTheme:
TextButtonThemeData
(
textButtonTheme:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
style:
TextButton
.
styleFrom
(
foregroundColor:
const
Color
.
fromARGB
(
255
,
125
,
50
,
253
),
foregroundColor:
const
Color
.
fromARGB
(
255
,
125
,
50
,
253
),
),
),
),
),
),
),
child:
child
!,
child:
child
!,
);
);
});
}
);
setState
(()
{
setState
(()
{
_selectedDate
=
picked
!;
_selectedDate
=
picked
!;
_dateTime
.
text
=
_dateTime
.
text
=
'
${_selectedDate.year}
/
${_selectedDate.month}
/
${_selectedDate.day}
'
;
'
${_selectedDate.year}
/
${_selectedDate.month}
/
${_selectedDate.day}
'
;
getupdateData
(
selectedDropdownItem
);
getupdateData
(
selectedDropdownItem
,
empId
!
);
});
});
}
}
void
updateStoreNames
(
String
region
)
{
void
updateStoreNames
(
String
region
)
{
storeNames
=
stores
storeNames
=
[
'All'
,
...
stores
.
where
((
store
)
=>
store
.
region
==
region
)
.
where
((
store
)
=>
store
.
region
==
region
)
.
map
((
store
)
=>
store
.
storename
)
.
map
((
store
)
=>
store
.
storename
)
.
toList
();
.
toList
()];
selectedDropdownItem
=
storeNames
[
0
];
// Reset the selected store
selectedDropdownItem
=
storeNames
[
0
];
// Reset the selected store
setState
(()
{
setState
(()
{
getupdateData
(
selectedDropdownItem
);
getupdateData
(
selectedDropdownItem
,
empId
!);
});
}
void
updateStores
()
{
storeNames
=
stores
.
map
((
store
)
=>
store
.
storename
).
toList
();
print
(
'Testing Selecting Store :
$storeNames
'
);
selectedDropdownItem
=
storeNames
[
0
];
// Reset the selected store
print
(
'Testing Selecting Store :
$selectedDropdownItem
'
);
setState
(()
{
getupdateData
(
selectedDropdownItem
,
empId
!);
});
});
}
}
...
@@ -188,7 +206,6 @@ class _Home extends State<Home> {
...
@@ -188,7 +206,6 @@ class _Home extends State<Home> {
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'force press down'
);
print
(
'force press down'
);
}
}
//Navigator.pop(context);
},
},
child:
Container
(
child:
Container
(
margin:
const
EdgeInsets
.
all
(
12.0
),
margin:
const
EdgeInsets
.
all
(
12.0
),
...
@@ -196,7 +213,8 @@ class _Home extends State<Home> {
...
@@ -196,7 +213,8 @@ class _Home extends State<Home> {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Visibility
(
visible:
isAuthenticated
,
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10.0
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
grey
),
border:
Border
.
all
(
color:
Colors
.
grey
),
...
@@ -222,6 +240,7 @@ class _Home extends State<Home> {
...
@@ -222,6 +240,7 @@ class _Home extends State<Home> {
isExpanded:
true
,
isExpanded:
true
,
),
),
),
),
),
),
),
const
SizedBox
(
const
SizedBox
(
height:
15
,
height:
15
,
...
@@ -240,15 +259,7 @@ class _Home extends State<Home> {
...
@@ -240,15 +259,7 @@ class _Home extends State<Home> {
onChanged:
(
newValue
)
{
onChanged:
(
newValue
)
{
setState
(()
{
setState
(()
{
selectedDropdownItem
=
newValue
;
selectedDropdownItem
=
newValue
;
getupdateData
(
selectedDropdownItem
);
getupdateData
(
selectedDropdownItem
,
empId
!);
// if (selectedDropdownItem == 'WH KISMATPUR' ||
// selectedDropdownItem == 'WH BANGALORE' ||
// selectedDropdownItem == 'WH VIJAYAWADA' ||
// selectedDropdownItem == 'WH KANCHI') {
// iswarehouserelated = true;
// } else {
// iswarehouserelated = false;
// }
});
});
},
},
items:
storeNames
.
map
((
item
)
{
items:
storeNames
.
map
((
item
)
{
...
@@ -271,8 +282,7 @@ class _Home extends State<Home> {
...
@@ -271,8 +282,7 @@ class _Home extends State<Home> {
readOnly:
true
,
readOnly:
true
,
onTap:
()
{},
onTap:
()
{},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
contentPadding:
const
EdgeInsets
.
symmetric
(
contentPadding:
const
EdgeInsets
.
symmetric
(
vertical:
15
,
horizontal:
10
),
vertical:
15
,
horizontal:
10
),
isDense:
true
,
isDense:
true
,
hintText:
'Select date'
,
hintText:
'Select date'
,
border:
OutlineInputBorder
(
border:
OutlineInputBorder
(
...
@@ -289,136 +299,124 @@ class _Home extends State<Home> {
...
@@ -289,136 +299,124 @@ class _Home extends State<Home> {
),
),
),
),
const
SizedBox
(
height:
10
),
const
SizedBox
(
height:
10
),
const
Text
(
'AI Powered Insights'
,
Visibility
(
textAlign:
TextAlign
.
right
,
visible:
isAuthenticated
,
style:
Constants
.
headerfontStyle
),
child:
Column
(
const
SizedBox
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
width:
0
,
children:
[
height:
5
,
const
Text
(
),
'AI Powered Insights'
,
Container
(
textAlign:
TextAlign
.
right
,
height:
2
,
style:
Constants
.
headerfontStyle
,
width:
60
,
),
color:
const
Color
.
fromARGB
(
255
,
170
,
57
,
243
),
const
SizedBox
(
),
width:
0
,
const
SizedBox
(
height:
5
,
height:
15
,
),
width:
1
,
Container
(
),
height:
2
,
width:
60
,
SizedBox
(
color:
const
Color
.
fromARGB
(
255
,
170
,
57
,
243
),
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.15
,
),
child:
ListView
.
builder
(
const
SizedBox
(
itemCount:
insightslist
?.
length
,
height:
15
,
itemBuilder:
(
context
,
index
)
{
width:
1
,
return
Padding
(
),
padding:
const
EdgeInsets
.
all
(
2.0
),
SizedBox
(
child:
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.15
,
height:
60
,
child:
ListView
.
builder
(
color:
index
%
2
==
0
itemCount:
insightslist
?.
length
,
?
const
Color
.
fromARGB
(
255
,
245
,
242
,
251
)
itemBuilder:
(
context
,
index
)
{
:
Colors
.
white
,
return
Padding
(
child:
GestureDetector
(
padding:
const
EdgeInsets
.
all
(
2.0
),
onTap:
()
{
child:
Container
(
showDialog
(
height:
60
,
context:
context
,
color:
index
%
2
==
0
builder:
(
BuildContext
context
)
{
?
const
Color
.
fromARGB
(
255
,
245
,
242
,
251
)
return
AlertDialog
(
:
Colors
.
white
,
title:
const
Text
(
'View Insights'
),
child:
GestureDetector
(
content:
Text
(
onTap:
()
{
Constants
.
capitalizeFirstLetter
(
showDialog
(
insightslist
![
index
].
content
)),
context:
context
,
actions:
<
Widget
>[
builder:
(
BuildContext
context
)
{
ToggleSwitch
(
return
AlertDialog
(
minWidth:
90.0
,
title:
const
Text
(
'View Insights'
),
minHeight:
50.0
,
content:
Text
(
Constants
.
capitalizeFirstLetter
(
insightslist
![
index
].
content
)),
cornerRadius:
20.0
,
actions:
<
Widget
>[
activeBgColors:
const
[
ToggleSwitch
(
[
Colors
.
green
],
minWidth:
90.0
,
[
Colors
.
redAccent
]
minHeight:
50.0
,
],
cornerRadius:
20.0
,
activeFgColor:
Colors
.
white
,
activeBgColors:
const
[
inactiveBgColor:
Colors
.
grey
,
[
Colors
.
green
],
inactiveFgColor:
Colors
.
white
,
[
Colors
.
redAccent
]
initialLabelIndex:
0
,
],
totalSwitches:
2
,
activeFgColor:
Colors
.
white
,
labels:
const
[
'YES'
,
'NO'
],
inactiveBgColor:
Colors
.
grey
,
onToggle:
(
index
)
{
inactiveFgColor:
Colors
.
white
,
if
(
kDebugMode
)
{
initialLabelIndex:
0
,
print
(
'Switched to:
$index
'
);
totalSwitches:
2
,
}
labels:
const
[
'YES'
,
'NO'
],
},
onToggle:
(
index
)
{
),
if
(
kDebugMode
)
{
],
print
(
'Switched to:
$index
'
);
);
}
},
},
);
),
},
],
child:
Column
(
);
children:
[
},
const
SizedBox
(
);
width:
5
,
},
height:
2
,
child:
Column
(
),
children:
[
Padding
(
const
SizedBox
(
padding:
const
EdgeInsets
.
symmetric
(
width:
5
,
vertical:
2.0
,
horizontal:
2.0
),
height:
2
,
child:
Row
(
children:
[
SizedBox
(
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.68
,
child:
Text
(
Constants
.
capitalizeFirstLetter
(
insightslist
![
index
].
heading
),
style:
Constants
.
headerlistitems1
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
textAlign:
TextAlign
.
left
,
),
),
),
Padding
(
SizedBox
(
padding:
const
EdgeInsets
.
symmetric
(
width:
MediaQuery
.
of
(
context
).
size
.
width
*
vertical:
2.0
,
horizontal:
2.0
),
0.22
,
child:
Row
(
child:
IconButton
(
children:
[
icon:
const
Icon
(
SizedBox
(
false
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.68
,
?
Icons
.
visibility
child:
Text
(
:
Icons
.
visibility_off
,
Constants
.
capitalizeFirstLetter
(
insightslist
![
index
].
heading
),
// You can customize the color, size, and other properties of the icon as needed
style:
Constants
.
headerlistitems1
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
textAlign:
TextAlign
.
left
,
),
),
SizedBox
(
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.22
,
child:
IconButton
(
icon:
const
Icon
(
Icons
.
visibility_off
,
// or Icons.visibility
),
onPressed:
()
{},
),
),
],
),
),
onPressed:
()
{},
),
),
),
const
VerticalDivider
(
]),
width:
1.0
,
),
color:
Colors
.
white
,
// const VerticalDivider(
),
// width: 1.0,
],
// color: Colors.white,
),
// ),
// SizedBox(
// width:
// MediaQuery.of(context).size.width / 0.8,
// height: 100,
// child: Text(
// insightslist![index].ins2.last,
// style: Constants.headerlistitems,
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// //softWrap: true,
// ),
// ),
const
VerticalDivider
(
width:
1.0
,
color:
Colors
.
white
,
),
),
]
,
)
,
)
,
)
;
)
,
}
,
),
),
)
;
)
,
}
,
]
,
),
),
),
),
const
SizedBox
(
height:
10
),
const
SizedBox
(
height:
10
),
const
Text
(
'AI Alert Status'
,
const
Text
(
'AI Alert Status'
,
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
...
@@ -621,10 +619,7 @@ class _Home extends State<Home> {
...
@@ -621,10 +619,7 @@ class _Home extends State<Home> {
margin:
const
EdgeInsets
.
only
(
margin:
const
EdgeInsets
.
only
(
left:
0
,
top:
0
,
right:
0
,
bottom:
0
),
left:
0
,
top:
0
,
right:
0
,
bottom:
0
),
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.44
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.44
,
//visible: isAuthenticated,
child:
Container
(
child:
Container
(
//height: MediaQuery.of(context).size.width * 0.12,
padding:
const
EdgeInsets
.
all
(
1
),
padding:
const
EdgeInsets
.
all
(
1
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
gradient:
const
LinearGradient
(
gradient:
const
LinearGradient
(
...
@@ -632,7 +627,6 @@ class _Home extends State<Home> {
...
@@ -632,7 +627,6 @@ class _Home extends State<Home> {
end:
Alignment
.
bottomCenter
,
end:
Alignment
.
bottomCenter
,
colors:
[
colors:
[
Color
.
fromARGB
(
255
,
170
,
133
,
220
),
Color
.
fromARGB
(
255
,
170
,
133
,
220
),
//Color(0xFFC2185B),
Color
.
fromARGB
(
255
,
201
,
175
,
236
),
Color
.
fromARGB
(
255
,
201
,
175
,
236
),
],
],
),
),
...
@@ -642,15 +636,14 @@ class _Home extends State<Home> {
...
@@ -642,15 +636,14 @@ class _Home extends State<Home> {
controller:
_controller
,
controller:
_controller
,
readOnly:
true
,
readOnly:
true
,
enabled:
false
,
enabled:
false
,
decoration:
const
InputDecoration
(
decoration:
const
InputDecoration
(
border:
InputBorder
.
none
),
border:
InputBorder
.
none
),
style:
Constants
.
whitefontStyle
,
style:
Constants
.
whitefontStyle
,
textAlign:
TextAlign
.
left
,
textAlign:
TextAlign
.
left
,
onEditingComplete:
()
{
onEditingComplete:
()
{
FocusScope
.
of
(
context
)
FocusScope
.
of
(
context
).
unfocus
();
// remove the focus from the TextFormField
.
unfocus
();
// remove the focus from the TextFormField
},
},
)),
),
),
),
),
),
),
],
],
...
@@ -1148,7 +1141,7 @@ class _Home extends State<Home> {
...
@@ -1148,7 +1141,7 @@ class _Home extends State<Home> {
// return chartData;
// return chartData;
// }
// }
Future
<
void
>
getupdateData
(
String
?
selectedDropdownItem
)
async
{
Future
<
void
>
getupdateData
(
String
?
selectedDropdownItem
,
String
empid
)
async
{
showDialog
(
showDialog
(
context:
context
,
context:
context
,
builder:
(
context
)
{
builder:
(
context
)
{
...
@@ -1169,7 +1162,7 @@ class _Home extends State<Home> {
...
@@ -1169,7 +1162,7 @@ class _Home extends State<Home> {
final
String
res
;
final
String
res
;
//Response data;
//Response data;
respon
=
await
RemoteData
().
geAlertSummary
(
selectedDropdownItem
!,
respon
=
await
RemoteData
().
geAlertSummary
(
selectedDropdownItem
!,
'
${_selectedDate.year}
-
$selectedmonth
-
$selectedday
'
);
'
${_selectedDate.year}
-
$selectedmonth
-
$selectedday
'
,
empid
);
res
=
await
RemoteData
().
getpendingAlerts
(
res
=
await
RemoteData
().
getpendingAlerts
(
selectedDropdownItem
,
selectedDropdownItem
,
...
@@ -1194,22 +1187,24 @@ class _Home extends State<Home> {
...
@@ -1194,22 +1187,24 @@ class _Home extends State<Home> {
//_controller1.text = '\t\t Pending Videos Alerts : $pending_video_alerts';
//_controller1.text = '\t\t Pending Videos Alerts : $pending_video_alerts';
});
});
String
insights
=
await
RemoteData
().
getInsights
(
if
(
isAuthenticated
){
selectedRegion
!,
String
insights
=
await
RemoteData
().
getInsights
(
selectedDropdownItem
,
selectedRegion
!,
'
${_selectedDate.year}
-
$selectedmonth
-
$selectedday
'
,
selectedDropdownItem
,
);
'
${_selectedDate.year}
-
$selectedmonth
-
$selectedday
'
,
print
(
'Testing Data :
$insights
'
);
);
print
(
'Testing Data :
$insights
'
);
List
<
dynamic
>
parsedJson
=
json
.
decode
(
insights
);
List
<
dynamic
>
parsedJson
=
json
.
decode
(
insights
);
print
(
parsedJson
);
print
(
parsedJson
);
List
<
Insight
>
insightsList
=
List
<
Insight
>
insightsList
=
parsedJson
.
map
((
json
)
=>
Insight
.
fromJson
(
json
)).
toList
();
parsedJson
.
map
((
json
)
=>
Insight
.
fromJson
(
json
)).
toList
();
setState
(()
{
setState
(()
{
insightslist
=
insightsList
;
insightslist
=
insightsList
;
});
});
}
}
}
}
}
...
...
lib/Screens/IssueVideos.dart
View file @
b2fb65e0
...
@@ -50,33 +50,25 @@ class _IssueVideos extends State<IssueVideos> {
...
@@ -50,33 +50,25 @@ class _IssueVideos extends State<IssueVideos> {
Future
<
void
>
loadData
()
async
{
Future
<
void
>
loadData
()
async
{
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
String
?
userId
=
prefs
.
getString
(
"storeName"
);
String
?
userId
=
prefs
.
getString
(
"storeName"
);
//print(userId);
storesList
=
(
json
.
decode
(
userId
!)
as
List
<
dynamic
>)
storesList
=
(
json
.
decode
(
userId
!)
as
List
<
dynamic
>)
.
map
((
map
)
=>
map
[
'name'
]
as
String
)
.
map
((
map
)
=>
map
[
'name'
]
as
String
)
.
toList
();
.
toList
();
//print(storesList);
int
index
=
storesList
!.
indexWhere
((
item
)
=>
item
.
contains
(
isMeeters
));
int
index
=
storesList
!.
indexWhere
((
item
)
=>
item
.
contains
(
isMeeters
));
setState
(()
{
setState
(()
{
selectedDropdownItem
=
storesList
![
index
];
selectedDropdownItem
=
storesList
![
index
];
//print(selectedDropdownItem);
getData
(
selectedDropdownItem
!);
getData
(
selectedDropdownItem
!);
});
});
}
}
void
getData
(
String
name
)
async
{
void
getData
(
String
name
)
async
{
if
(
kDebugMode
)
{
print
(
"Second Class Hitting"
);
}
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
if
(
isInternetConnected
)
{
if
(
isInternetConnected
)
{
showDialog
(
showDialog
(
context:
context
,
context:
context
,
builder:
(
context
)
{
builder:
(
context
)
{
return
const
Center
(
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromARGB
(
255
,
29
,
20
,
34
)));
child:
CircularProgressIndicator
(
}
color:
Color
.
fromARGB
(
255
,
29
,
20
,
34
)));
);
});
final
respon
=
await
RemoteData
().
getIssueVideos
(
name
);
final
respon
=
await
RemoteData
().
getIssueVideos
(
name
);
Map
<
String
,
dynamic
>
responseMap
=
jsonDecode
(
respon
);
Map
<
String
,
dynamic
>
responseMap
=
jsonDecode
(
respon
);
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
...
@@ -87,13 +79,10 @@ class _IssueVideos extends State<IssueVideos> {
...
@@ -87,13 +79,10 @@ class _IssueVideos extends State<IssueVideos> {
setState
(()
{
setState
(()
{
notificationslist
;
notificationslist
;
});
});
//Navigator.of(context).pop();
}
else
{
}
else
{
//print('response $responseMap');
issue
=
Issue
.
fromJson
(
responseMap
);
issue
=
Issue
.
fromJson
(
responseMap
);
notificationslist
=
issue
!.
data
;
notificationslist
=
issue
!.
data
;
if
(
notificationslist
!.
isNotEmpty
)
{
if
(
notificationslist
!.
isNotEmpty
)
{
//Navigator.of(context).pop();
setState
(()
{
setState
(()
{
notificationslist
;
notificationslist
;
});
});
...
...
lib/Screens/NavBar.dart
View file @
b2fb65e0
...
@@ -3,8 +3,7 @@ import 'package:flutter/foundation.dart';
...
@@ -3,8 +3,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_sms/flutter_sms.dart'
;
import
'package:flutter_sms/flutter_sms.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
import
'package:shared_preferences/shared_preferences.dart'
show
SharedPreferences
;
show
SharedPreferences
;
import
'package:storemonitor/Screens/Chatboat.dart'
;
import
'package:storemonitor/Screens/Chatboat.dart'
;
import
'package:storemonitor/Screens/Constants.dart'
;
import
'package:storemonitor/Screens/Constants.dart'
;
import
'package:storemonitor/Screens/LoginPage.dart'
;
import
'package:storemonitor/Screens/LoginPage.dart'
;
...
@@ -28,7 +27,7 @@ class _NavBarState extends State<NavBar> {
...
@@ -28,7 +27,7 @@ class _NavBarState extends State<NavBar> {
Future
<
void
>
_getSharedPreferencesValues
()
async
{
Future
<
void
>
_getSharedPreferencesValues
()
async
{
SharedPreferences
sharedPreferences
=
await
SharedPreferences
.
getInstance
();
SharedPreferences
sharedPreferences
=
await
SharedPreferences
.
getInstance
();
setState
(()
{
setState
(()
{
name
=
sharedPreferences
.
getString
(
'userId'
);
name
=
sharedPreferences
.
getString
(
'userId'
);
access
=
sharedPreferences
.
getString
(
'access'
);
access
=
sharedPreferences
.
getString
(
'access'
);
});
});
}
}
...
@@ -38,12 +37,11 @@ class _NavBarState extends State<NavBar> {
...
@@ -38,12 +37,11 @@ class _NavBarState extends State<NavBar> {
super
.
initState
();
super
.
initState
();
_getSharedPreferencesValues
();
_getSharedPreferencesValues
();
isMeeters
=
widget
.
message
;
isMeeters
=
widget
.
message
;
names
=
widget
.
storeNames
names
=
widget
.
storeNames
.
substring
(
1
,
widget
.
storeNames
.
length
-
1
)
// Remove square brackets
.
substring
(
1
,
widget
.
storeNames
.
length
-
1
)
.
split
(
", "
)
// Split by comma and space
.
split
(
", "
)
.
map
((
store
)
=>
store
.
replaceAll
(
.
map
((
store
)
=>
store
.
replaceAll
(
RegExp
(
r'[^\w\s]+'
),
''
))
RegExp
(
r'[^\w\s]+'
),
''
))
// Remove non-alphanumeric characters
.
toList
();
.
toList
();
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
isMeeters
);
print
(
isMeeters
);
}
}
...
@@ -52,34 +50,17 @@ class _NavBarState extends State<NavBar> {
...
@@ -52,34 +50,17 @@ class _NavBarState extends State<NavBar> {
}
}
}
}
// void makePhoneCall(String phoneNumber) async {
// //FlutterPhoneDirectCaller.callNumber(phoneNumber);
// //launchUrl("tel:+99364921507");
// // final Uri phoneUri = Uri(scheme: "tel", path: phoneNumber);
// // try {
// // if (await canLaunchUrl(phoneUri)) await canLaunchUrl(phoneUri);
// // } catch (error) {
// // throw ("Cannot dial");
// // }
// final url = Uri.parse('tel:$phoneNumber');
// if (await canLaunchUrl(url)) {
// await launchUrl(url);
// } else {
// throw 'Could not launch $url';
// }
// }
void
makePhoneCall
(
String
phoneNumber
)
async
{
void
makePhoneCall
(
String
phoneNumber
)
async
{
final
Uri
launchUri
=
Uri
(
final
Uri
launchUri
=
Uri
(
scheme:
'tel'
,
scheme:
'tel'
,
path:
phoneNumber
,
path:
phoneNumber
,
);
);
if
(!
mounted
)
return
;
// Check if the widget is still mounted
if
(!
mounted
)
return
;
await
launchUrl
(
launchUri
);
await
launchUrl
(
launchUri
);
}
}
void
requestPhoneCallPermission
()
async
{
void
requestPhoneCallPermission
()
async
{
if
(!
mounted
)
return
;
// Check if the widget is still mounted
if
(!
mounted
)
return
;
PermissionStatus
status
=
await
Permission
.
microphone
.
request
();
PermissionStatus
status
=
await
Permission
.
microphone
.
request
();
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'Status
$status
'
);
print
(
'Status
$status
'
);
...
@@ -88,13 +69,10 @@ class _NavBarState extends State<NavBar> {
...
@@ -88,13 +69,10 @@ class _NavBarState extends State<NavBar> {
if
(
status
.
isGranted
)
{
if
(
status
.
isGranted
)
{
makePhoneCall
(
'8121007327'
);
makePhoneCall
(
'8121007327'
);
}
else
{
}
else
{
// Permission is denied or permanently denied, show an explanation to the user
if
(
status
.
isPermanentlyDenied
)
{
if
(
status
.
isPermanentlyDenied
)
{
// Show a dialog explaining why the permission is required and how to enable it
openAppSettings
();
openAppSettings
();
}
else
{
}
else
{
// Permission is denied but not permanently, show a rationale to the user
if
(!
mounted
)
return
;
if
(!
mounted
)
return
;
// Check if the widget is still mounted
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
SnackBar
(
content:
const
Text
(
'Phone call permission is required to make calls.'
),
content:
const
Text
(
'Phone call permission is required to make calls.'
),
...
@@ -112,7 +90,6 @@ class _NavBarState extends State<NavBar> {
...
@@ -112,7 +90,6 @@ class _NavBarState extends State<NavBar> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
//_getSharedPreferencesValues();
return
Drawer
(
return
Drawer
(
child:
Column
(
child:
Column
(
children:
[
children:
[
...
@@ -121,11 +98,11 @@ class _NavBarState extends State<NavBar> {
...
@@ -121,11 +98,11 @@ class _NavBarState extends State<NavBar> {
height:
120
,
height:
120
,
margin:
const
EdgeInsets
.
only
(
top:
0.0
),
margin:
const
EdgeInsets
.
only
(
top:
0.0
),
color:
const
Color
.
fromARGB
(
color:
const
Color
.
fromARGB
(
255
,
123
,
50
,
254
),
// Set the background color
255
,
123
,
50
,
254
),
child:
const
Text
(
child:
const
Text
(
'
\n\n\t\t\t\t
MENU'
,
// Text content
'
\n\n\t\t\t\t
MENU'
,
style:
TextStyle
(
style:
TextStyle
(
color:
Colors
.
white
,
// Set the text color
color:
Colors
.
white
,
fontSize:
22.0
,
fontSize:
22.0
,
fontWeight:
FontWeight
.
w400
),
fontWeight:
FontWeight
.
w400
),
textAlign:
TextAlign
.
left
,
textAlign:
TextAlign
.
left
,
...
@@ -154,18 +131,13 @@ class _NavBarState extends State<NavBar> {
...
@@ -154,18 +131,13 @@ class _NavBarState extends State<NavBar> {
),
),
children:
[
children:
[
ListTile
(
ListTile
(
title:
Text
(
'Name :
$name
'
,
title:
Text
(
'Name :
$name
'
,
style:
Constants
.
headerlistitems
),
style:
Constants
.
headerlistitems
),
//onTap: () => null,
),
),
const
Divider
(
const
Divider
(
height:
1
,
height:
1
,
),
),
ListTile
(
ListTile
(
//leading: const Icon(Icons.support_agent),
title:
Text
(
'Access Level :
$access
'
,
style:
Constants
.
headerlistitems
),
title:
Text
(
'Access Level :
$access
'
,
style:
Constants
.
headerlistitems
),
//onTap: () => null,
),
),
const
Divider
(
const
Divider
(
height:
1
,
height:
1
,
...
@@ -209,20 +181,19 @@ class _NavBarState extends State<NavBar> {
...
@@ -209,20 +181,19 @@ class _NavBarState extends State<NavBar> {
height:
1
,
height:
1
,
),
),
ListTile
(
ListTile
(
leading:
Image
.
asset
(
leading:
Image
.
asset
(
'assets/images/support.png'
,
'assets/images/support.png'
,
width:
32
,
width:
32
,
height:
32
,
height:
32
,
),
),
title:
const
Text
(
title:
const
Text
(
'Raise a ticket'
,
'Raise a ticket'
,
style:
Constants
.
headerlistitems
,
style:
Constants
.
headerlistitems
,
),
),
onTap:
()
=>
showDialog
(
onTap:
()
=>
showDialog
(
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
CustomDialog1
(
return
CustomDialog1
(
message:
isMeeters
,
names:
names
.
toString
());
message:
isMeeters
,
names:
names
.
toString
());
},
},
),
),
),
),
...
@@ -230,25 +201,22 @@ class _NavBarState extends State<NavBar> {
...
@@ -230,25 +201,22 @@ class _NavBarState extends State<NavBar> {
height:
1
,
height:
1
,
),
),
ListTile
(
ListTile
(
leading:
Image
.
asset
(
leading:
Image
.
asset
(
'assets/images/change_password.png'
,
'assets/images/change_password.png'
,
width:
32
,
width:
32
,
height:
32
,
height:
32
,
),
),
title:
const
Text
(
title:
const
Text
(
'Change Password'
,
'Change Password'
,
style:
Constants
.
headerlistitems
,
style:
Constants
.
headerlistitems
,
),
),
onTap:
()
{
onTap:
()
{
// Navigator.push(
showDialog
(
// context,
context:
context
,
// MaterialPageRoute(builder: (context) => const VideoApp()),
builder:
(
BuildContext
context
)
{
// );
return
const
CustomDialog
();
showDialog
(
}
context:
context
,
);
builder:
(
BuildContext
context
)
{
return
const
CustomDialog
();
});
},
},
),
),
const
Divider
(
const
Divider
(
...
@@ -475,10 +443,8 @@ class _CustomDialogState extends State<CustomDialog> {
...
@@ -475,10 +443,8 @@ class _CustomDialogState extends State<CustomDialog> {
Constants
(
'Change Password '
,
'Enter Confirm Password'
)
Constants
(
'Change Password '
,
'Enter Confirm Password'
)
.
showAlertDialog
(
context
,
false
);
.
showAlertDialog
(
context
,
false
);
}
else
{
}
else
{
if
(
_textFieldController2
.
text
==
if
(
_textFieldController2
.
text
==
_textFieldController3
.
text
)
{
_textFieldController3
.
text
)
{
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
if
(
isInternetConnected
)
{
if
(
isInternetConnected
)
{
showDialog
(
showDialog
(
context:
context
,
context:
context
,
...
@@ -509,33 +475,31 @@ class _CustomDialogState extends State<CustomDialog> {
...
@@ -509,33 +475,31 @@ class _CustomDialogState extends State<CustomDialog> {
Constants
(
'Change Password'
,
status
)
Constants
(
'Change Password'
,
status
)
.
showAlertDialog
(
context
,
true
);
.
showAlertDialog
(
context
,
true
);
}
}
//login(_email.text, _pass.text);
//login(_email.text, _pass.text);
//Navigator.pop(context);
//Navigator.pop(context);
// Navigator.pop(context);
// Navigator.pop(context);
}
else
{
}
else
{
Constants
.
dialogMessage
(
context
,
'Change Password'
,
Constants
.
dialogMessage
(
context
,
'Change Password'
,
'Check your internetconnection'
);
'Check your internetconnection'
);
}
}
}
else
{
}
else
{
Constants
.
dialogMessage
(
context
,
'Change Password'
,
Constants
.
dialogMessage
(
context
,
'Change Password'
,
'Must be Same New and Confirm Password'
);
'Must be Same New and Confirm Password'
);
}
}
}
}
},
},
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
<
Color
>(
backgroundColor:
WidgetStateProperty
.
all
<
Color
>(
const
Color
.
fromARGB
(
255
,
62
,
43
,
75
)),
const
Color
.
fromARGB
(
255
,
62
,
43
,
75
)),
shape:
WidgetStateProperty
.
all
<
RoundedRectangleBorder
>(
shape:
MaterialStateProperty
.
all
<
RoundedRectangleBorder
>(
RoundedRectangleBorder
(
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
borderRadius:
BorderRadius
.
circular
(
5.0
),
//side: BorderSide(color: Colors.red)
//side: BorderSide(color: Colors.red)
)
))),
)
),
child:
const
Text
(
child:
const
Text
(
'UPDATE'
,
'UPDATE'
,
style:
Constants
.
fontStyle
,
style:
Constants
.
fontStyle
,
),
),
),
),
),
),
],
],
),
),
...
@@ -568,7 +532,6 @@ class _customdialog1state extends State<CustomDialog1> {
...
@@ -568,7 +532,6 @@ class _customdialog1state extends State<CustomDialog1> {
final
TextEditingController
_textFieldController3
=
TextEditingController
();
final
TextEditingController
_textFieldController3
=
TextEditingController
();
String
?
selectedDropdownItem
;
String
?
selectedDropdownItem
;
late
String
message
;
late
String
message
;
List
<
String
>?
storesList
;
List
<
String
>?
storesList
;
@override
@override
...
@@ -780,17 +743,7 @@ class _customdialog1state extends State<CustomDialog1> {
...
@@ -780,17 +743,7 @@ class _customdialog1state extends State<CustomDialog1> {
// Show a dialog explaining why the permission is required and how to enable it
// Show a dialog explaining why the permission is required and how to enable it
openAppSettings
();
openAppSettings
();
}
else
{
}
else
{
// Permission is denied b
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
//ut not permanently, show a rationale to the user
// var status = await Permission.sms.request();
// if (status.isGranted) {
// requestSmsPermission(message, reciepts);
// } else {
// // Permission denied
// print('SMS permission denied.');
// }
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
SnackBar
(
content:
const
Text
(
'SMS permission is required to send messages.'
),
content:
const
Text
(
'SMS permission is required to send messages.'
),
action:
SnackBarAction
(
action:
SnackBarAction
(
...
...
lib/Screens/SignUp.dart
View file @
b2fb65e0
...
@@ -62,6 +62,7 @@ class _SignUpState extends State<SignUp> {
...
@@ -62,6 +62,7 @@ class _SignUpState extends State<SignUp> {
}
}
String
jsonStr
=
json
.
encode
(
normalArray
);
String
jsonStr
=
json
.
encode
(
normalArray
);
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
print
(
'User Level :
$userResponse
.level'
);
Constants
.
saveLoginCredentials
(
userResponse
.
empName
,
_email
.
text
,
Constants
.
saveLoginCredentials
(
userResponse
.
empName
,
_email
.
text
,
jsonStr
,
''
,
userResponse
.
level
,
true
);
jsonStr
,
''
,
userResponse
.
level
,
true
);
Navigator
.
pushReplacement
(
Navigator
.
pushReplacement
(
...
...
lib/Services/RemoteData.dart
View file @
b2fb65e0
...
@@ -5,58 +5,54 @@ import 'dart:io';
...
@@ -5,58 +5,54 @@ import 'dart:io';
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
class
RemoteData
{
class
RemoteData
{
String
BaseUrl
=
'http://vaman.plutokm.com/'
;
String
BaseUrl
=
'http://vaman.plutokm.com/'
;
String
LoginUrl
=
'http://vaman.plutokm.com/login_test'
;
String
LoginUrl
=
'http://vaman.plutokm.com/login_test'
;
//String AlertSummary = 'http://vaman.plutokm.com/alert_summary_flutter';
String
AlertSummary
=
'http://vaman.plutokm.com/alert_summary_flutter'
;
String
AlertSummary
=
'http://vaman.plutokm.com/alert_summary_flutter'
;
String
Review
=
'http://vaman.plutokm.com/alerts_new'
;
String
Review
=
'http://vaman.plutokm.com/alerts_new'
;
String
EmpReport
=
'http://vaman.plutokm.com/regstatusreport'
;
String
EmpReport
=
'http://vaman.plutokm.com/regstatusreport'
;
String
ImageUrl
=
'http://vaman.plutokm.com/flutter'
;
String
ImageUrl
=
'http://vaman.plutokm.com/flutter'
;
String
UploadVideo
=
'http://vaman.plutokm.com/registeration_video'
;
String
UploadVideo
=
'http://vaman.plutokm.com/registeration_video'
;
String
feedback
=
'http://vaman.plutokm.com/api/mx_feedback_new'
;
String
feedback
=
'http://vaman.plutokm.com/api/mx_feedback_new'
;
String
AuditData
=
'http://vaman.plutokm.com/audit_page'
;
String
AuditData
=
'http://vaman.plutokm.com/audit_page'
;
String
AuditupdateData
=
'http://vaman.plutokm.com/audit_update'
;
//String AuditData = 'http://192.168.65.111:8088/audit_page';
String
ChangePassword
=
'http://vaman.plutokm.com/changePassword'
;
//String AuditupdateData = 'http://192.168.65.111:8088/audit_update';
String
FootFallVerify
=
'http://vaman.plutokm.com/footfall_verify_flutter'
;
String
AuditupdateData
=
'http://vaman.plutokm.com/audit_update'
;
String
EmployeeStatus
=
'http://vaman.plutokm.com/employees_status'
;
String
ChangePassword
=
'http://vaman.plutokm.com/changePassword'
;
String
DepartmentSearch
=
'http://vaman.plutokm.com/employees_status_department_instore'
;
String
FootFallVerify
=
'http://vaman.plutokm.com/footfall_verify_flutter'
;
String
IssueVideos
=
'http://vaman.plutokm.com/video_alert_page'
;
String
EmployeeStatus
=
'http://vaman.plutokm.com/employees_status'
;
String
UpdateIssueVideos
=
'http://vaman.plutokm.com/update_video_alert'
;
String
DepartmentSearch
=
String
UpdateIssueVideos1
=
'http://vaman.plutokm.com/L2_update_video_alert'
;
'http://vaman.plutokm.com/employees_status_department_instore'
;
String
Insights
=
'http://vaman.plutokm.com/get_insights'
;
String
IssueVideos
=
'http://vaman.plutokm.com/video_alert_page'
;
String
Type
=
"Content-Type"
;
String
UpdateIssueVideos
=
'http://vaman.plutokm.com/update_video_alert'
;
String
App_json
=
"application/json"
;
String
UpdateIssueVideos1
=
'http://vaman.plutokm.com/L2_update_video_alert'
;
String
speechtotext
=
'http://192.168.65.112:5113/mobile_response2/'
;
String
Insights
=
'http://vaman.plutokm.com/get_insights'
;
String
pendingAlerts
=
'http://vaman.plutokm.com/pending_alerts'
;
String
Type
=
"Content-Type"
;
String
speechtotext1
=
'http://vaman.plutokm.com/llama_tool_1/'
;
String
App_json
=
"application/json"
;
String
speechtotext2
=
'http://vaman.plutokm.com/llama_tool_2/'
;
String
speechtotext
=
'http://192.168.65.112:5113/mobile_response2/'
;
String
speechtotext3
=
'http://vaman.plutokm.com/llama_tool_3/'
;
String
pendingAlerts
=
'http://vaman.plutokm.com/pending_alerts'
;
String
speechtotext1
=
'http://vaman.plutokm.com/llama_tool_1/'
;
String
speechtotext2
=
'http://vaman.plutokm.com/llama_tool_2/'
;
String
speechtotext3
=
'http://vaman.plutokm.com/llama_tool_3/'
;
// Stores List Request GET Method
// Stores List Request GET Method
// Login Request POST Method
// Login Request POST Method
Future
<
String
>
getLoginRequest
(
Future
<
String
>
getLoginRequest
(
String
loginid
,
String
pass
,
String
token
)
async
{
String
loginid
,
String
pass
,
String
token
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'login_id'
:
loginid
,
'login_id'
:
loginid
,
'password'
:
pass
,
'password'
:
pass
,
'token'
:
token
,
'token'
:
token
,
'os'
:
Platform
.
isAndroid
'os'
:
Platform
.
isAndroid
?
'Android'
?
'Android'
:
Platform
.
isIOS
:
Platform
.
isIOS
?
'IOS'
?
'IOS'
:
'Unknown'
,
:
'Unknown'
,
};
};
if
(
kDebugMode
)
{
if
(
kDebugMode
){
print
(
body
);
print
(
body
);
}
}
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
LoginUrl
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
LoginUrl
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
print
(
res
.
body
);
if
(
kDebugMode
)
{
print
(
res
.
body
);
}
return
res
.
body
;
return
res
.
body
;
}
else
{
}
else
{
throw
Exception
(
'Status code was wrong
$res
.statusCode'
);
throw
Exception
(
'Status code was wrong
$res
.statusCode'
);
...
@@ -64,7 +60,6 @@ class RemoteData {
...
@@ -64,7 +60,6 @@ class RemoteData {
}
}
Future
<
String
>
getVoiceResponse
(
File
text
,
String
?
userid
)
async
{
Future
<
String
>
getVoiceResponse
(
File
text
,
String
?
userid
)
async
{
var
header
=
{
Type:
App_json
};
var
res
=
''
;
var
res
=
''
;
var
url
=
''
;
var
url
=
''
;
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
...
@@ -76,14 +71,12 @@ class RemoteData {
...
@@ -76,14 +71,12 @@ class RemoteData {
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
url
);
print
(
url
);
}
}
try
{
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
url
));
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
url
));
request
.
files
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
text
.
path
));
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
text
.
path
));
//request.files.add(http.MultipartFile.fromString('body_image_path', image));
//request.files.add(http.MultipartFile.fromString('body_image_path', image));
//request.fields['style_code'] = stylecode;
//request.fields['style_code'] = stylecode;
var
response
=
await
request
.
send
();
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
print
(
'Response :
$responseString
'
);
...
@@ -96,8 +89,7 @@ class RemoteData {
...
@@ -96,8 +89,7 @@ class RemoteData {
}
}
// var response = await http.post(
// var response = await http.post(
// Uri.parse(url),
// Uri.parse(url),
// headers: header,
// headers: header);
// );
// if (kDebugMode) {
// if (kDebugMode) {
// print(response.statusCode);
// print(response.statusCode);
// }
// }
...
@@ -136,7 +128,6 @@ class RemoteData {
...
@@ -136,7 +128,6 @@ class RemoteData {
print
(
url
);
print
(
url
);
}
}
}
}
var
response
=
await
http
.
post
(
var
response
=
await
http
.
post
(
Uri
.
parse
(
url
),
Uri
.
parse
(
url
),
headers:
header
,
headers:
header
,
...
@@ -154,14 +145,13 @@ class RemoteData {
...
@@ -154,14 +145,13 @@ class RemoteData {
return
res
;
return
res
;
}
}
Future
<
int
>
getFeedbackStatus
(
String
notificationId
,
String
userId
,
Future
<
int
>
getFeedbackStatus
(
String
notificationId
,
String
userId
,
String
feed
,
String
comments
)
async
{
String
feed
,
String
comments
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'NotificationID'
:
notificationId
,
'NotificationID'
:
notificationId
,
'user_id'
:
userId
,
'user_id'
:
userId
,
'verified'
:
'Verified'
,
'verified'
:
'Verified'
,
'feedback'
:
feed
,
'feedback'
:
feed
,
'comments'
:
comments
,
'comments'
:
comments
,
};
};
//print(body);
//print(body);
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
...
@@ -182,29 +172,25 @@ class RemoteData {
...
@@ -182,29 +172,25 @@ class RemoteData {
//return 200;
//return 200;
}
}
Future
<
String
?>
empuploadVideo
(
Future
<
String
?>
empuploadVideo
(
File
imagepath
,
String
filename
,
String
storename
)
async
{
File
imagepath
,
String
filename
,
String
storename
)
async
{
try
{
try
{
final
request
=
http
.
MultipartRequest
(
'Post'
,
Uri
.
parse
(
'http://192.168.65.111:8080/zoom'
));
final
request
=
http
.
MultipartRequest
(
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'video_path'
,
imagepath
.
path
));
'Post'
,
Uri
.
parse
(
'http://192.168.65.111:8080/zoom'
));
request
.
fields
[
'empid'
]
=
'78'
;
request
.
files
request
.
fields
[
'store_name'
]
=
'KLM AMEERPET'
;
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'video_path'
,
imagepath
.
path
));
request
.
fields
[
'file'
]
=
filename
;
request
.
fields
[
'empid'
]
=
'78'
;
var
response
=
await
request
.
send
();
request
.
fields
[
'store_name'
]
=
'KLM AMEERPET'
;
var
responseString
=
await
response
.
stream
.
bytesToString
();
request
.
fields
[
'file'
]
=
filename
;
if
(
response
.
statusCode
==
200
)
{
var
response
=
await
request
.
send
();
return
responseString
;
var
responseString
=
await
response
.
stream
.
bytesToString
();
}
else
{
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
return
responseString
;
}
}
else
{
return
responseString
;
}
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
"Error in upload video
$e
"
);
print
(
"Error in upload video
$e
"
);
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -213,7 +199,9 @@ class RemoteData {
...
@@ -213,7 +199,9 @@ class RemoteData {
'store'
:
store
,
'store'
:
store
,
'date'
:
date
,
'date'
:
date
,
};
};
print
(
body
);
if
(
kDebugMode
)
{
print
(
body
);
}
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
pendingAlerts
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
pendingAlerts
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
...
@@ -229,11 +217,11 @@ class RemoteData {
...
@@ -229,11 +217,11 @@ class RemoteData {
Future
<
String
>
getInsights
(
String
region
,
String
store
,
String
date
)
async
{
Future
<
String
>
getInsights
(
String
region
,
String
store
,
String
date
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'region'
:
region
,
'region'
:
region
,
'store'
:
store
,
'store'
:
store
,
'date'
:
date
,
'date'
:
date
,
'os'
:
Platform
.
isAndroid
'os'
:
Platform
.
isAndroid
?
'Android'
?
'Android'
:
Platform
.
isIOS
:
Platform
.
isIOS
?
'IOS'
?
'IOS'
:
'Unknown'
,
:
'Unknown'
,
};
};
...
@@ -241,8 +229,7 @@ class RemoteData {
...
@@ -241,8 +229,7 @@ class RemoteData {
print
(
body
);
print
(
body
);
}
}
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
Insights
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
Insights
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
return
res
.
body
;
return
res
.
body
;
}
else
{
}
else
{
...
@@ -252,19 +239,23 @@ class RemoteData {
...
@@ -252,19 +239,23 @@ class RemoteData {
// Alert Summary Post Request
// Alert Summary Post Request
Future
<
String
>
geAlertSummary
(
String
store
,
String
date
)
async
{
Future
<
String
>
geAlertSummary
(
String
store
,
String
date
,
String
userid
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'store'
:
store
,
'store'
:
store
,
'date'
:
date
,
'date'
:
date
,
'user_id'
:
userid
,
'platform'
:
Platform
.
isAndroid
'platform'
:
Platform
.
isAndroid
?
'Android'
?
'Android'
:
Platform
.
isIOS
:
Platform
.
isIOS
?
'IOS'
?
'IOS'
:
'Unknown'
,
:
'Unknown'
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
AlertSummary
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
AlertSummary
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
kDebugMode
)
{
print
(
res
.
statusCode
);
}
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
return
res
.
body
;
return
res
.
body
;
}
else
{
}
else
{
...
@@ -272,16 +263,14 @@ class RemoteData {
...
@@ -272,16 +263,14 @@ class RemoteData {
}
}
}
}
Future
<
http
.
Response
?>
getFootFallVerify
(
Future
<
http
.
Response
?>
getFootFallVerify
(
String
store
,
String
hours
,
String
selectdate
)
async
{
String
store
,
String
hours
,
String
selectdate
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'store'
:
store
,
'store'
:
store
,
'hours'
:
hours
,
'hours'
:
hours
,
'date'
:
selectdate
,
'date'
:
selectdate
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
FootFallVerify
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
FootFallVerify
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
res
.
body
);
print
(
res
.
body
);
...
@@ -311,8 +300,7 @@ class RemoteData {
...
@@ -311,8 +300,7 @@ class RemoteData {
}
}
}
}
Future
<
http
.
Response
?>
getDepartmentSearch
(
Future
<
http
.
Response
?>
getDepartmentSearch
(
String
store
,
String
dept
,
String
empid
)
async
{
String
store
,
String
dept
,
String
empid
)
async
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
store
);
print
(
store
);
}
}
...
@@ -322,8 +310,7 @@ class RemoteData {
...
@@ -322,8 +310,7 @@ class RemoteData {
'login_id'
:
empid
,
'login_id'
:
empid
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
DepartmentSearch
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
DepartmentSearch
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
res
.
body
);
print
(
res
.
body
);
...
@@ -334,8 +321,7 @@ class RemoteData {
...
@@ -334,8 +321,7 @@ class RemoteData {
}
}
}
}
Future
<
String
>
getChangePassword
(
Future
<
String
>
getChangePassword
(
String
oldpass
,
String
newpass
,
String
userid
)
async
{
String
oldpass
,
String
newpass
,
String
userid
)
async
{
//print(date);
//print(date);
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'old_password'
:
oldpass
,
'old_password'
:
oldpass
,
...
@@ -365,7 +351,6 @@ class RemoteData {
...
@@ -365,7 +351,6 @@ class RemoteData {
var
res
=
await
client
.
post
(
Uri
.
parse
(
AuditData
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
AuditData
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
//loginResponseFromJson(res as String);
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
res
.
body
);
print
(
res
.
body
);
}
}
...
@@ -375,8 +360,7 @@ class RemoteData {
...
@@ -375,8 +360,7 @@ class RemoteData {
}
}
}
}
Future
<
String
>
getWeeklyUpdate
(
Future
<
String
>
getWeeklyUpdate
(
String
userid
,
String
store
,
List
<
Map
<
String
,
dynamic
>>
array
)
async
{
String
userid
,
String
store
,
List
<
Map
<
String
,
dynamic
>>
array
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'userid'
:
userid
,
'userid'
:
userid
,
'store'
:
store
,
'store'
:
store
,
...
@@ -400,19 +384,17 @@ class RemoteData {
...
@@ -400,19 +384,17 @@ class RemoteData {
'key'
:
path
,
'key'
:
path
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
ImageUrl
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
ImageUrl
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
var
jsonMap
=
jsonDecode
(
res
.
body
);
var
jsonMap
=
jsonDecode
(
res
.
body
);
return
jsonMap
[
'url'
];
return
jsonMap
[
'url'
];
}
}
Future
<
String
>
getUserReport
(
String
storeName
)
async
{
Future
<
String
>
getUserReport
(
String
storeName
)
async
{
Map
<
String
,
dynamic
>
body
=
{
Map
<
String
,
dynamic
>
body
=
{
'STORE'
:
storeName
,
'STORE'
:
storeName
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
EmpReport
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
EmpReport
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
return
res
.
body
;
return
res
.
body
;
}
else
{
}
else
{
...
@@ -461,14 +443,13 @@ class RemoteData {
...
@@ -461,14 +443,13 @@ class RemoteData {
'comment'
:
comment
,
'comment'
:
comment
,
};
};
var
client
=
http
.
Client
();
var
client
=
http
.
Client
();
var
res
=
await
client
.
post
(
Uri
.
parse
(
UpdateIssueVideos1
),
var
res
=
await
client
.
post
(
Uri
.
parse
(
UpdateIssueVideos1
),
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
headers:
{
Type:
App_json
},
body:
json
.
encode
(
body
));
if
(
kDebugMode
){
if
(
kDebugMode
)
{
print
(
'Status Code :
$res
.statusCode'
);
print
(
'Status Code :
$res
.statusCode'
);
}
}
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
return
res
.
body
;
return
res
.
body
;
}
else
{
}
else
{
throw
Exception
(
res
.
statusCode
);
throw
Exception
(
res
.
statusCode
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment