unit MainFrmEstoque;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.MultiView, FMX.Objects, FMX.TabControl,
  FMX.StdCtrls, FMX.Layouts, FMX.ListView.Types, FMX.ListView, FMX.ExtCtrls, FMX.Ani, FMX.Gestures, FMX.ListBox,
  FMX.DateTimeCtrls, FMX.Edit, FMX.MultiView.Types, FMX.Colors,  FMX.MultiView.CustomPresentation,
  FMX.EditBox, FMX.NumberBox, FMX.Controls.Presentation,
  FMX.ListView.Appearances, FMX.ListView.Adapters.Base, Fmx.Bind.GenData,
  Data.Bind.GenData, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti,
  System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components,
  Data.Bind.ObjectScope;

type
  TFormMainEstoque = class(TForm)
    MultiView1: TMultiView;
    ToolBar1: TToolBar;
    MasterButton: TSpeedButton;
    ToolBar2: TToolBar;
    Label1: TLabel;
    Label2: TLabel;
    ListBox1: TListBox;
    ListBoxItemCompraTipoRequisicao: TListBoxItem;
    ListBoxItem2: TListBoxItem;
    ListBoxItem3: TListBoxItem;
    DetailPanel: TPanel;
    TabControl1: TTabControl;
    TabItem3: TTabItem;
    VaporStyleBook: TStyleBook;
    PrototypeBindSource1: TPrototypeBindSource;
    BindingsList1: TBindingsList;
    LinkFillControlToField1: TLinkFillControlToField;
    ListBoxGroupHeader1: TListBoxGroupHeader;
    Panel1: TPanel;
    procedure ListBox1ItemClick(const Sender: TCustomListBox; const Item: TListBoxItem);
    procedure FormCreate(Sender: TObject);
    procedure ListBoxItemCompraTipoRequisicaoClick(Sender: TObject);
    procedure ListBoxItem2Click(Sender: TObject);
    procedure ListBoxItem3Click(Sender: TObject);
  public
    { Public declarations }
  end;

var
  FormMainEstoque: TFormMainEstoque;
  FrameAtual: TFrame;

implementation

uses
  FMX.MultiView.Presentations, UCompraTipoRequisicao, UCompraRequisicaoM,
  UEstoqueReajusteM;

{$R *.fmx}

procedure TFormMainEstoque.FormCreate(Sender: TObject);
begin
  MultiView1.CustomPresentationClass := TMultiViewAlertPresentation;
end;

procedure TFormMainEstoque.ListBox1ItemClick(const Sender: TCustomListBox; const Item: TListBoxItem);
begin
  Item.IsSelected := False;
  MultiView1.HideMaster;
end;

procedure TFormMainEstoque.ListBoxItem2Click(Sender: TObject);
begin
  if Assigned(FrameAtual) then
    FreeAndNil(FrameAtual);
  FrameAtual := TFCompraRequisicaoM.Create(Panel1);

  with FrameAtual do
  begin
    Parent := Panel1;
    Align := FMX.Types.TAlignLayout.Client;
  end;
  TabItem3.Text := ListBoxItem2.Text;
end;

procedure TFormMainEstoque.ListBoxItem3Click(Sender: TObject);
begin
  if Assigned(FrameAtual) then
    FreeAndNil(FrameAtual);
  FrameAtual := TFEstoqueReajusteM.Create(Panel1);

  with FrameAtual do
  begin
    Parent := Panel1;
    Align := FMX.Types.TAlignLayout.Client;
  end;
  TabItem3.Text := ListBoxItem3.Text;
end;

procedure TFormMainEstoque.ListBoxItemCompraTipoRequisicaoClick(Sender: TObject);
begin
  if Assigned(FrameAtual) then
    FreeAndNil(FrameAtual);
  FrameAtual := TFCompraTipoRequisicao.Create(Panel1);

  with FrameAtual do
  begin
    Parent := Panel1;
    Align := FMX.Types.TAlignLayout.Client;
  end;
  TabItem3.Text := ListBoxItemCompraTipoRequisicao.Text;
end;

end.
