using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Threading; using Gestor.Application.Actions; using Gestor.Application.Componentes; using Gestor.Application.Drawers; using Gestor.Application.Helpers; using Gestor.Application.Servicos; using Gestor.Application.ViewModels.BI; using Gestor.Application.Views.Ferramentas; using Gestor.Application.Views.Generic; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Ferramentas; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.MalaDireta; using Gestor.Model.Domain.Seguros; using MaterialDesignThemes.Wpf; using Xceed.Wpf.AvalonDock.Controls; namespace Gestor.Application.Views.BI; public class TarefaView : BaseUserControl, IComponentConnector, IStyleConnector { internal ComboBox UsuarioBox; internal DatePicker InicioBox; internal DatePicker FimBox; internal TextBox TituloTarefaLabel; internal DatePicker AgendamentoBox; internal ComboBox ResponsavelBox; internal RadioButton AnotacoesButton; internal RadioButton AnotacoesInternasButton; internal WebEditor Anotacoes; internal WebEditor Historico; internal WebEditor AnotacoesInternas; internal WebEditor HistoricoInterno; private bool _contentLoaded; public TarefaBIViewModel ViewModel { get; set; } public TarefaView() { ViewModel = new TarefaBIViewModel(); ((FrameworkElement)this).DataContext = ViewModel; InitializeComponent(); Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); } } private void ContentLoad() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; ((ToggleButton)AnotacoesInternasButton).IsChecked = !ViewModel.IsAnotacoes; ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); ((ToggleButton)AnotacoesInternasButton).Checked += new RoutedEventHandler(AnotacoesInternas_OnChecked); } private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e) { if (!(await ViewModel.ValidaPermissaoParaExcluirTarefa())) { await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE EXCLUIR ESSA TAREFA."); } else { await ViewModel.Excluir(); } } private async void TarefaConcluida_OnClick(object sender, RoutedEventArgs e) { object dataContext = ((FrameworkElement)(Button)sender).DataContext; Tarefa tarefa = (Tarefa)((dataContext is Tarefa) ? dataContext : null); if (tarefa != null) { if (!(await ViewModel.ValidaPermissaoParaEditarTarefa())) { await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE CONCLUIR ESSA TAREFA."); return; } tarefa.Conclusao = Funcoes.GetNetworkTime(); tarefa.Status = (StatusTarefa)2; await ViewModel.ConcluirTarefa(tarefa); await ViewModel.CarregarTarefas(); Gestor.Application.Actions.Actions.AtualizaTrilhas?.Invoke(); } } private async void Concluida_OnClick(object sender, RoutedEventArgs e) { if (ViewModel.SelectedTarefa == null) { await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA TAREFA ANTES DE CONCLUIR."); return; } if (!(await ViewModel.ValidaPermissaoParaEditarTarefa())) { await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE CONCLUIR ESSA TAREFA."); return; } ViewModel.SelectedTarefa.Conclusao = Funcoes.GetNetworkTime(); ViewModel.SelectedTarefa.Status = (StatusTarefa)2; await ViewModel.ConcluirTarefa(ViewModel.SelectedTarefa); await ViewModel.CarregarTarefas(); } private async void NaoConcluida_OnClick(object sender, RoutedEventArgs e) { if (ViewModel.SelectedTarefa == null) { await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA TAREFA ANTES DE MARCAR COMO NÃO CONCLUÍDO."); return; } ViewModel.SelectedTarefa.Conclusao = null; ViewModel.SelectedTarefa.Status = (StatusTarefa)0; await ViewModel.ConcluirTarefa(ViewModel.SelectedTarefa); await ViewModel.CarregarTarefas(); } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { ViewModel.SelectedTarefa.Anotacoes = Anotacoes.GetHtml(); ViewModel.SelectedTarefa.AnotacoesInternas = AnotacoesInternas.GetHtml(); ViewModel.SelectedTarefa.Usuario = (Usuario)((Selector)ResponsavelBox).SelectedItem; List> list = await ViewModel.Salvar(TituloTarefaLabel.Text); bool num = list == null || list.Count == 0; ViewModel.Loading(isLoading: false); if (num) { ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); ViewModel.Alterar(alterar: false); } else { await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); } } private async void Cancelar_OnClick(object sender, RoutedEventArgs e) { await ViewModel.Cancelar(); } private async void Excluir_OnClick(object sender, RoutedEventArgs e) { if (!ViewModel.SelectedTarefa.Restrito.HasValue || !ViewModel.SelectedTarefa.Restrito.Value || ((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id == ((DomainBase)Recursos.Usuario).Id || Recursos.Usuario.Administrador) { await ViewModel.Excluir(); } else { await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE EXCLUIR ESSA TAREFA."); } } private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) { ViewModel.AdcionarFiltro(); } private void ExcluirFiltro_onClick(object sender, RoutedEventArgs e) { Chip val = (Chip)((sender is Chip) ? sender : null); if (val != null) { ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; if (text != null) { ViewModel.ExcluirFiltro(text); } } } private void Alterar_OnClick(object sender, RoutedEventArgs e) { ViewModel.AlterarTarefa(); Anotacoes.Initialize(); AnotacoesInternas.Initialize(); } private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Button val = (Button)sender; if (((FrameworkElement)val).DataContext != null) { object dataContext = ((FrameworkElement)val).DataContext; TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null); if (val2 != null) { (val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero)).CopyToClipboard(); ViewModel.ToggleSnackBar("COPIADO - " + val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero)); } } } private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) { Button val = (Button)sender; if (((FrameworkElement)val).DataContext != null) { object dataContext = ((FrameworkElement)val).DataContext; TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null); if (val2 != null && !((val2.Tipo.HasValue && (int)val2.Tipo.GetValueOrDefault() == 8) ? (val2.Prefixo + val2.Numero).Clear() : ("55" + val2.Prefixo + val2.Numero.Clear())).EnviarWhatsapp()) { await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); } } } private async void Email_OnClick(object sender, RoutedEventArgs e) { MalaDireta val = await ViewModel.CriarMalaDireta(ViewModel.SelectedTarefa.Entidade); if (val == null) { await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR."); return; } if (Funcoes.IsWindowOpen("ENVIO DE E-MAIL")) { Funcoes.Destroy("ENVIO DE E-MAIL"); } string text = "Cliente: " + ViewModel.SelectedTarefa.Cliente + "
"; text += $"Número do Atendimento: {((DomainBase)ViewModel.SelectedTarefa).Id}
"; text += $"Data/Hora da Solicitação: {ViewModel.SelectedTarefa.Agendamento}
"; if (ViewModel.SelectedTarefa.Conclusao.HasValue) { text += $"Data/Hora da Conclusão: {ViewModel.SelectedTarefa.Conclusao}
"; } if (ViewModel.SelectedTarefa.Usuario != null) { text = text + "Atendente: " + ViewModel.SelectedTarefa.Usuario.Nome + "
"; } if (ViewModel.SelectedTarefa.TipoDeTarefa != null) { text = text + "Tipo: " + ViewModel.SelectedTarefa.TipoDeTarefa.Nome + "
"; } text = text + "Assunto: " + ViewModel.SelectedTarefa.Titulo + "
"; text = text + "Situação do Atendimento: " + ValidationHelper.GetDescription((Enum)(object)ViewModel.SelectedTarefa.Status) + "

"; text += "Prezado cliente,
"; text += "Segue, abaixo, a descrição do seu atendimento prestado pela corretora.

"; ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List { val }, ViewModel.SelectedTarefa.Titulo, text + ViewModel.Descricao), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); } private void Imprimir_OnClick(object sender, RoutedEventArgs e) { if (((DomainBase)ViewModel.SelectedTarefa).Id != 0L) { ViewModel.Print(); } } private void Cliente_OnClick(object sender, RoutedEventArgs e) { ViewModel.Abrir((TipoTarefa)2); } private void Apolice_OnClick(object sender, RoutedEventArgs e) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 ViewModel.Abrir((TipoTarefa)(((int)ViewModel.SelectedTarefa.Entidade == 3) ? 3 : 0)); } private void Sinistro_OnClick(object sender, RoutedEventArgs e) { ViewModel.Abrir((TipoTarefa)4); } private void AbrirLog_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirLog((TipoTela)38, ((DomainBase)ViewModel.SelectedTarefa).Id); } private void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirArquivoDigital(); } private async void AnexoTarefa_OnClick(object sender, RoutedEventArgs e) { if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)15).Consultar) { await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)15) + "."); return; } FiltroArquivoDigital filtro = new FiltroArquivoDigital { Id = ((DomainBase)ViewModel.SelectedTarefa).Id, Tipo = (TipoArquivoDigital)15, Parente = ViewModel.SelectedTarefa }; ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); } private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) { ViewModel.IsAnotacoes = true; } private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) { ViewModel.IsAnotacoes = false; } private void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Chip val = (Chip)((sender is Chip) ? sender : null); if (val == null) { return; } ResponsavelTarefa val2 = (ResponsavelTarefa)((FrameworkElement)val).DataContext; if (val2 != null) { ViewModel.Responsaveis.Remove(val2); ViewModel.Usuarios.Add(val2.Usuario); ViewModel.Usuarios = new ObservableCollection(ViewModel.Usuarios.OrderBy((Usuario x) => x.Nome)); } } private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) { ViewModel.AdcionarResponsavel(); } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/views/bi/tarefaview.xaml", UriKind.Relative); Application.LoadComponent((object)this, uri); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] internal Delegate _CreateDelegate(Type delegateType, string handler) { return Delegate.CreateDelegate(delegateType, this, handler); } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IComponentConnector.Connect(int connectionId, object target) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Expected O, but got Unknown switch (connectionId) { case 1: UsuarioBox = (ComboBox)target; break; case 2: InicioBox = (DatePicker)target; ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); break; case 3: FimBox = (DatePicker)target; ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); break; case 4: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); break; case 8: ((MenuItem)target).Click += new RoutedEventHandler(Concluida_OnClick); break; case 9: ((MenuItem)target).Click += new RoutedEventHandler(NaoConcluida_OnClick); break; case 10: ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); break; case 11: ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); break; case 12: ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); break; case 13: ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); break; case 14: ((MenuItem)target).Click += new RoutedEventHandler(AnexoTarefa_OnClick); break; case 15: ((MenuItem)target).Click += new RoutedEventHandler(Cliente_OnClick); break; case 16: ((MenuItem)target).Click += new RoutedEventHandler(Apolice_OnClick); break; case 17: ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); break; case 18: ((MenuItem)target).Click += new RoutedEventHandler(Sinistro_OnClick); break; case 19: ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); break; case 20: ((MenuItem)target).Click += new RoutedEventHandler(Email_OnClick); break; case 21: ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); break; case 24: TituloTarefaLabel = (TextBox)target; break; case 25: AgendamentoBox = (DatePicker)target; ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); break; case 26: ResponsavelBox = (ComboBox)target; break; case 27: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick); break; case 29: AnotacoesButton = (RadioButton)target; break; case 30: AnotacoesInternasButton = (RadioButton)target; break; case 31: Anotacoes = (WebEditor)target; break; case 32: Historico = (WebEditor)target; break; case 33: AnotacoesInternas = (WebEditor)target; break; case 34: HistoricoInterno = (WebEditor)target; break; default: _contentLoaded = true; break; } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IStyleConnector.Connect(int connectionId, object target) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown switch (connectionId) { case 5: ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onClick); break; case 6: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTarefa_OnClick); break; case 7: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(TarefaConcluida_OnClick); break; case 22: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); break; case 23: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); break; case 28: ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick); break; } } }