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