2026-09-30 09:13:45 +05:30
import 'dart:typed_data' ;
import 'package:flutter/material.dart' ;
import 'package:image_picker/image_picker.dart' ;
import '../../Utils/image_constant.dart' ;
import '../../Utils/size_utils.dart' ;
2026-10-03 12:12:31 +05:30
import '../../l10n/app_localizations.dart' ;
2026-09-30 09:13:45 +05:30
import '../../providers/token_manager.dart' ;
import '../../theme/app_style.dart' ;
import '../../widgets/app_bar/appbar_image.dart' ;
import '../../widgets/app_bar/appbar_title.dart' ;
import '../../widgets/app_bar/custom_app_bar.dart' ;
import '../../widgets/custom_button.dart' ;
import '../../widgets/custom_text_form_field.dart' ;
import 'SystemParameterApiService.dart' ;
class SysParameter extends StatefulWidget {
final int sysparameter = 1 ;
// const SysParameter({Key? key, required this.sysparameter}) : super(key: key);
@ override
_SysParameterState createState () => _SysParameterState ();
}
class _SysParameterState extends State < SysParameter > {
TextEditingController schedulerTimerController = TextEditingController ();
TextEditingController leaseTaxCodeController = TextEditingController ();
TextEditingController vesselConfirmationController = TextEditingController ();
TextEditingController rowToDisplayController = TextEditingController ();
TextEditingController linkToDisplayController = TextEditingController ();
TextEditingController rowToAddController = TextEditingController ();
TextEditingController lovRowToDisplayController = TextEditingController ();
TextEditingController lovLinkToDisplayController = TextEditingController ();
TextEditingController oidServerNameController = TextEditingController ();
TextEditingController oidBaseController = TextEditingController ();
TextEditingController oidAdminUserController = TextEditingController ();
TextEditingController oidServerPortController = TextEditingController ();
TextEditingController userDefaultGroupController = TextEditingController ();
TextEditingController defaultDepartmentController = TextEditingController ();
TextEditingController defaultPositionController = TextEditingController ();
TextEditingController singleChargeController = TextEditingController ();
TextEditingController firstDayOfWeekController = TextEditingController ();
TextEditingController hourPerShiftController = TextEditingController ();
TextEditingController cnBillingFrequencyController = TextEditingController ();
TextEditingController billingDepartmentCodeController = TextEditingController ();
TextEditingController basePriceListController = TextEditingController ();
TextEditingController nonContainerServiceController = TextEditingController ();
TextEditingController ediMaeSchedulerController = TextEditingController ();
TextEditingController ediSchedulerController = TextEditingController ();
TextEditingController lastController = TextEditingController ();
TextEditingController companynameController = TextEditingController ();
bool isRegistrationAllow = false ;
Map < String , dynamic > formData = {};
var logoname ;
var logopath ;
SystemParameterApiService apiService = SystemParameterApiService ();
String ? uploadimageurl ;
Uint8List ? _imageBytes ; // Uint8List to store the image data
String ? _imageFileName ;
late Map < String , dynamic > sysparameter ;
@ override
void initState () {
_loadParameters ();
}
Future < void > _loadParameters () async {
final token = await TokenManager . getToken ();
try {
final projectData = await apiService . getsystemparameters ( token ! , widget . sysparameter );
setState (() {
sysparameter = projectData ;
lastController . text = "('SYSADMIN','ITSUPPORTMSC')" ;
schedulerTimerController . text = sysparameter [ 'schedulerTime' ]. toString () ?? '' ;
isRegistrationAllow = sysparameter [ 'regitrationAllowed' ] ?? false ;
leaseTaxCodeController . text = sysparameter [ 'leaseTaxCode' ]. toString () ?? '' ;
vesselConfirmationController . text = sysparameter [ 'vesselConfProcessLimit' ]. toString () ?? '' ;
rowToDisplayController . text = sysparameter [ 'rowToDisplay' ]. toString () ?? '' ;
linkToDisplayController . text = sysparameter [ 'linkToDisplay' ]. toString () ?? '' ;
rowToAddController . text = sysparameter [ 'rowToAdd' ]. toString () ?? '' ;
lovRowToDisplayController . text = sysparameter [ 'lovRowToDisplay' ]. toString () ?? '' ;
lovLinkToDisplayController . text = sysparameter [ 'lovLinkToDisplay' ]. toString () ?? '' ;
oidServerNameController . text = sysparameter [ 'oidserverName' ]. toString () ?? '' ;
oidBaseController . text = sysparameter [ 'oidBase' ]. toString () ?? '' ;
oidAdminUserController . text = sysparameter [ 'oidAdminUser' ]. toString () ?? '' ;
oidServerPortController . text = sysparameter [ 'oidServerPort' ]. toString () ?? '' ;
userDefaultGroupController . text = sysparameter [ 'userDefaultGroup' ]. toString () ?? '' ;
defaultDepartmentController . text = sysparameter [ 'defaultDepartment' ]. toString () ?? '' ;
defaultPositionController . text = sysparameter [ 'defaultPosition' ]. toString () ?? '' ;
singleChargeController . text = sysparameter [ 'singleCharge' ]. toString () ?? '' ;
firstDayOfWeekController . text = sysparameter [ 'firstDayOftheWeek' ]. toString () ?? '' ;
hourPerShiftController . text = sysparameter [ 'hourPerShift' ]. toString () ?? '' ;
cnBillingFrequencyController . text = sysparameter [ 'cnBillingFrequency' ]. toString () ?? '' ;
billingDepartmentCodeController . text = sysparameter [ 'billingDepartmentCode' ]. toString () ?? '' ;
basePriceListController . text = sysparameter [ 'basePriceList' ]. toString () ?? '' ;
nonContainerServiceController . text = sysparameter [ 'nonContainerServiceOrder' ]. toString () ?? '' ;
ediMaeSchedulerController . text = sysparameter [ 'ediMaeSchedulerONOFF' ]. toString () ?? '' ;
ediSchedulerController . text = sysparameter [ 'ediSchedulerONOFF' ]. toString () ?? '' ;
lastController . text = "('SYSADMIN','ITSUPPORTMSC')" ?? '' ;
companynameController . text = sysparameter [ 'company_Display_Name' ]. toString () ?? '' ;
print ( sysparameter [ 'schedulerTime' ]);
});
} catch ( e ) {
print ( 'Failed to load projects: $ e ' );
}
}
Future < void > _uploadImageFile () async {
final imagePicker = ImagePicker ();
try {
final pickedImage =
await imagePicker . pickImage ( source : ImageSource . gallery );
if ( pickedImage != null ) {
final imageBytes = await pickedImage . readAsBytes ();
setState (() {
_imageBytes = imageBytes ;
_imageFileName = pickedImage . name ; // Store the file name
});
}
_submitImage ();
} catch ( e ) {
print ( e );
}
}
Future < void > _submitImage () async {
if ( _imageBytes == null ) {
// Show an error message if no image is selected
showDialog (
context: context ,
builder: ( BuildContext context ) {
return AlertDialog (
2026-10-03 12:12:31 +05:30
title: Text ( AppLocalizations . of ( context ) ! . error ),
content: Text (
AppLocalizations . of ( context ) ! . selectImage ),
2026-09-30 09:13:45 +05:30
actions: [
TextButton (
2026-10-03 12:12:31 +05:30
child: Text ( AppLocalizations . of ( context ) ! . ok ),
2026-09-30 09:13:45 +05:30
onPressed: () {
Navigator . of ( context ). pop ();
},
),
],
);
},
);
return ;
}
if ( _imageFileName == null ) {
// Handle the case where _imageFileName is null (no file name provided)
print ( 'File name is missing.' );
return ;
}
try {
final token = await TokenManager . getToken ();
Map < String , dynamic > fileuploadeddata = await apiService . createFile ( _imageBytes ! , _imageFileName ! , token ! );
logoname = fileuploadeddata [ 'image_name' ];
logopath = fileuploadeddata [ 'image_path' ];
} catch ( e ) {
showDialog (
context: context ,
builder: ( BuildContext context ) {
return AlertDialog (
2026-10-03 12:12:31 +05:30
title: Text ( AppLocalizations . of ( context ) ! . error ),
content: Text ( AppLocalizations . of ( context ) !
. failedUploadImage ( e . toString ())),
2026-09-30 09:13:45 +05:30
actions: [
TextButton (
2026-10-03 12:12:31 +05:30
child: Text ( AppLocalizations . of ( context ) ! . ok ),
2026-09-30 09:13:45 +05:30
onPressed: () {
Navigator . of ( context ). pop ();
},
),
],
);
},
);
}
}
@ override
Widget build ( BuildContext context ) {
return Scaffold (
appBar: CustomAppBar (
height: getVerticalSize ( 49 ),
leadingWidth: 40 ,
leading: AppbarImage (
height: getSize ( 24 ),
width: getSize ( 24 ),
svgPath: ImageConstant . imgArrowleftBlueGray900 ,
margin: getMargin ( left: 16 , top: 12 , bottom: 13 ),
onTap: () {
Navigator . pop ( context );
}),
2026-10-03 12:12:31 +05:30
centerTitle: true ,
title: AppbarTitle (
text: AppLocalizations . of ( context ) ! . sysParamTitle )),
2026-09-30 09:13:45 +05:30
body: Material ( child: SingleChildScrollView ( // Wrap the form in a SingleChildScrollView
scrollDirection: Axis . vertical , // Allow vertical scrolling
child: Padding (
padding: const EdgeInsets . all ( 16.0 ),
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . schedulerTimer ,
2026-09-30 09:13:45 +05:30
controller: schedulerTimerController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . schedulerTimer ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . leaseTaxCode ,
2026-09-30 09:13:45 +05:30
controller: leaseTaxCodeController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . leaseTaxCode ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName:
AppLocalizations . of ( context ) ! . vesselConfProcessLimit ,
2026-09-30 09:13:45 +05:30
controller: vesselConfirmationController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . vesselConfProcessLimit ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . rowToDisplay ,
2026-09-30 09:13:45 +05:30
controller: rowToDisplayController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . rowToDisplay ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . linkToDisplay ,
2026-09-30 09:13:45 +05:30
controller: linkToDisplayController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . linkToDisplay ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . rowToAdd ,
2026-09-30 09:13:45 +05:30
controller: rowToAddController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . rowToAdd ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . lovRowToDisplay ,
2026-09-30 09:13:45 +05:30
controller: lovRowToDisplayController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . lovRowToDisplay ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . lovLinkToDisplay ,
2026-09-30 09:13:45 +05:30
controller: lovLinkToDisplayController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . lovLinkToDisplay ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . oidServerName ,
2026-09-30 09:13:45 +05:30
controller: oidServerNameController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . oidServerName ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . oidBase ,
2026-09-30 09:13:45 +05:30
controller: oidBaseController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . oidBase ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . oidAdminUser ,
2026-09-30 09:13:45 +05:30
controller: oidAdminUserController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . oidAdminUser ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . oidServerPort ,
2026-09-30 09:13:45 +05:30
controller: oidServerPortController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . oidServerPort ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . userDefaultGroup ,
2026-09-30 09:13:45 +05:30
controller: userDefaultGroupController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . userDefaultGroup ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . defaultDepartment ,
2026-09-30 09:13:45 +05:30
controller: defaultDepartmentController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . defaultDepartment ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . defaultPosition ,
2026-09-30 09:13:45 +05:30
controller: defaultPositionController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . defaultPosition ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . singleCharge ,
2026-09-30 09:13:45 +05:30
controller: singleChargeController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . singleCharge ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . firstDayOfWeek ,
2026-09-30 09:13:45 +05:30
controller: firstDayOfWeekController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . firstDayOfWeek ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . hourPerShift ,
2026-09-30 09:13:45 +05:30
controller: hourPerShiftController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . hourPerShift ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName:
AppLocalizations . of ( context ) ! . cnBillingFrequency ,
2026-09-30 09:13:45 +05:30
controller: cnBillingFrequencyController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . cnBillingFrequency ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName:
AppLocalizations . of ( context ) ! . billingDepartmentCode ,
2026-09-30 09:13:45 +05:30
controller: billingDepartmentCodeController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . billingDepartmentCode ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . basePriceList ,
2026-09-30 09:13:45 +05:30
controller: basePriceListController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . basePriceList ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) !
. nonContainerServiceOrder ,
2026-09-30 09:13:45 +05:30
controller: nonContainerServiceController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . nonContainerServiceOrder ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . ediMaeScheduler ,
2026-09-30 09:13:45 +05:30
controller: ediMaeSchedulerController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . ediMaeScheduler ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . ediScheduler ,
2026-09-30 09:13:45 +05:30
controller: ediSchedulerController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . tooltipFor (
AppLocalizations . of ( context ) ! . ediScheduler ),
2026-09-30 09:13:45 +05:30
),
_buildFieldWithTooltip (
2026-10-03 12:12:31 +05:30
fieldName: AppLocalizations . of ( context ) ! . companyName ,
2026-09-30 09:13:45 +05:30
controller: companynameController ,
2026-10-03 12:12:31 +05:30
tooltip: AppLocalizations . of ( context ) ! . companyName ,
2026-09-30 09:13:45 +05:30
),
2026-10-03 12:12:31 +05:30
Text ( AppLocalizations . of ( context ) ! . regAllowed ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
Row (
children: [
Radio (
value: true ,
groupValue: isRegistrationAllow ,
onChanged: ( value ) {
setState (() {
isRegistrationAllow = value as bool ;
});
},
),
2026-10-03 12:12:31 +05:30
Text ( AppLocalizations . of ( context ) ! . yes ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
Radio (
value: false ,
groupValue: isRegistrationAllow ,
onChanged: ( value ) {
setState (() {
isRegistrationAllow = value as bool ;
});
},
),
2026-10-03 12:12:31 +05:30
Text ( AppLocalizations . of ( context ) ! . no ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
],
),
ElevatedButton (
onPressed: () {
_uploadImageFile ();
},
style: ButtonStyle (
backgroundColor: _imageBytes == null ? MaterialStateProperty . all < Color > ( Colors . red ) : MaterialStateProperty . all < Color > ( Colors . green ), // Change to the desired color
),
child: _imageBytes == null
2026-10-03 12:12:31 +05:30
? Text ( AppLocalizations . of ( context ) ! . pickCompanyLogo ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 )
2026-10-03 12:12:31 +05:30
: Text (
AppLocalizations . of ( context ) ! . logoUploadSuccess ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
),
Tooltip (
2026-10-03 12:12:31 +05:30
message: AppLocalizations . of ( context ) ! . mscTooltip ,
2026-09-30 09:13:45 +05:30
child: Column (
children: [
2026-10-03 12:12:31 +05:30
Text ( AppLocalizations . of ( context ) ! . miscInfoLabel ,
2026-09-30 09:13:45 +05:30
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
CustomTextFormField (
focusNode: FocusNode (),
controller: lastController ,
margin: getMargin ( top: 7 ),
textInputType:
TextInputType . text ),
],
)
// TextFormField(
// controller: lastController,
// decoration: const InputDecoration(
// labelText: 'i',
// ),
// ),
),
CustomButton (
height: getVerticalSize ( 50 ),
2026-10-03 12:12:31 +05:30
text: AppLocalizations . of ( context ) ! . saveBtn ,
2026-09-30 09:13:45 +05:30
margin: getMargin ( top: 24 , bottom: 5 ),
onTap: () async {
formData [ 'regitrationAllowed' ] = isRegistrationAllow ;
formData [ 'schedulerTime' ] = schedulerTimerController . text ;
formData [ 'leaseTaxCode' ] = leaseTaxCodeController . text ;
formData [ 'vesselConfProcessLimit' ] = vesselConfirmationController . text ;
formData [ 'rowToDisplay' ] = rowToDisplayController . text ;
formData [ 'linkToDisplay' ] = linkToDisplayController . text ;
formData [ 'rowToAdd' ] = rowToAddController . text ;
formData [ 'lovRowToDisplay' ] = lovRowToDisplayController . text ;
formData [ 'lovLinkToDisplay' ] = lovLinkToDisplayController . text ;
formData [ 'oidserverName' ] = oidServerNameController . text ;
formData [ 'oidBase' ] = oidBaseController . text ;
formData [ 'oidAdminUser' ] = oidAdminUserController . text ;
formData [ 'oidServerPort' ] = oidServerPortController . text ;
formData [ 'userDefaultGroup' ] = userDefaultGroupController . text ;
formData [ 'defaultDepartment' ] = defaultDepartmentController . text ;
formData [ 'defaultPosition' ] = defaultPositionController . text ;
formData [ 'singleCharge' ] = singleChargeController . text ;
formData [ 'firstDayOftheWeek' ] = firstDayOfWeekController . text ;
formData [ 'hourPerShift' ] = hourPerShiftController . text ;
formData [ 'cnBillingFrequency' ] = cnBillingFrequencyController . text ;
formData [ 'billingDepartmentCode' ] = billingDepartmentCodeController . text ;
formData [ 'basePriceList' ] = basePriceListController . text ;
formData [ 'nonContainerServiceOrder' ] = nonContainerServiceController . text ;
formData [ 'ediMaeSchedulerONOFF' ] = ediMaeSchedulerController . text ;
formData [ 'ediSchedulerONOFF' ] = ediSchedulerController . text ;
//formData['']=lastController.text;
formData [ 'upload_Logo_name' ] = logoname ;
formData [ 'upload_Logo_path' ] = logopath ;
formData [ 'company_Display_Name' ] = companynameController . text ;
final token = await TokenManager . getToken ();
try {
print ( "token is : $ token " );
print ( formData );
if ( formData != null ) {
// Create new project
apiService . updateParameter ( token ! , widget . sysparameter , formData );
}
Navigator . pop ( context );
// Add navigation or any other logic after successful create/update
} catch ( e ) {
print ( 'error is $ e ' );
showDialog (
context: context ,
builder: ( BuildContext context ) {
return AlertDialog (
2026-10-03 12:12:31 +05:30
title: Text (
AppLocalizations . of ( context ) ! . error ),
content: Text ( widget . sysparameter == null
? AppLocalizations . of ( context ) !
. failedCreateProject ( e . toString ())
: AppLocalizations . of ( context ) !
. failedUpdateProject ( e . toString ())),
2026-09-30 09:13:45 +05:30
actions: [
TextButton (
2026-10-03 12:12:31 +05:30
child: Text (
AppLocalizations . of ( context ) ! . ok ),
2026-09-30 09:13:45 +05:30
onPressed: () {
Navigator . of ( context ). pop ();
},
),
],
);
},
);
}
},
),
],
),
),
)));
}
Widget _buildFieldWithTooltip ({
required String fieldName ,
required TextEditingController controller ,
required String tooltip ,
}) {
return Tooltip (
message: tooltip ,
child:
Padding (
padding: getPadding ( top: 18 ),
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisAlignment: MainAxisAlignment . start ,
children: [
Text ( " $ fieldName " ,
overflow: TextOverflow . ellipsis ,
textAlign: TextAlign . left ,
style: AppStyle
. txtGilroyMedium16Bluegray800 ),
CustomTextFormField (
focusNode: FocusNode (),
controller: controller ,
hintText: "Enter Your $ fieldName " ,
margin: getMargin ( top: 7 ),
textInputType:
TextInputType . text )
])),
// TextFormField(
// controller: controller,
// decoration: InputDecoration(
// labelText: fieldName,
// ),
// ),
);
}
}