|
|
|
|
@ -28,6 +28,7 @@ import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
import 'package:test_sa/providers/loading_list_notifier.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
|
|
|
|
|
class SparePartRequest extends StatefulWidget {
|
|
|
|
|
@ -158,7 +159,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
|
loading: _isLoading,
|
|
|
|
|
initialValue: requestDetailProvider.sparePartHelperModel?.sparePart,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
onSelect: (part) async {
|
|
|
|
|
if (part != null) {
|
|
|
|
|
requestDetailProvider.sparePartHelperModel?.sparePart = part;
|
|
|
|
|
@ -181,18 +182,15 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
decorationColor: AppColor.primary10,
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
)).onPress(
|
|
|
|
|
() async {
|
|
|
|
|
() async {
|
|
|
|
|
requestDetailProvider.getStoreAvailabilityById(partId: requestDetailProvider.sparePartHelperModel?.sparePart?.id);
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
|
top: Radius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
|
|
|
builder: (BuildContext context) => PartDetailBottomSheetSheet(),
|
|
|
|
|
isDismissible: true,
|
|
|
|
|
backgroundColor: AppColor.bottomSheetColor(context),
|
|
|
|
|
builder: (BuildContext context) => PartDetailBottomSheetSheet().bottomSheetContainer(context),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -204,14 +202,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
labelText: context.translation.quantity,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
|
|
|
|
|
validator: (value) => value == null || value.isEmpty
|
|
|
|
|
? context.translation.requiredField
|
|
|
|
|
: Validator.isNumeric(value)
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
requestDetailProvider.sparePartHelperModel?.quantity = num.tryParse(value ?? "");
|
|
|
|
|
},
|
|
|
|
|
@ -226,14 +224,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
labelText: context.translation.installedQty,
|
|
|
|
|
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
|
|
|
|
|
validator: (value) => value == null || value.isEmpty
|
|
|
|
|
? context.translation.requiredField
|
|
|
|
|
: Validator.isNumeric(value)
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
requestDetailProvider.sparePartHelperModel?.installQty = num.tryParse(value ?? "");
|
|
|
|
|
},
|
|
|
|
|
@ -247,14 +245,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
labelText: context.translation.returnQty,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
|
|
|
|
|
validator: (value) => value == null || value.isEmpty
|
|
|
|
|
? context.translation.requiredField
|
|
|
|
|
: Validator.isNumeric(value)
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
? null
|
|
|
|
|
: context.translation.onlyNumbers,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
requestDetailProvider.sparePartHelperModel?.returnQty = num.tryParse(value ?? "");
|
|
|
|
|
},
|
|
|
|
|
@ -269,8 +267,8 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
controller: _oracleNoController,
|
|
|
|
|
labelText: context.translation.oracleNo,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: AppColor.disableFieldBackground(context),
|
|
|
|
|
enable: false,
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
@ -279,10 +277,10 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
controller: _descriptionController,
|
|
|
|
|
showSpeechToText: true,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
|
|
|
|
|
labelText: "Engineer Comment",
|
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
requestDetailProvider.sparePartHelperModel?.comment = value;
|
|
|
|
|
@ -309,12 +307,12 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: AppFilledButton(
|
|
|
|
|
label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity,
|
|
|
|
|
buttonColor: AppColor.green70,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_onSubmit(requestDetailProvider: requestDetailProvider);
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity,
|
|
|
|
|
buttonColor: AppColor.green70,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_onSubmit(requestDetailProvider: requestDetailProvider);
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -390,7 +388,7 @@ class PartDetailBottomSheetSheet extends StatelessWidget {
|
|
|
|
|
: requestDetailProvider.storeAvailability.isEmpty
|
|
|
|
|
? const NoDataFound().center
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
padding: const EdgeInsets.only(top: 12),
|
|
|
|
|
itemCount: requestDetailProvider.storeAvailability.length,
|
|
|
|
|
separatorBuilder: (czt, index) => 12.height,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
@ -406,12 +404,9 @@ class PartDetailBottomSheetSheet extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
Widget partAvailableQuantityCard({required StoreAvailability model, required BuildContext context}) {
|
|
|
|
|
return Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
|
'Site Name: ${model.siteName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120),
|
|
|
|
|
8.height,
|
|
|
|
|
'Store Name: ${model.storeName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120),
|
|
|
|
|
8.height,
|
|
|
|
|
'Available Quantity: ${model.availablityQty ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120),
|
|
|
|
|
8.height,
|
|
|
|
|
]).toShadowContainer(context, padding: 12, showShadow: false, backgroundColor: AppColor.neutral110);
|
|
|
|
|
InfoTextWidget(label: "Site Name:".addTranslation, value: model.siteName ?? ''),
|
|
|
|
|
InfoTextWidget(label: "Store Name:".addTranslation, value: model.storeName ?? ''),
|
|
|
|
|
InfoTextWidget(label: "Available Quantity:".addTranslation, value: model.availablityQty != null ? model.availablityQty.toString() : ''),
|
|
|
|
|
]).toShadowContainer(context, padding: 12, showShadow: false,);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|