diff --git a/.vscode/settings.json b/.vscode/settings.json index 2fa9402..874a441 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "cmake.sourceDirectory": "/home/melkor/Desktop/schl/4semestre/MDS/GITHUB/2024.2-Fehu/catavento/linux" + "cmake.sourceDirectory": "C:/FlutterProjects/fehu/2024.2-Fehu/catavento/linux" } \ No newline at end of file diff --git a/catavento/lib/main.dart b/catavento/lib/main.dart index e23ebe6..3ad67cf 100644 --- a/catavento/lib/main.dart +++ b/catavento/lib/main.dart @@ -2,7 +2,7 @@ import 'package:catavento/bloc/demanda_bloc.dart'; import 'package:catavento/constants.dart'; import 'package:catavento/screens/Login/login.dart'; import 'package:catavento/screens/dashboardAdmin/dashboard_admin.dart'; -import 'package:catavento/screens/dashboardFuncionarios/dashboard_funcionarios.dart'; +import 'package:catavento/screens/employee-management.dart'; import 'package:catavento/views/login_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -23,7 +23,7 @@ void main() { routes: { loginRoute: (context) => const LoginView(), homeRoute: (context) => const DashBoardAdmin(), - crudFuncionariosRoute: (context) => const DashBoardFuncionarios(), + crudFuncionariosRoute: (context) => EmployeeManagement(), }, ), ), diff --git a/catavento/lib/screens/dashboardAdmin/components/ativAndamentoCard.dart b/catavento/lib/screens/dashboardAdmin/components/ativAndamentoCard.dart new file mode 100644 index 0000000..6e54b0f --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/ativAndamentoCard.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + + +class AtivAndamentoCard extends StatelessWidget { + final String nomeFuncionario; + final String nomeDemanda; + + const AtivAndamentoCard({ + super.key, + required this.nomeFuncionario, + required this.nomeDemanda, + }); + + @override + Widget build(BuildContext context) { + + return Card( + margin: EdgeInsets.symmetric(vertical: 8.0), + child: ListTile( + title: Text(nomeFuncionario), + subtitle: Text( + 'Em andamento: $nomeDemanda' + ), + ), + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/background.dart b/catavento/lib/screens/dashboardAdmin/components/background.dart new file mode 100644 index 0000000..e1c2787 --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/background.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +class BackgroundPage extends StatelessWidget { + final Color? backgroundColor; + final List? gradientColors; + final Listchildren; + + BackgroundPage({ + this.backgroundColor, + this.gradientColors, + required this.children, + }); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + //Cor de fundo + Container( + width: double.infinity, + height: double.infinity, + decoration: BoxDecoration( + color: backgroundColor, + gradient: gradientColors != null + ? LinearGradient( + colors: gradientColors!, + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ) + : null, + ), + ), + + //Conteúdo + Column( + children: children, + ) + ], + ); + } +} diff --git a/catavento/lib/screens/dashboardAdmin/components/blocks.dart b/catavento/lib/screens/dashboardAdmin/components/blocks.dart new file mode 100644 index 0000000..fae97c1 --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/blocks.dart @@ -0,0 +1,77 @@ +import 'dart:ffi'; + +import 'package:flutter/material.dart'; + +class Blocks extends StatefulWidget { + final String? title; + final double? height; + final double? width; + final double borderRadius; + final Color color; + final Widget child; + + Blocks({ + this.title, + this.height, + this.width, + this.borderRadius = 16.0, + required this.color, + required this.child, + }); + + @override + State createState() { + return BlocksState(); + } +} + +class BlocksState extends State { + + @override + Widget build(BuildContext context) { + double screenWidth = MediaQuery.of(context).size.width; + double screenHeight = MediaQuery.of(context).size.height; + + double blockWidth = widget.width ?? screenWidth * 0.9; + double blockHeight = widget.height ?? screenHeight * 0.5; + + return Stack( + children: [ + Container( + width: blockWidth, + height: blockHeight, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: widget.color, + borderRadius: BorderRadius.circular(widget.borderRadius) + ), + ), + + if (widget.title != null) + Positioned( + top: 10, + left: 0, + right: 0, + child: Center( + child: Text( + widget.title!, + style: TextStyle( + fontSize: 16, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + + Positioned.fill( + child: Align( + alignment: Alignment.center, + child: widget.child, + ), + ), + + ], + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart b/catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart new file mode 100644 index 0000000..60c3677 --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart @@ -0,0 +1,144 @@ +import 'package:catavento/screens/components/infoFuncionarios.dart'; +import 'package:catavento/screens/components/showDialog.dart'; +import 'package:flutter/material.dart'; +import 'input.dart'; +import 'confirmDialog.dart'; + +class FuncionarioCard extends StatefulWidget{ + final String nomeFuncionario; + final String status; + final String setor; + + const FuncionarioCard({ + super.key, + required this.nomeFuncionario, + required this.setor, + required this.status, + }); + + @override + State createState() { + return FuncionarioCardState(); + } +} + +class FuncionarioCardState extends State{ + + @override + Widget build(BuildContext context) { + + return Card( + margin: EdgeInsets.symmetric(vertical: 8.0), + child: ListTile( + title: Text(widget.nomeFuncionario), + subtitle: Text( + 'Setor: ${widget.setor}\nStatus: ${widget.status}'), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: Icon(Icons.info), + onPressed: () { + //Lógica ao clicar + showDialog( + context: context, + builder: (BuildContext context) { + return Showdialog( + width: 463, + height: 402, + title: 'nomeFuncionario', //Inserir o nome do funcionario + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Infofuncionarios(nome: "Fulano", email: "email", status: "Ativo", setor: "Montagem", demanda: "Hello Kitty") //Trocar para as informações do banco de dados + ] + ), + ); + }, + ); + + }, + ), + // botão de Editar. + IconButton( + icon: Icon(Icons.edit), + onPressed: () { + // editar a demanda + showDialog( + context: context, + builder: (BuildContext context) { + return Showdialog( + width: 463, + height: 402, + title: 'Editar', + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Inputs(text: "Nome:",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Setor:",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Email:",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Nome de usuário:",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Senha:",), + SizedBox(height: MediaQuery.of(context).size.height * 0.08), + + Positioned.fill( + child: Center( + child: ElevatedButton(onPressed: (){ + //Lógica do botão + Navigator.pop(context); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(22) + ) + ), + child: Text( + "Cadastrar", + style: TextStyle(color: Colors.white), + ) + + ) + ) + ) + ] + ), + ); + }, + ); + + }, + ), + // apagar + IconButton( + icon: Icon(Icons.delete), + onPressed: () async { + showDialog( + context: context, + builder: (BuildContext context) { + return ConfirmDialog( + title: 'Confirmar Exclusão', + contente: + 'Tem certeza de que deseja apagar esta demanda?', + onConfirm: () { + Navigator.of(context).pop(); // Fecha o diálogo + //Lógica do botão + }, + ); + }, + ); + }), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/graficInfo.dart b/catavento/lib/screens/dashboardAdmin/components/graficInfo.dart new file mode 100644 index 0000000..0525001 --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/graficInfo.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + + +class Graficinfo, S> extends StatefulWidget { + final double? size; + final IconData icons; + final Color colorIcons; + final String info; + final String dataKey; + final BlocBuilderCondition buildWhen; + + Graficinfo ({ + this.size, + required this.icons, + required this.colorIcons, + required this.info, + required this.dataKey, + required this.buildWhen, + + }); + + @override + State> createState() { + return GraficinfoState(); + } +} + +class GraficinfoState, S> extends State> { + @override + Widget build(BuildContext context) { + return BlocBuilder( + buildWhen: widget.buildWhen, + builder: (context, response) { + final metaData = (response as dynamic).metaData; + + return Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + widget.icons, + size: widget.size, + color: widget.colorIcons, + ), + SizedBox(width: 20), + + Center( // Adicionado Center para centralizar o conteúdo dentro do Column + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, // Centralizado horizontalmente + children: [ + Text( + "${metaData[widget.dataKey] ?? '--'}", + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + SizedBox(height: 2), + Text( + widget.info, + style: TextStyle(fontSize: 18, color: Colors.black), + ), + ], + ), + ), + ] + ); + } + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/infoFuncionarios.dart b/catavento/lib/screens/dashboardAdmin/components/infoFuncionarios.dart new file mode 100644 index 0000000..fee010c --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/infoFuncionarios.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; + +class Infofuncionarios extends StatelessWidget{ + final String nome; + final String email; + final String status; + final String setor; + final String demanda; + + const Infofuncionarios({ + super.key, + required this.nome, + required this.email, + required this.status, + required this.setor, + required this.demanda, + }); + + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Info(texto: "Nome: ", info: nome), + SizedBox(height: MediaQuery.of(context).size.height * 0.05), + Info(texto: "Email: ", info: email), + SizedBox(height: MediaQuery.of(context).size.height * 0.05), + Info(texto: "Status: ", info: status), + SizedBox(height: MediaQuery.of(context).size.height * 0.05), + Info(texto: "Setor: ", info: setor), + SizedBox(height: MediaQuery.of(context).size.height * 0.05), + Info(texto: "Atividade em andamento: ", info: demanda), + + ], + ); + } +} + +class Info extends StatelessWidget { + final String texto; + final String info; + + Info({ + required this.texto, + required this.info + }); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Text( + texto, + style: TextStyle( + fontSize: 20, + color: Colors.black, + fontWeight: FontWeight.bold + ), + ), + Text( + info, + style: TextStyle( + fontSize: 20, + color: Colors.black, + ) + ) + ], + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/input.dart b/catavento/lib/screens/dashboardAdmin/components/input.dart new file mode 100644 index 0000000..3ff4da8 --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/input.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; + +class Inputs extends StatefulWidget { + final String text; + final String? hint; + final TextEditingController? controller; + final Function(String)? onChanged; + + Inputs({ + required this.text, + this.hint, + this.controller, + this.onChanged, + }); + + @override + State createState() { + return InputsState(); + } +} + +class InputsState extends State{ + @override + Widget build(BuildContext context) { + + return Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + + children: [ + Text( + widget.text, + style: TextStyle( + fontSize: 15, + color: Colors.black + ), + ), + + SizedBox(width: 4,), + + Expanded( + child: SizedBox( + height: 33, + child: TextField( + controller: widget.controller, + onChanged: widget.onChanged, + decoration: InputDecoration( + hintStyle: TextStyle( + fontSize: 15, + color: Colors.grey + ), + hintText: widget.hint?? '', + filled: true, + fillColor: Colors.white, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10) + ), + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10) + ), + ), + ) + + ), + ], + ); + } +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/showDialog.dart b/catavento/lib/screens/dashboardAdmin/components/showDialog.dart new file mode 100644 index 0000000..39710ed --- /dev/null +++ b/catavento/lib/screens/dashboardAdmin/components/showDialog.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; + +class Showdialog extends StatelessWidget { + final double? height; + final double? width; + final String title; + final Widget? child; + + Showdialog({ + this.height, + this.width, + required this.title, + this.child, + }); + + @override + Widget build(BuildContext context) { + double screenWidth = MediaQuery.of(context).size.width; + double screenHeight = MediaQuery.of(context).size.height; + + double blockWidth = width ?? screenWidth * 0.9; + double blockHeight = height ?? screenHeight * 0.5; + + return Stack( + children: [ + AlertDialog( + backgroundColor: Color(0xFFD1EEFF), + content: SizedBox( + width: blockWidth, + height: blockHeight, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Título e botão de fechar + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Align( + alignment: Alignment.center, + child: Text( + title, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: Icon( + Icons.close, + size: 25, + ), + ), + ], + ), + + SizedBox( height: MediaQuery.of(context).size.height * 0.05), + + child!, + ], + ), + ), + ), + ], + ); + } +} diff --git a/catavento/lib/screens/employee-management.dart b/catavento/lib/screens/employee-management.dart new file mode 100644 index 0000000..0602fdf --- /dev/null +++ b/catavento/lib/screens/employee-management.dart @@ -0,0 +1,277 @@ +import 'dart:ffi'; +import 'package:catavento/bloc/usuario_bloc.dart'; +import 'package:catavento/screens/components/ativAndamentoCard.dart'; +import 'package:catavento/screens/components/confirmDialog.dart'; +import 'package:catavento/screens/components/graficInfo.dart'; +import 'package:catavento/screens/components/input.dart'; +import 'package:catavento/screens/dashboard_admin.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'components/background.dart'; +import 'components/header.dart'; +import 'components/blocks.dart'; +import 'components/showDialog.dart'; +import 'package:catavento/screens/components/menu.dart'; +import 'components/funcionarioCard.dart'; + +class EmployeeManagement extends StatelessWidget { + final List> funcionarios = [ + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, + {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'} + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: BackgroundPage( + gradientColors: [Color(0xFF75CDF3), Color(0xFFB2E8FF)], + children: [ + Header(title: "Funcionários"), + SizedBox(height: MediaQuery.of(context).size.height * 0.05), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Blocks( + color: Colors.white, + height: 97, + width: 321, + borderRadius: 26, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + Icons.group, + size: 30, + color: Color(0xFF015C98), + ), + SizedBox( + width: MediaQuery.of(context).size.height * 0.04), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [], + ) + ], + ) + ], + ), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + + /*Blocks( + color: Colors.white, + height: 97, + width: 321, + borderRadius: 26, + children: [ + + ], + ),*/ + + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + SizedBox( + height: MediaQuery.of(context).size.height * 0.07, + width: MediaQuery.of(context).size.width * 0.25, + child: ElevatedButton( + onPressed: () { + //Logica do botão + showDialog( + context: context, + builder: (BuildContext context) { + return Showdialog( + width: 463, + height: 402, + title: 'Novo funcionário', + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Inputs( + text: "Nome:", + hint: "Nome do funcionário", + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.02), + Inputs( + text: "Setor:", + hint: "Setor do funcionário", + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.02), + Inputs( + text: "Email:", + hint: "Email do funcionário", + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.02), + Inputs( + text: "Nome de usuário:", + hint: "Nome de usuário do funcionário", + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.02), + Inputs( + text: "Senha:", + hint: "Senha para o funcionário", + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.08), + Positioned.fill( + child: Center( + child: ElevatedButton( + onPressed: () { + //Lógica do botão + Navigator.pop(context); + }, + style: ElevatedButton.styleFrom( + backgroundColor: + Colors.green, + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 22))), + child: Text( + "Cadastrar", + style: TextStyle( + color: Colors.white), + )))) + ]), + ); + }, + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFF015C98), + padding: EdgeInsets.all(16), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(26)), + ), + child: Text( + "Cadastrar funcionário", + style: TextStyle(fontSize: 16, color: Colors.white), + ), + ), + ), + ], + ), + SizedBox(width: MediaQuery.of(context).size.height * 0.07), + + /*Blocks( + color: Colors.white, + height: 559, + width: 346, + borderRadius: 26, + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.6, + width: MediaQuery.of(context).size.height * 0.45, + + child: ListView.builder( //Aqui vai o cards dos funcionarios cadastrados + itemCount: funcionarios.length, + itemBuilder: (context, index) { + final funcionario = funcionarios[index]; + return FuncionarioCard( + nomeFuncionario: funcionario['nome']!, + setor: funcionario['setor']!, + status: funcionario['status']!, + ); + }, + ) + ) + ), + + SizedBox(width: MediaQuery.of(context).size.height * 0.07), + + Blocks( + color: Colors.white, + height: 559, + width: 380, + borderRadius: 26, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Center( + child: Text( + "Setor de Montagem", + style: TextStyle( + fontSize: 14, + color: Colors.black, + ), + ), + ), + ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.25, + width: MediaQuery.of(context).size.height * 0.5, + child: ListView.builder( //Aqui vai o card das atividades em andamento (Corte) + itemCount: ativAndamento.length, + itemBuilder: (context, index) { + final atividade = ativAndamento[index]; + return AtivAndamentoCard( + nomeFuncionario: atividade['nome']!, + nomeDemanda: atividade['demanda']!, + ); + }, + ) + ), + + SizedBox(height: MediaQuery.of(context).size.height * 0.03), + + Center( + child: Text( + "Setor de Corte", + style: TextStyle( + fontSize: 14, + color: Colors.black, + ), + ), + ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.3, + width: MediaQuery.of(context).size.height * 0.5, + child: ListView.builder( //Aqui vai os cards das atividades em andamento (Montagem) + itemCount: ativAndamento.length, + itemBuilder: (context, index) { + final atividade = ativAndamento[index]; + return AtivAndamentoCard( + nomeFuncionario: atividade['nome']!, + nomeDemanda: atividade['demanda']!, + ); + }, + ) + ), + + ], + ) + ) + ], + ), + ], + ), + ); + } +}