Commit c3f1ba54 by cam

finish and tested set status

parent 7c01cce8
......@@ -56,50 +56,6 @@ object FViewOrders: TFViewOrders
WidthPercent = 100.000000000000000000
OnClick = btnSearchClick
end
object pnlMessage: TWebPanel
Left = 82
Top = 352
Width = 125
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 2
object lblMessage: TWebLabel
Left = 32
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object WebButton1: TWebButton
Left = 188
Top = 79
......@@ -114,6 +70,7 @@ object FViewOrders: TFViewOrders
TabOrder = 7
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = WebButton1Click
end
object btnPDF: TWebButton
Left = 332
......@@ -163,6 +120,7 @@ object FViewOrders: TFViewOrders
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
OnClickCell = wdbtcOrdersClickCell
OnDblClickCell = wdbtcOrdersDblClickCell
Columns = <
item
......@@ -343,6 +301,36 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 8
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
......
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<!-- Alert Section -->
<div class="row">
<div class="col-sm">
<div id="pnl_message" class="alert alert-danger">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
......
......@@ -42,9 +42,6 @@ type
xdwdsOrdersplateDue: TStringField;
xdwdsOrdersplateDone: TStringField;
xdwdsOrdersorderType: TStringField;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
btnPDF: TWebButton;
wdsCustomers: TWebDataSource;
......@@ -59,6 +56,9 @@ type
wcbPageSize: TWebComboBox;
wlcbOrderBy: TWebLookupComboBox;
edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -68,6 +68,8 @@ type
procedure wcbPageSizeChange(Sender: TObject);
procedure wlcbOrderByChange(Sender: TObject);
procedure wdbtcOrdersDblClickCell(Sender: TObject; ACol, ARow: Integer);
procedure wdbtcOrdersClickCell(Sender: TObject; ACol, ARow: Integer);
procedure WebButton1Click(Sender: TObject);
private
FChildForm: TWebForm;
procedure ClearTable();
......@@ -78,8 +80,10 @@ type
procedure ShowNotification(Notification: string);
procedure ShowAddOrderForm();
procedure ShowSearchForm();
procedure ShowSetStatusForm();
[async] procedure GetOrders(searchOptions: string);
[async] procedure GenerateReportPDF;
[async] procedure SetStatus(ORDER_ID, date, status: string);
var
PageNumber: integer;
PageSize: integer;
......@@ -115,7 +119,7 @@ var
implementation
uses
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.PDF;
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.SetStatus;
{$R *.dfm}
......@@ -145,6 +149,14 @@ end;
procedure TFViewOrders.WebButton1Click(Sender: TObject);
begin
if OrderID <> '' then
ShowSetStatusForm()
else
ShowNotification('Failure:Please select an order');
end;
procedure TFViewOrders.WebFormCreate(Sender: TObject);
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
......@@ -284,6 +296,44 @@ begin
);
end;
procedure TFViewOrders.ShowSetStatusForm();
// displays the search pop-up that allows the user to filter the order list
var
newform: TFSetStatus;
begin
newform := TFSetStatus.CreateNew;
newform.Caption := 'Input Search Options';
newForm.Popup := True;
newForm.Border := fbDialog;
newForm.OrderID := OrderID;
// used to manage Back button handling to close subform
window.location.hash := 'subform';
newform.ShowModal(
procedure(AValue: TModalResult)
var
searchOptions: string;
begin
if newform.confirm then
begin
SetStatus(OrderID, DateTimeToStr(newform.dtpDate.Date), newform.wlcbStatus.Value);
getOrders(searchOptions);
end;
end
);
end;
procedure TFViewOrders.SetStatus(ORDER_ID, date, status: string);
var
xdcResponse: TXDataClientResponse;
statusOptions: string;
begin
statusOptions := '&ORDER_ID=' + ORDER_ID + '&date=' + date + '&status=' + status + '&USER_ID=1011';
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.SetStatus', [statusOptions]));
end;
procedure TFViewOrders.wcbPageSizeChange(Sender: TObject);
begin
......@@ -291,6 +341,12 @@ begin
getOrders(generateSearchOptions());
end;
procedure TFViewOrders.wdbtcOrdersClickCell(Sender: TObject; ACol,
ARow: Integer);
begin
OrderID := wdbtcOrders.Cells[0, ARow];
end;
procedure TFViewOrders.wdbtcOrdersDblClickCell(Sender: TObject; ACol,
ARow: Integer);
begin
......@@ -645,10 +701,29 @@ end;
procedure TFViewOrders.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
......
object FSetStatus: TFSetStatus
Width = 640
Height = 480
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 168
Top = 124
Width = 38
Height = 14
Caption = 'Status:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 348
Top = 124
Width = 91
Height = 14
Caption = 'Date Completed:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 8
Top = 124
Width = 48
Height = 14
Caption = 'Order ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object wlcbStatus: TWebLookupComboBox
Left = 178
Top = 150
Width = 145
Height = 22
ElementClassName = 'custom-select'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
Value = 'PROOF'
DisplayText = 'Proof'
end
item
Value = 'ART'
DisplayText = 'Art'
end
item
Value = 'PLATE'
DisplayText = 'Plate'
end
item
Value = 'MOUNT'
DisplayText = 'Mount'
end
item
Value = 'SHIP'
DisplayText = 'Ship'
end>
end
object dtpDate: TWebDateTimePicker
Left = 348
Top = 150
Width = 170
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
object btnConfirm: TWebButton
Left = 4
Top = 185
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 114
Top = 185
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object edtOrderID: TWebEdit
Left = 4
Top = 150
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtNotification: TWebEdit
Left = 8
Top = 80
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.SetStatus;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.ExtCtrls,
WEBLib.StdCtrls;
type
TFSetStatus = class(TWebForm)
wlcbStatus: TWebLookupComboBox;
dtpDate: TWebDateTimePicker;
lblStatus1: TWebLabel;
WebLabel1: TWebLabel;
btnConfirm: TWebButton;
btnCancel: TWebButton;
WebLabel2: TWebLabel;
edtOrderID: TWebEdit;
edtNotification: TWebEdit;
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private
{ Private declarations }
procedure HideNotification;
procedure ShowNotification(Notification: string);
public
{ Public declarations }
confirm: boolean;
OrderID: string;
end;
var
FSetStatus: TFSetStatus;
implementation
{$R *.dfm}
procedure TFSetStatus.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TFSetStatus.btnConfirmClick(Sender: TObject);
begin
if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then
ShowNotification('Failure:Please fill in all information')
else
begin
confirm := true;
Close;
end;
end;
procedure TFSetStatus.WebFormShow(Sender: TObject);
begin
HideNotification();
edtOrderID.Text := OrderID;
dtpDate.Date := 0;
end;
procedure TFSetStatus.HideNotification;
begin
//pnlMessage.ElementHandle.hidden := True;
end;
procedure TFSetStatus.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
edtNotification.Text := Notification;
end;
end;
end.
\ No newline at end of file
......@@ -19,7 +19,8 @@ uses
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html},
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html},
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html};
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html},
View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html};
{$R *.res}
......
......@@ -180,6 +180,11 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.SetStatus.pas">
<Form>FSetStatus</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/>
<None Include="css\app.css"/>
<None Include="config\config.json"/>
......
......@@ -239,6 +239,7 @@ type
function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function SetStatus(statusOptions: string): string;
end;
implementation
......
......@@ -47,6 +47,7 @@ type
function GenerateStatusSelectSQL(statusTableShort, statusTableLong, startDate, endDate, statusType: string): string;
function GenerateStatusWhereSQL(status: TStatusSearchInfo): string;
function CreateStatusSearchInfo(params: TStringList; statusNum: string): TStatusSearchInfo;
function SetStatus(statusOptions: string): string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end;
......@@ -1001,6 +1002,53 @@ begin
Result := 'success';
end;
function TLookupService.SetStatus(statusOptions: string): string;
var
params: TStringList;
OrderID: string;
Date: String;
Status: string;
UserID: string;
SQL: string;
begin
params := TStringList.Create;
// parse the statusOptions
params.Delimiter := '&';
params.StrictDelimiter := true;
params.DelimitedText := statusOptions;
OrderID := params.Values['ORDER_ID'];
Date := params.Values['date'];
Status := params.Values['status'];
UserID := params.Values['USER_ID'];
SQL := 'select * from orders_status where ORDER_ID = ' + OrderID + ' AND ' +
'ORDER_STATUS = ' + quotedStr(Status);
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.IsEmpty then
// Add Status
begin
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString := OrderID;
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := Status;
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(Date);
ordersDB.UniQuery1.FieldByName('STATUS_TIMESTAMP').AsDateTime := Now;
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := UserID;
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1;
end
else
// Edit Status
begin
ordersDB.UniQuery1.Edit;
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(Date);
ordersDB.UniQuery1.FieldByName('STATUS_TIMESTAMP').AsDateTime := Now;
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
end;
ordersDB.UniQuery1.Post
end;
function TLookupService.AddUser(userInfo:string): string;
// Adds a user to the database
// userInfo - user information being added
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=86
LogFileNum=91
webClientVersion=1.0.0
[Database]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment