|
|
|
|
@ -25,6 +25,7 @@ class _FleetEmployeesState extends State<FleetEmployees> {
|
|
|
|
|
final _nameCtrl = TextEditingController();
|
|
|
|
|
final _mobileCtrl = TextEditingController();
|
|
|
|
|
final _altMobileCtrl = TextEditingController();
|
|
|
|
|
final _locationCtrl = TextEditingController();
|
|
|
|
|
|
|
|
|
|
final List<String> licenseNumbers = [
|
|
|
|
|
"UP3220050012345",
|
|
|
|
|
@ -43,6 +44,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
|
|
|
|
|
_fetchDrivers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String? _status; // 'available' | 'on delivery' | 'offline'
|
|
|
|
|
final List<String> _statusOptions = const ['available', 'on delivery', 'offline'];
|
|
|
|
|
|
|
|
|
|
Future<void> _fetchDrivers() async {
|
|
|
|
|
setState(() => isLoading = true);
|
|
|
|
|
try {
|
|
|
|
|
@ -371,8 +375,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
|
|
|
|
|
inputFormatters: const [
|
|
|
|
|
FirstCharUppercaseFormatter(), // << live first-letter caps
|
|
|
|
|
],
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: "Full Name",
|
|
|
|
|
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
isDense: true,
|
|
|
|
|
),
|
|
|
|
|
@ -421,8 +426,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
|
|
|
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
|
|
|
LengthLimitingTextInputFormatter(10),
|
|
|
|
|
],
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: "Mobile Number",
|
|
|
|
|
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
isDense: true,
|
|
|
|
|
),
|
|
|
|
|
@ -437,13 +443,56 @@ class _FleetEmployeesState extends State<FleetEmployees> {
|
|
|
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
|
|
|
LengthLimitingTextInputFormatter(10),
|
|
|
|
|
],
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: "Mobile Number",
|
|
|
|
|
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
isDense: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
_LabeledField(
|
|
|
|
|
label: "Location *",
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
controller: _locationCtrl,
|
|
|
|
|
validator: (v) => _required(v, field: "Location"),
|
|
|
|
|
textCapitalization: TextCapitalization.none,
|
|
|
|
|
inputFormatters: const [
|
|
|
|
|
FirstCharUppercaseFormatter(), // << live first-letter caps
|
|
|
|
|
],
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: "Area / locality",
|
|
|
|
|
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
|
|
|
|
|
border: const OutlineInputBorder(),
|
|
|
|
|
isDense: true,
|
|
|
|
|
),
|
|
|
|
|
textInputAction: TextInputAction.done,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
_LabeledField(
|
|
|
|
|
label: "Status *",
|
|
|
|
|
child: DropdownButtonFormField<String>(
|
|
|
|
|
value: _status,
|
|
|
|
|
items: _statusOptions
|
|
|
|
|
.map((s) => DropdownMenuItem(value: s, child: Text(s)))
|
|
|
|
|
.toList(),
|
|
|
|
|
onChanged: (v) => setState(() => _status = v),
|
|
|
|
|
validator: (v) => v == null || v.isEmpty ? "Status is required" : null,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
hint: Text(
|
|
|
|
|
"Select status",
|
|
|
|
|
style: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
|
|
|
|
|
),
|
|
|
|
|
icon: const Icon(Icons.keyboard_arrow_down_rounded),
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
isDense: false,
|
|
|
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
onPressed: _addDriver,
|
|
|
|
|
|