Commit 8d360d08 by Mac Stephens

Merge branch 'cam'

parents 63620b75 c515903d
......@@ -7,7 +7,7 @@ uses
XData.Web.Client;
const
TOKEN_NAME = 'WEBENVOYCALLS_TOKEN';
TOKEN_NAME = 'KG_ORDERS_WEB_TOKEN';
type
TOnLoginSuccess = reference to procedure;
......
......@@ -5,30 +5,6 @@
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<form class="form-inline">
<div class="col-sm py-2">
<label class='pe-2'style="font-weight: 700;">Location:</label>
<select class="custom-select" id="wcblocation" style="font-size: 1.00rem;"></select>
</div>
<div class="row">
<div class="col-sm-6">
<label class='pe-2'style="font-weight: 700;">Phone Number:</label>
<input class="form-control input-sm" id="edtsearch">
</div>
</div>
</form>
<form class="form-inline">
<div class="row">
<div class="col-sm-6">
<label style="font-weight: 700;">Start Date:</label>
<input class="form-control input-sm" id="dtpstartdate" type="date">
</div>
<div class="col-sm-6">
<label class= 'pe-2'style="font-weight: 700;">End Date:</label>
<input class="form-control input-sm" id="dtpenddate" type="date">
</div>
</div>
</form>
<form class="form-inline">
<div class= "row">
<div class="col-sm-5">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
......@@ -42,16 +18,25 @@
</div>
</div>
</form>
</div>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark">
<tr>
<th scope="col">Phone Number</th>
<th scope="col">Caller</th>
<th scope="col">Time</th>
<th scope="col">Duration</th>
<th scope="col">Transcript</th>
<th scope="col">Listen</th>
<th scope="col">Order ID</th>
<th scope="col">Company Name</th>
<th scope="col">Job Name</th>
<th scope="col">Order Date</th>
<th scope="col">Proof Due</th>
<th scope="col">Proof Date</th>
<th scope="col">Art Due</th>
<th scope="col">Art Done</th>
<th scope="col">Mount Due</th>
<th scope="col">Mount Done</th>
<th scope="col">Ship Due</th>
<th scope="col">Ship Done</th>
<th scope="col">Price</th>
<th scope="col">Quickbooks Reference Number</th>
<th scope="col">Colors</th>
</tr>
</thead>
<tbody>
......@@ -68,7 +53,6 @@
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal-dialog">
......
......@@ -2,17 +2,6 @@ object FViewEditUser: TFViewEditUser
Width = 640
Height = 480
OnShow = WebFormCreate
object WebLabel1: TWebLabel
Left = 8
Top = 125
Width = 73
Height = 15
Caption = 'Make Admin?'
Color = clBtnFace
ElementID = 'lblAdmin'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 16
Top = 8
......@@ -35,19 +24,19 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 6
Top = 62
Width = 84
object lblQB: TWebLabel
Left = 256
Top = 65
Width = 80
Height = 15
Caption = 'Phone Number:'
Caption = 'Quickbooks ID:'
Color = clBtnFace
ElementID = 'lblphone'
ElementID = 'lblQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 256
Left = 284
Top = 8
Width = 56
Height = 15
......@@ -69,8 +58,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000
end
object WebLabel7: TWebLabel
Left = 252
Top = 69
Left = 35
Top = 62
Width = 32
Height = 15
Caption = 'Email:'
......@@ -80,8 +69,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000
end
object lblactive: TWebLabel
Left = 291
Top = 125
Left = 45
Top = 163
Width = 38
Height = 15
Caption = 'Active?'
......@@ -90,23 +79,33 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblLocation: TWebLabel
object lblRights: TWebLabel
Left = 3
Top = 96
Width = 87
Width = 74
Height = 15
Caption = 'Default Location'
ElementID = 'lbllocation'
Caption = 'System Rights'
ElementID = 'lblrights'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtPhoneNumber: TWebEdit
Left = 96
Top = 62
Width = 121
Height = 22
ChildOrder = 7
ElementID = 'edtphonenumber'
object lblAccess: TWebLabel
Left = 272
Top = 96
Width = 66
Height = 15
Caption = 'Access Type:'
ElementID = 'lblaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblPerspective: TWebLabel
Left = 3
Top = 132
Width = 77
Height = 15
Caption = 'Perspective ID:'
ElementID = 'lblperspective'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
......@@ -121,7 +120,7 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000
end
object edtEmail: TWebEdit
Left = 348
Left = 96
Top = 62
Width = 121
Height = 22
......@@ -140,26 +139,9 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbAdmin: TWebCheckBox
Left = 96
Top = 124
Width = 107
Height = 20
Caption = 'Make Admin?'
ChildOrder = 12
ElementID = 'cbadminuser'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 96
Top = 170
Top = 200
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -197,8 +179,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000
end
object btnCancel: TWebButton
Left = 237
Top = 170
Left = 221
Top = 200
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -234,7 +216,7 @@ object FViewEditUser: TFViewEditUser
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 10
TabOrder = 8
object lblMessage: TWebLabel
Left = 16
Top = 11
......@@ -257,14 +239,14 @@ object FViewEditUser: TFViewEditUser
OnClick = btnCloseNotificationClick
end
end
object cbActive: TWebCheckBox
Left = 346
Top = 124
object cbStatus: TWebCheckBox
Left = 96
Top = 162
Width = 107
Height = 20
Caption = 'Active?'
ChildOrder = 12
ElementID = 'cbactive'
ElementID = 'cbstatus'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
......@@ -274,47 +256,63 @@ object FViewEditUser: TFViewEditUser
ParentFont = False
WidthPercent = 100.000000000000000000
end
object wcbLocation: TWebLookupComboBox
object edtQB: TWebEdit
Left = 348
Top = 62
Width = 121
Height = 22
ChildOrder = 7
ElementID = 'edtQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtRights: TWebEdit
Left = 96
Top = 96
Width = 145
Top = 93
Width = 121
Height = 22
ElementID = 'wcblocation'
ElementFont = efCSS
ChildOrder = 19
ElementID = 'edtrights'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbAccess: TWebComboBox
Left = 352
Top = 90
Width = 145
Height = 23
ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
DisplayText = 'All'
end
item
Value = '(716) 681-8820'
DisplayText = 'Galleria'
end
item
Value = '(716) 297-4654'
DisplayText = 'NF Outlet'
end
item
Value = '(585) 445-8911'
DisplayText = 'Rochester'
end
item
Value = '(315) 565-4138'
DisplayText = 'Syracuse'
end>
Items.Strings = (
'PLATE'
'MOUNT'
'SHIP'
'ART'
'ALL'
'ACTIVE')
end
object edtPerspective: TWebEdit
Left = 96
Top = 129
Width = 121
Height = 22
ChildOrder = 23
ElementID = 'edtperspective'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 462
Top = 164
Left = 556
Top = 416
end
object WebTimer1: TWebTimer
Enabled = False
Interval = 500
OnTimer = WebTimer1Timer
Left = 236
Top = 194
Left = 430
Top = 382
end
end
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
......@@ -39,30 +38,37 @@
<form class="form-inline">
<div class="row">
<div class="col-sm">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblphone">Phone Number:</label>
<input id="edtphonenumber" class= "form-control input-sm" width='50%'/>
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblemail">Email Address:</label>
<input id="edtemail" class= "form-control input-sm" width='50%'/>
</div>
<div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblemail">Email Address:</label>
<input class="form-control input-sm" id="edtemail">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblQB">Quickbook ID:</label>
<input class="form-control input-sm" id="edtQB">
</div>
</div>
</form>
<div class="row">
<div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lbllocation">Location:</label>
<select class="custom-select-large" id="wcblocation" style="font-size: 1.00rem;"></select>
<div class="col-sm">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblrights">System Rights:</label>
<input id="edtrights" class= "form-control input-sm" width='50%'/>
</div>
<div class="col-sm-6">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblperspective">Perspective ID:</label>
<input id="edtperspective" class= "form-control input-sm" width='50%'/>
</div>
</div>
<div class="row">
<div class="col-sm py-3">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblaccess">Access Type:</label>
<select class="custom-select-large" id="cbaccess" style="font-size: 1.00rem;"></select>
</div>
</div>
<div class="row">
<div class="col-sm">
<form class='form-inline'>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbadminuser"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblAdmin">Make Admin?</label></div>
</div>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbactive"></div>
<div class="form-cells"><input type="checkbox" id="cbstatus"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active></label></div>
</div>
</form>
......
......@@ -12,18 +12,15 @@ uses
type
TFViewEditUser = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
lblQB: TWebLabel;
WebLabel5: TWebLabel;
WebLabel6: TWebLabel;
WebLabel7: TWebLabel;
edtPhoneNumber: TWebEdit;
edtConfirmPassword: TWebEdit;
edtEmail: TWebEdit;
edtPassword: TWebEdit;
cbAdmin: TWebCheckBox;
btnConfirm: TWebButton;
edtFullname: TWebEdit;
edtUsername: TWebEdit;
......@@ -35,9 +32,14 @@ type
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
lblactive: TWebLabel;
cbActive: TWebCheckBox;
lblLocation: TWebLabel;
wcbLocation: TWebLookupComboBox;
cbStatus: TWebCheckBox;
lblRights: TWebLabel;
edtQB: TWebEdit;
edtRights: TWebEdit;
lblAccess: TWebLabel;
cbAccess: TWebComboBox;
lblPerspective: TWebLabel;
edtPerspective: TWebEdit;
procedure WebFormCreate(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
......@@ -49,12 +51,14 @@ type
FMessage: string;
Mode: string;
Username: string;
Password: string;
FullName: string;
Phone: string;
Status: string;
Email: string;
Location: string;
Admin: boolean;
Active: boolean;
Access: string;
Rights: string;
Perspective: string;
QB: string;
[async] procedure EditUser();
[async] function AddUser(): string;
procedure HideNotification();
......@@ -62,7 +66,8 @@ type
public
{ Public declarations }
Info: string;
class function CreateForm(AElementID, Mode, Username, FullName, Phone, Email, Location: string; Admin, Active: boolean): TWebForm;
class function CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string): TWebForm;
end;
var
......@@ -108,13 +113,16 @@ var
xdcResponse: TXDataClientResponse;
responseString: TJSObject;
begin
userInfo := '&username=' + string(edtUsername.Text).ToLower +
'&password=' + edtPassword.Text +
'&fullname=' + edtFullName.Text +
'&phonenumber=' + edtPhoneNumber.Text +
'&email=' + edtEmail.Text +
'&admin=' + BoolToStr(cbAdmin.Checked) +
'&location=' + wcbLocation.Value;
userInfo := '&username=' + edtUsername.Text +
'&fullname=' + edtFullName.Text +
'&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text +
'&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser',
[userInfo]));
......@@ -146,13 +154,14 @@ begin
editOptions := 'username=' + Username +
'&fullname=' + edtFullName.Text +
'&phonenumber=' + edtPhoneNumber.Text +
'&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text +
'&admin=' + BoolToStr(cbAdmin.Checked) +
'&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text +
'&password=' + edtPassword.Text +
'&active=' + BoolToStr(cbActive.Checked) +
'&location=' + wcbLocation.DisplayText;
'&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
console.log(editOptions);
......@@ -163,18 +172,20 @@ begin
end;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, FullName, Phone, Email, Location: string; Admin, Active: boolean): TWebForm;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string): TWebForm;
// Autofills known information about a user on create
procedure AfterCreate(AForm: TObject);
begin
TFViewEditUser(AForm).Mode := Mode;
TFViewEditUser(AForm).Username := Username;
TFViewEditUser(AForm).FullName := FullName;
TFViewEditUser(AForm).Phone := Phone;
TFViewEditUser(AForm).Email:= Email;
TFViewEditUser(AForm).Location:= Location;
TFViewEditUser(AForm).Admin := Admin;
TFViewEditUser(AForm).Active := Active;
TFViewEditUser(AForm).FullName := Name;
TFViewEditUser(AForm).Status := Status;
TFViewEditUser(AForm).Email := Email;
TFViewEditUser(AForm).Access := Access;
TFViewEditUser(AForm).Rights := Rights;
TFViewEditUser(AForm).Perspective := Perspective;
TFViewEditUser(AForm).QB := QB;
end;
{$R *.dfm}
......@@ -197,14 +208,14 @@ begin
begin
edtPassword.Text := 'hidden';
edtConfirmPassword.Text := 'hidden';
end
else
cbAdmin.Enabled := False;
wcbLocation.DisplayText := Location;
edtPhoneNumber.Text := Phone;
edtEmail.Text := Email;
cbAdmin.checked := Admin;
cbActive.Checked := Active;
end;
edtEmail.Text := Email;
cbAccess.Text := Access;
edtRights.Text := Rights;
edtQB.Text := QB;
if Status = 'ACTIVE' then
cbStatus.checked := true;
edtPerspective.Text := Perspective
end;
procedure TFViewEditUser.WebTimer1Timer(Sender: TObject);
......@@ -229,7 +240,7 @@ var
charIndex: integer;
phoneNum: string;
begin
checkString := edtFullName.Text + edtUsername.Text + edtPassword.Text
{ checkString := edtFullName.Text + edtUsername.Text + edtPassword.Text
+ edtConfirmPassword.Text + edtPhoneNumber.Text + edtEmail.Text;
if string(edtFullName.Text).IsEmpty then
begin
......@@ -331,7 +342,7 @@ begin
ShowNotification('Passwords must be between 6-20 characters!');
exit;
end;
}
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false });
......
object FViewCalls: TFViewCalls
object FViewItems: TFViewItems
Width = 676
Height = 480
CSSLibrary = cssBootstrap
......@@ -22,37 +22,6 @@ object FViewCalls: TFViewCalls
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbLocation: TWebLookupComboBox
Left = 154
Top = 0
Width = 145
Height = 22
ElementID = 'wcblocation'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
DisplayText = 'All'
end
item
Value = '(716) 681-8820'
DisplayText = 'Galleria'
end
item
Value = '(716) 297-4654'
DisplayText = 'NF Outlet'
end
item
Value = '(585) 445-8911'
DisplayText = 'Rochester'
end
item
Value = '(315) 565-4138'
DisplayText = 'Syracuse'
end>
end
object wcbPageSize: TWebComboBox
Left = 0
Top = 0
......@@ -65,29 +34,13 @@ object FViewCalls: TFViewCalls
HeightPercent = 100.000000000000000000
Text = '10'
WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange
ItemIndex = -1
Items.Strings = (
'10'
'25'
'50')
end
object wcbSortBy: TWebComboBox
Left = 442
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbsortby'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = 'Date'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Date'
'Phone Number')
end
object btnApply: TWebButton
Left = 478
Top = 128
......@@ -103,43 +56,42 @@ object FViewCalls: TFViewCalls
WidthPercent = 100.000000000000000000
OnClick = btnApplyClick
end
object edtSearch: TWebEdit
Left = 48
Top = 382
object edtName: TWebEdit
Left = 342
Top = 0
Width = 121
Height = 22
HelpType = htKeyword
ChildOrder = 8
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtsearch'
ElementID = 'edtname'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
TextHint = 'Format: (XXX) XXX-XXXX'
WidthPercent = 100.000000000000000000
end
object dtpStartDate: TWebEdit
Left = 342
object edtDescription: TWebEdit
Left = 478
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'dtpstartdate'
ElementID = 'edtdescription'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object dtpEndDate: TWebEdit
Left = 478
Top = 0
Width = 121
object cbStatus: TWebCheckBox
Left = 354
Top = 52
Width = 113
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'dtpenddate'
ChildOrder = 5
ElementClassName = 'custom-control custom-checkbox'
ElementButtonClassName = 'custom-control-input'
ElementLabelClassName = 'custom-control-label'
ElementID = 'cbstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
......
<div class="row">
<div class="col-12">
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<form class="form-inline">
<div class="row">
<div class="col-sm-6">
<label style="font-weight: 700;">Name:</label>
<input class="form-control input-sm" id="edtname">
</div>
<div class="col-sm-6">
<label class= 'pe-2'style="font-weight: 700;">Description:</label>
<input class="form-control input-sm" id="edtdescription">
</div>
</div>
</form>
<div class="row">
<div class="col-sm">
<form class='form-inline'>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbstatus"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active?</label></div>
</div>
</form>
</div>
</div>
<form class="form-inline">
<div class= "row">
<div class="col-sm-5">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div>
<div class="col-sm-5">
<button class= "ps-3" id="btnapply"></button>
</div>
</div>
</form>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark">
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<!-- Rows will be added dynamically via Delphi code -->
</tbody>
</table>
<label id="lblentries"></label>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="audioModalLabel">Audio Player</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="stopAudio()"></button>
</div>
<div class="modal-body">
<audio controls id="audioPlayer">
<source src="" type="audio/mp3" id="audioSource">
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
</div>
<script>
document.getElementById('tblPhoneGrid').addEventListener('click', function(event) {
// Check if the clicked element is a table cell (td)
if (event.target.tagName === 'TD') {
const row = event.target.parentNode;
const cells = row.getElementsByTagName('td');
// Extract data from the row
const id = cells[0].textContent;
const name = cells[1].textContent;
const description = cells[2].textContent;
const status = cells[3].textContent.trim().toLowerCase();
// Populate form fields
document.getElementById('edtname').value = name;
document.getElementById('edtdescription').value = description;
// Set the checkbox based on the status
const isActive = status === 'active';
document.getElementById('cbstatus').checked = isActive;
console.log(`Row clicked! ID: ${id}, Name: ${name}, Description: ${description}, Status: ${status}`);
}
});
</script>
// Displays calls and their associated recordings in the grid. Allows the user
// Displays items in the grid. Allows the user
// to sort the entries, filter their search, and search for a specific person.
// Authors:
// Cameron Hayes
// Mac ...
unit View.Calls;
unit View.Items;
interface
......@@ -15,29 +15,29 @@ uses
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WebAudio;
type
TFViewCalls = class(TWebForm)
wcbLocation: TWebLookupComboBox;
TFViewItems = class(TWebForm)
XDataWebClient1: TXDataWebClient;
XDataWebDataSet1: TXDataWebDataSet;
lblEntries: TWebLabel;
wcbPageSize: TWebComboBox;
wcbSortBy: TWebComboBox;
btnApply: TWebButton;
edtSearch: TWebEdit;
dtpStartDate: TWebEdit;
dtpEndDate: TWebEdit;
edtName: TWebEdit;
edtDescription: TWebEdit;
cbStatus: TWebCheckBox;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
private
FChildForm: TWebForm;
procedure AddRowToTable(PhoneNumber, Caller, Time, Duration, Transcript, MediaUrl: string);
procedure AddRowToTable(ID, Name, Description, Status: string);
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string);
[async] procedure GetCalls(searchOptions: string);
[async] procedure GetItems(searchOptions: string);
[async] procedure getUser();
[async] procedure AddItem(itemOptions: string);
var
PageNumber: integer;
PageSize: integer;
......@@ -51,7 +51,7 @@ type
end;
var
FViewCalls: TFViewCalls;
FViewItems: TFViewItems;
implementation
......@@ -61,7 +61,7 @@ uses
{$R *.dfm}
procedure TFViewCalls.WebFormCreate(Sender: TObject);
procedure TFViewItems.WebFormCreate(Sender: TObject);
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
// TotalPages: Total number of pages returned from the search.
......@@ -71,26 +71,20 @@ begin
PageNumber := 1;
TotalPages := 1; // Initial total pages
wcbPageSize.Text := '10';
getUser();
wcbSortBy.Text := 'Date';
getItems(GenerateSearchOptions());
end;
procedure TFViewCalls.getUser();
procedure TFViewItems.getUser();
var
xdcResponse: TXDataClientResponse;
userList, user: TJSObject;
data: TJSArray;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
[JS.toString(AuthService.TokenPayload.Properties['user_name'])]));
userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']);
user := TJSObject(data[0]);
wcbLocation.DisplayText := string(user['location']);
end;
procedure TFViewCalls.AddRowToTable(PhoneNumber, Caller, Time, Duration, Transcript, MediaUrl: string);
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
// Caller: phone number of the caller
......@@ -102,88 +96,35 @@ var
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
// Phone Number Cell
// Item ID Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Phone Number');
Cell.innerText := PhoneNumber;
Cell.setAttribute('data-label', 'Item ID');
Cell.innerText := ID;
NewRow.appendChild(Cell);
// Caller Cell
// Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Caller');
Cell.innerText := Caller;
Cell.setAttribute('data-label', 'Name');
Cell.innerText := Name;
NewRow.appendChild(Cell);
// Time Cell
// Description Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Time');
Cell.innerText := DateTimeToStr(IncHour(StrToDateTime(Time), -4));;
Cell.setAttribute('data-label', 'Description');
Cell.innerText := Description;
NewRow.appendChild(Cell);
// Duration Cell
// Status Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Duration');
Cell.innerText := Duration;
NewRow.appendChild(Cell);
// Transcript Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Transcript');
P := TJSHTMLElement(document.createElement('p'));
P.className := 'transcript';
P.innerText := Transcript;
Cell.appendChild(P);
NewRow.appendChild(Cell);
// Listen Button Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Listen');
Button := TJSHTMLElement(document.createElement('button'));
Button.className := 'btn btn-primary';
Button.innerHTML := '<i class="fa fa-play"></i>';
Button.addEventListener('click', procedure(Event: TJSMouseEvent)
begin
Audio := TJSHTMLElement(document.createElement('audio'));
{Button.disabled = true;
Audio.id = 'myAudio';
Audio.src = MediaUrl; // Replace with your audio file URL
Audio.preload = 'auto';
Audio.play();}
{ var playerWindow = window.open('', 'audioPlayer', 'width=400,height=200');
var playerContent = `
<div class="player-container">
<audio controls>
<source src=` + MediaUrl + `>
Your browser does not support the audio element.
</audio>
</div>
`;
playerWindow.document.body.innerHTML = playerContent;}
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('audioModal'), {
keyboard: false });
confirmationModal.show();
var audioPlayer = document.getElementById('audioPlayer');
var sourceElement = document.getElementById('audioSource');
sourceElement.src = MediaUrl;
audioPlayer.load();
end;
Audio.addEventListener('ended', procedure
begin
asm
Button.disabled = false;
end;
end);
end);
Cell.appendChild(Button);
Cell.setAttribute('data-label', 'Status');
Cell.innerText := Status;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
procedure TFViewCalls.GeneratePagination(TotalPages: Integer);
procedure TFViewItems.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search
var
......@@ -207,7 +148,7 @@ begin
if PageNumber > 1 then
begin
Dec(PageNumber);
GetCalls(GenerateSearchOptions());
GetItems(GenerateSearchOptions());
end;
end);
PageItem.appendChild(PageLink);
......@@ -247,7 +188,7 @@ begin
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetCalls(GenerateSearchOptions());
GetItems(GenerateSearchOptions());
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
......@@ -286,7 +227,7 @@ begin
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetCalls(GenerateSearchOptions());
GetItems(GenerateSearchOptions());
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
......@@ -323,7 +264,7 @@ begin
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetCalls(generateSearchOptions());
GetItems(generateSearchOptions());
end);
end;
PageItem.appendChild(PageLink);
......@@ -343,7 +284,7 @@ begin
if PageNumber < TotalPages then
begin
Inc(PageNumber);
GetCalls(GenerateSearchOptions());
GetItems(GenerateSearchOptions());
end;
end);
PageItem.appendChild(PageLink);
......@@ -351,79 +292,78 @@ begin
end;
procedure TFViewCalls.GetCalls(searchOptions: string);
// Retrieves list of calls from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on
// user input.
procedure TFViewItems.GetItems(searchOptions: string);
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
itemList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
item: TJSObject;
itemListLength: integer;
begin
if PageNumber > 0 then
console.log('correct');
if PageNumber > 0 then
begin
asm
startSpinner();
end;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCalls',
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
itemList := TJSObject(xdcResponse.Result);
data := TJSArray(itemList['data']);
itemListLength := integer(itemList['count']);
ClearTable();
asm
setTimeout(endSpinner, 2000);
end;
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));
item := TJSObject(data[i]);
AddRowToTable(string(item['ID']), string(item['name']), string(item['description']),
string(item['status']));
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < callListLength then
TotalPages := (itemListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < itemListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
' of ' + IntToStr(itemListLength);
end
else
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
' - ' + IntToStr(itemListLength) +
' of ' + IntToStr(itemListLength);
end;
GeneratePagination(TotalPages);
end;
end;
procedure TFViewCalls.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetCalls() button
procedure TFViewItems.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetItems() button
var
searchOptions: string;
itemOptions: string;
begin
PageNumber := 1;
PageSize := StrToInt(wcbPageSize.Text);
StartDate := dtpStartDate.Text;
EndDate := dtpEndDate.Text;
OrderBy := wcbSortBy.Text;
Caller := edtSearch.Text;
searchOptions := '&phonenumber=' + wcbLocation.Value +
'&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&startdate=' + StartDate +
'&enddate=' + EndDate +
'&orderby=' + OrderBy +
'&caller=' + Caller;
GetCalls(searchOptions);
itemOptions := '&name=' + edtName.Text +
'&description=' + edtDescription.Text +
'&status=' + BoolToStr(cbStatus.Checked);
console.log('GetItems');
AddItem(itemOptions);
end;
procedure TFViewCalls.Search(searchOptions: string);
procedure TFViewItems.AddItem(itemOptions: string);
var
xdcResponse: TXDataClientResponse;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem',
[itemOptions]));
getItems(GenerateSearchOptions());
end;
procedure TFViewItems.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
......@@ -434,7 +374,7 @@ var
callListLength: integer;
begin
if PageNumber > 0 then
{if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
......@@ -450,16 +390,22 @@ begin
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end;
end; }
end;
procedure TFViewItems.wcbPageSizeChange(Sender: TObject);
begin
PageNumber := 1;
getItems(GenerateSearchOptions());
end;
procedure TFViewCalls.btnSearchClick(Sender: TObject);
// calls Search method
procedure TFViewItems.btnSearchClick(Sender: TObject);
// item Search method
begin
Search(edtSearch.Text);
//Search(edtSearch.Text);
end;
procedure TFViewCalls.ClearTable();
procedure TFViewItems.ClearTable();
// clears the table
var
tbody: TJSHTMLElement;
......@@ -468,22 +414,15 @@ begin
tbody.innerHTML := '';
end;
function TFViewCalls.GenerateSearchOptions(): string;
// Generates searchOptions for get calls.
function TFViewItems.GenerateSearchOptions(): string;
// Generates searchOptions for GetItems.
var
searchOptions: string;
begin
PageSize := StrToInt(wcbPageSize.Text);
StartDate := dtpStartDate.Text;
EndDate := dtpEndDate.Text;
OrderBy := wcbSortBy.Text;
searchOptions := '&phonenumber=' + wcbLocation.Value +
'&pagenumber=' + IntToStr(PageNumber) +
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&startdate=' + StartDate +
'&enddate=' + EndDate +
'&orderby=' + OrderBy +
'&caller=' + Caller;
'&orderby=' + OrderBy;
Result := searchOptions;
end;
......
......@@ -19,6 +19,220 @@ object FViewLogin: TFViewLogin
Transparent = False
WidthPercent = 100.000000000000000000
end
object WebImageControl1: TWebImageControl
Left = 22
Top = 68
Width = 200
Height = 200
ElementID = 'kgpicture'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ChildOrder = 5
Picture.Data = {
0954506E67496D61676589504E470D0A1A0A0000000D49484452000000560000
006B0806000000EDB27584000000017352474200AECE1CE90000000467414D41
0000B18F0BFC6105000000097048597300000EC300000EC301C76FA864000018
DD4944415478DAED5D077C14D5D73D5BD26909A1041129D2A48348938E60A424
101034F48EA058E8288AA27F50448AB490108AD221F4264DA426108A94D02148
098140207DB33BDF3B6F0926BB1BD804DC2CF97DE7E7BA66776676E6CC7DF7DD
7BEE7DA36AF2F76B95E99376C2495314D64181A2E8E53BA012FFA82C6CA2702B
F1955A6CA1366E672318942428A9D7B1CC711DCAAAEEDBEC77D3E3BC8F3F5459
25D6A0A4204177117A71011A952B346AD70CDF2B4AAAF82E5EBC12E0A42E0A27
6D51A8554E36BB28B5F8DDBCFAF398EBB01DA555B13625340DD92296A4DD4DDC
01AFE2CE7073731156A9CDB88162802E3509F1F14978185D10791C2A41ABCE67
B38B72561EA2B4FE28BE733884575571B6E4F309B2456CAAE111A21242D0B173
4354AB5111F9F2999376FBF66D1C3A780C87FF8C451E6D4D38A80BD8ECA2F22B
31A867D88DC1DAB328A24AB4D9EFA6C773113B61E227F0EBD806254A9430DBE6
EFBFFF46E0BCDFB06CC131B8AAABDB94D8C2CA1DF81A42D0417B0B1E2A9DCD7E
373D7221B10A8A2B37304859807A9A64E451196C48E7BFC875C41A946494512E
E37BD5EF28A156E068BB602403721DB17A431CCA291108D286C05990AAB6299D
FF22D711EB60B88B1ACA49FCEAB0D3A6449A22D711EBA95C47432514A3B5E136
25D214B98ED892868BF056FE422F878B3625D214B98ED88ACA19F86237DA6B6E
DA944853E43A626B2B47E1AF6C467D6D924D893445AE2296DA442BE53086A877
A0584E85038F91AB8835E8A3D0517518A3B4876D4EA4297215B12E8648416C28
3ED61CB33991A6C855C416379C41075518BA6ACEDB9C4853E42A62AB19C2D05E
10FB9EE686CD893445AE22B699619720F608EA687246DC4E8F5C432CAB16EF63
137C55E128AB4ECD1132D3C30E8955F0A496F6A44EA63C7ECF5CAA4AD5C76288
6A33DAAB4FC13D87432DBB245667B80FBD21111A95331C341E52064C353C94DF
B1BC9359ED2C29F526C66976888CEB1C3439CDAABD119BA0BB0C38454251DD47
72B20E29C9B455BD2C5E3A69BC90CFB1261C359E16F654E0AE3F8B619A7D7847
7D2DA739B51F62491E75D447FA03A859B7302A572D09474747A4A4A420222202
278E9FC2C3BB1EF0706E26882D68B6BF4A1CA192D8B79FE628EAA9A3729A537B
21D6208E178FB89433285CF20E060DEE8A4E9D3AA160C182888B8BC39C3973B1
62E9765C3BEF88024E6F0957E06891D866FAADF840731A55D539D3476077C4B2
B92231F51AEEA6ACC3D8B15FA04B97CE285BB62C1E3E7C8843870E61E8D091B8
7BAD30F239D5103E36BFC56390583FC36AF8AACFA39C3A3EA739B50F62137497
A0770E47F35655307CF817A858B12212131371F0E0418C183102D1D73DE1A0AF
0027AD9720D0F2B4A416563FD81080E6EA1B28A6CE99E2A15D119B947A037A87
F378BD9282493F4E40952A55E0E0E080DDBB7763EA2FB311B6FFA6D8B7061CD5
45840B70B6782EB2EBC6700F33354B5143152DEB5CF6801C2396615582FE244A
5754C1BF7B1B0C1A34080683410EFFC58B9663D5D23D7055D585B3F695A7B727
0957A2D65FC122874D2897437D5A7642AC22FCAA0E0F538EC3C3EB1EFC3A37C2
A79F7E0A7777779C3A750A73E7CCC7960D61487CE085FC4EB5F0AC663AAD120F
4FFD694C75D893637D5A7641AC22484DD6472126652BFA7FD4010306F4439932
6570FFFE7D7CFCF1C7D8B7E702521F9596939535705362F18608B5463B1C4371
957D4C5C362796F16A8A3E1A771236A175BBBAE83FA0071A376E2C499D316306
962FDB8CF8E85270D35412C3DFC5AA737157EEA1B9612B7A6A2FA3B02A67CB31
39466CB2FE0E52D46750ACD4238C1E330C4D9A34464C4C0C56AF0E117E75351E
4679416B2823262B4FABCE83288A28F81B96A2A5E63EDC55392FBED89C582602
3AD525142C7E0FBDFBFAE1FDF7DF874AA5C2860D1B316BE602445E70425E07DE
00F7C78DCACF069B9F4BE03A46280B5145A313939D62D57EB98658675579241B
6EC0BDE85DBCE35D1DE3C78F8746A3C18E1D3BB078E14AECD87A16855DDBC890
CA5A5209839288D2868B98AE59064FB19BD6EA3D7305B1E130A40A7FE9780D2D
BCDFC037DF7C8372E5CAE1F8F1E398306102B66D38034F97771F8B2B590B42A9
7A95379CC552C7F539CDA36D899D17B0108B83772121E9063A757E0F7DFBF540
BD7AF5E0E4E48473E7CE0992BFC3C635A750C8B925B49AAC0BE1799428D456C2
3149BB2FA779B42DB1010181089AB704CD5B3440CF5EDDD0A2450BE4CF6FCCF7
A905CC9E3D07BF2FD88E3B911E22BCAA86AC5AAC97720D4D9503F8547B2AA779
B41DB1D7AE5DC31F7FFC813D7BF6A07DFBF6A85FBF3EBCBCBC326CB36FDF3E04
CF5F8A901587E0AE6D09B5DA2D4B3EB68C721E6D943FE1AFBD9AD33CDA8ED807
0F1E487253535351BE7C79E4C993C76C1B5AED9A356BF0C377D3107FA7A2485F
CB406365FC4A54514EA123B6C35B732FA779B41DB1972F5FC681030750B46851
D4AA554BA6AC9670E2C40931C92D4070E07A783AB511935811AB4FBEBE128A9E
CA3A54B7A770E0BF26F6F4E9D3F8EDB7DFA43BF8F2CB2F658665895C5AEDFEFD
07D0AD6B4F38E91AC3592DAC569DE799E74011A71D42314AB3172E76A268D984
581915CC9B87E0E0C5F0F1698B8103FBE3EDB7DF36DB8E8A56646424264F9E8C
4D6B4F40175B0EAE0E659E790E6AFD4DF8A9C2305C1B6AF65D8AC813A20CC075
458547E2152FFE8E15AF4726522DD7271412498593EAD99E5D2DB62DA1368897
8846ACB891FF71B8351FC141EB50B090133E193A00DDBAF9A350A14266DB2624
24C8ED877E321CD722F20A0BAC0AAD3AEF53CFC1DD70091D108601DABF8DC710
C45D31A870550FDC51A9F1C0D91571F9DCA1CD5F00A98ECE4872708453419354
39250588897E26B1C9C9C978101D8D6AB1D168AAD6A1B815F3EB7F9C202CC692
E050C427DF44EBB6F5D06F803F5AB66C99E971070F1E8C3F3647202EDA0B6E8E
159E1A2194319C947D5A3E9ACBD23A2FA40261AE0570265F413C702F08771181
F0BC5E7BED35299E2B8A82D2A54BCBFFE6823FC6D2ACA99D3FFFEC3EAF68416A
E85F7FA154D87E74D6C7A182E6D9A9B34D525A45EF02C73CB7D1E9C3FA983265
8AD4082C213C3C5C646313B173F315918D79CBDE82CCF096E1A0ECD32AA7BA83
19892AACD501359AB7C0071F7C8056AD5A3D09ED48E8993367F0D7DEBD888A8A
8257B16268D6AC99942A4DCF83DBA67F4FC3952B57B0685E00921705C13731C6
7E8875565540A22102556A3BE1B3CF07C0DBDB5B6A05A6A04B9832E517FC2692
8607B7D947500599250DDECA36BCA63F828BE23027BD4AA0F7679FE3CD3A75F0
CA2BAF488BA465C6C7C7232828087B4342E0107905250CA908536951A64143F8
F9FBE3DD77DFCD70CC23478E60F9F2E5D8B9F3DF1537458A1491C7BB7A2E0275
AE5EC087AA24FB2196EA964E7F17CEEED7F176B357306DDA34E4CD9B572404E6
439D17353F702936AC094761D7B68FCBDD19C9A5F85253BF55B88B0B88ABF006
7C070D4693264D50B8706149A8DC464C8AAB57AFC696A040B8851D40D3D478B8
8BC35C143E78977B5194F0ED886EFDFBA372E5CA4F8E7BF3E64DF9FBB366FE8A
5BE2FC9B1B12F17A5E37E85CDC9092108F4ABA24D452EB5138E77DECBFC4AAE1
8004C31978148FC4F4193FA176ED372D2E6EBE73E70E962E5D861FFF17005542
5D386BCC6B5E29E2261548F903A52A68D0C0BFABF4CDF499E96F944EA7C38001
03E0B4732BDE7D701B8D1D8C569624DEE627AB70B9465D34E8DD0FBD7AF5CA70
6C2EAE5EBF6E1D7E9F3615DEB7AFA2AE81CB4615796BF3897FE557C1AAD58E36
15BAD93F0097BFE1EDC352F730BCFEFAEB16FDED5F62A298F2F32CECDE7605EE
4E6F4B8D36BDD526E8AE40D184A19D5F2D8CFEFA6BB3DFD7EBF5888D8D858F18
EA1DCE1F879F462749494378AA0ADB0BBD8AE4361DF0CB2FBF98FD3E5DD2679F
7D86B86D9BF16ECC0DB475CCBACE6B5362F56208A7E8AFE2917A3356AD5A8E86
0D1B4A4B330567EBBD7BF789F8B7238AB874818BB684A0F5DFF4EA4172284A57
D4A1471F6375D7144C3AC24243F1E34703D1F3F665789B10735744110B142784
D76B86CD9B379B5F9F48C38F1E3D8A6FC78C41E583BB31DA359BC406CF0B5416
07FF6EF5C31A92539270FAC2717CF5F518F8B6F77D0AB18BF07BF03E382A651F
C7A56C278A45ACEE00BAF8B742BFFEBD50B76E5DB37DE91F2F5CB880112346E2
C4E164A4C4796638B758416C9B0E35D1BBEFFB68DEBCB9D9FE77EFDEC5D62D5B
307FDC5768191D893ADA8CC4B080B3264585883A8D650F83291815D06A3F1D3A
140FD7AE844FCA2378A9B3466E5CFB0FA03A776EA272F1C2CF62583A58B5534C
8C41F8C907E8DDFB0731C3FB654AEC922541381FB1026FD77745C182C663A7EA
75881641F9C68D1EF0F71F89AE5DBB5A146828E27022F972CC8FA856255AA4C4
4E7016C6FD20169836E30EDAF9F440DF7E3D51B56A55B37D6FDDBA85C58B1763
BEF09379EEDC42210B930D13893C35DE14E7B844C6BA6CC233C5F7DF7F8FED8B
17417FF902F266B1EC53B35317A8F4CAD7E21E8DB77AA75B37818103800EED27
A3458B4E9912BB7A7580B0D1B9E8D94B274EDEF8B9707F82346090D8BFE46BBD
45DC39086FBEF9A6D9FE1C8EF4937DFAF441D9F27BD0B9732CCA5700CE9E057A
7403FC3A8C45BF7EFD2429A6F8E79F7F3077EE5C040404C8C93033F0A6FCFAEB
AF522472757535FB3E383818818181524CCA2ABA74B131B169983B07083D5459
5C5C2FD94F9016269962E6CC99080D0D428D5AC704B92254DA057C3516E8DBF7
7B49ACA514F94511BB72E54A790CD6E65E1A62C56815C31C888FEB28E35A664A
962204C69623460C17BE79093EFF02D8B801080C20B15FA1BF88438B172FFEFF
C4A6870833B1720570F85055942BDB47C6A296B231C6A3B367CFC691A381C23A
FF164403DBB791D811D26219B2FD57C4D24FD315EC15E9B04D89550CF5E1E151
5A6651A6E0E413137301B56A1F439FBE7A587085B87409581B921F07F6D513F1
E42C998E5A9A44A8212C5F11800DEBE7C2455C7F84F0B3DDBB0F94165BA38679
2B92B5C4D6AE5D1BCB962DC3ABAFBE6AD11551D758B0608134129B101B1303FC
3A43CCAC57181A010EE65C4097A2119990039A344B025372916D9A81AADD1611
460605BE82D6EF8D869F5F47999B9B8271ED8A152B3061C2372246BD2E2635A0
6DDBF69258D37C5FDE78E167162D5A84A953A7CA4C2A333468D0400AF1A6599B
3C7F3152860D1B26B2C0A552DDB209B11CC6D7AE028CEDDD3D44D86241F027F9
919100E716BE2C18A2444404B07A950BB66CAA88E9D367A37AF51A16AD275404
FCB366CDC2C2850BE5DFB454BA02A6ADA6A4DCBB770F5BB76EC5E8D1A371FDFA
758BBFCBDFA0CAC5ED4CC1389AFB7DF4D147161388FF8C58224D5953A99E6F9B
E464E05838D0DE47252C7226DAB4F141B162C5CCB67BF4E8910CE67D7C7CE4DF
F489CCF3274E9C68160753D56269C8DFDF1F172F5A7ED206DD4E870E1DC4CD9C
6EE19C9265F583EE84ADA53625F64581E4FF238C6AD2244608ADD0ADEB1778E7
9D77CCB663FECF268FE1C38763FFFEFD9268666D4C699964A4072D8E69ADAFAF
AFB474B6DE9BA24E9D3AD295F4EEDD3BC3E75CA9436BE548E0BEFC9D97925842
1818C28F023F4C282432B9E1F8F0C3EE167D2DDB3DE91339C45905E6CA1AFAC9
3122A7679B7DFA999D3782020B271F5A6F7A70826453DEA851A350A952A5279F
3329612A4D0D978550FA56DE249B11CBE17BFA142FD4E86FB30B5737806168C9
9240521230F463F1998B9F18EE032C5A2D2F9CD1065D0043205AA5A7A7A7B44C
3685D0EF3261D06AB532DFE71A3192B47EFD7A590520D9942AAB55AB861E3D7A
881BF8219C9D8D550AEA0BAC346CDBB64D4E7C9CF4F87BD945B68815E780893F
400C190F7147F340ABC97A613F39255984690FD0BC453CBAF7307EB66A251380
122853BA07468E1C0D1717CBCD1BF48B24ECE4C993F26F2616AC4A74ECD8116F
BDF59614BC0B1428200966F35D484888242C49DC3DA6C0F4BD8D1A3592DBD01F
F30651CD6242B071E3468BAEC326C4326B62AE5FB9F20054ADD2485E485671F1
E2051C3EBC0465CBEFC38891C6CF18468DFB5285A8DBEF89613A1E356BD6B498
8D314E6528C4324A1A1819B8B9B9496B6CD7AE9D1CEA9C04492E2D356D48F378
4C4418C27162FBF3CF3F25998C55194D6477E8BF18621F2708EF794F409326ED
E50C9B55D0DA42427E8267E10D1839CAF819059AE5CB80DDBBCAA09857177CFB
EDB716CB379C60A821CC9F3F3FC3ACCD6DE967995191788654248C37223DD8FA
C4A14FCBA4D043DF4D99F07986FE0B25B651C3516266F6366B76B306F467DBB7
8B6CEBD5ED4F8825C4DC8195CB5DB179537971723D24896CA7E7859BEE4F52D3
2700A54A959291021B4358CB62E6455740BF9C1E6944FE97C816B15151C08861
103EB29920B502F2E5CDFAD38C598ABE79EB006AD63A87211FFFFB39B3B13DBB
81DF163B8959BFA48C292F5FBE2B26A23819966506A6A59CC4FCFCFC50A14205
1C3B764C06F89CB47202D9229606B06881D1BAE29F63051023AA868D844B699D
F173FADA1B378084C7C716F30AD686007F6C373F06873F5352C6B28C3D29A8DC
103B737263A6C61BF8D210CBA09EEE88EFCA73ACA7E0BC4441CB54D4323DEEF4
A9109910702EC2FC188C1CD8264A25EA8D37DE904433FE5CBB76ADF4D1A6FED5
AE89B535C67F0D04CC35BA205350B2E444C50B4913BD19565DBD7A5576C5D00F
BFC849C95AD83DB14C46E8CF83028D4984291801B0799982775AC5972113C9A5
96BA61C3063981310AB025EC9E580ADB2387034B9758FE9E9A2A737A5330F362
C4C038954BF4398925A5BB334C0C18CBA607BF67F8C5288456AE3C879FB37B62
0F1DA4860064A6DEB110C915E396AA0F692081F4BBE975554E6A8C67D383845E
BA74498672FC6F260CBC01D97125764FEC8AE54651FDC07ECBDF333BDBB56B97
940E3323979697F64AFF99A52C8B9F317666B84657C27AD7D3C4F29796D8C93F
028B17B1F5DEF2F77CCC094B28CCFD2DF5826507249D56CE4226051C8A3259D5
65ED9ED84F8600EBD689B83693A889424AD3A64D3172E44833E9F045800A199B
3A7EFAE92799AC58EB77ED9E58DF76C64C2C2E93FF650CE356C6B27DFBF6950A
57F5EAD52D6AB9D9056B5F9CFCD8FB4092E926AC81DD124BC3E035346A60CCBC
AC014B2DEC9CE10A1D4A811459329BDDE98F2978F345ABE7BB25C187E084C612
3CB33953DDE1A523362991D222E0FF41E6FED5144C67A9C9F29DDA2A573E72F6
D75950E32990B32781591BCB335C384DD9D11218215058A7F6C00AF04B4D2C0D
63D74E60F44863FF4166A03448925811604ACB92CD962D5B642845158B43D792
C5723FFA639249DDB673E7CE68DBB6AD24DA1469C549DEB4CCAABE2F0DB10C39
97FC0E4C9DC24A85E56D3C3C3C64E64517C0098CF12C1B30685DBA2CD68C2890
53C861B9C6B44A4C77C208812E86A9F24B4D2CB59349138DE59A680BCD2CF489
ACB4F6ECD9535A1B2F9EC5411601E3E2B2F73F47E36A1B3E51C9B4098416CFE4
825AAFB532A4DD124B49B24F4FE0C44996C5CDBFA7F8C2A222CBE11CD2AC4870
6929CB2CD905DD002D76DCB871193EA73BA1A5728D9A69B69619EC9658C6E32D
9A095F7BDF28519A82C3969D306CB72758FF62D722DD4176C1E8A075EBD6D2EA
D38391007B64F97B7409D6C02E89A57B3C7A0468DED41872598AC919B0F342F9
60090E55A69F73E6CC910D74D9050B8F6CBD376D3B6264C191C0FE85A735D9D9
3DB18C0876EF023A773236DD9982C5CB9F7FFE59FA5682F93DEB5B7C31C77F1E
7012A4F6901E6CE260C99D623AD52F6B6097C4B28B71D52A60CC28CBC45278E1
9390DAB46923FFA6C5329F67E5362C2C2CDBBFCB108C8F5749DF0897F6BCC521
438648D58B69ED4B4B2CDB8DC4A84670906537C0D0E8BBEFBE9371671AB11CBE
93264D92FA6B76C1F08D372BADA39160064737C0268FACC02E89150913A64C06
36ACB74C2C5D019F6FC0932748ECD9B367654F17D5A8EC82CFAE258163C78E7D
F219AD95FE9BE96C566097C46EDE048CFB4A845AC72D13CB120CAD93E1569A54
C8EC88CB87E81258A5CD0EF8086BC6C2743504272D3685F0B98BD6A6B2764DEC
B2A546B990CDCB99A17BF7EEB20D93DD8669607F162D6BDDBA7556AB5069A056
C0E30D1C3850A6B9F4A5ECE626B15C829A55D81DB14C9AE85B3FFBF4E9DBA505
F30CB9D23A715830A44EC0A14BA9CF9ABA157BB9B83F89E08B1D8B8C5B5947A3
A592D4F86C344FD81DB1EC1D604576CACFCFDE964F9D6393065B3869659402A9
44910CC69C4C43D9384CEB352DC3705BEAB84C0AA8E3B28199220E873F3B0FF9
7840FAEDEC761EDA1DB12CB806CE03E6073E7B5B864794FE98DFB3B5888DC8B4
5092419FB84AC46C0C9D98EE9AEAA8145A98B575EBD64D567A1911300666ACCA
B64F26021472B25BA9B53B623789547F5E8071A19C3560E3309BE148122D9842
09DD04DD00C925410C9918D8A7AD47609F17873F97517122647CCAA76BD05259
25A0D5B2F5335795BF83E71B97831EC9629C4FA2F8301D1617F94E8BA44ECBE1
CE61CFC928AD8F8B7FB38780A433F76766C517BF4F4A7A314F4DB63B6227FD4F
2407B333D760AD01C9E4C374482ECBE2D400D283931C433212696DA925ABB02B
62D9783C62B8B0D8D996DB895E26D815B11CA92CC5B08FE079BA18ED017645EC
99D3C0F86FB85231A7CFE4F96157C4322298FA8B51327CD96157C44E9B0A2C5C
009C3C91D367F2FCB02B62870F03D6AC362E807ED96157C4F6EA695C667F37EB
ABD8ED0E925883B242109BF333C69AD5E51079CD0D5914A6EC12D476FF0FA62D
A3F3F4F969570000000049454E44AE426082}
end
object edtUsername: TWebEdit
Left = 240
Top = 136
......
<nav class="navbar navbar-light bg-light login-navbar">
<div class="container-fluid">
<a class="navbar-brand" href="#">Envoy Calls</a>
<a class="navbar-brand" href="#">Koehler-Gibson Orders</a>
</div>
</nav>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-auto">
<img id="kgpicture"style="width: 250px; height: 250px;">
</div>
<div class="col-md-6 col-lg-4">
<div class="card login-card">
<div class="card-header">
......
......@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON,
JS, XData.Web.Connection, WEBLib.ExtCtrls,
App.Types, ConnectionModule, XData.Web.Client;
App.Types, ConnectionModule, XData.Web.Client, Vcl.Imaging.pngimage;
type
TFViewLogin = class(TWebForm)
......@@ -18,6 +18,7 @@ type
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebClient: TXDataWebClient;
WebImageControl1: TWebImageControl;
procedure btnLoginClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject);
......
......@@ -28,7 +28,7 @@ object FViewMain: TFViewMain
end
object wllblLogout: TWebLinkLabel
Left = 551
Top = 85
Top = 143
Width = 41
Height = 15
ElementID = 'dropdown.menu.logout'
......@@ -51,29 +51,29 @@ object FViewMain: TFViewMain
object lblAppTitle: TWebLabel
Left = 57
Top = 31
Width = 60
Width = 82
Height = 15
Caption = 'Envoy Calls'
Caption = 'Koehler-Gibson'
ElementID = 'view.main.apptitle'
HeightPercent = 100.000000000000000000
Transparent = False
WidthPercent = 100.000000000000000000
end
object lblCallsList: TWebLinkLabel
Left = 564
Top = 56
Width = 25
object lblItemsList: TWebLinkLabel
Left = 560
Top = 85
Width = 29
Height = 15
ElementID = 'dropdown.menu.callslist'
ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblCallsListClick
Caption = 'Calls'
OnClick = lblItemsListClick
Caption = 'Items'
end
object lblUsers: TWebLinkLabel
Left = 561
Top = 70
Top = 108
Width = 28
Height = 15
ElementID = 'dropdown.menu.users'
......@@ -83,9 +83,48 @@ object FViewMain: TFViewMain
OnClick = lblUsersClick
Caption = 'Users'
end
object lblorders: TWebLabel
Left = 556
Top = 52
Width = 35
Height = 15
Caption = 'Orders'
ElementID = 'lblorders'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblordersClick
end
object lblCustomers: TWebLabel
Left = 540
Top = 69
Width = 57
Height = 15
Caption = 'Customers'
ElementID = 'lblcustomers'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblCustomersClick
end
object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 63
Height = 15
Caption = 'QuickBooks'
ElementID = 'lblquickbooks'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick
end
object WebPanel1: TWebPanel
Left = 136
Top = 110
Left = 77
Top = 112
Width = 471
Height = 369
ElementID = 'main.webpanel'
......@@ -102,8 +141,8 @@ object FViewMain: TFViewMain
Opacity = 0.200000000000000000
end
object WebMemo1: TWebMemo
Left = 136
Top = 467
Left = 77
Top = 479
Width = 471
Height = 83
ElementID = 'main.debugmemo'
......
<div id="wrapper">
<nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;">
<div class="container-fluid">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Envoy Calls</a>
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="lblcustomers" href="#"><i class="fa fa-tags fa-fw"></i><span> Customers</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="lblquickbooks" href="#"><i class="fa fa-tags fa-fw"></i><span> QuickBooks</span></a>
</li>
</ul>
<div class="collapse navbar-collapse show" id="navbarNavDropdown">
<ul class="navbar-nav ms-auto">
<li class="nav-item dropdown">
......@@ -16,9 +30,6 @@
<a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a>
</li>
<li>
<a class="dropdown-item" id="dropdown.menu.callslist" href="#"><i class="fa fa-phone fa-fw"></i><span> Calls</span></a>
</li>
<li>
<a class="dropdown-item" id="dropdown.menu.users" href="#"><i class="fas fa-address-book fa-fw"></i><span> Users</span></abbr></a>
</li>
<li>
......
......@@ -19,15 +19,21 @@ type
lblAppTitle: TWebLabel;
WebMemo1: TWebMemo;
XDataWebClient: TXDataWebClient;
lblCallsList: TWebLinkLabel;
lblItemsList: TWebLinkLabel;
lblUsers: TWebLinkLabel;
lblorders: TWebLabel;
lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject);
procedure wllblLogoutClick(Sender: TObject);
procedure lblHomeClick(Sender: TObject);
procedure lblCallsListClick(Sender: TObject);
procedure lblItemsListClick(Sender: TObject);
procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject);
procedure lblCustomersClick(Sender: TObject);
procedure lblQuickbooksClick(Sender: TObject);
private
{ Private declarations }
FUserInfo: string;
......@@ -38,11 +44,15 @@ type
procedure ShowCrudForm( AFormClass: TWebFormClass );
//procedure EditUser( AParam, BParam, CParam, DParam, EParam: string);
function GetUserInfo: string;
procedure setActive(page: string);
public
{ Public declarations }
class procedure Display(LogoutProc: TLogoutProc);
procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, FullName, Username, Phone, Email, Location: string; admin, active: boolean);
procedure EditUser( Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
procedure ViewOrderEntry(orderInfo, mode: string);
procedure ViewOrders(info: string);
procedure ShowUserForm(Info: string);
end;
......@@ -56,10 +66,11 @@ uses
View.Login,
View.UserProfile,
View.Home,
View.Calls,
View.Admin,
View.Items,
View.Users,
View.EditUser;
View.EditUser,
View.Orders,
View.OrderEntryCorrugated;
{$R *.dfm}
......@@ -76,25 +87,71 @@ begin
//Change this later
lblUsers.Visible := true;
ShowForm(TFViewHome);
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end;
procedure TFViewMain.lblCustomersClick(Sender: TObject);
begin
//ShowForm(TFViewCustomers);
lblAppTitle.Caption := 'Koehler-Gibson Customers';
setActive('Customers');
end;
procedure TFViewMain.lblHomeClick(Sender: TObject);
begin
ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home');
end;
procedure TFViewMain.lblordersClick(Sender: TObject);
begin
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end;
procedure TFViewMain.lblUsersClick(Sender: TObject);
begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
end;
procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin
ShowForm(TFViewItems);
lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items');
end;
procedure TFViewMain.lblCallsListClick(Sender: TObject);
procedure TFViewMain.setActive(page: string);
var
links: TJSNodeList;
link: TJSHTMLElement;
i: integer;
begin
ShowForm(TFViewCalls);
// Get all the links in the navbar
links := document.querySelectorAll('.navbar-nav .nav-item a');
for i := 0 to links.length - 1 do
begin
link := TJSHTMLElement(links[i]);
link.classList.remove('active');
if link.innerText.Contains(page) then
link.classList.add('active');
end;
end;
procedure TFViewMain.mnuLogoutClick(Sender: TObject);
......@@ -112,6 +169,7 @@ end;
procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin
ShowCrudForm(TFViewUserProfile);
lblAppTitle.Caption := 'Koehler-Gibson User Profile';
end;
......@@ -152,11 +210,29 @@ begin
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
end;
procedure TFViewMain.EditUser( Mode, FullName, Username, Phone, Email, Location: string; Admin, Active: boolean);
procedure TFViewMain.EditUser(Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
begin
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFViewEditUser.CreateForm(WebPanel1.ElementID, Mode, Username,
Password, Name, Status, Email, Access, Rights, Perspective, QB);
end;
procedure TFViewMain.ViewOrders(info: string);
begin
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFViewOrders.CreateForm(WebPanel1.ElementID, info);
end;
procedure TFViewMain.ViewOrderEntry(orderInfo, mode: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFViewEditUser.CreateForm(WebPanel1.ElementID, Mode, FullName, Username, Phone, Email, Location, Admin, Active);
FChildForm := TFOrderEntry.CreateForm(WebPanel1.ElementID, orderInfo, mode);
end;
procedure TFViewMain.ShowUserForm(Info: string);
......
object FOrderEntry: TFOrderEntry
Width = 1018
Height = 764
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnCreate = WebFormCreate
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 34
Top = 188
Width = 55
Height = 14
Caption = 'Staff Fields'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 26
Top = 72
Width = 45
Height = 14
Caption = 'Company'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 320
Top = 188
Width = 105
Height = 14
Caption = 'Supplied by Customer'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 496
Top = 19
Width = 33
Height = 14
Caption = 'Layout'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 496
Top = 289
Width = 43
Height = 14
Caption = 'Mounting'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 658
Top = 19
Width = 31
Height = 14
Caption = 'Colors'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel7: TWebLabel
Left = 662
Top = 199
Width = 40
Height = 14
Caption = 'Proofing'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel8: TWebLabel
Left = 872
Top = 19
Width = 29
Height = 14
Caption = 'Plates'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel9: TWebLabel
Left = 862
Top = 147
Width = 38
Height = 14
Caption = 'General'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 324
Top = 19
Width = 121
Height = 33
ElementID = 'pnl_message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 44
Height = 14
Caption = 'Message'
ElementID = 'view.login.message.label'
ElementPosition = epRelative
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'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Role = 'button'
WidthPercent = 100.000000000000000000
end
end
object dtpOrderDate: TWebDateTimePicker
Left = 22
Top = 218
Width = 170
Height = 22
ElementID = 'dtporderdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45544.402385138890000000
Role = ''
Text = ''
end
object dtpProofDate: TWebDateTimePicker
Left = 22
Top = 250
Width = 170
Height = 22
ElementID = 'dtpproofdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45544.402385138890000000
Role = ''
Text = ''
end
object dtpShipDate: TWebDateTimePicker
Left = 22
Top = 282
Width = 170
Height = 22
ElementID = 'dtpshipdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45544.402385138890000000
Role = ''
Text = ''
end
object dtpArtDue: TWebDateTimePicker
Left = 24
Top = 544
Width = 170
Height = 22
ElementID = 'dtpartdue'
BorderStyle = bsSingle
ChildOrder = 17
Color = clWhite
Date = 45544.409323321760000000
Role = ''
Text = ''
end
object dtpPlateDue: TWebDateTimePicker
Left = 24
Top = 568
Width = 170
Height = 22
ElementID = 'dtpplatedue'
BorderStyle = bsSingle
ChildOrder = 17
Color = clWhite
Date = 45544.409323321760000000
Role = ''
Text = ''
end
object dtpMountDue: TWebDateTimePicker
Left = 24
Top = 592
Width = 170
Height = 22
ElementID = 'dtpmountdue'
BorderStyle = bsSingle
ChildOrder = 17
Color = clWhite
Date = 45544.409323321760000000
Role = ''
Text = ''
end
object WebButton1: TWebButton
Left = 658
Top = 150
Width = 96
Height = 25
Caption = '+'
ChildOrder = 59
ElementID = 'btnaddcolor'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton1Click
end
object dtpApprovedDate: TWebDateTimePicker
Left = 662
Top = 508
Width = 170
Height = 22
ElementID = 'dtpapproveddate'
BorderStyle = bsSingle
ChildOrder = 72
Color = clWhite
Date = 45544.481204965280000000
Role = ''
Text = ''
end
object edtCompanyName: TWebDBEdit
Left = 24
Top = 92
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcompanyname'
HeightPercent = 100.000000000000000000
MaxLength = 90
WidthPercent = 100.000000000000000000
DataField = 'NAME'
DataSource = WebDataSource1
end
object edtCompanyAccountName: TWebDBEdit
Left = 24
Top = 120
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtaccountcompanyname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'SHORT_NAME'
DataSource = WebDataSource1
end
object edtInQuickBooks: TWebDBEdit
Left = 26
Top = 148
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtinquickbooks'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'inQuickBooks'
DataSource = WebDataSource1
end
object edtShipVia: TWebDBEdit
Left = 24
Top = 314
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtshipvia'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_ship_via'
DataSource = WebDataSource1
end
object edtQuantity: TWebDBEdit
Left = 24
Top = 346
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quantity'
DataSource = WebDataSource1
end
object edtPrice: TWebDBEdit
Left = 24
Top = 374
Width = 121
Height = 22
ChildOrder = 79
ElementID = 'edtprice'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_price'
DataSource = WebDataSource1
end
object edtInvoiceTo: TWebDBEdit
Left = 26
Top = 402
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtinvoiceto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_invoice_to'
DataSource = WebDataSource1
end
object edtShipTo: TWebDBEdit
Left = 26
Top = 430
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtshipto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_ship_to'
DataSource = WebDataSource1
end
object edtPONumber: TWebDBEdit
Left = 26
Top = 458
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtponumber'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_po_number'
DataSource = WebDataSource1
end
object edtJobName: TWebDBEdit
Left = 26
Top = 486
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_job_name'
DataSource = WebDataSource1
end
object edtQuickBooksItem: TWebDBEdit
Left = 26
Top = 514
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
end
object edtEmail: TWebDBEdit
Left = 316
Top = 376
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtemail'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_e_mail'
DataSource = WebDataSource1
end
object edtOther: TWebDBEdit
Left = 316
Top = 348
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtother'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_other'
DataSource = WebDataSource1
end
object edtCADFile: TWebDBEdit
Left = 496
Top = 207
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcadfile'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_cad_file'
DataSource = WebDataSource1
end
object edtAroundNo: TWebDBEdit
Left = 496
Top = 179
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtaroundno'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_around_no'
DataSource = WebDataSource1
end
object edtAcrossNo: TWebDBEdit
Left = 496
Top = 151
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtacrossno'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_accross_no'
DataSource = WebDataSource1
end
object edtDieCutNo: TWebDBEdit
Left = 496
Top = 123
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtdiecutno'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_die_cut_no'
DataSource = WebDataSource1
end
object edtRSCD: TWebDBEdit
Left = 496
Top = 95
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtrscd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_rsc_d'
DataSource = WebDataSource1
end
object edtRSCW: TWebDBEdit
Left = 496
Top = 64
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtrscw'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_rsc_w'
DataSource = WebDataSource1
end
object edtRSCL: TWebDBEdit
Left = 496
Top = 39
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtrscl'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_rsc_l'
DataSource = WebDataSource1
end
object edtCustomAdhesive: TWebDBEdit
Left = 496
Top = 506
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcustomadhesive'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_custom_adhesive'
DataSource = WebDataSource1
end
object edtCustomBacking: TWebDBEdit
Left = 496
Top = 478
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcustombacking'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_custom_backing'
DataSource = WebDataSource1
end
object edtStandardSetup: TWebDBEdit
Left = 496
Top = 450
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtstandardsetup'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_standard_setup'
DataSource = WebDataSource1
end
object edtStripMount: TWebDBEdit
Left = 496
Top = 430
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtstripmount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_strip_mount'
DataSource = WebDataSource1
end
object edtLoose: TWebDBEdit
Left = 496
Top = 334
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtloose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_loose'
DataSource = WebDataSource1
end
object edtRSCStyle: TWebDBEdit
Left = 496
Top = 261
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtrscstyle'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_rsc_style'
DataSource = WebDataSource1
end
object edtProofOther: TWebDBEdit
Left = 666
Top = 458
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtproofother'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_other'
DataSource = WebDataSource1
end
object edtProofShipTo: TWebDBEdit
Left = 658
Top = 328
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtproofshipto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_ship_to'
DataSource = WebDataSource1
end
object edtEmailAttn: TWebDBEdit
Left = 658
Top = 300
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtemailattn'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_e_mail_attn'
DataSource = WebDataSource1
end
object edtProofEmail: TWebDBEdit
Left = 658
Top = 272
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtproofemail'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_e_mail'
DataSource = WebDataSource1
end
object edtFaxAttn: TWebDBEdit
Left = 658
Top = 244
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtfaxattn'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_fax_attn'
DataSource = WebDataSource1
end
object edtFax: TWebDBEdit
Left = 658
Top = 219
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtfax'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_fax'
DataSource = WebDataSource1
end
object edtClemson: TWebDBEdit
Left = 658
Top = 117
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtclemson'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'colors_clemson'
DataSource = WebDataSource1
end
object edtCrossHairs: TWebDBEdit
Left = 658
Top = 89
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcrosshairs'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'colors_cross_hairs'
DataSource = WebDataSource1
end
object edtMachineIndent: TWebDBEdit
Left = 658
Top = 64
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtmachineindent'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'colors_machine_ident'
DataSource = WebDataSource1
end
object edtCylinderSize: TWebDBEdit
Left = 658
Top = 39
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtcylindersize'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'colors_cylinder_size'
DataSource = WebDataSource1
end
object edtJobNumber: TWebDBEdit
Left = 852
Top = 105
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtjobnumber'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_job_number'
DataSource = WebDataSource1
end
object edtPlateMaterial: TWebDBEdit
Left = 852
Top = 72
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtplatematerial'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_plate_material'
DataSource = WebDataSource1
end
object edtThickness: TWebDBEdit
Left = 852
Top = 39
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtThickness'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_thickness'
DataSource = WebDataSource1
end
object cbArtApprovedAsIs: TWebDBCheckBox
Left = 662
Top = 480
Width = 113
Height = 22
Caption = 'Art Approved As Is'
ChildOrder = 79
ElementID = 'cbartapprovedasis'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_art_approved_as_is'
DataSource = WebDataSource1
end
object cbPDFFile: TWebDBCheckBox
Left = 662
Top = 430
Width = 113
Height = 22
Caption = 'PDF File'
ChildOrder = 79
ElementID = 'cbpdffile'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_file'
DataSource = WebDataSource1
end
object cbWideFormat: TWebDBCheckBox
Left = 658
Top = 406
Width = 113
Height = 22
Caption = 'Wide Format'
ChildOrder = 79
ElementID = 'cbwideformat'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_wide_format'
DataSource = WebDataSource1
end
object cbPrintCard: TWebDBCheckBox
Left = 658
Top = 382
Width = 113
Height = 22
Caption = 'Print Card'
ChildOrder = 79
ElementID = 'cbprintcard'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_print_card'
DataSource = WebDataSource1
end
object cbFullSizePanel: TWebDBCheckBox
Left = 658
Top = 356
Width = 113
Height = 22
Caption = 'Full Size Panel'
ChildOrder = 79
ElementID = 'cbfullsizepanel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_panel'
DataSource = WebDataSource1
end
object edtSpecialInstructions: TWebDBEdit
Left = 852
Top = 185
Width = 121
Height = 22
AutoSize = True
ChildOrder = 78
ElementID = 'edtspecialinstructions'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'general_special_instructions'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 752
Top = 558
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 79
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object cbRefArtAPDF: TWebCheckBox
Left = 316
Top = 463
Width = 113
Height = 22
Caption = 'Ref Art A PDF?'
ChildOrder = 76
ElementID = 'edtrefartapdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbRefArtPrintCard: TWebCheckBox
Left = 316
Top = 435
Width = 113
Height = 22
Caption = 'Ref Art Print Card?'
ChildOrder = 76
ElementID = 'edtrefartprintcard'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbExistingCuttingDie: TWebCheckBox
Left = 316
Top = 407
Width = 113
Height = 22
Caption = 'Existing Cutting Die?'
ChildOrder = 76
ElementID = 'edtexistingcuttingdie'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbFTP: TWebCheckBox
Left = 320
Top = 318
Width = 113
Height = 22
Caption = 'FTP?'
ChildOrder = 76
ElementID = 'edtftp'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbSampleCarton: TWebCheckBox
Left = 316
Top = 283
Width = 113
Height = 22
Caption = 'Sample Carton'
ChildOrder = 76
ElementID = 'cbsampleCarton'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbPlates: TWebCheckBox
Left = 316
Top = 255
Width = 113
Height = 22
Caption = 'Plates'
ChildOrder = 76
ElementID = 'cbplates'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbColorCopy: TWebCheckBox
Left = 316
Top = 227
Width = 113
Height = 22
Caption = 'Color Copy'
ChildOrder = 76
ElementID = 'cbcolorcopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbStripMount: TWebCheckBox
Left = 496
Top = 406
Width = 113
Height = 22
Caption = 'Strip Mount'
ChildOrder = 76
ElementID = 'cbstripmount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbFullMount: TWebCheckBox
Left = 496
Top = 382
Width = 113
Height = 22
Caption = 'Full Mount'
ChildOrder = 76
ElementID = 'cbfullmount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbStickyBak: TWebCheckBox
Left = 496
Top = 358
Width = 113
Height = 22
Caption = 'Sticky Bak'
ChildOrder = 76
ElementID = 'cbstickybak'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbLoose: TWebCheckBox
Left = 496
Top = 309
Width = 113
Height = 22
Caption = 'Loose'
ChildOrder = 76
ElementID = 'cbloose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbExcaliburDie: TWebCheckBox
Left = 496
Top = 233
Width = 113
Height = 22
Caption = 'Excalibur Die'
ChildOrder = 76
ElementID = 'edtftp'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 244
Top = 44
end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 240
Top = 8
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 324
Top = 104
object XDataWebDataSet1ORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
object XDataWebDataSet1COMPANY_ID: TIntegerField
FieldName = 'COMPANY_ID'
end
object XDataWebDataSet1USER_ID: TIntegerField
FieldName = 'USER_ID'
end
object XDataWebDataSet1ORDER_DATE: TDateField
FieldName = 'ORDER_DATE'
end
object XDataWebDataSet1START_DATE: TDateField
FieldName = 'START_DATE'
end
object XDataWebDataSet1END_DATE: TDateField
FieldName = 'END_DATE'
end
object XDataWebDataSet1ORDER_STATUS: TStringField
FieldName = 'ORDER_STATUS'
end
object XDataWebDataSet1SCHED_JSON: TStringField
FieldName = 'SCHED_JSON'
end
object XDataWebDataSet1NAME: TStringField
FieldName = 'NAME'
end
object XDataWebDataSet1SHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object XDataWebDataSet1staff_fields_ship_via: TStringField
FieldName = 'staff_fields_ship_via'
end
object XDataWebDataSet1staff_fields_price: TStringField
FieldName = 'staff_fields_price'
end
object XDataWebDataSet1staff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
end
object XDataWebDataSet1staff_fields_invoice_attention: TStringField
FieldName = 'staff_fields_invoice_attention'
end
object XDataWebDataSet1staff_fields_ship_to: TStringField
FieldName = 'staff_fields_ship_to'
end
object XDataWebDataSet1staff_fields_ship_attention: TStringField
FieldName = 'staff_fields_ship_attention'
end
object XDataWebDataSet1staff_fields_po_number: TStringField
FieldName = 'staff_fields_po_number'
end
object XDataWebDataSet1staff_fields_job_name: TStringField
FieldName = 'staff_fields_job_name'
end
object XDataWebDataSet1plates_job_number: TStringField
FieldName = 'plates_job_number'
end
object XDataWebDataSet1supplied_by_customer_b_w_copy: TBooleanField
FieldName = 'supplied_by_customer_b_w_copy'
end
object XDataWebDataSet1supplied_by_customer_dimension: TStringField
FieldName = 'supplied_by_customer_dimension'
end
object XDataWebDataSet1supplied_by_customer_e_mail: TStringField
FieldName = 'supplied_by_customer_e_mail'
end
object XDataWebDataSet1supplied_by_customer_ftp: TStringField
FieldName = 'supplied_by_customer_ftp'
end
object XDataWebDataSet1supplied_by_customer_other: TStringField
FieldName = 'supplied_by_customer_other'
end
object XDataWebDataSet1supplied_by_customer_existing_: TStringField
FieldName = 'supplied_by_customer_existing_'
end
object XDataWebDataSet1supplied_by_customer_ref_art_p: TStringField
FieldName = 'supplied_by_customer_ref_art_p'
end
object XDataWebDataSet1supplied_by_customer_ref_art_a: TStringField
FieldName = 'supplied_by_customer_ref_art_a'
end
object XDataWebDataSet1cut_die_cutdier: TStringField
FieldName = 'cut_die_cutdier'
end
object XDataWebDataSet1cut_die_cutdieb: TStringField
FieldName = 'cut_die_cutdieb'
end
object XDataWebDataSet1cut_die_cutdief: TStringField
FieldName = 'cut_die_cutdief'
end
object XDataWebDataSet1cut_die_cutdierkr: TStringField
FieldName = 'cut_die_cutdierkr'
end
object XDataWebDataSet1cut_die_cutdiefkr: TStringField
FieldName = 'cut_die_cutdiefkr'
end
object XDataWebDataSet1cut_die_cad_file: TStringField
FieldName = 'cut_die_cad_file'
end
object XDataWebDataSet1cut_die_attached: TStringField
FieldName = 'cut_die_attached'
end
object XDataWebDataSet1cut_die_boxpol250: TStringField
FieldName = 'cut_die_boxpol250'
end
object XDataWebDataSet1cut_die_boxpol155: TStringField
FieldName = 'cut_die_boxpol155'
end
object XDataWebDataSet1cut_die_boxpol125: TStringField
FieldName = 'cut_die_boxpol125'
end
object XDataWebDataSet1cut_die_brub: TStringField
FieldName = 'cut_die_brub'
end
object XDataWebDataSet1proofing_fax: TStringField
FieldName = 'proofing_fax'
end
object XDataWebDataSet1proofing_fax_attn: TStringField
FieldName = 'proofing_fax_attn'
end
object XDataWebDataSet1proofing_e_mail: TStringField
FieldName = 'proofing_e_mail'
end
object XDataWebDataSet1proofing_ship_to: TStringField
FieldName = 'proofing_ship_to'
end
object XDataWebDataSet1proofing_other: TStringField
FieldName = 'proofing_other'
end
object XDataWebDataSet1proofing_changes_required: TStringField
FieldName = 'proofing_changes_required'
end
object XDataWebDataSet1proofing_changes_date: TDateField
FieldName = 'proofing_changes_date'
end
object XDataWebDataSet1layout_rsc_l: TStringField
FieldName = 'layout_rsc_l'
end
object XDataWebDataSet1layout_rcs_w: TStringField
FieldName = 'layout_rcs_w'
end
object XDataWebDataSet1layout_rcs_d: TStringField
FieldName = 'layout_rcs_d'
end
object XDataWebDataSet1layout_die_cut_no: TStringField
FieldName = 'layout_die_cut_no'
end
object XDataWebDataSet1layout_accross_no: TStringField
FieldName = 'layout_accross_no'
end
object XDataWebDataSet1layout_around_no: TStringField
FieldName = 'layout_around_no'
end
object XDataWebDataSet1layout_cad_file: TStringField
FieldName = 'layout_cad_file'
end
object XDataWebDataSet1mounting_standard_setup: TStringField
FieldName = 'mounting_standard_setup'
end
object XDataWebDataSet1mounting_custom_backing: TStringField
FieldName = 'mounting_custom_backing'
end
object XDataWebDataSet1mounting_custom_adhesive: TStringField
FieldName = 'mounting_custom_adhesive'
end
object XDataWebDataSet1colors_cylinder_size: TStringField
FieldName = 'colors_cylinder_size'
end
object XDataWebDataSet1colors_cross_hairs: TStringField
FieldName = 'colors_cross_hairs'
end
object XDataWebDataSet1colors_machine_ident: TStringField
FieldName = 'colors_machine_ident'
end
object XDataWebDataSet1colors_clemson: TStringField
FieldName = 'colors_clemson'
end
object XDataWebDataSet1plates_thickness: TStringField
FieldName = 'plates_thickness'
end
object XDataWebDataSet1plates_plate_material: TStringField
FieldName = 'plates_plate_material'
end
object XDataWebDataSet1general_special_instructions: TStringField
FieldName = 'general_special_instructions'
end
object XDataWebDataSet1colors_colors: TStringField
FieldName = 'colors_colors'
end
object XDataWebDataSet1staff_fields_quickbooks_item: TStringField
FieldName = 'staff_fields_quickbooks_item'
end
object XDataWebDataSet1staff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity'
end
object XDataWebDataSet1layout_rsc_style: TStringField
FieldName = 'layout_rsc_style'
end
object XDataWebDataSet1staff_fields_art_location: TStringField
FieldName = 'staff_fields_art_location'
end
object XDataWebDataSet1supplied_by_customer_color_copy: TBooleanField
FieldName = 'supplied_by_customer_color_copy'
end
object XDataWebDataSet1supplied_by_customer_plates: TBooleanField
FieldName = 'supplied_by_customer_plates'
end
object XDataWebDataSet1supplied_by_customer_sample_ca: TBooleanField
FieldName = 'supplied_by_customer_sample_ca'
end
object XDataWebDataSet1supplied_by_customer_disk_or_cd: TBooleanField
FieldName = 'supplied_by_customer_disk_or_cd'
end
object XDataWebDataSet1mounting_loose: TStringField
FieldName = 'mounting_loose'
end
object XDataWebDataSet1mounting_sticky_bak: TBooleanField
FieldName = 'mounting_sticky_bak'
end
object XDataWebDataSet1mounting_full_mount: TBooleanField
FieldName = 'mounting_full_mount'
end
object XDataWebDataSet1mounting_strip_mount: TStringField
FieldName = 'mounting_strip_mount'
end
object XDataWebDataSet1layout_excalibur_die: TBooleanField
FieldName = 'layout_excalibur_die'
end
object XDataWebDataSet1proofing_full_size_panel: TBooleanField
FieldName = 'proofing_full_size_panel'
end
object XDataWebDataSet1proofing_print_card: TBooleanField
FieldName = 'proofing_print_card'
end
object XDataWebDataSet1proofing_wide_format: TBooleanField
FieldName = 'proofing_wide_format'
end
object XDataWebDataSet1proofing_pdf_file: TBooleanField
FieldName = 'proofing_pdf_file'
end
object XDataWebDataSet1proofing_art_approved_as_is: TBooleanField
FieldName = 'proofing_art_approved_as_is'
end
object XDataWebDataSet1proofing_e_mail_attn: TStringField
FieldName = 'proofing_e_mail_attn'
end
object XDataWebDataSet1proofing_approved_date: TStringField
FieldName = 'proofing_approved_date'
end
object XDataWebDataSet1staff_fields_order_date: TStringField
FieldName = 'staff_fields_order_date'
end
object XDataWebDataSet1staff_fields_proof_date: TStringField
FieldName = 'staff_fields_proof_date'
end
object XDataWebDataSet1staff_fields_ship_date: TStringField
FieldName = 'staff_fields_ship_date'
end
object XDataWebDataSet1staff_fields_art_due: TStringField
FieldName = 'staff_fields_art_due'
end
object XDataWebDataSet1staff_fields_plate_due: TStringField
FieldName = 'staff_fields_plate_due'
end
object XDataWebDataSet1staff_fields_mount_due: TStringField
FieldName = 'staff_fields_mount_due'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 216
Top = 104
end
end
<div class="col-12 col-md-8">
<div class="row">
<div class=col-sm>
<div id="pnl_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>
</div>
</div>
<h4 class="custom-h4 mt-3">Company</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label>
<input id="edtcompanyname" type="text" class="form-control" width=150px/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" width=300px/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" width=300px/>
</div>
</div>
<h4 class="custom-h4 mt-3">Staff Fields</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Proof Date:</label>
<input class="form-control input-sm" id="dtpproofdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Ship Date:</label>
<input class="form-control input-sm" id="dtpshipdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Ship Via:</label>
<input id="edtshipvia" type="text" class="form-control" width=300px/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Quantity:</label>
<input id="edtquantity" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Price:</label>
<input id="edtprice" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Invoice To:</label>
<input id="edtinvoiceto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Ship To:</label>
<input id="edtshipto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">PO Number:</label>
<input id="edtponumber" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">QuickBooks Item:</label>
<input id="edtquickbooksitem" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Art Due:</label>
<input class="form-control input-sm" id="dtpartdue" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Plate Due:</label>
<input class="form-control input-sm" id="dtpplatedue" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Mount Due:</label>
<input class="form-control input-sm" id="dtpmountdue" type="date">
</div>
<div class="col-auto">
<label class="form-label mt-2">Art Location:</label>
<input id="edtartlocation" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">Supplied by Customer</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Color Copy:</label>
<input type="checkbox" id="cbcolorcopy">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Plates:</label>
<input type="checkbox" id="cbplates">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton:</label>
<input type="checkbox" id="cbsampleCarton">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Disk or CD:</label>
<input type="checkbox" id="cbdiskorcd">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Email:</label>
<input type="checkbox" id="edtemail" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">FTP:</label>
<input type="checkbox" id="edtftp" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Other:</label>
<input class="form-control input-sm" id="edtother" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Existing Cutting Die:</label>
<input type="checkbox" id="edtexistingcuttingdie" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art Print Card:</label>
<input type="checkbox" id="edtrefartprintcard" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art A PDF:</label>
<input type="checkbox" id="edtrefartapdf" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">Layout</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">RSC L:</label>
<input id="edtrscl" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">RSC W:</label>
<input id="edtrscw" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">RSC D:</label>
<input id="edtrscd" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Die Cut No:</label>
<input class="form-control input-sm" id="edtdiecutno" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Across No:</label>
<input class="form-control input-sm" id="edtacrossno" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Around No:</label>
<input class="form-control input-sm" id="edtaroundno" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">CAD File:</label>
<input id="edtcadfile" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Excalibur Die:</label>
<input type="checkbox" id="cbexcaliburdie">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">RSC Style:</label>
<input id="edtrscstyle" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">Mounting</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Loose:</label>
<input type="checkbox" id="cbloose">
<input id="edtloose" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Sticky Bak:</label>
<input type="checkbox" id="cbstickybak">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Full Mount:</label>
<input type="checkbox" id="cbfullmount">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Strip Mount:</label>
<input type="checkbox" id="cbstripmount">
<input id="edtstripmount" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Standard Setup:</label>
<input id="edtstandardsetup" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Custom Backing:</label>
<input id="edtcustombacking" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Custom Adhesive:</label>
<input id="edtcustomadhesive" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">Colors</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Cylinder Size:</label>
<input id="edtcylindersize" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Machine Indent:</label>
<input id="edtmachineindent" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Cross Hairs:</label>
<input id="edtcrosshairs" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Clemson:</label>
<input id="edtclemson" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Colors:</label>
<button id="btnaddcolor" class="btn btn-primary btn-sm float-end">+</button>
<div id="additionalFields" class="row mt-3"></div>
</div>
</div>
<h4 class="custom-h4 mt-3">Proofing</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Fax:</label>
<input id="edtfax" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Fax Attn:</label>
<input id="edtfaxattn" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Email:</label>
<input id="edtproofemail" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Email Attn:</label>
<input id="edtemailattn" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Ship To:</label>
<input id="edtproofshipto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Full Size Panel:</label>
<input type="checkbox" id="cbfullsizepanel">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Print Card:</label>
<input type="checkbox" id="cbprintcard">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Wide Format:</label>
<input type="checkbox" id="cbwideformat">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">PDF File:</label>
<input type="checkbox" id="cbpdffile">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Other:</label>
<input id="edtproofother" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Art Approved As Is:</label>
<input type="checkbox" id="cbartapprovedasis">
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Approved Date:</label>
<input class="form-control input-sm" id="dtpapproveddate" type="date">
</div>
</div>
<h4 class="custom-h4 mt-3">Plates</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lblthickness">Thickness:</label>
<input id="edtThickness" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lblplatematerial">Plate Material:</label>
<input id="edtplatematerial" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lbljobnumber">Job Number:</label>
<input id="edtjobnumber" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label">Special Instructions</label>
<input type="text" class="form-control" id="edtspecialinstructions" style="width: 300px;">
</div>
</div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end">Confirm</button>
</div>
</div>
</div>
<script>
</script>
unit View.OrderEntryCorrugated;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type
TFOrderEntry = class(TWebForm)
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
dtpArtDue: TWebDateTimePicker;
dtpPlateDue: TWebDateTimePicker;
dtpMountDue: TWebDateTimePicker;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
WebLabel5: TWebLabel;
WebLabel6: TWebLabel;
WebButton1: TWebButton;
WebLabel7: TWebLabel;
dtpApprovedDate: TWebDateTimePicker;
WebLabel8: TWebLabel;
WebLabel9: TWebLabel;
edtCompanyName: TWebDBEdit;
edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit;
edtShipVia: TWebDBEdit;
edtQuantity: TWebDBEdit;
edtPrice: TWebDBEdit;
edtInvoiceTo: TWebDBEdit;
edtShipTo: TWebDBEdit;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
edtQuickBooksItem: TWebDBEdit;
edtEmail: TWebDBEdit;
edtOther: TWebDBEdit;
edtCADFile: TWebDBEdit;
edtAroundNo: TWebDBEdit;
edtAcrossNo: TWebDBEdit;
edtDieCutNo: TWebDBEdit;
edtRSCD: TWebDBEdit;
edtRSCW: TWebDBEdit;
edtRSCL: TWebDBEdit;
edtCustomAdhesive: TWebDBEdit;
edtCustomBacking: TWebDBEdit;
edtStandardSetup: TWebDBEdit;
edtStripMount: TWebDBEdit;
edtLoose: TWebDBEdit;
edtRSCStyle: TWebDBEdit;
edtProofOther: TWebDBEdit;
edtProofShipTo: TWebDBEdit;
edtEmailAttn: TWebDBEdit;
edtProofEmail: TWebDBEdit;
edtFaxAttn: TWebDBEdit;
edtFax: TWebDBEdit;
edtClemson: TWebDBEdit;
edtCrossHairs: TWebDBEdit;
edtMachineIndent: TWebDBEdit;
edtCylinderSize: TWebDBEdit;
edtJobNumber: TWebDBEdit;
edtPlateMaterial: TWebDBEdit;
edtThickness: TWebDBEdit;
cbArtApprovedAsIs: TWebDBCheckBox;
cbPDFFile: TWebDBCheckBox;
cbWideFormat: TWebDBCheckBox;
cbPrintCard: TWebDBCheckBox;
cbFullSizePanel: TWebDBCheckBox;
XDataWebClient1: TXDataWebClient;
edtSpecialInstructions: TWebDBEdit;
tmrScrollTop: TWebTimer;
XDataWebDataSet1: TXDataWebDataSet;
WebDataSource1: TWebDataSource;
btnConfirm: TWebButton;
XDataWebDataSet1ORDER_ID: TIntegerField;
XDataWebDataSet1COMPANY_ID: TIntegerField;
XDataWebDataSet1USER_ID: TIntegerField;
XDataWebDataSet1ORDER_STATUS: TStringField;
XDataWebDataSet1SCHED_JSON: TStringField;
XDataWebDataSet1staff_fields_ship_via: TStringField;
XDataWebDataSet1staff_fields_price: TStringField;
XDataWebDataSet1staff_fields_invoice_to: TStringField;
XDataWebDataSet1staff_fields_invoice_attention: TStringField;
XDataWebDataSet1staff_fields_ship_to: TStringField;
XDataWebDataSet1staff_fields_ship_attention: TStringField;
XDataWebDataSet1staff_fields_po_number: TStringField;
XDataWebDataSet1staff_fields_job_name: TStringField;
XDataWebDataSet1ORDER_DATE: TDateField;
XDataWebDataSet1START_DATE: TDateField;
XDataWebDataSet1END_DATE: TDateField;
XDataWebDataSet1plates_job_number: TStringField;
XDataWebDataSet1supplied_by_customer_dimension: TStringField;
XDataWebDataSet1supplied_by_customer_e_mail: TStringField;
XDataWebDataSet1supplied_by_customer_ftp: TStringField;
XDataWebDataSet1supplied_by_customer_other: TStringField;
XDataWebDataSet1supplied_by_customer_existing_: TStringField;
XDataWebDataSet1supplied_by_customer_ref_art_p: TStringField;
XDataWebDataSet1supplied_by_customer_ref_art_a: TStringField;
XDataWebDataSet1cut_die_cutdier: TStringField;
XDataWebDataSet1cut_die_cutdieb: TStringField;
XDataWebDataSet1cut_die_cutdief: TStringField;
XDataWebDataSet1cut_die_cutdierkr: TStringField;
XDataWebDataSet1cut_die_cutdiefkr: TStringField;
XDataWebDataSet1cut_die_cad_file: TStringField;
XDataWebDataSet1cut_die_attached: TStringField;
XDataWebDataSet1cut_die_boxpol250: TStringField;
XDataWebDataSet1cut_die_boxpol155: TStringField;
XDataWebDataSet1cut_die_boxpol125: TStringField;
XDataWebDataSet1cut_die_brub: TStringField;
XDataWebDataSet1proofing_fax: TStringField;
XDataWebDataSet1proofing_fax_attn: TStringField;
XDataWebDataSet1proofing_e_mail: TStringField;
XDataWebDataSet1proofing_ship_to: TStringField;
XDataWebDataSet1proofing_other: TStringField;
XDataWebDataSet1proofing_changes_required: TStringField;
XDataWebDataSet1proofing_changes_date: TDateField;
XDataWebDataSet1layout_rsc_l: TStringField;
XDataWebDataSet1layout_rcs_w: TStringField;
XDataWebDataSet1layout_rcs_d: TStringField;
XDataWebDataSet1layout_die_cut_no: TStringField;
XDataWebDataSet1layout_accross_no: TStringField;
XDataWebDataSet1layout_around_no: TStringField;
XDataWebDataSet1layout_cad_file: TStringField;
XDataWebDataSet1colors_cylinder_size: TStringField;
XDataWebDataSet1colors_machine_ident: TStringField;
XDataWebDataSet1mounting_standard_setup: TStringField;
XDataWebDataSet1mounting_custom_backing: TStringField;
XDataWebDataSet1mounting_custom_adhesive: TStringField;
XDataWebDataSet1colors_cross_hairs: TStringField;
XDataWebDataSet1colors_clemson: TStringField;
XDataWebDataSet1plates_thickness: TStringField;
XDataWebDataSet1plates_plate_material: TStringField;
XDataWebDataSet1general_special_instructions: TStringField;
XDataWebDataSet1colors_colors: TStringField;
XDataWebDataSet1staff_fields_quickbooks_item: TStringField;
XDataWebDataSet1staff_fields_quantity: TStringField;
XDataWebDataSet1layout_rsc_style: TStringField;
XDataWebDataSet1staff_fields_art_location: TStringField;
XDataWebDataSet1NAME: TStringField;
XDataWebDataSet1SHORT_NAME: TStringField;
XDataWebDataSet1supplied_by_customer_b_w_copy: TBooleanField;
XDataWebDataSet1supplied_by_customer_color_copy: TBooleanField;
XDataWebDataSet1supplied_by_customer_plates: TBooleanField;
XDataWebDataSet1supplied_by_customer_sample_ca: TBooleanField;
XDataWebDataSet1supplied_by_customer_disk_or_cd: TBooleanField;
XDataWebDataSet1mounting_loose: TStringField;
XDataWebDataSet1mounting_sticky_bak: TBooleanField;
XDataWebDataSet1mounting_full_mount: TBooleanField;
XDataWebDataSet1mounting_strip_mount: TStringField;
XDataWebDataSet1layout_excalibur_die: TBooleanField;
XDataWebDataSet1proofing_full_size_panel: TBooleanField;
XDataWebDataSet1proofing_print_card: TBooleanField;
XDataWebDataSet1proofing_wide_format: TBooleanField;
XDataWebDataSet1proofing_pdf_file: TBooleanField;
XDataWebDataSet1proofing_art_approved_as_is: TBooleanField;
XDataWebDataSet1proofing_e_mail_attn: TStringField;
XDataWebDataSet1proofing_approved_date: TStringField;
XDataWebDataSet1staff_fields_order_date: TStringField;
XDataWebDataSet1staff_fields_proof_date: TStringField;
XDataWebDataSet1staff_fields_ship_date: TStringField;
XDataWebDataSet1staff_fields_art_due: TStringField;
XDataWebDataSet1staff_fields_plate_due: TStringField;
XDataWebDataSet1staff_fields_mount_due: TStringField;
cbRefArtAPDF: TWebCheckBox;
cbRefArtPrintCard: TWebCheckBox;
cbExistingCuttingDie: TWebCheckBox;
cbFTP: TWebCheckBox;
cbSampleCarton: TWebCheckBox;
cbPlates: TWebCheckBox;
cbColorCopy: TWebCheckBox;
cbStripMount: TWebCheckBox;
cbFullMount: TWebCheckBox;
cbStickyBak: TWebCheckBox;
cbLoose: TWebCheckBox;
cbExcaliburDie: TWebCheckBox;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure getOrder(Order_ID: string);
procedure tmrScrollTopTimer(Sender: TObject);
procedure WebButton1Click(Sender: TObject);
procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
private
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
orderID: string;
mode: string;
//FJSONProc1: TJSONProc1;
public
class function CreateForm(AElementID, orderInfo, mode: string): TWebForm;
end;
var
FOrderEntry: TFOrderEntry;
implementation
{$R *.dfm}
uses
View.Home, View.Main;
procedure TFOrderEntry.btnConfirmClick(Sender: TObject);
var
colorList: TJSONArray;
container: TJSElement;
colorCollection: TJSHTMLCollection;
color: TJSHTMLElement;
I, J: integer;
colorJSON, orderJSON, colorListJSON: TJSONObject;
fieldNames: TStringList;
itemList: TJSNodeList;
header, value: string;
Field: TField;
Response: TXDataClientResponse;
begin
//TJSONObject.Create;
orderJSON := TJSONObject.Create;
colorList := TJSONArray.Create;
container := document.getElementById('additionalFields');
colorCollection := container.children;
for I := 0 to colorCollection.length - 1 do
begin
colorJSON := TJSONObject.Create;
itemList := colorCollection[I].childNodes;
for J := 0 to itemList.length - 2 do
begin
header := TJSHTMLElement(itemList[J]).children[0].innerText.Replace(':', '').Trim();
value := TJSHTMLInputElement(TJSHTMLElement(itemList[J]).childNodes[1]).value;
colorJSON.AddPair(header, value);
end;
colorList.Add(colorJSON);
end;
colorListJSON := TJSONObject.Create;
colorListJSON.AddPair('items', colorList);
XDataWebDataSet1.Edit;
XDataWebDataSet1colors_colors.Value := colorListJSON.ToString;
//Convert all dates to strings because I was having less issues with that data type.
XDataWebDataSet1staff_fields_proof_date.Value := DateTimeToStr(dtpProofDate.Date);
XDataWebDataSet1staff_fields_ship_date.Value := DateTimeToStr(dtpShipDate.Date);
XDataWebDataSet1staff_fields_art_due.Value := DateTimeToStr(dtpArtDue.Date);
XDataWebDataSet1staff_fields_mount_due.Value := DateTimeToStr(dtpMountDue.Date);
XDataWebDataSet1staff_fields_plate_due.Value := DateTimeToStr(dtpPlateDue.Date);
XDataWebDataSet1ORDER_DATE.Value := dtpOrderDate.Date;
// Convert all check boxes to strings because the database stores them as strings
if cbFTP.Checked then
XDataWebDataSet1supplied_by_customer_ftp.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_ftp.AsString := '';
if cbExistingCuttingDie.Checked then
XDataWebDataSet1supplied_by_customer_existing_.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_existing_.AsString := '';
if cbRefArtPrintCard.Checked then
XDataWebDataSet1supplied_by_customer_ref_art_p.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_ref_art_p.AsString := '';
if cbRefArtAPDF.Checked then
XDataWebDataSet1supplied_by_customer_ref_art_a.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_ref_art_a.AsString := '';
if cbColorCopy.Checked then
XDataWebDataSet1supplied_by_customer_color_copy.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_color_copy.AsString := '';
if cbPlates.Checked then
XDataWebDataSet1supplied_by_customer_plates.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_plates.AsString := '';
if cbSampleCarton.Checked then
XDataWebDataSet1supplied_by_customer_sample_ca.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_sample_ca.AsString := '';
if cbPDFFile.Checked then
XDataWebDataSet1proofing_pdf_file.AsString := 'T'
else
XDataWebDataSet1proofing_pdf_file.AsString := '';
XDataWebDataSet1.Post;
XDataWebDataSet1.First;
console.log(XDataWebDataSet1supplied_by_customer_sample_ca.AsString);
while not XDataWebDataSet1.Eof do
begin
for Field in XDataWebDataSet1.Fields do
begin
if Field is TStringField then
begin
if Field.AsString = '' then
orderJSON.AddPair(Field.FieldName, '')
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TBooleanField then
begin
if Field.AsBoolean then
orderJSON.AddPair(Field.FieldName, 'T')
else
orderJSON.AddPair(Field.FieldName, '');
end;
end;
XDataWebDataSet1.Next;
end;
orderJSON.AddPair('COMPANY_ID', '749');
orderJSON.AddPair('USER_ID', '1011');
orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
AddCorrugatedOrder(orderJSON);
FViewMain.ViewOrders('Success');
end;
procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject);
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder',
[orderJSON.ToString]));
end;
class function TFOrderEntry.CreateForm(AElementID, orderInfo, mode: string): TWebForm;
var
localMode: string;
begin
localMode := mode;
Application.CreateForm(TFOrderEntry, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntry(AForm) do
begin
HideNotification;
TFOrderEntry(AForm).orderID := orderInfo;
TFOrderEntry(AForm).mode := localMode;
console.log(TFOrderEntry(AForm).mode);
end;
end
);
end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
begin
asm
const container = document.getElementById('additionalFields');
// Create a new row for the new fields
const newRow = document.createElement('div');
newRow.className = 'row mb-2';
// Labels and inputs
const labels = ['#', 'Color', 'LPI', 'Size'];
const values = [num, Color, LPI, Size];
labels.forEach((label, index) => {
const col = document.createElement('div');
col.className = 'col-sm';
const labelElement = document.createElement('label');
labelElement.className = 'pe-2';
labelElement.style.fontWeight = '700';
labelElement.style.fontSize = '15px';
labelElement.textContent = label + ':';
const inputElement = document.createElement('input');
inputElement.className = 'form-control input-sm';
inputElement.style.width = '100%';
inputElement.id = 'input-' + container.childElementCount + '-' + index; // Unique ID based on count
inputElement.value = values[index]; // Set the value based on the parameter
col.appendChild(labelElement);
col.appendChild(inputElement);
newRow.appendChild(col);
});
const removeButtonCol = document.createElement('div');
removeButtonCol.className = 'col-auto d-flex align-items-center';
const removeButton = document.createElement('button');
removeButton.className = 'btn btn-danger btn-sm';
removeButton.textContent = 'Remove';
removeButton.addEventListener('click', function() {
container.removeChild(newRow);
});
removeButtonCol.appendChild(removeButton);
newRow.appendChild(removeButtonCol);
// Add the new row to the container
container.appendChild(newRow);
end;
end;
procedure TFOrderEntry.WebButton1Click(Sender: TObject);
begin
addColorRow('','','','');
end;
procedure TFOrderEntry.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFOrderEntry.getOrder(Order_ID: string);
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString, strColorList: string;
colorObject: TJSObject;
colorList: TJSArray;
colorLength: integer;
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder',
[Order_ID]));
order := TJSObject(xdcResponse.Result);
data := TJSArray(order['data']);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open;
if XDataWebDataSet1colors_colors.Value <> '' then
begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors_colors.Value));
colorList := TJSArray(colorObject['items']);
for I := 0 to colorList.length -1 do
begin
color := TJSObject(colorList[i]);
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size']));
end;
end;
console.log(XDataWebDataSet1staff_fields_invoice_to.AsString);
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
else
dtpOrderDate.Date := 0;
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString)
else
dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
else
dtpShipDate.Date := 0;
if not (XDataWebDataSet1staff_fields_art_due.AsString = '') then
dtpArtDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_art_due.AsString)
else
dtpArtDue.Date := 0;
if not (XDataWebDataSet1staff_fields_plate_due.AsString = '') then
dtpPlateDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_plate_due.AsString)
else
dtpPlateDue.Date := 0;
if not (XDataWebDataSet1staff_fields_mount_due.AsString = '') then
dtpMountDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_mount_due.AsString)
else
dtpMountDue.Date := 0;
if not (XDataWebDataSet1proofing_approved_date.AsString = '') then
dtpApprovedDate.Date := StrToDateTime(XDataWebDataSet1proofing_approved_date.AsString)
else
dtpApprovedDate.Date := 0;
if XDataWebDataSet1supplied_by_customer_ftp.AsString = 'T' then
cbFTP.Checked := true
else
cbFTP.Checked := false;
if XDataWebDataSet1supplied_by_customer_existing_.AsString = 'T' then
cbExistingCuttingDie.Checked := true
else
cbExistingCuttingDie.Checked := false;
if XDataWebDataSet1supplied_by_customer_ref_art_a.AsString = 'T' then
cbRefArtAPDF.Checked := true
else
cbRefArtAPDF.Checked := false;
if XDataWebDataSet1supplied_by_customer_ref_art_p.AsString = 'T' then
cbRefArtPrintCard.Checked := true
else
cbRefArtPrintCard.Checked := false;
if XDataWebDataSet1supplied_by_customer_color_copy.AsString = 'T' then
cbColorCopy.Checked := true
else
cbColorCopy.checked := false;
if XDataWebDataSet1supplied_by_customer_plates.AsString = 'T' then
cbPlates.Checked := true
else
cbPlates.Checked := false;
if XDataWebDataSet1supplied_by_customer_sample_ca.AsString = 'T' then
cbSampleCarton.Checked := true
else
cbSampleCarton.Checked := false;
end;
procedure TFOrderEntry.WebFormShow(Sender: TObject);
begin
getOrder(orderID);
HideNotification();
end;
procedure TFOrderEntry.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntry.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFOrderEntry.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
initialization
RegisterClass(TFOrderEntry);
end.
object FOrderList: TFOrderList
Width = 1016
Height = 683
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnShow = WebFormShow
object lblEntries: TWebLabel
Left = 0
Top = 336
Width = 77
Height = 14
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries2: TWebLabel
Left = 8
Top = 358
Width = 49
Height = 14
Caption = 'lblEntries2'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 8
Top = 384
Width = 121
Height = 22
HelpType = htKeyword
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 24
Top = 57
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 1
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 44
Height = 14
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
end
end
object WebDBTableControl: TWebDBTableControl
Left = 172
Top = 287
Width = 530
Height = 265
ElementClassName = 'table-responsive'
ElementId = 'customer_list'
BorderColor = clSilver
ChildOrder = 5
ColHeader = False
ElementTableClassName = 'table table-striped table-bordered table-hover dataTable'
Options.ResizeColumns = True
Columns = <
item
DataField = 'ID'
Title = 'ID'
Width = 24
end
item
DataField = 'NAME'
Title = 'NAME'
Width = 100
end
item
DataField = 'SHORT_NAME'
Title = 'SHORT_NAME'
end
item
DataField = 'ADDRESS'
Title = 'ADDRESS'
end>
DataSource = wdsCustomers
end
object cbCorrugatedPlate: TWebCheckBox
Left = 172
Top = 210
Width = 113
Height = 22
Caption = 'Corrugated Plate'
Checked = True
ChildOrder = 5
HeightPercent = 100.000000000000000000
State = cbChecked
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 304
Top = 210
Width = 113
Height = 22
Caption = 'Web Plate'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object edtCompanyName: TWebEdit
Left = 302
Top = 252
Width = 121
Height = 22
ChildOrder = 7
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtID: TWebEdit
Left = 172
Top = 252
Width = 121
Height = 22
ChildOrder = 8
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 564
Top = 251
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 88
Top = 434
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 84
Top = 490
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 38
Top = 562
end
end
<div class="row">
<div class="col-12">
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<div class="row">
<div class="col-sm">
<div id="pnl_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>
</div>
</div>
<div class="row">
<label id="lblentries"></label>
</div>
<label id="lblentries2"></label>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
</div>
</div>
</div>
</div>
unit View.OrderList;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids,
Vcl.Grids;
type
TFOrderList = class(TWebForm)
lblEntries: TWebLabel;
lblEntries2: TWebLabel;
edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersADDRESS: TStringField;
WebDBTableControl: TWebDBTableControl;
cbCorrugatedPlate: TWebCheckBox;
cbWebPlate: TWebCheckBox;
edtCompanyName: TWebEdit;
edtID: TWebEdit;
btnConfirm: TWebButton;
procedure WebFormShow(Sender: TObject);
procedure WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
private
//FJSONProc: TJSONProc;
procedure AddRowToTable();
procedure ClearTable();
[async] procedure getCustomers();
public
class function CreateForm(AElementID: string): TWebForm;
end;
var
FOrderList: TFOrderList;
implementation
{$R *.dfm}
class function TFOrderList.CreateForm(AElementID: string): TWebForm;
begin
Application.CreateForm(TFOrderList, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderList(AForm) do
begin
end;
end
);
end;
procedure TFOrderList.WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
begin
//WebDBTableControl.WidthStyle := TSizeStyle.ssAuto;
console.log(AValue);
WebDBTableControl.ColWidths[ACol] := AValue.Length * 12;
end;
procedure TFOrderList.WebFormShow(Sender: TObject);
begin
getCustomers();
end;
procedure TFOrderList.cbCorrugatedPlateClick(Sender: TObject);
begin
cbWebPlate.Checked := false;
end;
procedure TFOrderList.cbWebPlateClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := false;
end;
procedure TFOrderList.ClearTable();
// clears the table
var
tbody: TJSHTMLElement;
begin
tbody := TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]);
tbody.innerHTML := '';
end;
procedure TFOrderList.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
data: TJSArray;
i, count: integer;
temp: TJSONObject;
customer: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers',
[]));
customerList := TJSObject(xdcResponse.Result);
data := TJSArray(customerList['data']);
count := integer(customerList['count']);
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open;
end;
procedure TFOrderList.AddRowToTable();
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
ClickHandler: TJSFunction;
//strColorList: string;
id: integer;
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
//NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
//orderEntry(NewRow.Attrs['id'], 'EDIT');
end);
// Company ID Cell
NewRow.Attrs['id'] := xdwdsCustomersID.AsString;
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if xdwdsCustomersID.AsString = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersID.AsString;
NewRow.appendChild(Cell);
// Company Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name');
if xdwdsCustomersNAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersNAME.Value;
NewRow.appendChild(Cell);
// Short Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name');
if xdwdsCustomersSHORT_NAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersSHORT_NAME.Value;
NewRow.appendChild(Cell);
// Address Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date');
if xdwdsCustomersADDRESS.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersADDRESS.Value;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
end.
object FViewOrders: TFViewOrders
Width = 676
Height = 480
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
OnCreate = WebFormCreate
OnShow = WebFormShow
object lblEntries: TWebLabel
Left = 0
Top = 336
Width = 77
Height = 13
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries2: TWebLabel
Left = 8
Top = 358
Width = 49
Height = 13
Caption = 'lblEntries2'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbPageSize: TWebComboBox
Left = -4
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '10'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'10'
'25'
'50')
end
object wcbSortBy: TWebComboBox
Left = 0
Top = 18
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbsortby'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'PROOF DUE'
'PROOF DONE'
'ART DUE'
'ART DONE'
'PLATE DUE'
'PLATE DONE'
'MOUNT DUE'
'MOUNT DONE'
'SHIP DUE'
'SHIP DONE')
end
object btnApply: TWebButton
Left = 542
Top = 16
Width = 96
Height = 25
Caption = 'Apply'
ChildOrder = 7
ElementClassName = 'btn btn-light'
ElementID = 'btnapply'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnApplyClick
end
object edtSearch: TWebEdit
Left = 48
Top = 382
Width = 121
Height = 22
HelpType = htKeyword
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
WidthPercent = 100.000000000000000000
end
object btnaddOrder: TWebButton
Left = 0
Top = 79
Width = 96
Height = 25
Caption = 'Add Order'
ChildOrder = 5
ElementClassName = 'btn btn-light'
ElementID = 'btnaddorder'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnaddOrderClick
end
object btnFilters: TWebButton
Left = 542
Top = 50
Width = 96
Height = 25
Caption = 'Show Filters'
ChildOrder = 6
ElementClassName = 'btn btn-light'
ElementID = 'btnfilters'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnFiltersClick
end
object dtpStartDate: TWebDateTimePicker
Left = 168
Top = 16
Width = 170
Height = 22
ElementClassName = 'form-control'
ElementID = 'dtpstartdate'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
Text = ''
end
object dtpEndDate: TWebDateTimePicker
Left = 356
Top = 16
Width = 170
Height = 22
ElementClassName = 'form-control'
ElementID = 'dtpenddate'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
Text = ''
end
object pnlMessage: TWebPanel
Left = 220
Top = 429
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 8
object lblMessage: TWebLabel
Left = 28
Top = 9
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 = 174
Top = 79
Width = 96
Height = 25
Caption = 'Set Status'
ChildOrder = 11
ElementClassName = 'btn btn-light'
ElementID = 'btnsetstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebButton2: TWebButton
Left = 344
Top = 79
Width = 96
Height = 25
Caption = 'PDF'
ChildOrder = 12
ElementClassName = 'btn btn-light'
ElementID = 'btngeneratepdf'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 566
Top = 317
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 13
ElementClassName = 'btn btn-light'
ElementID = 'btn_confirm_order'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object wcbCustomers: TWebDBLookupComboBox
Left = 550
Top = 286
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementID = 'wcbcustomer'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wcbCustomersChange
DataField = 'CURR_ID'
DataSource = wdsSave
KeyField = 'ID'
ListField = 'NAME'
ListSource = wdsCustomers
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 8
Top = 430
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 58
Top = 432
object XDataWebDataSet1ID: TStringField
FieldName = 'ID'
end
object XDataWebDataSet1companyName: TStringField
FieldName = 'companyName'
end
object XDataWebDataSet1jobName: TStringField
FieldName = 'jobName'
end
object XDataWebDataSet1orderDate: TStringField
FieldName = 'orderDate'
end
object XDataWebDataSet1proofDue: TStringField
FieldName = 'proofDue'
end
object XDataWebDataSet1proofDone: TStringField
FieldName = 'proofDone'
end
object XDataWebDataSet1artDue: TStringField
FieldName = 'artDue'
end
object XDataWebDataSet1artDone: TStringField
FieldName = 'artDone'
end
object XDataWebDataSet1mountDue: TStringField
FieldName = 'mountDue'
end
object XDataWebDataSet1mountDone: TStringField
FieldName = 'mountDone'
end
object XDataWebDataSet1shipDue: TStringField
FieldName = 'shipDue'
end
object XDataWebDataSet1shipDone: TStringField
FieldName = 'shipDone'
end
object XDataWebDataSet1price: TStringField
FieldName = 'price'
end
object XDataWebDataSet1qbRefNum: TStringField
FieldName = 'qbRefNum'
end
object XDataWebDataSet1colors: TStringField
FieldName = 'colors'
end
object XDataWebDataSet1plateDue: TStringField
FieldName = 'plateDue'
end
object XDataWebDataSet1plateDone: TStringField
FieldName = 'plateDone'
end
object XDataWebDataSet1orderType: TStringField
FieldName = 'orderType'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 94
Top = 430
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 598
Top = 406
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 596
Top = 354
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersCURR_ID: TIntegerField
FieldName = 'CURR_ID'
end
end
object xdwdsSave: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 498
Top = 352
object xdwdsSaveCURR_ID: TIntegerField
FieldName = 'CURR_ID'
end
end
object wdsSave: TWebDataSource
DataSet = xdwdsSave
Left = 490
Top = 408
end
end
<div class="row">
<div class="col-12">
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<div class="row">
<div class="col-sm">
<div id="pnl_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>
</div>
</div>
<div class="mb-3" id="filter_info" style="display: none;">
<div class="row">
<!-- Search Input Field -->
<div class="col-auto">
<label class='pe-2' style="font-weight: 700;">Search:</label>
<input class="form-control input-sm" id="edtsearch">
</div>
<!-- Start Date Input Field -->
<div class="col-auto">
<label class='pe-2' style="font-weight: 700;">Start Date:</label>
<input class="form-control input-sm" id="dtpstartdate" type="date">
</div>
<!-- End Date Input Field -->
<div class="col-auto">
<label class='pe-2' style="font-weight: 700;">End Date:</label>
<input class="form-control input-sm" id="dtpenddate" type="date">
</div>
<!-- Status Type Dropdown -->
<div class="col-auto">
<label style="font-weight: 700;">Status Type:</label>
<div>
<select class="form-control input-sm" id="wcbsortby" style="font-size: 1.00rem; height: calc(2.25rem + 2px); padding-top: 0.375rem; padding-bottom: 0.375rem;"></select>
</div>
</div>
<!-- Button (Align this with the inputs) -->
<div class="col-auto d-flex align-items-end">
<label style="font-weight: 700;"> </label>
<button class="btn btn-primary btn-sm" id="btnapply">Apply</button>
</div>
</div>
</div>
<form class="form-inline">
<div class= "row">
<div class="col-sm-3">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnaddorder"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnsetstatus"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btngeneratepdf"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnfilters"></button>
</div>
</div>
</form>
</div>
<div class="row">
<label id="lblentries"></label>
</div>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark">
<tr>
<th scope="col">Order ID</th>
<th scope="col">Company Name</th>
<th scope="col">Job Name</th>
<th scope="col">Order Date</th>
<th scope="col">Proof Due</th>
<th scope="col">Proof Date</th>
<th scope="col">Art Due</th>
<th scope="col">Art Done</th>
<th scope="col">Plate Due</th>
<th scope="col">Plate Done</th>
<th scope="col">Mount Due</th>
<th scope="col">Mount Done</th>
<th scope="col">Ship Due</th>
<th scope="col">Ship Done</th>
<th scope="col">Price</th>
<th scope="col">Quickbooks Reference Number</th>
<th scope="col">Colors</th>
</tr>
</thead>
<tbody>
<!-- Rows will be added dynamically via Delphi code -->
</tbody>
</table>
<label id="lblentries2"></label>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmation_modal_label">Select Customer</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<select class="form-control input-sm" id="wcbcustomer"></select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_order">Confirm</button>
</div>
</div>
</div>
</div>
// Displays orders in the grid. Allows the user
// to sort the entries, filter their search, and search for a specific person.
// Authors:
// Cameron Hayes
// Mac ...
unit View.Orders;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type
TFViewOrders = class(TWebForm)
XDataWebClient1: TXDataWebClient;
XDataWebDataSet1: TXDataWebDataSet;
lblEntries: TWebLabel;
wcbPageSize: TWebComboBox;
wcbSortBy: TWebComboBox;
btnApply: TWebButton;
edtSearch: TWebEdit;
WebDataSource1: TWebDataSource;
XDataWebDataSet1companyName: TStringField;
XDataWebDataSet1jobName: TStringField;
XDataWebDataSet1orderDate: TStringField;
XDataWebDataSet1proofDue: TStringField;
XDataWebDataSet1proofDone: TStringField;
XDataWebDataSet1artDue: TStringField;
XDataWebDataSet1artDone: TStringField;
XDataWebDataSet1mountDue: TStringField;
XDataWebDataSet1mountDone: TStringField;
XDataWebDataSet1shipDue: TStringField;
XDataWebDataSet1shipDone: TStringField;
XDataWebDataSet1price: TStringField;
XDataWebDataSet1ID: TStringField;
XDataWebDataSet1qbRefNum: TStringField;
XDataWebDataSet1colors: TStringField;
btnaddOrder: TWebButton;
btnFilters: TWebButton;
dtpStartDate: TWebDateTimePicker;
dtpEndDate: TWebDateTimePicker;
lblEntries2: TWebLabel;
XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateDone: TStringField;
XDataWebDataSet1orderType: TStringField;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
WebButton2: TWebButton;
btnConfirm: TWebButton;
wdsCustomers: TWebDataSource;
wcbCustomers: TWebDBLookupComboBox;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersCURR_ID: TIntegerField;
xdwdsSave: TXDataWebDataSet;
wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure btnaddOrderClick(Sender: TObject);
procedure btnFiltersClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure wcbCustomersChange(Sender: TObject);
private
FChildForm: TWebForm;
procedure AddRowToTable(temp: string);
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
procedure orderEntry(orderInfo, mode: string);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ShowOrderListForm();
[async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
var
PageNumber: integer;
PageSize: integer;
TotalPages: integer;
StartDate: string;
EndDate: string;
OrderBy: string;
Caller: string;
filters: boolean;
info: string;
public
class function CreateForm(AElementID, Info: string): TWebForm;
end;
var
FViewOrders: TFViewOrders;
implementation
uses
XData.Model.Classes, View.Main, View.OrderList;
{$R *.dfm}
procedure TFViewOrders.WebFormCreate(Sender: TObject);
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
// TotalPages: Total number of pages returned from the search.
// PageSize: Number of entries per page.
var
today: TDateTime;
begin
DMConnection.ApiConnection.Connected := True;
PageNumber := 1;
TotalPages := 1; // Initial total pages
wcbPageSize.Text := '10';
wcbSortBy.Text := 'PROOF';
//today := TDateTime.Today;
dtpStartDate.Date := 0;
dtpEndDate.Date := 0;
getOrders(GenerateSearchOptions());
end;
procedure TFViewOrders.WebFormShow(Sender: TObject);
begin
console.log(info);
if info <> '' then
ShowNotification(info)
else
HideNotification();
end;
procedure TFViewOrders.getUser();
var
xdcResponse: TXDataClientResponse;
userList, user: TJSObject;
data: TJSArray;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
[JS.toString(AuthService.TokenPayload.Properties['user_name'])]));
userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']);
user := TJSObject(data[0]);
end;
class function TFViewOrders.CreateForm(AElementID, Info: string): TWebForm;
var
localInfo: string;
begin
localInfo := info;
Application.CreateForm(TFViewOrders, AElementID, Result,
procedure(AForm: TObject)
begin
with TFViewOrders(AForm) do
begin
TFViewOrders(AForm).info := LocalInfo;
end;
end
);
end;
procedure TFViewOrders.ShowOrderListForm();
var
newform: TFOrderList;
formattedBkNum: string;
begin
newform := TFOrderList.CreateNew;
{newform.FUserInfo := AUserInfo;
newform.FBKNum := ABKNum;
newform.FSource := ASource;
newform.FViewImages := AViewImages;}
newform.Caption := 'Select Company an Order Type';
newForm.Popup := True;
newForm.Border := fbDialog;
console.log(newForm.GetElementHandle);
// used to manage Back button handling to close subform
window.location.hash := 'subform';
newform.ShowModal(
procedure(AValue: TModalResult)
begin
//ShowMessage('View Booking Details Form closed');
end
);
end;
procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
// Caller: phone number of the caller
// Duration: duration of the call
// Transcript: transcription of the recording
// MediaUrl: Link to the recording
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
colorObject: TJSObject;
colorList: TJSArray;
colorListJSON: TJSONArray;
colors: integer;
ClickHandler: TJSFunction;
id, strColorList: string;
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
orderEntry(NewRow.Attrs['id'], 'EDIT');
end);
// Order ID Cell
NewRow.Attrs['id'] := XDataWebDataSet1ID.Value;
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if XDataWebDataSet1ID.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1ID.Value;
NewRow.appendChild(Cell);
// Company Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name');
if XDataWebDataSet1companyName.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1companyName.Value;
NewRow.appendChild(Cell);
// Job Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name');
if XDataWebDataSet1jobName.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1jobName.Value;
NewRow.appendChild(Cell);
// Order Date Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date');
if XDataWebDataSet1orderDate.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1orderDate.Value;
NewRow.appendChild(Cell);
// Proof Due Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Due');
if XDataWebDataSet1proofDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDue.Value;
NewRow.appendChild(Cell);
// Proof Done Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Done');
if XDataWebDataSet1proofDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDone.Value;
NewRow.appendChild(Cell);
// Art Due Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Due');
if XDataWebDataSet1artDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDue.Value;
NewRow.appendChild(Cell);
// Art Done Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Done');
if XDataWebDataSet1artDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDone.Value;
NewRow.appendChild(Cell);
// Plate Due Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Plate Due');
if XDataWebDataSet1plateDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1plateDue.Value;
NewRow.appendChild(Cell);
// Plate Done Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Plate Done');
if XDataWebDataSet1plateDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1plateDone.Value;
NewRow.appendChild(Cell);
// Mount Due Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Due');
if XDataWebDataSet1mountDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDue.Value;
NewRow.appendChild(Cell);
// Mount Done Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Done');
if XDataWebDataSet1mountDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDone.Value;
NewRow.appendChild(Cell);
// Ship Due Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Ship Due');
if XDataWebDataSet1shipDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1shipDue.Value;
NewRow.appendChild(Cell);
// Ship Done Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Ship Done');
if XDataWebDataSet1shipDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1shipDone.Value;
NewRow.appendChild(Cell);
// Price Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Price');
if XDataWebDataSet1price.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1price.Value;
NewRow.appendChild(Cell);
// QuickBooks Reference Number Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Quickbooks Reference Number');
if XDataWebDataSet1qbRefNum.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1qbRefNum.Value;
NewRow.appendChild(Cell);
// Colors Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Colors');
if XDataWebDataSet1colors.Value = '' then
Cell.innerText := '0'
else
begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors.Value));
colorList := TJSArray(colorObject['items']);
colors := colorList.flength;
Cell.innerText := IntToStr(colors);
end;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
procedure TFViewOrders.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search
var
PaginationElement, PageItem, PageLink: TJSHTMLElement;
I, Start, Finish: Integer;
begin
PaginationElement := TJSHTMLElement(document.getElementById('pagination'));
PaginationElement.innerHTML := ''; // Clear existing pagination
// Previous Button
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if PageNumber = 1 then
PageItem.classList.add('disabled');
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := 'Previous';
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
begin
if PageNumber > 1 then
begin
Dec(PageNumber);
GetOrders(GenerateSearchOptions());
end;
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
// Page Numbers
if TotalPages <= 7 then
begin
for I := 1 to 7 do
begin
if I <= TotalPages then
begin
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if I = PageNumber then
PageItem.classList.add('selected-number'); // Add the selected-number class
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := IntToStr(I);
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
var
PageNum: Integer;
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetOrders(GenerateSearchOptions());
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
end;
end
else
begin
if PageNumber <= 4 then
// If page number is low enough no early elipsis needed
Begin
Start := 2;
Finish := 5;
End
else if (PageNumber >= (TotalPages - 3)) then
// If page number is high enough no late elipsis needed
begin
Start := TotalPages - 3;
Finish := TotalPages - 1;
end
else
begin
Start := PageNumber - 1;
Finish := PageNumber + 1;
end;
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if 1 = PageNumber then
PageItem.classList.add('selected-number'); // Add the selected-number class
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := '1';
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
var
PageNum: Integer;
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetOrders(GenerateSearchOptions());
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
// Adds Elipse to pagination if page number is too big
if PageNumber > 4 then
begin
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
PageItem.classList.add('disabled');
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := '...';
PageLink.setAttribute('href', 'javascript:void(0)');
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
// Adds Page, page - 1, and page + 1 to pagination
for I := Start to Finish do
begin
if ( I > 1) and (I < TotalPages) then
begin
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if I = PageNumber then
PageItem.classList.add('selected-number'); // Add the selected-number class
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := IntToStr(I);
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
var
PageNum: Integer;
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetOrders(GenerateSearchOptions());
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
end;
// adds ellipse if number is too small
if PageNumber < TotalPages - 4 then
begin
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
PageItem.classList.add('disabled');
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := '...';
PageLink.setAttribute('href', 'javascript:void(0)');
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
if TotalPages <> 1 then
begin
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if TotalPages = PageNumber then
PageItem.classList.add('selected-number');
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := IntToStr(TotalPages);
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
var
PageNum: Integer;
begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum;
GetOrders(generateSearchOptions());
end);
end;
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
// Next Button
PageItem := TJSHTMLElement(document.createElement('li'));
PageItem.className := 'page-item';
if PageNumber = TotalPages then
PageItem.classList.add('disabled');
PageLink := TJSHTMLElement(document.createElement('a'));
PageLink.className := 'page-link';
PageLink.innerText := 'Next';
PageLink.setAttribute('href', 'javascript:void(0)');
PageLink.addEventListener('click', procedure(Event: TJSMouseEvent)
begin
if PageNumber < TotalPages then
begin
Inc(PageNumber);
GetOrders(GenerateSearchOptions());
end;
end);
PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem);
end;
procedure TFViewOrders.GetOrders(searchOptions: string);
// Retrieves list of orders from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on
// user input.
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString: string;
begin
if PageNumber > 0 then
begin
asm
startSpinner();
end;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrders',
[searchOptions]));
orderList := TJSObject(xdcResponse.Result);
data := TJSArray(orderList['data']);
callListLength := integer(orderList['count']);
ClearTable();
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(orderList['data']);
XDataWebDataSet1.Open;
asm
setTimeout(endSpinner, 2000);
end;
for i := 0 to data.Length - 1 do
begin
order := TJSObject(data[i]);
AddRowToTable(tempString);
XDataWebDataSet1.Next;
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
if callListLength = 0 then
begin
lblEntries.Caption := 'No entries found';
lblEntries2.Caption := 'No entries found';
end
else if (PageNumber * PageSize) < callListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
end
else if (PageNumber * PageSize) >= callListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
end;
GeneratePagination(TotalPages);
end;
end;
procedure TFViewOrders.btnaddOrderClick(Sender: TObject);
begin
//getCustomers();
ShowOrderListForm();
end;
procedure TFViewOrders.orderEntry(orderInfo, mode: string);
begin
FViewMain.ViewOrderEntry(orderInfo, mode);
end;
procedure TFViewOrders.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetOrders() button
var
searchOptions: string;
begin
PageNumber := 1;
PageSize := StrToInt(wcbPageSize.Text);
OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy +
'&startDate=' + FormatDateTime('yyyy/mm/dd', dtpStartDate.Date) +
'&endDate=' + FormatDateTime('yyyy/mm/dd', dtpEndDate.Date) +
'&filterType=' + wcbSortBy.Text;
GetOrders(searchOptions);
end;
procedure TFViewOrders.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification();
end;
procedure TFViewOrders.btnConfirmClick(Sender: TObject);
begin
orderEntry('', 'ADD');
end;
procedure TFViewOrders.btnFiltersClick(Sender: TObject);
var
filterSection: TJSHTMLElement;
begin
if btnFilters.Caption = 'Show Filters' then
begin
btnFilters.Caption := 'Hide Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'block');
end
else
begin
btnFilters.Caption := 'Show Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'none');
end;
end;
procedure TFViewOrders.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
{AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));}
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end;
end;
procedure TFViewOrders.btnSearchClick(Sender: TObject);
// orders Search method
begin
Search(edtSearch.Text);
end;
procedure TFViewOrders.ClearTable();
// clears the table
var
tbody: TJSHTMLElement;
begin
tbody := TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]);
tbody.innerHTML := '';
end;
function TFViewOrders.GenerateSearchOptions(): string;
// Generates searchOptions for GetOrders.
var
searchOptions: string;
begin
//PageNumber := 1;
PageSize := StrToInt(wcbPageSize.Text);
OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy;
if btnFilters.Caption = 'Hide Filters' then
begin
searchOptions := searchOptions +
'&startDate=' + FormatDateTime('yyyy/mm/dd', dtpStartDate.Date) +
'&endDate=' + FormatDateTime('yyyy/mm/dd', dtpEndDate.Date) +
'&filterType=' + wcbSortBy.Text;
end;
Result := searchOptions;
end;
procedure TFViewOrders.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
info := '';
end;
procedure TFViewOrders.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
console.log('hit');
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFViewOrders.wcbCustomersChange(Sender: TObject);
begin
console.log(wcbCustomers.Value);
end;
end.
<div class="row">
<div class="col-lg-12">
<h1 class="page-header" id="view.userprofile.title">User Profile</h1>
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
......
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4">
<div class="container mt-4 px-0">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<div class="row">
......@@ -12,6 +11,7 @@
</div>
</div>
</div>
</div>
<div class="row justify-content-center py-2">
<div class="col-sm">
<button id="btnadduser" class="btn btn-primary">Add User></button>
......@@ -30,6 +30,7 @@
<th scope="col">System Rights</th>
<th scope="col">Perspective ID</th>
<th scope="col">QB ID</th>
<th scope="col">Edit</th>
</tr>
</thead>
<tbody>
......@@ -47,7 +48,7 @@
</div>
</div>
</div>
</div>
<!--</div> -->
<!--</div> -->
<div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<div class="modal-dialog">
......
......@@ -121,12 +121,14 @@ var
cells: TJSHTMLCollection;
UserID: TJSNode;
Username: TJSNode;
Password: TJSNode;
FullName: TJSNode;
PhoneNum: TJSNode;
Status: TJSNode;
Email: TJSNode;
Admin: TJSNode;
Password: TJSNode;
Location: TJSNode;
Access: TJSNode;
Rights: TJSNode;
Perspective: TJSNode;
QB: TJSNode;
isAdmin: boolean;
isActive: boolean;
ButtonCancel: TJSHTMLElement;
......@@ -143,18 +145,16 @@ begin
Username := cells[1];
Password := cells[2];
FullName := cells[3];
PhoneNum := cells[4];
Status := cells[4];
Email := cells[5];
Location := cells[6];
if TJSHTMLElement(cells[7].childNodes.item(0).childNodes.item(0)).attributes.Attrs['checked'] = nil then
isAdmin := false
else
isAdmin := true;
if TJSHTMLElement(cells[8].childNodes.item(0).childNodes.item(0)).attributes.Attrs['checked'] = nil then
isActive := false
else
isActive := true;
FViewMain.EditUser('Edit', Username.innerText, FullName.innerText, PhoneNum.innerText, Email.innerText, Location.innerText, isAdmin, isActive);
Access := cells[6];
Rights := cells[7];
Perspective := cells[8];
QB := cells[9];
FViewMain.EditUser('Edit', Username.innerText, Password.innerText, FullName.innerText,
Status.innerText, Email.innerText, Access.innerText,
Rights.innerText, Perspective.innerText, QB.innerText);
end;
......@@ -346,10 +346,9 @@ begin
XDataWebDataSet1.Open;
for i := 0 to data.Length - 1 do
begin
console.log(user);
user := TJSObject(data[i]);
AddRowToTable(XDataWebDataSet1userID.AsString, XDataWebDataSet1username.AsString,
XDataWebDataSet1full_name.AsString, XDataWebDataSet1password.AsString,
XDataWebDataSet1password.AsString, XDataWebDataSet1full_name.AsString,
XDataWebDataSet1status.AsString, XDataWebDataSet1email_address.AsString,
XDataWebDataSet1Atype.AsString, XDataWebDataSet1perspectiveID.AsString,
XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger);
......@@ -409,7 +408,7 @@ begin
Cell.innerText := Full_Name;
NewRow.appendChild(Cell);
// Phone Cell
// Status Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Status');
Cell.innerText := Status;
......@@ -446,6 +445,19 @@ begin
Cell.innerText := QBID;
NewRow.appendChild(Cell);
// Edit Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Edit');
Button := TJSHTMLElement(document.createElement('a'));
Button.className := 'btn btn-primary';
Button.innerHTML := '<i class="far fa-edit fa-fw"></i><span>Edit</span>';
Button.addEventListener('click', procedure(Event: TJSMouseEvent)
begin
EditUser(TJSHTMLElement(NewRow));
end);
Cell.appendChild(Button);
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
......@@ -453,7 +465,7 @@ end;
procedure TFViewUsers.btnAddUserClick(Sender: TObject);
begin
//Info := '';
FViewMain.EditUser('Add', '', '', '', '', 'All', false, true);
FViewMain.EditUser('Add', '', '', '', '', '', '', '', '', '');
end;
procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject);
......
......@@ -7,6 +7,8 @@
background-color: #fff;
}
.card-header {
width: 100%;
text-align: left; /* Align text to the left */
......@@ -19,10 +21,84 @@
box-sizing: border-box; /* Ensure padding is included in the element's total width and height */
}
/* Ensure that the title does not affect the navbar layout */
#view.main.apptitle {
display: flex;
align-items: center;
justify-content: flex-start; /* Align title to the left */
width: auto; /* Ensure it doesn't stretch the container */
margin-right: 20px; /* Optional: add space between title and navbar items */
}
/* Fixed width for title area to prevent shifting */
#title {
white-space: nowrap; /* Prevent the title text from wrapping */
width: 200px; /* Fixed width for the title */
text-overflow: ellipsis; /* Truncate text with ellipsis if it overflows */
overflow: hidden;
font-weight: bold; /* Optional: make the title text bold */
}
/* Navbar items - keep them aligned and spaced out */
.navbar-nav .nav-item {
padding: 0 15px; /* Adjust spacing between navbar items */
}
/* Flexbox for the entire navbar */
.navbar-nav {
display: flex;
justify-content: flex-end; /* Align navbar items to the right */
width: 100%;
}
/* Additional mobile responsiveness (optional) */
@media (max-width: 1200px) {
.navbar-nav {
flex-direction: column; /* Stack items vertically on smaller screens */
align-items: flex-start; /* Align items to the left */
}
.navbar-nav-spaced .nav-item {
padding: 10px 0; /* Adjust vertical spacing between items */
}
}
/* Make sure active navbar item color gets applied */
.navbar-nav .nav-item a.active {
color: #fff !important; /* Set text color to white for active item */
background-color: #004F84 !important; /* Darker blue for active background */
font-weight: bold;
}
/* Default navbar item color */
.navbar-nav .nav-item a {
color: #000 !important; /* Default color for links */
transition: color 0.3s ease;
}
/* Navbar item hover state */
.navbar-nav .nav-item a:hover {
color: #fff !important; /* Set hover text color to white */
background-color: #286090 !important; /* Light blue on hover */
}
.nav-item {
padding: 0 20px; /* Adjust this value for desired spacing between labels */
}
.mr-2 {
margin-right: 0.5rem;
}
.custom-h4 {
margin-bottom: 5px;
}
.custom-hr {
margin-top: 5px;
margin-bottom: 10px;
}
.custom-select-large {
font-size: 1.25rem;
padding: 0.5rem;
......
program webKGOrders;
uses
Vcl.Forms,
XData.Web.Connection,
......@@ -13,12 +11,14 @@ uses
View.ErrorPage in 'View.ErrorPage.pas' {FViewErrorPage: TWebForm} {*.html},
App.Config in 'App.Config.pas',
Paginator.Plugins in 'Paginator.Plugins.pas',
View.Calls in 'View.Calls.pas' {FViewCalls: TWebForm} {*.html},
View.Items in 'View.Items.pas' {FViewItems: TWebForm} {*.html},
View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html},
View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html},
View.Admin in 'View.Admin.pas' {FViewAdmin: TWebForm} {*.html},
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html};
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html},
View.OrderList in 'View.OrderList.pas' {FOrderList: TWebForm} {*.html};
{$R *.res}
......
......@@ -136,8 +136,8 @@
</DCCReference>
<DCCReference Include="App.Config.pas"/>
<DCCReference Include="Paginator.Plugins.pas"/>
<DCCReference Include="View.Calls.pas">
<Form>FViewCalls</Form>
<DCCReference Include="View.Items.pas">
<Form>FViewItems</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......@@ -151,11 +151,6 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.Admin.pas">
<Form>FViewAdmin</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.Users.pas">
<Form>FViewUsers</Form>
<FormType>dfm</FormType>
......@@ -166,6 +161,21 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.Orders.pas">
<Form>FViewOrders</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderEntryCorrugated.pas">
<Form>FOrderEntry</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderList.pas">
<Form>FOrderList</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/>
<None Include="template\css\app.css"/>
<BuildConfiguration Include="Base">
......
......@@ -26,4 +26,354 @@ object FDatabaseModule: TFDatabaseModule
Left = 220
Top = 134
end
object UniQuery2: TUniQuery
Connection = ucKG
SQL.Strings = (
'')
Left = 433
Top = 144
end
object uqOrders: TUniQuery
Connection = ucKG
SQL.Strings = (
'select * from corrugated_plate_orders')
Left = 527
Top = 120
object uqOrdersORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
object uqOrdersCOMPANY_ID: TIntegerField
FieldName = 'COMPANY_ID'
Required = True
end
object uqOrdersUSER_ID: TIntegerField
FieldName = 'USER_ID'
Required = True
end
object uqOrdersORDER_DATE: TDateTimeField
FieldName = 'ORDER_DATE'
end
object uqOrdersSTART_DATE: TDateField
FieldName = 'START_DATE'
end
object uqOrdersEND_DATE: TDateField
FieldName = 'END_DATE'
end
object uqOrdersORDER_STATUS: TStringField
FieldName = 'ORDER_STATUS'
Size = 10
end
object uqOrdersSCHED_JSON: TStringField
FieldName = 'SCHED_JSON'
Size = 4096
end
object uqOrdersstaff_fields_order_date: TDateField
FieldName = 'staff_fields_order_date'
end
object uqOrdersstaff_fields_proof_date: TDateField
FieldName = 'staff_fields_proof_date'
end
object uqOrdersstaff_fields_ship_date: TDateField
FieldName = 'staff_fields_ship_date'
end
object uqOrdersstaff_fields_ship_via: TStringField
FieldName = 'staff_fields_ship_via'
Size = 45
end
object uqOrdersstaff_fields_price: TStringField
FieldName = 'staff_fields_price'
Size = 10
end
object uqOrdersstaff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
Size = 128
end
object uqOrdersstaff_fields_invoice_attention: TStringField
FieldName = 'staff_fields_invoice_attention'
Size = 256
end
object uqOrdersstaff_fields_ship_to: TStringField
FieldName = 'staff_fields_ship_to'
Size = 128
end
object uqOrdersstaff_fields_ship_attention: TStringField
FieldName = 'staff_fields_ship_attention'
Size = 256
end
object uqOrdersstaff_fields_po_number: TStringField
FieldName = 'staff_fields_po_number'
Size = 16
end
object uqOrdersstaff_fields_job_name: TStringField
FieldName = 'staff_fields_job_name'
Size = 45
end
object uqOrdersstaff_fields_art_due: TDateField
FieldName = 'staff_fields_art_due'
end
object uqOrdersstaff_fields_plate_due: TDateField
FieldName = 'staff_fields_plate_due'
end
object uqOrdersstaff_fields_mount_due: TDateField
FieldName = 'staff_fields_mount_due'
end
object uqOrdersplates_job_number: TStringField
FieldName = 'plates_job_number'
Size = 16
end
object uqOrderssupplied_by_customer_b_w_copy: TStringField
FieldName = 'supplied_by_customer_b_w_copy'
Size = 1
end
object uqOrderssupplied_by_customer_color_copy: TStringField
FieldName = 'supplied_by_customer_color_copy'
Size = 1
end
object uqOrderssupplied_by_customer_plates: TStringField
FieldName = 'supplied_by_customer_plates'
Size = 1
end
object uqOrderssupplied_by_customer_sample_ca: TStringField
FieldName = 'supplied_by_customer_sample_ca'
Size = 1
end
object uqOrderssupplied_by_customer_dimension: TStringField
FieldName = 'supplied_by_customer_dimension'
Size = 64
end
object uqOrderssupplied_by_customer_disk_or_cd: TStringField
FieldName = 'supplied_by_customer_disk_or_cd'
Size = 1
end
object uqOrderssupplied_by_customer_e_mail: TStringField
FieldName = 'supplied_by_customer_e_mail'
Size = 256
end
object uqOrderssupplied_by_customer_ftp: TStringField
FieldName = 'supplied_by_customer_ftp'
Size = 256
end
object uqOrderssupplied_by_customer_other: TStringField
FieldName = 'supplied_by_customer_other'
Size = 96
end
object uqOrderssupplied_by_customer_existing_: TStringField
FieldName = 'supplied_by_customer_existing_'
Size = 16
end
object uqOrderssupplied_by_customer_ref_art_p: TStringField
FieldName = 'supplied_by_customer_ref_art_p'
Size = 256
end
object uqOrderssupplied_by_customer_ref_art_a: TStringField
FieldName = 'supplied_by_customer_ref_art_a'
Size = 256
end
object uqOrderscut_die_cutdier: TStringField
FieldName = 'cut_die_cutdier'
Size = 10
end
object uqOrderscut_die_cutdieb: TStringField
FieldName = 'cut_die_cutdieb'
Size = 10
end
object uqOrderscut_die_cutdief: TStringField
FieldName = 'cut_die_cutdief'
Size = 10
end
object uqOrderscut_die_cutdierkr: TStringField
FieldName = 'cut_die_cutdierkr'
Size = 10
end
object uqOrderscut_die_cutdiefkr: TStringField
FieldName = 'cut_die_cutdiefkr'
Size = 10
end
object uqOrderscut_die_cad_file: TStringField
FieldName = 'cut_die_cad_file'
Size = 128
end
object uqOrderscut_die_attached: TStringField
FieldName = 'cut_die_attached'
Size = 1
end
object uqOrderscut_die_boxpol250: TStringField
FieldName = 'cut_die_boxpol250'
Size = 10
end
object uqOrderscut_die_boxpol155: TStringField
FieldName = 'cut_die_boxpol155'
Size = 10
end
object uqOrderscut_die_boxpol125: TStringField
FieldName = 'cut_die_boxpol125'
Size = 10
end
object uqOrderscut_die_brub: TStringField
FieldName = 'cut_die_brub'
Size = 10
end
object uqOrdersproofing_fax: TStringField
FieldName = 'proofing_fax'
Size = 16
end
object uqOrdersproofing_fax_attn: TStringField
FieldName = 'proofing_fax_attn'
Size = 256
end
object uqOrdersproofing_e_mail: TStringField
FieldName = 'proofing_e_mail'
Size = 256
end
object uqOrdersproofing_e_mail_attn: TStringField
FieldName = 'proofing_e_mail_attn'
Size = 256
end
object uqOrdersproofing_ship_to: TStringField
FieldName = 'proofing_ship_to'
Size = 1024
end
object uqOrdersproofing_full_size_panel: TStringField
FieldName = 'proofing_full_size_panel'
Size = 1
end
object uqOrdersproofing_print_card: TStringField
FieldName = 'proofing_print_card'
Size = 1
end
object uqOrdersproofing_wide_format: TStringField
FieldName = 'proofing_wide_format'
Size = 1
end
object uqOrdersproofing_pdf_file: TStringField
FieldName = 'proofing_pdf_file'
Size = 1
end
object uqOrdersproofing_other: TStringField
FieldName = 'proofing_other'
Size = 64
end
object uqOrdersproofing_art_approved_as_is: TStringField
FieldName = 'proofing_art_approved_as_is'
Size = 1
end
object uqOrdersproofing_approved_date: TDateField
FieldName = 'proofing_approved_date'
end
object uqOrdersproofing_changes_required: TStringField
FieldName = 'proofing_changes_required'
Size = 1
end
object uqOrdersproofing_changes_date: TDateField
FieldName = 'proofing_changes_date'
end
object uqOrderslayout_rsc_l: TStringField
FieldName = 'layout_rsc_l'
Size = 10
end
object uqOrderslayout_rcs_w: TStringField
FieldName = 'layout_rcs_w'
Size = 10
end
object uqOrderslayout_rcs_d: TStringField
FieldName = 'layout_rcs_d'
Size = 10
end
object uqOrderslayout_die_cut_no: TStringField
FieldName = 'layout_die_cut_no'
Size = 45
end
object uqOrderslayout_accross_no: TStringField
FieldName = 'layout_accross_no'
Size = 10
end
object uqOrderslayout_around_no: TStringField
FieldName = 'layout_around_no'
Size = 10
end
object uqOrderslayout_cad_file: TStringField
FieldName = 'layout_cad_file'
Size = 45
end
object uqOrderslayout_excalibur_die: TStringField
FieldName = 'layout_excalibur_die'
Size = 1
end
object uqOrdersmounting_loose: TStringField
FieldName = 'mounting_loose'
Size = 10
end
object uqOrdersmounting_sticky_bak: TStringField
FieldName = 'mounting_sticky_bak'
Size = 1
end
object uqOrdersmounting_full_mount: TStringField
FieldName = 'mounting_full_mount'
Size = 1
end
object uqOrdersmounting_strip_mount: TStringField
FieldName = 'mounting_strip_mount'
Size = 10
end
object uqOrderscolors_cylinder_size: TStringField
FieldName = 'colors_cylinder_size'
Size = 45
end
object uqOrderscolors_machine_ident: TStringField
FieldName = 'colors_machine_ident'
Size = 45
end
object uqOrdersmounting_standard_setup: TStringField
FieldName = 'mounting_standard_setup'
Size = 45
end
object uqOrdersmounting_custom_backing: TStringField
FieldName = 'mounting_custom_backing'
Size = 96
end
object uqOrdersmounting_custom_adhesive: TStringField
FieldName = 'mounting_custom_adhesive'
Size = 45
end
object uqOrderscolors_cross_hairs: TStringField
FieldName = 'colors_cross_hairs'
Size = 10
end
object uqOrderscolors_clemson: TStringField
FieldName = 'colors_clemson'
Size = 10
end
object uqOrdersplates_thickness: TStringField
FieldName = 'plates_thickness'
Size = 5
end
object uqOrdersplates_plate_material: TStringField
FieldName = 'plates_plate_material'
Size = 16
end
object uqOrdersgeneral_special_instructions: TStringField
FieldName = 'general_special_instructions'
Size = 2048
end
object uqOrderscolors_colors: TStringField
FieldName = 'colors_colors'
Size = 4096
end
object uqOrdersstaff_fields_quickbooks_item: TStringField
FieldName = 'staff_fields_quickbooks_item'
Size = 45
end
object uqOrdersstaff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity'
Size = 10
end
object uqOrderslayout_rsc_style: TStringField
FieldName = 'layout_rsc_style'
Size = 32
end
object uqOrdersstaff_fields_art_location: TStringField
FieldName = 'staff_fields_art_location'
Size = 16
end
end
end
......@@ -15,6 +15,95 @@ type
ucKG: TUniConnection;
UniQuery1: TUniQuery;
MySQLUniProvider1: TMySQLUniProvider;
UniQuery2: TUniQuery;
uqOrders: TUniQuery;
uqOrdersORDER_ID: TIntegerField;
uqOrdersCOMPANY_ID: TIntegerField;
uqOrdersUSER_ID: TIntegerField;
uqOrdersORDER_DATE: TDateTimeField;
uqOrdersSTART_DATE: TDateField;
uqOrdersEND_DATE: TDateField;
uqOrdersORDER_STATUS: TStringField;
uqOrdersSCHED_JSON: TStringField;
uqOrdersstaff_fields_order_date: TDateField;
uqOrdersstaff_fields_proof_date: TDateField;
uqOrdersstaff_fields_ship_date: TDateField;
uqOrdersstaff_fields_ship_via: TStringField;
uqOrdersstaff_fields_price: TStringField;
uqOrdersstaff_fields_invoice_to: TStringField;
uqOrdersstaff_fields_invoice_attention: TStringField;
uqOrdersstaff_fields_ship_to: TStringField;
uqOrdersstaff_fields_ship_attention: TStringField;
uqOrdersstaff_fields_po_number: TStringField;
uqOrdersstaff_fields_job_name: TStringField;
uqOrdersstaff_fields_art_due: TDateField;
uqOrdersstaff_fields_plate_due: TDateField;
uqOrdersstaff_fields_mount_due: TDateField;
uqOrdersplates_job_number: TStringField;
uqOrderssupplied_by_customer_b_w_copy: TStringField;
uqOrderssupplied_by_customer_color_copy: TStringField;
uqOrderssupplied_by_customer_plates: TStringField;
uqOrderssupplied_by_customer_sample_ca: TStringField;
uqOrderssupplied_by_customer_dimension: TStringField;
uqOrderssupplied_by_customer_disk_or_cd: TStringField;
uqOrderssupplied_by_customer_e_mail: TStringField;
uqOrderssupplied_by_customer_ftp: TStringField;
uqOrderssupplied_by_customer_other: TStringField;
uqOrderssupplied_by_customer_existing_: TStringField;
uqOrderssupplied_by_customer_ref_art_p: TStringField;
uqOrderssupplied_by_customer_ref_art_a: TStringField;
uqOrderscut_die_cutdier: TStringField;
uqOrderscut_die_cutdieb: TStringField;
uqOrderscut_die_cutdief: TStringField;
uqOrderscut_die_cutdierkr: TStringField;
uqOrderscut_die_cutdiefkr: TStringField;
uqOrderscut_die_cad_file: TStringField;
uqOrderscut_die_attached: TStringField;
uqOrderscut_die_boxpol250: TStringField;
uqOrderscut_die_boxpol155: TStringField;
uqOrderscut_die_boxpol125: TStringField;
uqOrderscut_die_brub: TStringField;
uqOrdersproofing_fax: TStringField;
uqOrdersproofing_fax_attn: TStringField;
uqOrdersproofing_e_mail: TStringField;
uqOrdersproofing_e_mail_attn: TStringField;
uqOrdersproofing_ship_to: TStringField;
uqOrdersproofing_full_size_panel: TStringField;
uqOrdersproofing_print_card: TStringField;
uqOrdersproofing_wide_format: TStringField;
uqOrdersproofing_pdf_file: TStringField;
uqOrdersproofing_other: TStringField;
uqOrdersproofing_art_approved_as_is: TStringField;
uqOrdersproofing_approved_date: TDateField;
uqOrdersproofing_changes_required: TStringField;
uqOrdersproofing_changes_date: TDateField;
uqOrderslayout_rsc_l: TStringField;
uqOrderslayout_rcs_w: TStringField;
uqOrderslayout_rcs_d: TStringField;
uqOrderslayout_die_cut_no: TStringField;
uqOrderslayout_accross_no: TStringField;
uqOrderslayout_around_no: TStringField;
uqOrderslayout_cad_file: TStringField;
uqOrderslayout_excalibur_die: TStringField;
uqOrdersmounting_loose: TStringField;
uqOrdersmounting_sticky_bak: TStringField;
uqOrdersmounting_full_mount: TStringField;
uqOrdersmounting_strip_mount: TStringField;
uqOrderscolors_cylinder_size: TStringField;
uqOrderscolors_machine_ident: TStringField;
uqOrdersmounting_standard_setup: TStringField;
uqOrdersmounting_custom_backing: TStringField;
uqOrdersmounting_custom_adhesive: TStringField;
uqOrderscolors_cross_hairs: TStringField;
uqOrderscolors_clemson: TStringField;
uqOrdersplates_thickness: TStringField;
uqOrdersplates_plate_material: TStringField;
uqOrdersgeneral_special_instructions: TStringField;
uqOrderscolors_colors: TStringField;
uqOrdersstaff_fields_quickbooks_item: TStringField;
uqOrdersstaff_fields_quantity: TStringField;
uqOrderslayout_rsc_style: TStringField;
uqOrdersstaff_fields_art_location: TStringField;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
......
......@@ -20,34 +20,6 @@ const
API_MODEL = 'Api';
type
TCallItem = class
// Class of the info we want from the database from a specific call.
// callSid: SID of the call, 34 digit string.
// fromNumber: Who the phone call was from. (xxx) xxx-xxxx
// toNumber: Who the phone call was to. (xxx) xxx-xxxx
// dateCreated: Date the phone call was created. mm/dd/yyyy hh:nn:ss am/pm
// mediaURL: Link to the recording audio
// duration: Length of the entire call and recording.
// transcription: Transcription of the recording. Not always present due to
// the call being answerered or caller did not leave a message.
public
callSid: string;
fromNumber: string;
toNumber: string;
dateCreated: string;
mediaUrl: string;
duration: string;
transcription: string;
end;
// List of call items
// count: Total amount of records that fit the SQL query
// data: List of retrieved calls
TCallList = class
public
count: integer;
data: TList<TCallItem>;
end;
TUserItem = class
public
......@@ -69,17 +41,174 @@ type
data: TList<TUserItem>;
end;
TItemItem = class
public
ID: string;
name: string;
description: string;
status: string;
end;
TItemList = class
public
count: integer;
data: TList<TItemItem>;
end;
TOrderItem = class
public
ID,
companyName,
jobName,
orderDate,
proofDue,
proofDone,
artDue,
artDone,
plateDue,
plateDone,
mountDue,
mountDone,
shipDue,
shipDone,
price,
qbRefNum,
orderType,
colors: string;
end;
TOrderList = class
Public
count: integer;
data: TList<TOrderItem>;
end;
TCustomerItem = class
Public
NAME: string;
ID: integer;
SHORT_NAME: string;
ADDRESS: string;
end;
TCustomerList = class
Public
count: integer;
data: TList<TCustomerItem>;
end;
TFullOrder = class
Public
//Company
NAME: string;
SHORT_NAME: string;
inQuickBooks: string;
// Staff Fields:
staff_fields_order_date: string;
staff_fields_proof_date: string;
staff_fields_ship_date: string;
staff_fields_ship_via: string;
staff_fields_quantity: string;
staff_fields_price: string;
staff_fields_invoice_to: string;
staff_fields_ship_to: string;
staff_fields_po_number: string;
staff_fields_job_name: string;
staff_fields_quickbooks_item: string;
staff_fields_art_due: string;
staff_fields_plate_due: string;
staff_fields_mount_due: string;
staff_fields_art_location: string;
// Supplied by Customer:
supplied_by_customer_b_w_copy: boolean;
supplied_by_customer_color_copy: boolean;
supplied_by_customer_plates: boolean;
supplied_by_customer_sample_ca: boolean;
supplied_by_customer_dimension: string;
supplied_by_customer_disk_or_cd: boolean;
supplied_by_customer_e_mail: string;
supplied_by_customer_ftp: string;
supplied_by_customer_other: string;
supplied_by_customer_existing_: string;
supplied_by_customer_ref_art_p: string;
supplied_by_customer_ref_art_a: string;
// Layout
layout_rsc_l: string;
//Typos to match database typos
layout_rcs_w: string;
layout_rcs_d: string;
layout_die_cut_no: string;
layout_accross_no: string;
layout_around_no: string;
layout_cad_file: string;
layout_excalibur_die: boolean;
layout_rsc_style: string;
// Mounting
mounting_loose: string;
mounting_sticky_bak: boolean;
mounting_full_mount: boolean;
mounting_strip_mount: string;
mounting_standard_setup: string;
mounting_custom_backing: string;
mounting_custom_adhesive: string;
// Colors
colors_cylinder_size: string;
colors_machine_ident: string;
colors_cross_hairs: string;
colors_clemson: string;
colors_colors: string;
// Proofing
proofing_fax: string;
proofing_fax_attn: string;
proofing_e_mail: string;
proofing_e_mail_attn: string;
proofing_ship_to: string;
proofing_full_size_panel: boolean;
proofing_print_card: boolean;
proofing_wide_format: boolean;
proofing_pdf_file: boolean;
proofing_other: string;
proofing_art_approved_as_is: boolean;
proofing_approved_date: string;
// Plates
plates_thickness: string;
plates_plate_material: string;
plates_job_number: string;
// General
general_special_instructions: string;
end;
type
[ServiceContract]
ILookupService = interface(IInvokable)
['{F24E1468-5279-401F-A877-CD48B44F4416}']
[HttpGet] function GetCalls(searchOptions: string): TCallList;
[HttpGet] function Search(phoneNum: string): TCallList;
[HttpGet] function Search(phoneNum: string): TOrderList;
[HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList;
[HttpGet] function GetOrder(orderInfo: string): TFullOrder;
[HttpGet] function GetCustomers(): TCustomerList;
function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string;
function DelUser(username: string): string;
function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
end;
implementation
......
......@@ -12,21 +12,30 @@ uses
XData.Server.Module,
XData.Service.Common,
Database, Data.DB,
Lookup.Service, System.Hash, System.Classes;
Lookup.Service, System.Hash, System.Classes, System.JSON;
type
[ServiceImplementation]
TLookupService = class(TInterfacedObject, ILookupService)
strict private
callsDB: TFDatabaseModule;
ordersDB: TFDatabaseModule;
private
function GetItems(searchOptions: string): TItemList;
function GetUsers(searchOptions: string): TUserList;
function GetCalls(searchOptions: string): TCallList;
function GetOrders(searchOptions: string): TOrderList;
function GetOrder(orderInfo: string): TFullOrder;
function GetCustomers(): TCustomerList;
function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TCallList;
function Search(phoneNum: string): TOrderList;
function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string;
function DelUser(username: string): string;
function generateSelectSQL(filterType, startDate, endDate: string): string;
function generateSubQuery(filterType, statusType, currStatus: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end;
......@@ -41,17 +50,47 @@ uses
procedure TLookupService.AfterConstruction;
begin
inherited;
callsDB := TFDatabaseModule.Create(nil);
ordersDB := TFDatabaseModule.Create(nil);
end;
procedure TLookupService.BeforeDestruction;
begin
callsDB.Free;
ordersDB.Free;
inherited;
end;
function TLookupService.Search(phoneNum: string): TCallList;
function TLookupService.GetCustomers: TCustomerList;
var
SQL, ADDRESS: string;
customer: TCustomerItem;
begin
SQL := 'select NAME, CUSTOMER_ID, SHORT_NAME, BILL_ADDRESS, BILL_CITY, BILL_STATE, BILL_ZIP from customers';
doQuery(ordersDB.UniQuery1, SQL);
result := TCustomerList.Create;
Result.data := TList<TCustomerItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
result.count := 0;
while not ordersDB.UniQuery1.Eof do
begin
customer := TCustomerItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( customer );
customer.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
customer.ID := ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger;
customer.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
customer.ADDRESs := ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString +
', ' + ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString +
' ' + ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString;
result.data.Add(customer);
result.count := result.count + 1;
ordersDB.UniQuery1.Next;
end;
ordersDB.UniQuery1.Close;
end;
function TLookupService.Search(phoneNum: string): TOrderList;
// Searchs the database for a specific from phone number then returns a list of
// calls from said number
// SQL: String of the sql query used to retrieve info from the database
......@@ -59,144 +98,452 @@ function TLookupService.Search(phoneNum: string): TCallList;
// Return: A list of calls
var
SQL: string;
call: TCallItem;
order: TOrderItem;
begin
SQL := 'select * ' +
'from calls inner join recordings on calls.sid = recordings.call_sid ' +
'where from_formatted = ' + QuotedStr(PhoneNum) + ' order by calls.date_created desc';
doQuery(callsDB.UniQuery1, SQL);
doQuery(ordersDB.UniQuery1, SQL);
Result:= TCallList.Create;
Result.data := TList<TCallItem>.Create;
Result:= TOrderList.Create;
Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do
while not ordersDB.UniQuery1.Eof do
begin
call := TCallItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( call );
Result.data.Add( call );
call.callSid := callsDB.UniQuery1.FieldByName('sid').AsString;
call.fromNumber := callsDB.UniQuery1.FieldByName('from_formatted').AsString;
call.ToNumber := callsDB.UniQuery1.FieldByName('to_formatted').AsString;
call.dateCreated := callsDB.UniQuery1.FieldByName('date_created').AsString;
call.mediaUrl := callsDB.UniQuery1.FieldByName('media_url').AsString;
call.duration := callsDB.UniQuery1.FieldByName('duration').AsString;
call.transcription := callsDB.UniQuery1.FieldByName('transcription').AsString;
callsDB.UniQuery1.Next;
order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( order );
Result.data.Add( order );
//TODO
end;
callsDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from calls inner join ' +
'recordings on calls.sid = recordings.call_sid where ' +
'from_formatted = ' + QuotedStr(PhoneNum);
ordersDB.UniQuery1.Close;
SQL:= '';
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
doQuery(callsDB.UniQuery1, SQL);
end;
function TLookupService.generateSelectSQL(filterType, startDate, endDate: string): string;
begin
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger;
end;
function TLookupService.GetCalls(searchOptions: string): TCallList;
// Retrieves a list of calls from the database then sends it to the client.
// searchOptions: csv string representing all the search options the client sent.
// Format: Phone Number, Page Number, Page Size, Start Date, End Date, SortBy.
// Returns a TCallList containing PageSize amount of entries.
function TLookupService.generateSubQuery(filterType, statusType, currStatus: string): string;
var
params: TStringList;
SQL: string;
DBString: string;
call: TCallItem;
offset: string;
limit: string;
PhoneNum: string;
PageNum: integer;
PageSize: integer;
StartDate: string;
EndDate: string;
OrderBy: string;
whereSQL: string;
orderBySQL: string;
Caller: string;
statusSuffix: string;
begin
result := '';
statusSuffix := '';
if filterType <> '' then
statusSuffix := filterType.Split(['_'])[1];
if statusType <> currStatus then
begin
if (statusSuffix = 'DUE') or (statusSuffix = '') then
begin
result := result + '(select oss.STATUS_DATE from orders_status_schedule oss ' +
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = ' + quotedStr(currStatus) + ') AS '+ currStatus + '_DUE,';
end
else
result := result +'(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = o.ORDER_ID and os.ORDER_STATUS = ' +
quotedStr(currStatus) + ' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS ' + currStatus + '_DONE, ';
end;
if (statusSuffix = 'DUE') or (statusSuffix = '') then
begin
result := result +'(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = o.ORDER_ID and os.ORDER_STATUS = ' +
quotedStr(currStatus) + ' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS ' + currStatus + '_DONE, ';
end
else
result := result + '(select oss.STATUS_DATE from orders_status_schedule oss ' +
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = ' + quotedStr(currStatus) + ') AS '+ currStatus + '_DUE,';
end;
function TLookupService.GetOrders(searchOptions: string): TOrderList;
var
params: TStringList;
PageNum: integer;
PageSize: integer;
OrderBy: string;
offset: string;
limit: string;
startDate: string;
endDate: string;
filterType: string;
statusType: string;
statusSuffix: string;
SQL: string;
Order: TOrderItem;
colors: string;
ColorType: string;
whereSQL: string;
fromSQL: string;
statusTableShort: string;
statusTableLong: string;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
// parse the searchOptions
params.Delimiter := '&';
params.DelimitedText := searchOptions;
PhoneNum := params.Values['phonenumber'];
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
StartDate := params.Values['startdate'];
EndDate := params.Values['enddate'];
OrderBy := params.Values['orderby'];
Caller := params.Values['caller'];
startDate := params.Values['startDate'];
endDate := params.Values['endDate'];
statusType := '';
filterType := '';
statusSuffix := '';
if params.Values['filterType'] <> '' then
begin
statusType := params.Values['filterType'].Split([' '])[0];
statusSuffix := params.Values['filterType'].Split([' '])[1];
filterType := params.Values['filterType'].Split([' '])[0] + '_' + params.Values['filterType'].Split([' '])[1];
end;
if statusSuffix = 'DUE' then
begin
statusTableShort := 'oss';
statusTableLong := 'orders_status_schedule';
end
else
begin
statusTableShort := 'os';
statusTableLong := 'orders_status';
end;
// We want entries for the "page" the client is on.
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
whereSQL := 'WHERE ';
if filterType <> '' then
begin
SQL := 'SELECT o.ORDER_ID, ' + statusTableShort + '.STATUS_DATE AS '+ filterType.ToUpper +
', o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, ';
end
else
begin
SQL := 'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
end;
SQL := SQL + generateSubquery(filterType, statusType, 'PROOF');
SQL := SQL + generateSubquery(filterType, statusType, 'ART');
SQL := SQL + generateSubquery(filterType, statusType, 'PLATE');
SQL := SQL + generateSubquery(filterType, statusType, 'MOUNT');
SQL := SQL + generateSubquery(filterType, statusType, 'SHIP');
if filterType <> '' then
begin
whereSQL := 'FROM orders o join ' + statusTableLong + ' ' + statusTableShort +
' on ' + statusTableShort + '.ORDER_ID = o.ORDER_ID join ' +
'customers c on c.CUSTOMER_ID = o.COMPANY_ID left join ' +
'qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID ' +
'WHERE ' + statusTableShort + '.ORDER_ID = o.ORDER_ID AND + ' +
statusTableShort + '.ORDER_STATUS = '+ quotedStr(statusType) +
' AND ' + quotedStr(startDate) + ' <= '+ statusTableShort + '.STATUS_DATE AND ' +
quotedStr(endDate) + ' >= ' + statusTableShort + '.STATUS_DATE';
SQL := SQL + 'o.PRICE, qb.QB_REF_NUM ' + whereSQL + ' ORDER BY ' + filterType + ' DESC LIMIT ' + limit + ' OFFSET ' + offset;
end
else
begin
whereSQL := 'from orders o join customers c on ' +
'c.CUSTOMER_ID = o.COMPANY_ID left join qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID ' +
'ORDER BY o.ORDER_DATE DESC';
SQL := SQL + 'o.PRICE, qb.QB_REF_NUM ' + whereSQL + ' LIMIT ' + limit + ' OFFSET ' + offset;
end;
doQuery(ordersDB.UniQuery1, SQL);
Result:= TOrderList.Create;
Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not ordersDB.UniQuery1.Eof do
begin
Order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order );
Result.data.Add( Order );
order.ID := ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString;
order.companyName := ordersDB.UniQuery1.FieldByName('COMPANY_NAME').AsString;
order.jobName := ordersDB.UniQuery1.FieldByName('JOB_NAME').AsString;
order.orderDate := ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsString;
order.proofDue := ordersDB.UniQuery1.FieldByName('PROOF_DUE').AsString;
order.proofDone := ordersDB.UniQuery1.FieldByName('PROOF_DONE').AsString;
order.artDue := ordersDB.UniQuery1.FieldByName('ART_DUE').AsString;
order.artDone := ordersDB.UniQuery1.FieldByName('ART_DONE').AsString;
order.plateDue := ordersDB.UniQuery1.FieldByName('PLATE_DUE').AsString;
order.plateDone := ordersDB.UniQuery1.FieldByName('PLATE_DONE').AsString;
order.mountDue := ordersDB.UniQuery1.FieldByName('MOUNT_DUE').AsString;
order.mountDone := ordersDB.UniQuery1.FieldByName('MOUNT_DONE').AsString;
order.shipDue := ordersDB.UniQuery1.FieldByName('SHIP_DUE').AsString;
order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').AsString;
order.orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString;
if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin
colorType := 'quantity_and_colors_qty_colors';
SQL := 'Select quantity_and_colors_qty_colors from web_plate_orders where order_id = ' + order.ID;
end
else
begin
colorType := 'colors_colors';
SQL := 'Select colors_colors from corrugated_plate_orders where order_id = ' + order.ID;
end;
doQuery(ordersDB.UniQuery2, SQL);
colors := ordersDB.UniQuery2.FieldByName(ColorType).AsString;
order.colors := colors;
ordersDB.UniQuery1.Next;
end;
whereSQL := 'where ';
ordersDB.UniQuery1.Close;
SQL := 'SELECT COUNT(*) AS total_count ' + whereSQL;
if PhoneNum <> '' then
whereSQL := whereSQL + 'to_formatted = ' + QuotedStr(PhoneNum);
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
if StartDate <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'calls.date_created > ' + QuotedStr(StartDate)
ordersDB.UniQuery1.Close;
end;
function TLookupService.GetOrder(orderInfo: string): TFullOrder;
var
orderType: string;
orderID: string;
SQL: string;
table: string;
begin
orderID := orderInfo;
SQL := 'select ORDER_TYPE from orders where ORDER_ID = ' + quotedStr(orderID);
doQuery(ordersDB.UniQuery1, SQL);
orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString;
if orderType = 'web_plate' then
table := 'web_plate_orders'
else
table := 'corrugated_plate_orders';
SQL := 'select * from ' + table + ' o JOIN customers c ON c.CUSTOMER_ID = o.COMPANY_ID where ORDER_ID = ' + quotedStr(orderID);
doQuery(ordersDB.UniQuery1, SQL);
result := TFullOrder.Create;
// Company
result.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
result.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
result.inQuickBooks := '?';
// Staff Fields
result.staff_fields_order_date := ordersDB.UniQuery1.FieldByName('staff_fields_order_date').AsString;
result.staff_fields_proof_date := ordersDB.UniQuery1.FieldByName('staff_fields_proof_date').AsString;
result.staff_fields_ship_date := ordersDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
result.staff_fields_ship_via := ordersDB.UniQuery1.FieldByName('staff_fields_ship_via').AsString;
result.staff_fields_quantity := ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsString;
result.staff_fields_ship_to := ordersDB.UniQuery1.FieldByName('staff_fields_ship_to').AsString;
result.staff_fields_po_number := ordersDB.UniQuery1.FieldByName('staff_fields_po_number').AsString;
result.staff_fields_job_name := ordersDB.UniQuery1.FieldByName('staff_fields_job_name').AsString;
result.staff_fields_quickbooks_item := ordersDB.UniQuery1.FieldByName('staff_fields_quickbooks_item').AsString;
result.staff_fields_art_due := ordersDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
result.staff_fields_plate_due := ordersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString;
result.staff_fields_price := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString;
result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString;
result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString;
// Supplied by Customer
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_copy').AsString = 'T' then
result.supplied_by_customer_b_w_copy := true
else
result.supplied_by_customer_b_w_copy := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_color_copy').AsString = 'T' then
result.supplied_by_customer_color_copy := true
else
result.supplied_by_customer_color_copy := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_plates').AsString = 'T' then
result.supplied_by_customer_plates := true
else
result.supplied_by_customer_plates := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_sample_ca').AsString = 'T' then
result.supplied_by_customer_sample_ca := true
else
result.supplied_by_customer_sample_ca := false;
result.supplied_by_customer_dimension := ordersDB.UniQuery1.FieldByName('supplied_by_customer_dimension').AsString;
if orderType = 'web_plate' then
begin
{if ordersDB.UniQuery1.FieldByName('supplied_by_customer_disk').AsString = 'T' then
result.diskOrCD := true
else
result.diskOrCD := false;}
end
else
begin
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_disk_or_cd').AsString = 'T' then
result.supplied_by_customer_disk_or_cd := true
else
whereSQL := whereSQL + 'AND calls.date_created > ' + QuotedStr(StartDate);
result.supplied_by_customer_disk_or_cd := false;
end;
result.supplied_by_customer_e_mail := ordersDB.UniQuery1.FieldByName('supplied_by_customer_e_mail').AsString;
result.supplied_by_customer_ftp := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ftp').AsString;
result.supplied_by_customer_other := ordersDB.UniQuery1.FieldByName('supplied_by_customer_other').AsString;
if orderType = 'corrugated_plate' then
begin
result.supplied_by_customer_existing_ := ordersDB.UniQuery1.FieldByName('supplied_by_customer_existing_').AsString;
result.supplied_by_customer_ref_art_p := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ref_art_p').AsString;
result.supplied_by_customer_ref_art_a := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ref_art_a').AsString;
end;
if EndDate <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'calls.date_created < ' + QuotedStr(EndDate)
// Layout
if orderType = 'corrugated_plate' then
begin
result.layout_rsc_l := ordersDB.UniQuery1.FieldByName('layout_rsc_l').AsString;
result.layout_rcs_w := ordersDB.UniQuery1.FieldByName('layout_rcs_w').AsString;
result.layout_rcs_d := ordersDB.UniQuery1.FieldByName('layout_rcs_d').AsString;
result.layout_die_cut_no := ordersDB.UniQuery1.FieldByName('layout_die_cut_no').AsString;
result.layout_accross_no := ordersDB.UniQuery1.FieldByName('layout_accross_no').AsString;
result.layout_around_no := ordersDB.UniQuery1.FieldByName('layout_around_no').AsString;
result.layout_cad_file := ordersDB.UniQuery1.FieldByName('layout_cad_file').AsString;
if ordersDB.UniQuery1.FieldByName('layout_excalibur_die').AsString = 'T' then
result.layout_excalibur_die := true
else
result.layout_excalibur_die := false;
result.layout_rsc_style := ordersDB.UniQuery1.FieldByName('layout_rsc_style').AsString;
end
else
begin
//result.acrossNo := ordersDB.UniQuery1.FieldByName('layout_accross').AsString;
//result.aroundNo := ordersDB.UniQuery1.FieldByName('layout_around').AsString;
end;
// Mounting & Colors & Proofing
if orderType = 'corrugated_plate' then
begin
result.mounting_loose := ordersDB.UniQuery1.FieldByName('mounting_loose').AsString;
if ordersDB.UniQuery1.FieldByName('mounting_sticky_bak').AsString = 'T' then
result.mounting_sticky_bak := true
else
whereSQL := whereSQL + 'AND calls.date_created < ' + QuotedStr(EndDate);
result.mounting_sticky_bak := false;
if ordersDB.UniQuery1.FieldByName('mounting_full_mount').AsString = 'T' then
result.mounting_full_mount := true
else
result.mounting_full_mount := false;
result.mounting_strip_mount := ordersDB.UniQuery1.FieldByName('mounting_strip_mount').AsString;
result.mounting_standard_setup := ordersDB.UniQuery1.FieldByName('mounting_standard_setup').AsString;
result.mounting_custom_backing := ordersDB.UniQuery1.FieldByName('mounting_custom_backing').AsString;
result.mounting_custom_adhesive := ordersDB.UniQuery1.FieldByName('mounting_custom_adhesive').AsString;
result.colors_cylinder_size := ordersDB.UniQuery1.FieldByName('colors_cylinder_size').AsString;
result.colors_machine_ident := ordersDB.UniQuery1.FieldByName('colors_machine_ident').AsString;
result.colors_cross_hairs := ordersDB.UniQuery1.FieldByName('colors_cross_hairs').AsString;
result.colors_clemson := ordersDB.UniQuery1.FieldByName('colors_clemson').AsString;
result.colors_colors := ordersDB.UniQuery1.FieldByName('colors_colors').AsString;
result.proofing_fax := ordersDB.UniQuery1.FieldByName('proofing_fax').AsString;
result.proofing_fax_attn := ordersDB.UniQuery1.FieldByName('proofing_fax_attn').AsString;
result.proofing_e_mail := ordersDB.UniQuery1.FieldByName('proofing_e_mail').AsString;
result.proofing_e_mail_attn := ordersDB.UniQuery1.FieldByName('proofing_e_mail_attn').AsString;
result.proofing_ship_to := ordersDB.UniQuery1.FieldByName('proofing_ship_to').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_full_size_panel').AsString = 'T' then
result.proofing_full_size_panel := true
else
result.proofing_full_size_panel := false;
if ordersDB.UniQuery1.FieldByName('proofing_print_card').AsString = 'T'then
result.proofing_print_card := true
else
result.proofing_print_card := false;
if ordersDB.UniQuery1.FieldByName('proofing_wide_format').AsString = 'T'then
result.proofing_wide_format := true
else
result.proofing_wide_format := false;
if ordersDB.UniQuery1.FieldByName('proofing_pdf_file').AsString = 'T'then
result.proofing_pdf_file := true
else
result.proofing_pdf_file := false;
result.proofing_other := ordersDB.UniQuery1.FieldByName('proofing_other').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_art_approved_as_is').AsString = 'T'then
result.proofing_art_approved_as_is := true
else
result.proofing_art_approved_as_is := false;
result.proofing_approved_date := ordersDB.UniQuery1.FieldByName('proofing_approved_date').AsString;
if Caller <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'from_formatted = ' + QuotedStr(Caller)
end
else
begin
{result.colors := ordersDB.UniQuery1.FieldByName('quatity_and_colors_qty_colors').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_pdf').AsString = 'T'then
result.pdfFile := true
else
whereSQL := whereSQL + 'AND from_formatted = ' + QuotedStr(Caller);
result.pdfFile := false;}
end;
if whereSQL = 'where ' then
whereSQL := '';
// Plates
result.plates_thickness := ordersDB.UniQuery1.FieldByName('plates_thickness').AsString;
result.plates_plate_material := ordersDB.UniQuery1.FieldByName('plates_plate_material').AsString;
result.plates_job_number := ordersDB.UniQuery1.FieldByName('plates_job_number').AsString;
if (OrderBy = '') or (OrderBy = 'Date') then
orderBySQL := 'order by calls.date_created desc'
// General
if orderType = 'corrugated_plate' then
result.general_special_instructions := ordersDB.UniQuery1.FieldByName('general_special_instructions').AsString
else
orderBySQL := 'order by calls.from_formatted desc';
//result.specialInstructions := ordersDB.UniQuery1.FieldByName('general_comments').AsString
//this SQL will enventually be modifed for more generic work
SQL := 'select * ' +
'from calls inner join recordings on calls.sid = recordings.call_sid ' +
whereSQL + ' ' + orderBySQL + ' ' + 'limit ' + limit + ' offset ' + offset;
doQuery(callsDB.UniQuery1, SQL);
Result:= TCallList.Create;
Result.data := TList<TCallItem>.Create;
end;
function TLookupService.GetItems(searchOptions: string): TItemList;
var
params: TStringList;
PageNum: integer;
PageSize: integer;
OrderBy: string;
offset: string;
limit: string;
SQL: string;
item: TItemItem;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
// parse the searchOptions
params.Delimiter := '&';
params.DelimitedText := searchOptions;
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
OrderBy := params.Values['orderby'];
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
SQL := 'select * from qb_items ' + 'limit ' + limit + ' offset ' + offset;
doQuery(ordersDB.UniQuery1, SQL);
Result:= TItemList.Create;
Result.data := TList<TItemItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do
while not ordersDB.UniQuery1.Eof do
begin
call := TCallItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( call );
Result.data.Add( call );
call.callSid := callsDB.UniQuery1.FieldByName('sid').AsString;
call.fromNumber := callsDB.UniQuery1.FieldByName('from_formatted').AsString;
call.ToNumber := callsDB.UniQuery1.FieldByName('to_formatted').AsString;
call.dateCreated := callsDB.UniQuery1.FieldByName('date_created').AsString;
call.mediaUrl := callsDB.UniQuery1.FieldByName('media_url').AsString;
call.duration := callsDB.UniQuery1.FieldByName('duration').AsString;
call.transcription := callsDB.UniQuery1.FieldByName('transcription').AsString;
callsDB.UniQuery1.Next;
item := TItemItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( item );
Result.data.Add( item );
item.ID := ordersDB.UniQuery1.FieldByName('qb_items_id').AsString;
item.name := ordersDB.UniQuery1.FieldByName('qb_item_name').AsString;
item.description := ordersDB.UniQuery1.FieldByName('item_desc').AsString;
item.status := ordersDB.UniQuery1.FieldByName('status').AsString;
ordersDB.UniQuery1.Next;
end;
callsDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from calls inner join recordings on calls.sid = recordings.call_sid ' +
whereSQL;
doQuery(callsDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close;
ordersDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from qb_items';
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
ordersDB.UniQuery1.Close;
end;
function TLookupService.GetUsers(searchOptions: string): TUserList;
......@@ -208,53 +555,53 @@ begin
SQL := 'select * from users order by NAME ASC'
else
SQL := 'select * from users where username=' + quotedStr(searchOptions);
doQuery(callsDB.UniQuery1, SQL);
doQuery(ordersDB.UniQuery1, SQL);
Result:= TUserList.Create;
Result.data := TList<TUserItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do
while not ordersDB.UniQuery1.Eof do
begin
user := TUserItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( user );
Result.data.Add( user );
user.userID := callsDB.UniQuery1.FieldByName('USER_ID').AsString;
user.username := callsDB.UniQuery1.FieldByName('USER_NAME').AsString;
user.password := callsDB.UniQuery1.FieldByName('PASSWORD').AsString;
user.full_name := callsDB.UniQuery1.FieldByName('NAME').AsString;
user.status := callsDB.UniQuery1.FieldByName('STATUS').AsString;
user.email_address := callsDB.UniQuery1.FieldByName('EMAIL').AsString;
user.AType := callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString;
user.rights := callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger;
user.perspectiveID := callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString;
user.QBID := callsDB.UniQuery1.FieldByName('QB_ID').AsString;
callsDB.UniQuery1.Next;
user.userID := ordersDB.UniQuery1.FieldByName('USER_ID').AsString;
user.username := ordersDB.UniQuery1.FieldByName('USER_NAME').AsString;
user.password := ordersDB.UniQuery1.FieldByName('PASSWORD').AsString;
user.full_name := ordersDB.UniQuery1.FieldByName('NAME').AsString;
user.status := ordersDB.UniQuery1.FieldByName('STATUS').AsString;
user.email_address := ordersDB.UniQuery1.FieldByName('EMAIL').AsString;
user.AType := ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString;
user.rights := ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger;
user.perspectiveID := ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString;
user.QBID := ordersDB.UniQuery1.FieldByName('QB_ID').AsString;
ordersDB.UniQuery1.Next;
end;
callsDB.UniQuery1.Close;
ordersDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from users';
doQuery(callsDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close;
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
ordersDB.UniQuery1.Close;
end;
function TLookupService.EditUser(const editOptions: string): string;
var
params: TStringList;
user: string;
first_name: string;
last_name: string;
password: string;
full_name: string;
status: string;
email: string;
phone: string;
access: string;
rights: string;
perspective: string;
QB: string;
SQL: string;
Admin: string;
newUser: string;
location: string;
hashString: string;
hashPW: string;
password: string;
active: string;
begin
params := TStringList.Create;
......@@ -263,64 +610,239 @@ begin
params.StrictDelimiter := true;
params.DelimitedText := editOptions;
user := params.Values['username'];
password := params.Values['password'];
full_name := params.Values['fullname'];
phone := params.Values['phonenumber'];
status := params.Values['status'];
email := params.Values['email'];
Admin := params.Values['admin'];
access := params.Values['access'];
rights := params.Values['rights'];
perspective := params.Values['perspective'];
QB := params.Values['QB'];
newUser := params.Values['newuser'];
password := params.Values['password'];
active := params.Values['active'];
location := params.Values['location'];
SQL := 'select * from users where username = ' + QuotedStr(user);
doQuery(callsDB.UniQuery1, SQL);
SQL := 'select * from users where USER_NAME = ' + QuotedStr(user);
doQuery(ordersDB.UniQuery1, SQL);
if callsDB.UniQuery1.IsEmpty then
Result := 'No such user found'
if ordersDB.UniQuery1.IsEmpty then
Result := 'Failure:No such user found'
else
begin
callsDB.UniQuery1.Edit;
ordersDB.UniQuery1.Edit;
//user.password := ordersDB.UniQuery1.FieldByName('PASSWORD').AsString;
if (not (newUser.IsEmpty)) then
callsDB.UniQuery1.FieldByName('username').AsString := newUser;
ordersDB.UniQuery1.FieldByName('USER_NAME').AsString := newUser;
if (not (full_name.IsEmpty)) then
callsDB.UniQuery1.FieldByName('full_name').AsString := full_name;
ordersDB.UniQuery1.FieldByName('NAME').AsString := full_name;
if (not (phone.IsEmpty)) then
callsDB.UniQuery1.FieldByName('phone_number').AsString := phone;
if (not (status.IsEmpty)) then
begin
if( StrToBool(status) ) then
ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else
ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE'
end;
if (not (email.IsEmpty)) then
callsDB.UniQuery1.FieldByName('email').AsString := email;
ordersDB.UniQuery1.FieldByName('EMAIL').AsString := email;
if (not (access.IsEmpty)) then
ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
if(not (Admin.IsEmpty)) then
callsDB.UniQuery1.FieldByName('admin').AsBoolean := StrToBool(Admin);
if (not (rights.IsEmpty)) then
ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
if (not (Active.IsEmpty)) then
callsDB.UniQuery1.FieldByName('active').AsBoolean := StrToBool(Active);
if (not (perspective.IsEmpty)) then
ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
if (not (Location.IsEmpty)) then
callsDB.UniQuery1.FieldByName('default_location').asString := location;
if (not (QB.IsEmpty)) then
ordersDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then
{if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then
begin
hashString := callsDB.UniQuery1.FieldByName('date_created').AsString + password;
hashString := ordersDB.UniQuery1.FieldByName('date_created').AsString + password;
hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
callsDB.UniQuery1.FieldByName('password').AsString := hashPW;
end;
ordersDB.UniQuery1.FieldByName('password').AsString := hashPW;
end;}
callsDB.UniQuery1.Post;
ordersDB.UniQuery1.Post;
Result := 'Success:Edit Successful';
end;
callsDB.UniQuery1.Close;
ordersDB.UniQuery1.Close;
end;
function TLookupService.AddCorrugatedOrder(orderInfo: string): TJSONObject;
var
JSONData, ResponseData: TJSONObject;
SQL: string;
Pair: TJSONPair;
Field: TField;
DateFormat: TFormatSettings;
CurrDate: TDateTime;
ORDER_ID: integer;
mode: string;
begin
DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd';
DateFormat.DateSeparator := '-';
JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject;
if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
mode := JSONData.GetValue<string>('mode');
if mode = 'ADD' then
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
begin
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
if Assigned(Field) then
begin
// handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
// Post the record to the database
ordersDB.UniQuery1.Post;
if mode = 'ADD' then
begin
SQL := 'select * from orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
end
else
begin
SQL := 'select * from orders where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
end;
ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsString := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString := 'corrugated_plate';
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now;
if JSONData.GetValue<string>('staff_fields_price') = '' then
ordersDB.UniQuery1.FieldByName('PRICE').AsString := '0'
else
ordersDB.UniQuery1.FieldByName('PRICE').AsString := JSONData.GetValue<string>('staff_fields_price');
ordersDB.UniQuery1.FieldByName('JOB_NAME').AsString := JSONData.GetValue<string>('staff_fields_job_name');
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := JSONData.GetValue<string>('USER_ID');
ordersDB.UniQuery1.FieldByName('LOCATION').AsString := JSONData.GetValue<string>('staff_fields_art_location');
ordersDB.UniQuery1.Post;
ordersDB.UniQuery1.Close;
if mode = 'ADD' then
begin
ordersDB.UniQuery1.SQL.Text := 'SELECT LAST_INSERT_ID() AS OrderID'; // Use database's method to get the last inserted ID
ordersDB.UniQuery1.Open;
ORDER_ID := ordersDB.UniQuery1.FieldByName('OrderID').AsInteger;
end;
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_ship_date') <> '' then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_art_due') <> '' then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_plate_due') <> '' then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_mount_due') <> '' then
AddStatusSchedule('MOUNT', JSONData, ORDER_ID);
Result := TJSONObject.Create.AddPair('status', 'success');
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
except
on E: Exception do
begin
Result := TJSONObject.Create.AddPair('error', E.Message);
end;
end;
end;
function TLookupService.AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
var
SQL: string;
mode: string;
begin
mode := order.GetValue<string>('mode');
if mode = 'ADD' then
begin
SQL := 'select * from orders_status_schedule where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
end
else
begin
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := StatusType;
if( (StatusType = 'PROOF') or (StatusType = 'SHIP') ) then
begin
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
end
else
begin
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
end;
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := order.GetValue<string>('USER_ID');
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1
else
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
ordersDB.UniQuery1.Post;
Result := 'success';
end;
function TLookupService.EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
var
SQL: string;
begin
end;
function TLookupService.AddUser(userInfo:string): string;
var
user: string;
password: string;
full_name: string;
status: string;
email: string;
access: string;
rights: string;
perspective: string;
QB: string;
SQL: string;
dateCreated: TDateTime;
hashString: string;
SQL: string;
hashPW: string;
params: TStringList;
begin
......@@ -330,49 +852,108 @@ begin
params.Delimiter := '&';
params.DelimitedText := userInfo;
dateCreated := now;
hashString := DateTimeToStr(dateCreated) + params.Values['password'];
hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
SQL := 'select * from users where username = ' + QuotedStr(params.Values['username'].toLower);
callsDB.UniQuery1.Close;
callsDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.Open;
if callsDB.UniQuery1.IsEmpty then
user := params.Values['username'];
password := params.Values['password'];
full_name := params.Values['fullname'];
status := params.Values['status'];
email := params.Values['email'];
access := params.Values['access'];
rights := params.Values['rights'];
perspective := params.Values['perspective'];
QB := params.Values['QB'];
//newUser := params.Values['newuser'];
//hashString := DateTimeToStr(dateCreated) + params.Values['password'];
//hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
SQL := 'select * from users where USER_NAME = ' + QuotedStr(params.Values['username'].toLower);
ordersDB.UniQuery1.Close;
ordersDB.UniQuery1.SQL.Text := SQL;
ordersDB.UniQuery1.Open;
if ordersDB.UniQuery1.IsEmpty then
begin
callsDB.UniQuery1.Insert;
callsDB.UniQuery1.FieldByName('username').AsString := params.Values['username'].toLower;
callsDB.UniQuery1.FieldByName('password').AsString := THashSHA2.GetHashString(hashString,
THashSHA2.TSHA2Version.SHA512).ToUpper;
callsDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated);
callsDB.UniQuery1.FieldByName('full_name').AsString := params.Values['fullname'];
callsDB.UniQuery1.FieldByName('phone_number').AsString := params.Values['phonenumber'];
callsDB.UniQuery1.FieldByName('email').AsString := params.Values['email'];
callsDB.UniQuery1.FieldByName('admin').AsBoolean := StrToBool(params.Values['admin']);
callsDB.UniQuery1.Post;
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('USER_NAME').AsString := user;
ordersDB.UniQuery1.FieldByName('PASSWORD').AsString := password;
//THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
//ordersDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated);
ordersDB.UniQuery1.FieldByName('NAME').AsString := full_name;
if( StrToBool(status) ) then
ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else
ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE';
ordersDB.UniQuery1.FieldByName('EMAIL').AsString := email;
ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
ordersDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
ordersDB.UniQuery1.Post;
Result := 'Success:User successfully added';
end
else
Result := 'Failure:Username already taken';
end;
function TLookupService.DelUser(username: string): string;
function TLookupService.AddItem(itemInfo: string): string;
var
params: TStringList;
Name: string;
Description: string;
Status: boolean;
SQL: string;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
// parse the searchOptions
params.Delimiter := '&';
params.DelimitedText := itemInfo;
Name := params.Values['name'];
Description := params.Values['description'];
Status := StrToBool(params.Values['status']);
SQL := 'select * from qb_items where qb_item_name = ' + QuotedStr(Name);
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.IsEmpty then
begin
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('qb_item_name').AsString := Name;
ordersDB.UniQuery1.FieldByName('item_desc').AsString := Description;
if Status then
ordersDB.UniQuery1.FieldByName('status').AsString := 'ACTIVE'
else
ordersDB.UniQuery1.FieldByName('status').AsString := 'INACTIVE';
ordersDB.UniQuery1.Post;
Result := 'Success:Item successfully added';
end
else
Result := 'Failure: Item already exists';
end;
function TLookupService.DelUser(username: string): string;
var
SQL: string;
params: TStringList;
begin
SQL := 'select * from users where username = ' + QuotedStr(username.toLower);
callsDB.UniQuery1.Close;
callsDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.Open;
if callsDB.UniQuery1.IsEmpty then
ordersDB.UniQuery1.Close;
ordersDB.UniQuery1.SQL.Text := SQL;
ordersDB.UniQuery1.Open;
if ordersDB.UniQuery1.IsEmpty then
begin
Result := 'Failure:User does not exist';
end
else
begin
SQL:= 'DELETE FROM users where username = ' + QuotedStr(username.toLower);
callsDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.ExecSQL;
ordersDB.UniQuery1.SQL.Text := SQL;
ordersDB.UniQuery1.ExecSQL;
Result := 'Success:User deleted';
end;
end;
......
object FMain: TFMain
Left = 0
Top = 0
Caption = 'envoy Calls Server 2'
Caption = 'KG Orders Server'
ClientHeight = 597
ClientWidth = 764
Color = clBtnFace
......
unit Main;
//Main form of the program. This program gets calls/recordings/transcriptions from
//twilio and stores them in a database. From there it is able to be accessed by the client.
//Has access to every visual form for debugging purposes.
//Authors:
//Elias Sarraf
//Mac ...
......
......@@ -156,6 +156,6 @@ begin
Application.MainFormOnTaskbar := True;
Application.CreateForm(TFMain, FMain);
Logger.AddAppender(TMemoLogAppender.Create( 5, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create( 5, 'envoyCallsServer' ));
Logger.AddAppender(TFileLogAppender.Create( 5, 'kgOrdersServer' ));
Application.Run;
end.
[Options]
LogFileNum=15
LogFileNum=223
UpdateTimerLength=0
......
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