Merge branch 'Dev_Manish_17/11' of https://git.marcoaiot.com/admin/marco.pms.mobileapp into Dev_Manish_17/11
This commit is contained in:
commit
4518504fe5
@ -48,8 +48,6 @@ class _AssignTaskBottomSheetState extends State<AssignTaskBottomSheet> {
|
||||
final DailyTaskPlanningController controller = Get.find();
|
||||
final ProjectController projectController = Get.find();
|
||||
|
||||
final OrganizationController orgController =
|
||||
Get.put(OrganizationController());
|
||||
final OrganizationController orgController =
|
||||
Get.put(OrganizationController());
|
||||
final ServiceController serviceController = Get.put(ServiceController());
|
||||
@ -235,8 +233,6 @@ class _AssignTaskBottomSheetState extends State<AssignTaskBottomSheet> {
|
||||
}
|
||||
|
||||
void _onRoleMenuPressed() {
|
||||
final RenderBox overlay =
|
||||
Overlay.of(context).context.findRenderObject() as RenderBox;
|
||||
final RenderBox overlay =
|
||||
Overlay.of(context).context.findRenderObject() as RenderBox;
|
||||
final Size screenSize = overlay.size;
|
||||
@ -320,9 +316,6 @@ class _AssignTaskBottomSheetState extends State<AssignTaskBottomSheet> {
|
||||
validator: (value) => this
|
||||
.controller
|
||||
.formFieldValidator(value, fieldType: validatorType),
|
||||
validator: (value) => this
|
||||
.controller
|
||||
.formFieldValidator(value, fieldType: validatorType),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@ -11,6 +11,8 @@ import 'package:marco/helpers/widgets/expense/expense_form_widgets.dart';
|
||||
import 'package:marco/helpers/widgets/my_confirmation_dialog.dart';
|
||||
import 'package:marco/model/employees/multiple_select_bottomsheet.dart';
|
||||
import 'package:marco/model/employees/employee_model.dart';
|
||||
import 'package:marco/model/employees/multiple_select_bottomsheet.dart';
|
||||
import 'package:marco/model/employees/employee_model.dart';
|
||||
|
||||
Future<T?> showPaymentRequestBottomSheet<T>({
|
||||
bool isEdit = false,
|
||||
@ -263,6 +265,35 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
_gap(),
|
||||
_buildPayeeField(),
|
||||
_gap(),
|
||||
_buildDropdown(
|
||||
key: _categoryDropdownKey,
|
||||
),
|
||||
_gap(),
|
||||
_buildTextField("Title", Icons.title_outlined,
|
||||
controller.titleController,
|
||||
hint: "Enter title",
|
||||
validator: Validators.requiredField),
|
||||
_gap(),
|
||||
_buildRadio(
|
||||
"Is Advance Payment",
|
||||
Icons.attach_money_outlined,
|
||||
controller.isAdvancePayment,
|
||||
["Yes", "No"]),
|
||||
_gap(),
|
||||
_buildDueDateField(),
|
||||
_gap(),
|
||||
_buildTextField("Amount", Icons.currency_rupee,
|
||||
controller.amountController,
|
||||
hint: "Enter Amount",
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (v) => (v != null &&
|
||||
v.isNotEmpty &&
|
||||
double.tryParse(v) != null)
|
||||
? null
|
||||
: "Enter valid amount"),
|
||||
_gap(),
|
||||
_buildPayeeField(),
|
||||
_gap(),
|
||||
_buildDropdown(
|
||||
"Currency",
|
||||
Icons.monetization_on_outlined,
|
||||
@ -416,6 +447,7 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPayeeField() {
|
||||
Widget _buildPayeeField() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -426,6 +458,27 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
requiredField: true,
|
||||
),
|
||||
MySpacing.height(6),
|
||||
GestureDetector(
|
||||
onTap: _showPayeeSelector,
|
||||
child: TileContainer(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() => Text(
|
||||
controller.selectedPayee.value?.name ?? "Select Payee",
|
||||
style: const TextStyle(fontSize: 15),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)),
|
||||
),
|
||||
const Icon(Icons.arrow_drop_down, size: 22),
|
||||
],
|
||||
const SectionTitle(
|
||||
icon: Icons.person_outline,
|
||||
title: "Payee",
|
||||
requiredField: true,
|
||||
),
|
||||
MySpacing.height(6),
|
||||
GestureDetector(
|
||||
onTap: _showPayeeSelector,
|
||||
child: TileContainer(
|
||||
@ -445,6 +498,7 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -563,6 +617,7 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
if (controller.selectedCategory.value == null) {
|
||||
return _showError("Please select a category");
|
||||
}
|
||||
if (controller.selectedPayee.value == null) {
|
||||
if (controller.selectedPayee.value == null) {
|
||||
return _showError("Please select a payee");
|
||||
}
|
||||
@ -591,6 +646,25 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showPayeeSelector() async {
|
||||
final result = await showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (_) => EmployeeSelectionBottomSheet(
|
||||
title: "Select Payee",
|
||||
multipleSelection: false,
|
||||
initiallySelected: controller.selectedPayee.value != null
|
||||
? [controller.selectedPayee.value!]
|
||||
: [],
|
||||
),
|
||||
);
|
||||
|
||||
if (result is EmployeeModel) {
|
||||
controller.selectedPayee.value = result;
|
||||
}
|
||||
}
|
||||
|
||||
bool _showError(String msg) {
|
||||
showAppSnackbar(title: "Error", message: msg, type: SnackbarType.error);
|
||||
return false;
|
||||
|
||||
@ -35,8 +35,6 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
}
|
||||
});
|
||||
|
||||
_searchCtrl.addListener(() {
|
||||
controller.searchQuery.value = _searchCtrl.text.trim();
|
||||
_searchCtrl.addListener(() {
|
||||
controller.searchQuery.value = _searchCtrl.text.trim();
|
||||
});
|
||||
@ -52,7 +50,6 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F5F5),
|
||||
backgroundColor: const Color(0xFFF5F5F5),
|
||||
appBar: _buildAppBar(),
|
||||
body: SafeArea(
|
||||
@ -211,13 +208,6 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
}
|
||||
});
|
||||
},
|
||||
onTap: () {
|
||||
Future.delayed(const Duration(milliseconds: 50), () {
|
||||
if (mounted) {
|
||||
FocusScope.of(context).requestFocus(_searchFocus);
|
||||
}
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 0),
|
||||
@ -297,12 +287,6 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
TextPosition(offset: e.name.length),
|
||||
);
|
||||
|
||||
_searchCtrl
|
||||
..text = e.name
|
||||
..selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: e.name.length),
|
||||
);
|
||||
|
||||
FocusScope.of(context).unfocus();
|
||||
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
||||
controller.employees.clear();
|
||||
|
||||
@ -15,18 +15,7 @@ import 'package:on_field_work/helpers/services/tenant_service.dart';
|
||||
import 'package:on_field_work/view/tenant/tenant_selection_screen.dart';
|
||||
import 'package:on_field_work/controller/tenant/tenant_switch_controller.dart';
|
||||
import 'package:on_field_work/helpers/theme/theme_editor_widget.dart';
|
||||
import 'package:marco/helpers/services/storage/local_storage.dart';
|
||||
import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
|
||||
import 'package:marco/helpers/widgets/my_spacing.dart';
|
||||
import 'package:marco/helpers/widgets/my_text.dart';
|
||||
import 'package:marco/helpers/widgets/avatar.dart';
|
||||
import 'package:marco/model/employees/employee_info.dart';
|
||||
import 'package:marco/controller/auth/mpin_controller.dart';
|
||||
import 'package:marco/view/employees/employee_profile_screen.dart';
|
||||
import 'package:marco/helpers/services/tenant_service.dart';
|
||||
import 'package:marco/view/tenant/tenant_selection_screen.dart';
|
||||
import 'package:marco/controller/tenant/tenant_switch_controller.dart';
|
||||
import 'package:marco/helpers/theme/theme_editor_widget.dart';
|
||||
|
||||
|
||||
class UserProfileBar extends StatefulWidget {
|
||||
final bool isCondensed;
|
||||
@ -65,7 +54,6 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
Widget build(BuildContext context) {
|
||||
final bool isCondensed = widget.isCondensed;
|
||||
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 14),
|
||||
child: ClipRRect(
|
||||
@ -159,66 +147,6 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
],
|
||||
),
|
||||
),
|
||||
bottom: true,
|
||||
child: Stack(
|
||||
children: [
|
||||
// ======================= MAIN PROFILE SIDEBAR =======================
|
||||
Offstage(
|
||||
offstage: _isThemeEditorVisible,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight),
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_isLoading
|
||||
? const _LoadingSection()
|
||||
: _userProfileSection(isCondensed),
|
||||
if (!_isLoading && !isCondensed)
|
||||
_switchTenantRow(),
|
||||
MySpacing.height(12),
|
||||
Divider(
|
||||
indent: 18,
|
||||
endIndent: 18,
|
||||
thickness: 0.7,
|
||||
color: Colors.grey.withOpacity(0.25),
|
||||
),
|
||||
MySpacing.height(12),
|
||||
_supportAndSettingsMenu(isCondensed),
|
||||
const Spacer(),
|
||||
Divider(
|
||||
indent: 18,
|
||||
endIndent: 18,
|
||||
thickness: 0.35,
|
||||
color: Colors.grey.withOpacity(0.18),
|
||||
),
|
||||
_logoutButton(isCondensed),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// ======================= THEME EDITOR VIEW =======================
|
||||
Offstage(
|
||||
offstage: !_isThemeEditorVisible,
|
||||
child: ThemeEditorWidget(
|
||||
onClose: () {
|
||||
setState(() => _isThemeEditorVisible = false);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -227,8 +155,6 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
|
||||
// ==================== EXISTING CODE (UNCHANGED) =====================
|
||||
|
||||
// ==================== EXISTING CODE (UNCHANGED) =====================
|
||||
|
||||
Widget _switchTenantRow() {
|
||||
final TenantSwitchController tenantSwitchController =
|
||||
Get.put(TenantSwitchController());
|
||||
@ -332,8 +258,7 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
child: const Center(child: CircularProgressIndicator(strokeWidth: 2)),
|
||||
);
|
||||
|
||||
// ⭐ FIXED — YOUR ORIGINAL INTENT, COMPLETED PROPERLY
|
||||
// ⭐ FIXED — YOUR ORIGINAL INTENT, COMPLETED PROPERLY
|
||||
|
||||
Widget _noTenantContainer() => Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
@ -343,18 +268,6 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
color: Colors.blue.shade200,
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(
|
||||
color: Colors.blue.shade200,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
"No organizations available",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user