import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/index.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/architecture/define.dart';
import 'package:flyinsono/architecture/router/router.dart';
import 'package:flyinsono/pages/organization/org_personnel/controller.dart';

///删除确认对话框
class MakeSureDeleteDialogPage extends FStatefulWidget {
  MakeSureDeleteDialogPage({
    Key? key,
    this.onOkTap,
  }) : super(key: key);

  final VoidCallback? onOkTap;

  @override
  FState<MakeSureDeleteDialogPage> createState() =>
      _MakeSureDeleteDialogState();
}

class _MakeSureDeleteDialogState extends FState<MakeSureDeleteDialogPage> {
  @override
  FWidget build(BuildContext context) {
    return FSimpleDialog(
      backgroundColor: Colors.white,
      title: FText(
        i18nBook.organization.deleteOrNot.t,
        style: TextStyle(
          color: Colors.white,
          fontSize: 18,
        ),
      ),
      children: [
        _MakeSureDeleteDialog(),
      ],
      okString: i18nBook.common.confirm.t,
      cancelString: i18nBook.common.cancel.t,
      isDefault: true,
      onOk: () {
        widget.onOkTap?.call();
      },
      onCancel: () {
        router.back();
      },
    );
  }
}

///确认删除啊用户对话框
class _MakeSureDeleteDialog extends FisView<OrgPesonnelController> {
  _MakeSureDeleteDialog({
    Key? key,
  }) : super(key: key);

  @override
  FWidget build(BuildContext context) {
    return FContainer(
      height: 120,
      child: FCenter(
        child: FContainer(
            width: 480,
            child: FText(
              textAlign: TextAlign.center,
              i18nBook.organization.removeMembersConfirm
                  .translate([controller.state.selectedIdxs.length]),
              style: TextStyle(
                fontSize: 16,
              ),
            )),
      ),
    );
  }
}
