Skip to content

Commit 4770188

Browse files
committed
feature/aula11-001
1 parent c8f64c0 commit 4770188

7 files changed

Lines changed: 104 additions & 14 deletions

File tree

ClientWeb/ClientWeb.dpr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ uses
66
Vcl.Forms,
77
WEBLib.Forms,
88
Main.View in 'Src\Main.View.pas' {MainView: TWebForm} {*.html},
9-
Login.View in 'Src\Login.View.pas' {LoginView: TWebForm} {*.html};
9+
Login.View in 'Src\Login.View.pas' {LoginView: TWebForm} {*.html},
10+
Clientes.Cadastrar.View in 'Src\ClientesCadastrar\Clientes.Cadastrar.View.pas' {ClientesCadastrarView: TWebForm} {*.html};
1011

1112
{$R *.res}
1213

ClientWeb/ClientWeb.dproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@
118118
<FormType>dfm</FormType>
119119
<DesignClass>TWebForm</DesignClass>
120120
</DCCReference>
121+
<DCCReference Include="Src\ClientesCadastrar\Clientes.Cadastrar.View.pas">
122+
<Form>ClientesCadastrarView</Form>
123+
<FormType>dfm</FormType>
124+
<DesignClass>TWebForm</DesignClass>
125+
</DCCReference>
121126
<None Include="Index.html"/>
122127
<None Include="Index.css"/>
123128
<None Include="AdminLTE\dist\css\adminlte.css"/>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object ClientesCadastrarView: TClientesCadastrarView
2+
Width = 788
3+
Height = 559
4+
end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="pt-br">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Formulário</title>
7+
</head>
8+
<body>
9+
<div class="container mt-4">
10+
<form>
11+
<div class="row g-3">
12+
<div class="col-md-6">
13+
<label id="lbCodigo" for="edtCodigo" class="form-label">Código</label>
14+
<input type="text" id="edtCodigo" class="form-control" readonly>
15+
</div>
16+
<div class="col-md-6">
17+
<label id="lbIdCidade" for="edtIdCidade" class="form-label">IdCidade</label>
18+
<input type="number" id="edtIdCidade" class="form-control">
19+
</div>
20+
<div class="col-md-6">
21+
<label id="lbNome" for="edtNome" class="form-label">Nome</label>
22+
<input type="text" id="edtNome" class="form-control">
23+
</div>
24+
<div class="col-md-6">
25+
<label id="lbProfissao" for="edtProfissao" class="form-label">Profissão</label>
26+
<input type="text" id="edtProfissao" class="form-control">
27+
</div>
28+
<div class="col-md-6">
29+
<label id="lbLimite" for="edtLimite" class="form-label">Limite</label>
30+
<input type="number" id="edtLimite" class="form-control">
31+
</div>
32+
<div class="col-md-6">
33+
<label id="lbPorcentagem" for="edtPorcentagem" class="form-label">Porcentagem</label>
34+
<input type="number" id="edtPorcentagem" class="form-control">
35+
</div>
36+
<div class="col-12">
37+
<div class="form-check">
38+
<input type="checkbox" id="ckAtivo" class="form-check-input">
39+
<label id="lbAtivo" for="ckAtivo" class="form-check-label">Ativo</label>
40+
</div>
41+
</div>
42+
<div class="col-12 d-flex gap-2">
43+
<button type="button" id="btnGravar" class="btn btn-primary">Gravar</button>
44+
<button type="reset" id="btnLimpar" class="btn btn-secondary">Limpar</button>
45+
</div>
46+
</div>
47+
</form>
48+
</div>
49+
</body>
50+
</html>
51+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
unit Clientes.Cadastrar.View;
2+
3+
interface
4+
5+
uses
6+
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
7+
WEBLib.Forms, WEBLib.Dialogs;
8+
9+
type
10+
TClientesCadastrarView = class(TWebForm)
11+
private
12+
{ Private declarations }
13+
public
14+
{ Public declarations }
15+
end;
16+
17+
var
18+
ClientesCadastrarView: TClientesCadastrarView;
19+
20+
implementation
21+
22+
{$R *.dfm}
23+
24+
end.

ClientWeb/Src/Main.View.dfm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ object MainView: TMainView
162162
HeightPercent = 100.000000000000000000
163163
WidthPercent = 100.000000000000000000
164164
OnClick = btnAlterarClick
165-
ExplicitLeft = 581
166165
end
167166
object btnDelete: TWebButton
168167
Left = 723
@@ -176,7 +175,6 @@ object MainView: TMainView
176175
HeightPercent = 100.000000000000000000
177176
WidthPercent = 100.000000000000000000
178177
OnClick = btnDeleteClick
179-
ExplicitLeft = 729
180178
end
181179
end
182180
object mmTeste: TWebMemo

ClientWeb/Src/Main.View.pas

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ interface
2020
XData.Web.Client,
2121
XData.Web.Connection,
2222
WEBLib.DB,
23-
JS;
23+
JS,
24+
Clientes.Cadastrar.View;
2425

2526
type
2627
TMainView = class(TWebForm)
@@ -179,16 +180,6 @@ procedure TMainView.btnListarClick(Sender: TObject);
179180
end;
180181
end;
181182

182-
procedure TMainView.btnPostClick(Sender: TObject);
183-
var
184-
LResponse: TXDataClientResponse;
185-
begin
186-
LResponse := TAwait.Exec<TXDataClientResponse>(
187-
XDataWebClient1.RawInvokeAsync('IClientesService.Post', [Self.GetClientePreenchido]));
188-
189-
mmTeste.Lines.Text := LResponse.ResponseText;
190-
end;
191-
192183
function TMainView.GetClientePreenchido: TJSObject;
193184
begin
194185
Result := TJSObject.new;
@@ -223,4 +214,20 @@ procedure TMainView.btnDeleteClick(Sender: TObject);
223214
mmTeste.Lines.Add('ResponseText: ' + LResponse.ResponseText);
224215
end;
225216

217+
{
218+
procedure TMainView.btnPostClick(Sender: TObject);
219+
var
220+
LResponse: TXDataClientResponse;
221+
begin
222+
LResponse := TAwait.Exec<TXDataClientResponse>(
223+
XDataWebClient1.RawInvokeAsync('IClientesService.Post', [Self.GetClientePreenchido]));
224+
225+
mmTeste.Lines.Text := LResponse.ResponseText;
226+
end;}
227+
228+
procedure TMainView.btnPostClick(Sender: TObject);
229+
begin
230+
//
231+
end;
232+
226233
end.

0 commit comments

Comments
 (0)