using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demko_term.Models;

namespace demko_term;

public partial class ManagerWindow : Window
{
    public ManagerWindow(Employee employee)
    {
        InitializeComponent();
        FioTextBlock.Text = employee.Lastname + " " + employee.Firstname + " " + employee.Patronymic;
        RoleTextBlock.Text = employee.Position.Title;

        try
        {
            string absolutePath = Path.Combine(AppContext.BaseDirectory, employee.Logo);
            EmployeeImage.Source = new Bitmap(absolutePath);
        }
        catch
        {
            EmployeeImage.Source = null;
        }
    }
    
    private void AcceptStatement_OnClick(object? sender, RoutedEventArgs e)
    {
        AcceptStatementWindow acceptStatementWindow = new AcceptStatementWindow();
        acceptStatementWindow.ShowDialog(this);
    }
    
    private void CheckHistoryButton_OnClick(object? sender, RoutedEventArgs e)
    {
        HistoryWindow historyWindow = new HistoryWindow();
        historyWindow.ShowDialog(this);
    }
}