save method

Future<bool> save()

Implementation

Future<bool> save() async {
  final UParkingStaffResponse? s = editing;
  return await send(
    s == null
        ? UServices.parking.createParkingStaff(
            p: UParkingStaffCreateParams(
              parkingId: parking?.id ?? "",
              userName: userNameController.trimmedLatin(),
              password: passwordController.trimmedLatin(),
              tags: permissions.isEmpty ? <int>[TagParkingStaff.registerEntryExit.number] : permissions.map((TagParkingStaff t) => t.number).toList(),
              firstName: firstNameController.text.nullIfEmpty(),
              lastName: lastNameController.text.nullIfEmpty(),
              phoneNumber: phoneController.trimmedLatin().nullIfEmpty(),
              shiftTitle: shiftTitleController.text.nullIfEmpty(),
              maxDiscountPercent: maxDiscount.round(),
            ),
          )
        : UServices.parking.updateParkingStaff(
            p: UParkingStaffUpdateParams(
              id: s.id,
              shiftTitle: shiftTitleController.text.nullIfEmpty(),
              password: passwordController.text.nullIfEmpty(),
              maxDiscountPercent: maxDiscount.round(),
              tags: permissions.map((TagParkingStaff t) => t.number).toList(),
            ),
          ),
    read,
  ) !=
      null;
}