Enhancements

main_design2.0
zaid_daoud 2 years ago
parent 6caab58171
commit 66100c36a4

@ -12,6 +12,7 @@ class URLs {
set host(String value) => _host = value; set host(String value) => _host = value;
// static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/Files/DownloadFile?fileName=$file");
static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/attachment/$file"); static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/attachment/$file");
// API Routes // API Routes

@ -457,12 +457,12 @@ class AssignedEmployee {
class CallSiteContactPerson { class CallSiteContactPerson {
int id; int id;
Null employeeCode; String employeeCode;
String name; String name;
String telephone; String telephone;
String job; String job;
String email; String email;
Null land; String land;
String contactUserId; String contactUserId;
CallSiteContactPerson({this.id, this.employeeCode, this.name, this.telephone, this.job, this.email, this.land, this.contactUserId}); CallSiteContactPerson({this.id, this.employeeCode, this.name, this.telephone, this.job, this.email, this.land, this.contactUserId});

@ -155,11 +155,6 @@ class ServiceReport {
} }
Future<bool> validate() async { Future<bool> validate() async {
print("visitDate:$visitDate");
print("equipmentStatus:${equipmentStatus?.toMap()}");
print("callLastSituation:${callLastSituation?.toMap()}");
print("parts:$parts");
print("reason:${reason?.toMap()}");
if (visitDate == null) { if (visitDate == null) {
await Fluttertoast.showToast(msg: "Visit Date Required"); await Fluttertoast.showToast(msg: "Visit Date Required");
return false; return false;

@ -185,8 +185,8 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
margin: const EdgeInsets.symmetric(vertical: 16), margin: const EdgeInsets.symmetric(vertical: 16),
decoration: BoxDecoration(color: AColors.grey, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: [ decoration: BoxDecoration(color: AColors.grey, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: const [
const BoxShadow( BoxShadow(
color: AColors.grey, color: AColors.grey,
offset: Offset(0, -1), offset: Offset(0, -1),
) )
@ -195,70 +195,70 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Report type and Reasons // Report type and Reasons
Row( // Row(
children: [ // children: [
// Report Status // // Report Status
// Expanded( // // Expanded(
// child: Column( // // child: Column(
// crossAxisAlignment: CrossAxisAlignment.start, // // crossAxisAlignment: CrossAxisAlignment.start,
// children: [ // // children: [
// ASubTitle(_subtitle.reportType), // // ASubTitle(_subtitle.reportType),
// _validate && _serviceReport.type == null // // _validate && _serviceReport.type == null
// ? ASubTitle( // // ? ASubTitle(
// _subtitle.requiredWord, // // _subtitle.requiredWord,
// color: Colors.red, // // color: Colors.red,
// ) // // )
// : const SizedBox.shrink(), // // : const SizedBox.shrink(),
// const SizedBox( // // const SizedBox(
// height: 4, // // height: 4,
// ), // // ),
// ServiceReportTypeMenu( // // ServiceReportTypeMenu(
// initialValue: _serviceReport.type, // // initialValue: _serviceReport.type,
// onSelect: (status) { // // onSelect: (status) {
// _serviceReport.type = status; // // _serviceReport.type = status;
// }, // // },
// ), // // ),
// ], // // ],
// ), // // ),
// ), // // ),
// const SizedBox( // // const SizedBox(
// width: 8, // // width: 8,
// ), // // ),
// visit date // // visit date
Expanded( // Expanded(
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
ASubTitle(_subtitle.visitDate), // ASubTitle(_subtitle.visitDate),
_validate && _serviceReport.visitDate == null // _validate && _serviceReport.visitDate == null
? ASubTitle( // ? ASubTitle(
_subtitle.requiredWord, // _subtitle.requiredWord,
color: Colors.red, // color: Colors.red,
) // )
: const SizedBox.shrink(), // : const SizedBox.shrink(),
Row( // Row(
children: [ // children: [
Expanded( // Expanded(
child: ADatePicker( // child: ADatePicker(
date: _serviceReport.visitDate, // date: _serviceReport.visitDate,
from: DateTime.now().subtract(const Duration(days: 365)), // from: DateTime.now().subtract(const Duration(days: 365)),
to: DateTime.now().add(const Duration(days: 365)), // to: DateTime.now().add(const Duration(days: 365)),
onDatePicker: (date) { // onDatePicker: (date) {
_serviceReport.visitDate = date; // _serviceReport.visitDate = date;
setState(() {}); // setState(() {});
}, // },
), // ),
), // ),
], // ],
), // ),
], // ],
), // ),
), // ),
], // ],
), // ),
const SizedBox( // const SizedBox(
height: 8, // height: 8,
), // ),
// device sn // device sn
Visibility( Visibility(
visible: widget.request.deviceSerialNumber == null, visible: widget.request.deviceSerialNumber == null,
@ -400,7 +400,7 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
ASubTitle("Return to Service"), const ASubTitle("Return to Service"),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -721,7 +721,7 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
}, },
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
ASubTitle(_subtitle.workPreformed), const ASubTitle("Solutions"),
const SizedBox(height: 4), const SizedBox(height: 4),
ATextFormField( ATextFormField(
initialValue: _serviceReport?.workPreformed, initialValue: _serviceReport?.workPreformed,
@ -930,7 +930,7 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
//const SizedBox(height: 8,), //const SizedBox(height: 8,),
const SizedBox(height: 8), const SizedBox(height: 8),
ASubTitle("technical comment"), const ASubTitle("Technical comment"),
const SizedBox(height: 4), const SizedBox(height: 4),
ATextFormField( ATextFormField(
initialValue: _serviceReport?.comment, initialValue: _serviceReport?.comment,

@ -31,26 +31,28 @@ class _FutureServiceReportState extends State<FutureServiceReport> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context); _userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context); _settingProvider = Provider.of<SettingProvider>(context);
Subtitle _subtitle = AppLocalization.of(context).subtitle; Subtitle subtitle = AppLocalization.of(context).subtitle;
ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: _subtitle); ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: subtitle);
return Scaffold( return Scaffold(
body: FutureBuilder<ServiceReport>( body: FutureBuilder<ServiceReport>(
future: ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: _subtitle), future: ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: subtitle),
builder: (BuildContext context, AsyncSnapshot<ServiceReport> snapshot) { builder: (BuildContext context, AsyncSnapshot<ServiceReport> snapshot) {
if (snapshot.hasError) if (snapshot.hasError) {
return FailedLoading( return FailedLoading(
message: snapshot.error.toString(), message: snapshot.error.toString(),
onReload: () { onReload: () {
setState(() {}); setState(() {});
}, },
); );
if (snapshot.hasData) { }
if (snapshot.connectionState == ConnectionState.done) {
print("object");
return EditServiceReport( return EditServiceReport(
report: snapshot.data, report: snapshot.data,
request: widget.request, request: widget.request,
); );
} }
return Center(child: ALoading()); return const Center(child: ALoading());
}, },
), ),
); );

@ -79,7 +79,7 @@ class GasRefillItem extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Visit Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)), Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)), Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
], ],
), ),

Loading…
Cancel
Save